Changeset 413
- Timestamp:
- May 12, 2010, 11:48:05 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r410 r413 353 353 // Set the field value 354 354 if (isDomainField(field)) { 355 this[field.name] = value 356 } 357 else { 355 if (!value) { 356 println "removing [" + ((super) ? super.class : '??') + "] domain field: [" + fieldName + "]" 357 358 // remove value 359 this[field.name] = null 360 } else { 361 println "setting [" + ((super) ? super.class : '??') + "] domain field: [" + fieldName + "] ([" + value.toString() + "] of type [" + value.class + "])" 362 363 // set value 364 this[field.name] = value 365 } 366 } else { 358 367 // Caution: this assumes that all template...Field Maps are already initialized (as is done now above as [:]) 359 368 // If that is ever changed, the results are pretty much unpredictable (random Java object pointers?)! 360 369 def store = getStore(field.type) 361 370 if (!value && store[fieldName]) { 362 println "removing " + ((super) ? super.class : '??') + " template field: " + fieldName371 println "removing [" + ((super) ? super.class : '??') + "] template field: [" + fieldName + "]" 363 372 364 373 // remove the item from the Map (if present) 365 374 store.remove(fieldName) 366 375 } else if (value) { 367 println "setting " + ((super) ? super.class : '??') + " template field: " + fieldName + "([" + value.toString() + "] of type [" + value.class + "])"376 println "setting [" + ((super) ? super.class : '??') + "] template field: [" + fieldName + "] ([" + value.toString() + "] of type [" + value.class + "])" 368 377 369 378 // set value … … 375 384 } 376 385 386 /** 387 * Check if a given field is a domain field 388 * @param field 389 * @return boolean 390 */ 377 391 boolean isDomainField(TemplateField field) { 378 392 return this.giveDomainFields()*.name.contains(field.name)
Note: See TracChangeset
for help on using the changeset viewer.