Changeset 1058


Ignore:
Timestamp:
Nov 3, 2010, 2:03:20 PM (6 years ago)
Author:
t.w.abma@…
Message:
  • added failed cells view/logic
  • fixed Study-owner bug
Location:
trunk/grails-app
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1050 r1058  
    269269
    270270        // First handle the "failed cells"
    271         //render(view:"step2a_simple", model:[datamatrix:ImporterService.getFailedCells(session.importer_importeddata)])
     271        //render(view:"step2a_simple", model:[failedcells:ImporterService.getFailedCells(session.importer_importeddata)])
    272272
    273273        if (params.layout=="horizontal")
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r1050 r1058  
    3131
    3232class ImporterService {
     33    def AuthenticationService
    3334
    3435    boolean transactional = true
     
    236237     *
    237238     * @param datamatrix two dimensional array containing entities and possibly also failed cells
    238      * @return array of failed cells
     239     * @return array of failed cells in [rownum:n, value:xxx] format
    239240     * */
    240241    def getFailedCells(datamatrix) {
     
    244245            record.each { column ->
    245246                column.each {
    246                     if (it.getClass().getName().equals('java.util.LinkedHashMap$Entry')) {
    247                         println it.key
    248                         println it.value
     247                    if (it.getClass().getName().equals('java.util.LinkedHashMap$Entry')) {                       
    249248                        failedcells.add(it)
    250249                    }
     
    274273                        switch (entity.getClass()) {
    275274                        case Study       :  print "Persisting Study `" + entity + "`: "
     275                                                entity.owner = AuthenticationService.getLoggedInUser()
    276276                                                if (persistEntity(entity)) validatedSuccesfully++
    277277                                                break
     
    447447                                } catch (IllegalArgumentException iae) {
    448448                                    // leave the field empty and let the user choose the ontology manually in a later step
    449                                     failed.put(mc, value)
    450                                     println "failed ("+mc.templatefieldtype+"`" + value + "`"
     449                                    failed.put(mc, [rownum:excelrow.getRowNum(), value:value])
     450                                    //println "failed ("+mc.templatefieldtype+"`" + value + "`"
    451451                                }
    452452                        } // end
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r959 r1058  
    6565
    6666    /**
     67     * Show failed cells
     68     */
     69    def failedCells = { attrs ->
     70        def failedcells = attrs['failedcells']
     71        out << render (template:"common/failedcells", model:[failedcells:failedcells])
     72    }
     73
     74    /**
    6775     * @param entities array containing selected entities
    6876     * @param header array containing mappingcolumn objects
  • trunk/grails-app/views/importer/step2a_simple.gsp

    r1044 r1058  
    2525    <h1>Step 2a: values which could not be determined</h1>
    2626    <p>The next step is to adjust values which could not be determined.</p>
    27   <g:each var="record" in="${datamatrix}">
    28      <p>Record: ${record}</p>
    29 </g:each>
     27  <importer:failedCells failedcells="${failedcells}" />
    3028  </body>
    3129</html>
Note: See TracChangeset for help on using the changeset viewer.