Ejemplo n.º 1
0
 /**
  * Populates this <code>LocationData</code> from the data in the current row of the result set.
  *
  * @param columns a <code>Map</code> containing a key for each column in the <code>ResultSet
  *     </code>. Each key must be one of the column alias constants in {@link
  *     com.ardais.bigr.util.DbAliases} or {@link com.ardais.bigr.util.DbConstants} or the
  *     corresponding value is ignored.
  * @param rs the <code>ResultSet</code>
  */
 public void populate(Map columns, ResultSet rs) {
   try {
     if (columns.containsKey(DbConstants.LOCATION_ADDRESS_ID)) {
       setAddressId(rs.getString(DbConstants.LOCATION_ADDRESS_ID));
     }
     if (columns.containsKey(DbConstants.LOCATION_NAME)) {
       setName(rs.getString(DbConstants.LOCATION_NAME));
     }
     if (columns.containsKey(DbConstants.LOCATION_ADDRESS_1)) {
       setAddress1(rs.getString(DbConstants.LOCATION_ADDRESS_1));
     }
     if (columns.containsKey(DbConstants.LOCATION_ADDRESS_2)) {
       setAddress2(rs.getString(DbConstants.LOCATION_ADDRESS_2));
     }
     if (columns.containsKey(DbConstants.LOCATION_CITY)) {
       setCity(rs.getString(DbConstants.LOCATION_CITY));
     }
     if (columns.containsKey(DbConstants.LOCATION_STATE)) {
       setState(rs.getString(DbConstants.LOCATION_STATE));
     }
     if (columns.containsKey(DbConstants.LOCATION_ZIP)) {
       setZipCode(rs.getString(DbConstants.LOCATION_ZIP));
     }
     if (columns.containsKey(DbConstants.LOCATION_COUNTRY)) {
       setCountry(rs.getString(DbConstants.LOCATION_COUNTRY));
     }
     if (columns.containsKey(DbConstants.LOCATION_PHONE)) {
       setPhoneNumber(rs.getString(DbConstants.LOCATION_PHONE));
     }
     if (columns.containsKey(DbAliases.LOCATION_ADDRESS_ID)) {
       setAddressId(rs.getString(DbAliases.LOCATION_ADDRESS_ID));
     }
     if (columns.containsKey(DbAliases.LOCATION_NAME)) {
       setName(rs.getString(DbAliases.LOCATION_NAME));
     }
     if (columns.containsKey(DbAliases.LOCATION_ADDRESS_1)) {
       setAddress1(rs.getString(DbAliases.LOCATION_ADDRESS_1));
     }
     if (columns.containsKey(DbAliases.LOCATION_ADDRESS_2)) {
       setAddress2(rs.getString(DbAliases.LOCATION_ADDRESS_2));
     }
     if (columns.containsKey(DbAliases.LOCATION_CITY)) {
       setCity(rs.getString(DbAliases.LOCATION_CITY));
     }
     if (columns.containsKey(DbAliases.LOCATION_STATE)) {
       setState(rs.getString(DbAliases.LOCATION_STATE));
     }
     if (columns.containsKey(DbAliases.LOCATION_ZIP)) {
       setZipCode(rs.getString(DbAliases.LOCATION_ZIP));
     }
     if (columns.containsKey(DbAliases.LOCATION_COUNTRY)) {
       setCountry(rs.getString(DbAliases.LOCATION_COUNTRY));
     }
     if (columns.containsKey(DbAliases.LOCATION_PHONE)) {
       setPhoneNumber(rs.getString(DbAliases.LOCATION_PHONE));
     }
   } catch (SQLException e) {
     ApiFunctions.throwAsRuntimeException(e);
   }
 }
