Changeset 536 for trunk/grails-app/domain
- Timestamp:
- Jun 7, 2010, 9:20:00 AM (13 years ago)
- Location:
- trunk/grails-app/domain/dbnp/studycapturing
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/Event.groovy
r506 r536 84 84 } 85 85 86 def belongsToGroup( Set<EventGroup> groups ){ 87 def eventFound = false; 88 def that = this; 89 groups.each{ eventgroup -> 90 if( !eventFound ) { 91 eventFound = ( that.id in eventgroup.events.id ); 92 } 93 } 94 95 return eventFound; 96 } 97 86 98 def String toString() { 87 99 return fieldExists('Description') ? getFieldValue('Description') : "" -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r511 r536 66 66 } 67 67 68 /** 69 * returns all events and sampling events that do not belong to a group 70 */ 71 def Set<Event> getOrphanEvents() { 72 def orphans = 73 events.findAll{ event -> !event.belongsToGroup( eventGroups ) } + 74 samplingEvents.findAll { event -> !event.belongsToGroup( eventGroups ) }; 75 76 return orphans; 77 } 78 68 79 /** 69 80 * Return the unique Subject templates that are used in this study -
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r507 r536 585 585 /** 586 586 * Convenience method. Returns all unique templates used within a collection of TemplateEntities. 587 * 588 * If the collection is empty, an empty set is returned. If none of the entities contains 589 * a template, also an empty set is returned. 587 590 */ 588 591 static Set<Template> giveTemplates(Set<TemplateEntity> entityCollection) { 589 return entityCollection*.template.unique(); 592 def set = entityCollection*.template.unique(); 593 594 // If one or more entities does not have a template, the resulting 595 // set contains null. That is not what is meant. 596 return set.findAll { it != null }; 590 597 } 591 598
Note: See TracChangeset
for help on using the changeset viewer.