Changeset 700 for trunk/grails-app/services
- Timestamp:
- Nov 1, 2010, 11:29:11 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/AssignedGroupService.groovy
r514 r700 1 import org.hibernate.FetchMode as FM 2 1 3 class AssignedGroupService { 2 4 … … 47 49 } 48 50 49 result.assignedGroupInstance = AssignedGroup.get(params.id) 51 result.assignedGroupInstance = AssignedGroup.createCriteria().get { 52 idEq(params.id.toLong()) 53 fetchMode("personGroup", FM.EAGER) 54 fetchMode("personGroup.persons", FM.EAGER) 55 } 50 56 51 57 if(!result.assignedGroupInstance) … … 71 77 } 72 78 73 result.personGroup = PersonGroup.get(params.personGroup.id) 79 result.personGroup = PersonGroup.createCriteria().get { 80 idEq(params.personGroup.id.toLong()) 81 fetchMode("persons", FM.EAGER) 82 } 74 83 75 84 // Prevent a null property reference. … … 140 149 } 141 150 142 result.personGroup = PersonGroup.get(params.personGroup.id) 151 result.personGroup = PersonGroup.createCriteria().get { 152 idEq(params.personGroup.id.toLong()) 153 fetchMode("persons", FM.EAGER) 154 } 143 155 144 156 // Prevent a null property reference. … … 146 158 return fail(code:"personGroup.not.found") 147 159 148 result.personsInGroup = result.personGroup.persons ?.sort { p1, p2 -> p1.firstName.compareToIgnoreCase(p2.firstName) }160 result.personsInGroup = result.personGroup.persons.sort { p1, p2 -> p1.firstName.compareToIgnoreCase(p2.firstName) } 149 161 150 162 result.assignedGroupInstance = new AssignedGroup() … … 178 190 } 179 191 180 result.personGroup = PersonGroup.get(params.personGroup?.id) 192 if(!params.personGroup?.id?.isLong()) 193 return fail(code:"default.not.found") 194 195 result.personGroup = PersonGroup.createCriteria().get { 196 idEq(params.personGroup.id.toLong()) 197 fetchMode("persons", FM.EAGER) 198 } 181 199 182 200 if(!result.personGroup)
Note: See TracChangeset
for help on using the changeset viewer.