Ejemplo n.º 2
0
 /**
  * Populates this <code>RequestBoxDto</code> from the data in the current row of the result set.
  *
  * @param columns a <code>Map</code> containing a key for each column in the <code>ResultSet
  *     </code>. Each key must be one of the column alias constants in {@link
  *     com.ardais.bigr.util.DbAliases} and the corresponding value is ignored.
  * @param rs the <code>ResultSet</code>
  */
 public void populate(Map columns, ResultSet rs) {
   try {
     if (columns.containsKey(DbAliases.REQUEST_BOX_BOX_BARCODE_ID)) {
       setBoxId(rs.getString(DbAliases.REQUEST_BOX_BOX_BARCODE_ID));
     }
     if (columns.containsKey(DbAliases.REQUEST_BOX_SHIPPED_YN)) {
       setShipped("Y".equals(rs.getString(DbAliases.REQUEST_BOX_SHIPPED_YN).toUpperCase()));
     }
   } catch (SQLException e) {
     ApiFunctions.throwAsRuntimeException(e);
   }
 }
Ejemplo n.º 3
0
  private String getSampleInfo(HashMap sampleNumberToSample, SecurityInfo securityInfo) {
    Set problems = new HashSet();
    List encounteredAliases = new ArrayList();

    Iterator i = sampleNumberToSample.keySet().iterator();
    while (i.hasNext()) {
      String sampleNumber = (String) i.next();
      String sampleIdOrAlias = (String) sampleNumberToSample.get(sampleNumber);
      String sampleTypeCui = null;
      String sampleAlias = null;
      // if the value begins with the prefix for any of our sample ids (FR, PA, SX) then
      // assume it is a sample id.  Return an error if the sample doesn't exist.
      if (IltdsUtils.isSystemSampleId(sampleIdOrAlias)) {
        try {
          SampleAccessBean sample = new SampleAccessBean(new SampleKey(sampleIdOrAlias));
          sampleTypeCui = sample.getSampleTypeCid();
          sampleAlias = sample.getCustomerId();
        } catch (ObjectNotFoundException e) {
          StringBuffer error = new StringBuffer(100);
          error.append("Sample ");
          error.append(sampleIdOrAlias);
          error.append(" does not exist in the database.");
          problems.add(error.toString());
        } catch (Exception e) {
          ApiFunctions.throwAsRuntimeException(e);
        }
      }
      // if the value does not begin with the prefix for any of our sample ids (FR, PA, SX) then
      // assume it is a sample alias and handle the alias as follows:
      // - if the alias corresponds to multiple existing sample ids, return an error.
      // - if the alias corresponds to a single existing sample id, see if the account to which that
      //      sample belongs requires unique aliases.
      //      - if not, return an error since we cannot be positive the sample we found was the one
      //        intended.
      //      - if so
      //         - if the specified alias has already been encountered return an error since the
      //           same sample cannot be scanned into multiple locations in a box.
      //         - if the alias has not yet been encountered then get the information for that
      //           sample.
      // - if the alias corresponds to no existing sample return an error.
      else {
        // pass false to the findSampleIdsFromCustomerId call, to take into account any samples that
        // have been created via a box scan but have not yet been annotated.
        List existingSamples = IltdsUtils.findSamplesFromCustomerId(sampleIdOrAlias, false);
        // if multiple samples with the specified alias were found, return an error.
        if (existingSamples.size() > 1) {
          StringBuffer error = new StringBuffer(100);
          error.append("The alias \"");
          error.append(Escaper.htmlEscapeAndPreserveWhitespace(sampleIdOrAlias));
          error.append("\" corresponds to multiple existing samples.  Please scan the specific");
          error.append(" sample id you wish to use.");
          problems.add(error.toString());
        }
        // if a single sample was found, do some further checking
        else if (existingSamples.size() == 1) {
          String accountId = ((SampleData) existingSamples.get(0)).getArdaisAcctKey();
          AccountDto accountDto = IltdsUtils.getAccountById(accountId, false, false);
          boolean aliasMustBeUnique =
              FormLogic.DB_YES.equalsIgnoreCase(accountDto.getRequireUniqueSampleAliases());
          // if the account to which the sample belongs does not require unique sample aliases,
          // return an error since we cannot be sure the sample we found was the one intended.
          if (!aliasMustBeUnique) {
            StringBuffer error = new StringBuffer(100);
            error.append("The alias \"");
            error.append(Escaper.htmlEscapeAndPreserveWhitespace(sampleIdOrAlias));
            error.append("\" does not uniquely identify a sample.");
            error.append(" Please scan the specific sample id you wish to use.");
            problems.add(error.toString());
          }
          // if we've already encountered this alias, return an error (the same sample cannot
          // be scanned into multiple locations in a box)
          else if (encounteredAliases.contains(sampleIdOrAlias.toUpperCase())) {
            StringBuffer error = new StringBuffer(100);
            error.append("The alias \"");
            error.append(Escaper.htmlEscapeAndPreserveWhitespace(sampleIdOrAlias));
            error.append("\" appears more than once.");
            problems.add(error.toString());
            // still fill in the sample information so the resulting screen looks correct (otherwise
            // the first instance of this alias has information but the second does not)
            SampleData sample = (SampleData) existingSamples.get(0);
            sampleIdOrAlias = sample.getSampleId();
            sampleTypeCui = sample.getSampleTypeCui();
            sampleAlias = sample.getSampleAlias();
          }
          // otherwise store the encountered alias (in uppercase, so we can compare subsequent
          // aliases to this one without case accounting for any differences) and get the
          // information
          // for the sample
          else {
            encounteredAliases.add(sampleIdOrAlias.toUpperCase());
            SampleData sample = (SampleData) existingSamples.get(0);
            sampleIdOrAlias = sample.getSampleId();
            sampleTypeCui = sample.getSampleTypeCui();
            sampleAlias = sample.getSampleAlias();
          }
        }
        // if no matching sample was found, return an error
        else {
          StringBuffer error = new StringBuffer(100);
          error.append("Sample \"");
          error.append(Escaper.htmlEscapeAndPreserveWhitespace(sampleIdOrAlias));
          error.append("\" does not exist in the database.");
          problems.add(error.toString());
        }
      }
      // Create a sample data to hold the information
      SampleData sample = new SampleData();
      sample.setSampleId(sampleIdOrAlias);
      sample.setSampleAlias(sampleAlias);
      sample.setSampleTypeCui(sampleTypeCui);
      if (!ApiFunctions.isEmpty(sampleTypeCui)) {
        sample.setSampleType(GbossFactory.getInstance().getDescription(sampleTypeCui));
      }
      // replace the map entry with the sample data object
      sampleNumberToSample.put(sampleNumber, sample);
    }

    String returnValue = null;
    if (!problems.isEmpty()) {
      StringBuffer buff = new StringBuffer("The following problems were found: ");
      Iterator problemIterator = problems.iterator();
      while (problemIterator.hasNext()) {
        buff.append((String) problemIterator.next());
        buff.append("  ");
      }
      returnValue = buff.toString();
    }
    return returnValue;
  }
