Changeset 321 for trunk/grails-app
- Timestamp:
- Mar 31, 2010, 2:02:35 PM (11 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r284 r321 77 77 def entities = request.getParameterValues("entity") 78 78 def templatefieldtypes = request.getParameterValues("templatefieldtype") 79 def identifiercolumnindex = params.identifier.toInteger() 79 80 80 templatefieldtypes.each { t -> 81 def temp = t.split(":")82 def templatefieldtype = t emp[1]81 templatefieldtypes.each { t -> 82 def columnindex = t.split(":")[0].toInteger() 83 def templatefieldtype = t.split(":")[1] 83 84 84 85 switch (templatefieldtype) { … … 101 102 default: break 102 103 } 103 session.header[ temp[0].toInteger()].templatefieldtype = tft104 session.header[columnindex].templatefieldtype = tft 104 105 } 105 106 106 entities.each { e -> 107 def temp = e.split(":") 107 entities.each { e -> 108 def columnindex = e.split(":")[0].toInteger() 109 def entitytype = e.split(":")[1].toInteger() 108 110 Class clazz 109 111 110 switch ( temp[1].toInteger()) {112 switch (entitytype) { 111 113 case 0: clazz = Study 112 114 break … … 123 125 } 124 126 125 session.header[temp[0].toInteger()].index = temp[0].toInteger() 126 session.header[temp[0].toInteger()].entity = clazz 127 session.header[columnindex].identifier = (columnindex == identifiercolumnindex) ? true : false 128 session.header[columnindex].index = columnindex 129 session.header[columnindex].entity = clazz 127 130 } 128 131 … … 142 145 def columnproperties = request.getParameterValues("columnproperty") 143 146 144 columnproperties.each { cp -> 145 def temp = cp.split(":") 146 session.header[temp[0].toInteger()].property = TemplateField.get(temp[1].toInteger()) 147 columnproperties.each { cp -> 148 def columnindex = cp.split(":")[0].toInteger() 149 def property_id = cp.split(":")[1].toInteger() 150 session.header[columnindex].property = TemplateField.get(property_id) 147 151 } 148 152 -
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r313 r321 91 91 // First, search if there is an entity property with the given name, and if so, set that 92 92 if (this.properties.containsKey(fieldName)) { 93 this[fieldName] = value 93 this[fieldName] = value 94 94 } 95 95 // If not the found, then it is a template field, so check if there is a template -
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r312 r321 267 267 switch(mc.entity) { 268 268 case Study : (record.any {it.getClass()==mc.entity}) ? 0 : record.add(study) 269 if (mc.identifier) { study.title = value; break } 269 270 study.setFieldValue(mc.property.name, value) 270 271 break 271 272 case Subject : (record.any {it.getClass()==mc.entity}) ? 0 : record.add(subject) 273 if (mc.identifier) { subject.name = value; break } 272 274 subject.setFieldValue(mc.property.name, value) 273 275 break 274 276 case Event : (record.any {it.getClass()==mc.entity}) ? 0 : record.add(event) 277 if (mc.identifier) { event.eventdescription = value; break } 275 278 event.setFieldValue(mc.property.name, value) 276 279 break 277 280 case Protocol : (record.any {it.getClass()==mc.entity}) ? 0 : record.add(protocol) 281 if (mc.identifier) { protocol.name = value; break } 278 282 protocol.setFieldValue(mc.property.name, value) 279 283 break 280 284 case Sample : (record.any {it.getClass()==mc.entity}) ? record.add(sample) : 0 285 if (mc.identifier) { sample.name = value; break } 281 286 sample.setFieldValue(mc.property.name, value) 282 287 break -
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r305 r321 86 86 def t = Template.get(session.importtemplate_id) 87 87 def mc = attrs['mappingcolumn'] 88 89 out << createPropertySelect(attrs['name'], t.fields.findAll { it.type == mc.templatefieldtype }, mc.index) 88 89 (mc.identifier) ? out << "<select style=\"font-size:10px\" name=\"\" disabled><option>Identifier</option></select>": 90 out << createPropertySelect(attrs['name'], t.fields.findAll { it.type == mc.templatefieldtype }, mc.index) 90 91 } 91 92 -
trunk/grails-app/views/importer/common/_preview.gsp
r312 r321 34 34 35 35 <tr> 36 <td> Celltype:</td>36 <td>Fieldtype:</td> 37 37 <g:each var="column" in="${header}"> 38 38 <td class="header">
Note: See TracChangeset
for help on using the changeset viewer.