Ignore:
Timestamp:
Apr 29, 2010, 5:01:51 AM (15 years ago)
Author:
gav
Message:

Added integration test for TaskSearchService.getPersonsTasks().
Extended TaskService.delete() to handle assignedPersons and assignedGroups.
Use safe collection navigation in AssignedGroupService and AssignedPersonService?.

Location:
trunk/grails-app/services
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/AssignedGroupService.groovy

    r291 r514  
    146146                return fail(code:"personGroup.not.found")
    147147
    148             result.personsInGroup = result.personGroup.persons.sort { p1, p2 -> p1.firstName.compareToIgnoreCase(p2.firstName) }
     148            result.personsInGroup = result.personGroup.persons?.sort { p1, p2 -> p1.firstName.compareToIgnoreCase(p2.firstName) }
    149149
    150150            result.assignedGroupInstance = new AssignedGroup()
  • trunk/grails-app/services/AssignedPersonService.groovy

    r291 r514  
    146146                return fail(code:"person.not.found")
    147147
    148             result.groupsForPerson = result.person.personGroups.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }
     148            result.groupsForPerson = result.person.personGroups?.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) }
    149149
    150150            result.assignedPersonInstance = new AssignedPerson()
  • trunk/grails-app/services/TaskService.groovy

    r510 r514  
    254254            }
    255255
     256            // Handle assignedPersons.
     257            def taskAssignedPersons = AssignedPerson.findAllByTask(result.taskInstance)
     258            taskAssignedPersons.each() {
     259                result.taskInstance.removeFromAssignedPersons(it)
     260                it.delete()
     261            }
     262
     263            // Handle assignedGroups.
     264            def taskAssignedGroups = AssignedGroup.findAllByTask(result.taskInstance)
     265            taskAssignedGroups.each() {
     266                result.taskInstance.removeFromAssignedGroups(it)
     267                it.delete()
     268            }
     269
    256270            if(result.error)
    257271                return result
Note: See TracChangeset for help on using the changeset viewer.