Ejemplo n.º 4
0
 /**
  * Populates this <code>PathReportSectionData</code> from the data in the current row of the
  * result set.
  *
  * @param columns a <code>Map</code> containing a key for each column in the <code>ResultSet
  *     </code>. Each key must be one of the column alias constants in {@link
  *     com.ardais.bigr.util.DbAliases} and the corresponding value is ignored.
  * @param rs the <code>ResultSet</code>
  */
 public void populate(Map columns, ResultSet rs) {
   try {
     if (columns.containsKey(DbAliases.SECTION_DX)) {
       setDiagnosis(rs.getString(DbAliases.SECTION_DX));
     }
     if (columns.containsKey(DbAliases.SECTION_DX_OTHER)) {
       setDiagnosisOther(rs.getString(DbAliases.SECTION_DX_OTHER));
     }
     if (columns.containsKey(DbAliases.SECTION_HNG)) {
       setHistologicalNuclearGrade(rs.getString(DbAliases.SECTION_HNG));
     }
     if (columns.containsKey(DbAliases.SECTION_ID)) {
       setPathReportSectionId(rs.getString(DbAliases.SECTION_ID));
     }
     if (columns.containsKey(DbAliases.SECTION_GLEASON_PRIMARY)) {
       if (rs.getString(DbAliases.SECTION_GLEASON_PRIMARY) != null) {
         setGleasonPrimary(new Integer(rs.getInt(DbAliases.SECTION_GLEASON_PRIMARY)));
       }
     }
     if (columns.containsKey(DbAliases.SECTION_GLEASON_SECONDARY)) {
       if (rs.getString(DbAliases.SECTION_GLEASON_SECONDARY) != null) {
         setGleasonSecondary(new Integer(rs.getInt(DbAliases.SECTION_GLEASON_SECONDARY)));
       }
     }
     if (columns.containsKey(DbAliases.SECTION_GLEASON_TOTAL)) {
       if (rs.getString(DbAliases.SECTION_GLEASON_TOTAL) != null) {
         setGleasonTotal(new Integer(rs.getInt(DbAliases.SECTION_GLEASON_TOTAL)));
       }
     }
     if (columns.containsKey(DbAliases.SECTION_LYMPH_STAGE)) {
       setLymphNodeStage(rs.getString(DbAliases.SECTION_LYMPH_STAGE));
     }
     if (columns.containsKey(DbAliases.SECTION_METASTASIS)) {
       setDistantMetastasis(rs.getString(DbAliases.SECTION_METASTASIS));
     }
     if (columns.containsKey(DbAliases.SECTION_STAGE_GROUPING)) {
       setStageGrouping(rs.getString(DbAliases.SECTION_STAGE_GROUPING));
     }
     if (columns.containsKey(DbAliases.SECTION_TISSUE_FINDING)) {
       setTissueFinding(rs.getString(DbAliases.SECTION_TISSUE_FINDING));
     }
     if (columns.containsKey(DbAliases.SECTION_TISSUE_FINDING_OTHER)) {
       setTissueFindingOther(rs.getString(DbAliases.SECTION_TISSUE_FINDING_OTHER));
     }
     if (columns.containsKey(DbAliases.SECTION_TISSUE_ORIGIN)) {
       setTissueOrigin(rs.getString(DbAliases.SECTION_TISSUE_ORIGIN));
     }
     if (columns.containsKey(DbAliases.SECTION_TISSUE_ORIGIN_OTHER)) {
       setTissueOriginOther(rs.getString(DbAliases.SECTION_TISSUE_ORIGIN_OTHER));
     }
     if (columns.containsKey(DbAliases.SECTION_TUMOR_STAGE)) {
       setTumorStageDesc(rs.getString(DbAliases.SECTION_TUMOR_STAGE));
     }
     if (columns.containsKey(DbAliases.SECTION_TUMOR_STAGE_TYPE)) {
       setTumorStageType(rs.getString(DbAliases.SECTION_TUMOR_STAGE_TYPE));
     }
     if (columns.containsKey(DbAliases.SECTION_PRIMARY_IND)) {
       setPrimary(rs.getString(DbAliases.SECTION_PRIMARY_IND));
     }
     if (columns.containsKey(DbAliases.SECTION_PATH_REPORT_ID)) {
       setPathReportId(rs.getString(DbAliases.SECTION_PATH_REPORT_ID));
     }
     if (columns.containsKey(DbAliases.SECTION_TUMOR_SIZE)) {
       setTumorSize(rs.getString(DbAliases.SECTION_TUMOR_SIZE));
     }
     if (columns.containsKey(DbAliases.SECTION_TUMOR_WEIGHT)) {
       setTumorWeight(rs.getString(DbAliases.SECTION_TUMOR_WEIGHT));
     }
   } catch (SQLException e) {
     ApiFunctions.throwAsRuntimeException(e);
   }
 }