Changeset 227 for trunk/grails-app/domain
- Timestamp:
- Mar 3, 2010, 12:06:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/Template.groovy
r224 r227 24 24 } 25 25 26 /** 27 * overloaded toString method 28 * @return String 29 */ 26 30 def String toString() { 27 31 return this.name; … … 30 34 /** 31 35 * Look up the type of a certain template subject field 32 * @param 33 * @return 36 * @param String fieldName The name of the template field 37 * @return String The type (static member of TemplateFieldType) of the field, or null of the field does not exist 34 38 */ 35 39 def TemplateFieldType getFieldType(String fieldName) { … … 40 44 } 41 45 46 /** 47 * get all field of a particular type 48 * @param Class fieldType 49 * @return ArrayList 50 */ 42 51 def getFieldsByType(TemplateFieldType fieldType) { 43 52 def result = fields.findAll { … … 46 55 return result; 47 56 } 57 58 /** 59 * overloading the findAllByEntity method to make it function as expected 60 * @param Class entity (for example: dbnp.studycapturing.Subject) 61 * @return ArrayList 62 */ 63 public static findAllByEntity(java.lang.Class entity) { 64 def results = [] 65 66 // this should not work in static context, however it does so I'll keep 67 // this in for now :) 68 this.findAll().each() { 69 if (entity.equals(it.entity)) { 70 results[ results.size() ] = it 71 } 72 } 73 74 return results 75 } 48 76 }
Note: See TracChangeset
for help on using the changeset viewer.