Changeset 409 for trunk/grails-app
- Timestamp:
- May 11, 2010, 4:47:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r406 r409 258 258 * @throws NoSuchFieldException If the field is not found or the field type is not supported 259 259 */ 260 private static def getField(CollectionfieldsCollection, String fieldName) {260 private static TemplateField getField(List<TemplateField> fieldsCollection, String fieldName) { 261 261 // escape the fieldName for easy matching 262 262 // (such escaped names are commonly used … … 265 265 266 266 // Find the target template field, if not found, throw an error 267 deffield = fieldsCollection.find { it.name.toLowerCase().replaceAll("([^a-z0-9])", "_") == escapedLowerCaseFieldName }267 TemplateField field = fieldsCollection.find { it.name.toLowerCase().replaceAll("([^a-z0-9])", "_") == escapedLowerCaseFieldName } 268 268 269 269 if (field) { … … 325 325 // Convenience setter for template string list fields: find TemplateFieldListItem by name 326 326 if (field.type == TemplateFieldType.STRINGLIST && value && value.class == String) { 327 value = getField(field.listEntries,value).name 328 println value 327 // Kees insensitive pattern matching ;) 328 def escapedLowerCaseValue = value.toLowerCase().replaceAll("([^a-z0-9])", "_") 329 value = field.listEntries.find { 330 it.name.toLowerCase().replaceAll("([^a-z0-9])", "_") == escapedLowerCaseValue 331 } 329 332 } 330 333
Note: See TracChangeset
for help on using the changeset viewer.