Changeset 407


Ignore:
Timestamp:
May 11, 2010, 4:01:58 PM (14 years ago)
Author:
duh
Message:
  • implemented ontologyterm handler code in the subject page, note that this code should probably eventually move into templateEntity
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy

    r404 r407  
    619619                                // iterate through fields (= template fields and domain properties)
    620620                                flow.subjects[ subjectId ].giveFields().each() { subjectField ->
     621                                        def value = params.get( 'subject_' + subjectId + '_' + subjectField.escapedName() )
     622
     623/*** THIS SHOULD PROBABLY MOVE INTO TEMPLATE ENTITY ***/
     624                                        // handle ontology terms
     625                                        if (value instanceof String && subjectField.type.toString() == "ONTOLOGYTERM") {
     626                                                // iterate through ontologies and find term
     627                                                subjectField.ontologies.each() { ontology ->
     628                                                        def term = ontology.giveTermByName( value )
     629
     630                                                        // found a term?
     631                                                        if (term) {
     632                                                                value = term
     633                                                        }
     634                                                }
     635                                        }
     636/*** END ***/
     637
    621638                                        // set the field
    622639                                        flow.subjects[ subjectId ].setFieldValue(
    623640                                                subjectField.name,
    624                                                 params.get( 'subject_' + subjectId + '_' + subjectField.escapedName() )
     641                                                value
    625642                                        )
    626643                                }
Note: See TracChangeset for help on using the changeset viewer.