Changeset 798 for trunk/grails-app/services/AssetService.groovy
- Timestamp:
- Feb 8, 2011, 11:00:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/AssetService.groovy
r689 r798 22 22 } 23 23 } 24 } 25 26 /** 27 * Determines and returns a list of assemblies for an asset. 28 * This is purely a 'load from database' type method since a new hibernateSession is used. 29 * @params Asset to get the subItems for. 30 * @returns A list of the assemblies. 31 */ 32 def getAssemblies(asset) { 33 def assemblies = [] 34 if(!(asset instanceof Asset)) 35 return assemblies 36 // Database efficiency: 37 // The asset is configured to batch fetch assetSubItems which 38 // in turn are configured to batch fetch subItems. 39 Asset.withNewSession { 40 Asset.get(asset.id).assetSubItems.each { 41 assemblies.addAll(it.subItems) 42 } 43 } 44 assemblies.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } 45 return assemblies 24 46 } 25 47
Note: See TracChangeset
for help on using the changeset viewer.