Changeset 5931


Ignore:
Timestamp:
May 6, 2020, 1:25:36 PM (4 weeks ago)
Author:
Nicklas Nordborg
Message:

References #1234: Implement batch importer for followup blood samples

Minor changes and improvments in error handling and reporting.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/personal/import_followup_blood.js

    r5919 r5931  
    117117  {
    118118    Wizard.showFinalMessage(response.messages);
     119    Doc.hide('goabort');
    119120    Doc.show('gorestart');
    120121  }
  • extensions/net.sf.basedb.reggie/trunk/resources/personal/import_followup_blood.jsp

    r5919 r5931  
    6363          The following columns are required: <b>PersonalNumber</b>, <b>Name</b>, <b>BloodRccidNumber</b>,
    6464          <b>BloodSample</b>, <b>BloodSamplingDate</b>, <b>BloodSamplingTime</b>, <b>BloodFreezerDate</b>,
    65           <b>BloodFreezerTime</b> and <b>OtherPathNote</b>.
     65          <b>BloodFreezerTime</b> and <b>OtherPathNote</b>. Empty lines and lines starting with # are
     66          ignored.
    6667          <div id="worksheetSection.help" style="display:none;">
    6768            Note that it is only possible to import from one worksheet at a time.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/FollowupBloodImporter.java

    r5918 r5931  
    213213        validEntries.add(b);
    214214      }
     215    }
     216   
     217    if (numEntries == 0)
     218    {
     219      addErrorMessage("File '" + fileName + "': No data found after " + lineNo + " lines");
    215220    }
    216221   
     
    342347    ffp.setDataHeaderRegexp(Pattern.compile(".*BloodRccidNumber.*"));
    343348    ffp.setDataSplitterRegexp(Pattern.compile("\\t"));
    344     ffp.setIgnoreRegexp(Pattern.compile("#.*"));
     349    ffp.setIgnoreRegexp(Pattern.compile("#.*|\\s*"));
    345350    ffp.setUseNullIfEmpty(true);
    346351    ffp.setTrimWhiteSpace(true);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/BloodFollowUpRegistrationServlet.java

    r5919 r5931  
    603603        {
    604604          int numInvalid = importer.getNumEntries() - numValid;
    605           if (validateOnly)
    606           {
    607             jsonMessages.add("[Error]Validation failed. " + numInvalid + " invalid entries of " + importer.getNumEntries() + " total in " + filename);
    608           }
    609           else
    610           {
    611             jsonMessages.add("[Error]Import failed. " + numInvalid + " invalid entries of " + importer.getNumEntries() + " total in " + filename);
    612           }
    613          
    614           json.put("numWarnings", importer.getWarningMessages().size());
    615           jsonMessages.addAll(importer.getWarningMessages());
     605          if (numInvalid > 0)
     606          {
     607            String invalidEntries = numInvalid + " of " + importer.getNumEntries() + " entries in file " + filename + " are invalid.";
     608            if (validateOnly)
     609            {
     610              jsonMessages.add("[Error]Validation failed. " + invalidEntries);
     611            }
     612            else
     613            {
     614              jsonMessages.add("[Error]Import failed. " + invalidEntries);
     615            }
     616          }
    616617         
    617618          json.put("numErrors", importer.getErrorMessages().size());
    618619          jsonMessages.addAll(importer.getErrorMessages());
     620
     621          json.put("numWarnings", importer.getWarningMessages().size());
     622          jsonMessages.addAll(importer.getWarningMessages());
    619623        }
    620624      }
Note: See TracChangeset for help on using the changeset viewer.