public Account getAccount(String id) {
   id = ApiFunctions.safeTrim(id);
   if (ApiFunctions.isEmpty(id)) {
     throw new ApiException("A non-empty account id must be specified.");
   } else {
     return (Account) _accountMap.get(id.toLowerCase());
   }
 }
Пример #2
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);
   }
 }
Пример #3
0
 /** Adds a kc column */
 public void addColumnKcData(String cui, String domainObjectType) {
   if (ApiFunctions.isEmpty(cui)) {
     throw new ApiException("Null cui encountered");
   } else if (ApiFunctions.isEmpty(domainObjectType)) {
     throw new ApiException("Null domain object type encountered");
   } else {
     if (TagTypes.DOMAIN_OBJECT_VALUE_SAMPLE.equalsIgnoreCase(domainObjectType)) {
       getQuerySampleKcData().addColumn(cui);
     } else if (TagTypes.DOMAIN_OBJECT_VALUE_CASE.equalsIgnoreCase(domainObjectType)) {
       getQueryConsentKcData().addColumn(cui);
     } else if (TagTypes.DOMAIN_OBJECT_VALUE_DONOR.equalsIgnoreCase(domainObjectType)) {
       getQueryDonorKcData().addColumn(cui);
     } else {
       throw new ApiException("Unknown domain object type encountered: " + domainObjectType);
     }
   }
 }
Пример #4
0
 /** @see com.ardais.bigr.library.web.column.SampleColumnImpl#getBodyText(SampleRowParams) */
 protected String getBodyText(SampleRowParams rp) throws IOException {
   StringBuffer result = new StringBuffer(128);
   if (ApiFunctions.safeStringLength(getRawBodyText(rp)) > 0) {
     result.append("<td bgColor=red>");
   } else {
     result.append("<td>");
   }
   result.append(getRawBodyText(rp));
   result.append("</td>");
   return result.toString();
 }
Пример #5
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);
   }
 }
 private void validatePrinterLabelTemplates(
     Account account, LabelPrinter printer, StringBuffer problems, boolean appendComma) {
   Map templates = printer.getLabelTemplates();
   // if there are no label templates defined for the printer, return an error
   if (templates.isEmpty()) {
     if (appendComma) {
       problems.append(",");
     }
     problems.append(
         " printer with name = "
             + printer.getName()
             + " in account with id = "
             + account.getId()
             + " has no label templates defined.");
     appendComma = true;
   } else {
     Iterator iterator = templates.keySet().iterator();
     while (iterator.hasNext()) {
       LabelTemplate template = (LabelTemplate) templates.get(iterator.next());
       // make sure every template refers to a known template definition
       String templateDefinitionName = template.getLabelTemplateDefinitionName();
       if (printer
               .getParent()
               .getLabelTemplateDefinitions()
               .get(templateDefinitionName.toLowerCase())
           == null) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " label template for printer ("
                 + printer.getName()
                 + ") references an unknown labelTemplateDefinition ("
                 + templateDefinitionName
                 + ")");
         appendComma = true;
       }
       // make sure every template has a fully qualified name value
       String fullName = template.getFullyQualifiedName();
       if (ApiFunctions.isEmpty(fullName)) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " label template with labelTemplateDefinitionName = "
                 + templateDefinitionName
                 + " has no fully qualified name value");
         appendComma = true;
       }
     }
   }
 }
Пример #7
0
 /**
  * Creates a new <code>PathReportSectionData</code>, initialized from the data in the
  * PathReportSectionData passed in.
  *
  * @param pathReportSectionData the <code>PathReportSectionData</code>
  */
 public PathReportSectionData(PathReportSectionData pathReportSectionData) {
   this();
   BigrBeanUtilsBean.SINGLETON.copyProperties(this, pathReportSectionData);
   // any mutable objects must be handled seperately (BigrBeanUtilsBean.copyProperties
   // does a shallow copy.
   if (!ApiFunctions.isEmpty(pathReportSectionData.getFindings())) {
     _findings.clear();
     Iterator iterator = pathReportSectionData.getFindings().iterator();
     while (iterator.hasNext()) {
       _findings.add(
           new PathReportSectionFindingData((PathReportSectionFindingData) iterator.next()));
     }
   }
 }
Пример #8
0
  /**
   * Insert the method's description here. Creation date: (2/8/2001 6:51:19 PM)
   *
   * @param myError java.lang.String
   */
  private void retry(String myError) throws Exception {
    // Get the security info.
    SecurityInfo securityInfo = WebUtils.getSecurityInfo(request);

    String boxLayoutId = request.getParameter("boxLayoutId");
    boxLayoutId = BoxLayoutUtils.checkBoxLayoutId(boxLayoutId, false, true, true);
    if (!ApiFunctions.isEmpty(boxLayoutId)) {
      String accountId = securityInfo.getAccount();
      if (!BoxLayoutUtils.isValidBoxLayoutForAccount(boxLayoutId, accountId)) {
        // The box layout id is not part of the account box layout group.
        BoxScanData bsd = BoxLayoutUtils.prepareForBoxScan(securityInfo);
        boxLayoutId = bsd.getDefaultBoxLayoutId();
      }
    }
    BoxLayoutDto boxLayoutDto = BoxLayoutUtils.getBoxLayoutDto(boxLayoutId);
    request.setAttribute("boxLayoutDto", boxLayoutDto);

    retry(myError, RETRY_PATH);
  }
Пример #9
0
  /** Insert the method's description here. Creation date: (2/2/2001 2:39:22 PM) */
  public void invoke() throws Exception {

    SecurityInfo securityInfo = WebUtils.getSecurityInfo(request);

    // Check if box layout is valid for this account.
    String boxLayoutId = request.getParameter("boxLayoutId");
    boxLayoutId = BoxLayoutUtils.checkBoxLayoutId(boxLayoutId, false, true, true);
    if (!ApiFunctions.isEmpty(boxLayoutId)) {
      String accountId = securityInfo.getAccount();
      if (!BoxLayoutUtils.isValidBoxLayoutForAccount(boxLayoutId, accountId)) {
        // The box layout id is not part of the account box layout group.
        retry("The box layout selected does not belong to this account.");
      }
    }
    BoxLayoutDto boxLayoutDto = BoxLayoutUtils.getBoxLayoutDto(boxLayoutId);
    request.setAttribute("boxLayoutDto", boxLayoutDto);

    // Scan through all of the box cells to find the sample ids and/or aliases.
    // Here we're just accumulating non-null entries, we do validation later.
    //
    HashMap sampleNumberToSample = new HashMap();
    for (int i = 0; i < boxLayoutDto.getBoxCapacity(); i++) {
      String sampleNumber = "smpl" + (i + 1);
      String sampleIdOrAlias = ApiFunctions.safeString(request.getParameter(sampleNumber)).trim();
      if (!ApiFunctions.isEmpty(sampleIdOrAlias)) {
        sampleNumberToSample.put(sampleNumber, sampleIdOrAlias);
      }
    }

    // Get relevant information about the samples, and populate the request with that information.
    // If there was a problem getting the information return an error (but populate any retrieved
    // sample information first so it is retained for existing samples)
    String error = getSampleInfo(sampleNumberToSample, securityInfo);
    for (int i = 0; i < boxLayoutDto.getBoxCapacity(); i++) {
      String sampleNumber = "smpl" + (i + 1);
      String sampleIdOrAlias = ApiFunctions.safeString(request.getParameter(sampleNumber)).trim();
      if (!ApiFunctions.isEmpty(sampleIdOrAlias)) {
        SampleData sample = (SampleData) sampleNumberToSample.get(sampleNumber);
        request.setAttribute("smplType" + (i + 1), sample.getSampleType());
        request.setAttribute("smplAlias" + (i + 1), sample.getSampleAlias());
      }
    }
    if (!ApiFunctions.isEmpty(error)) {
      retry(error);
      return;
    }

    // iterate over the samples, gathering data we'll need for additional checking.  Note that
    // at this point, regardless of whether the sample was scanned via its system id or alias,
    // we have retrieved the sample id, sample alias, and sample type for every sample.
    List systemSampleIds = new ArrayList();
    Iterator i = sampleNumberToSample.keySet().iterator();
    while (i.hasNext()) {
      String sampleNumber = (String) i.next();
      SampleData sample = (SampleData) sampleNumberToSample.get(sampleNumber);
      if (sample != null) {
        String sampleId = sample.getSampleId();
        systemSampleIds.add(sampleId);
      }
    }

    // SWP-1100 - if nothing has been scanned in, return an error
    if (sampleNumberToSample.size() == 0) {
      retry("Please enter sample(s) before continuing.");
      return;
    }

    // Now perform some additional checks.  Pass true for the check to make sure that samples
    // exist, because for a check-out operation we always require that all of the samples
    // actually exist.  Note however that since we've already performed that check above this check
    // should always succeed.
    if (!ApiFunctions.isEmpty(systemSampleIds)) {
      // MR7356 Don't allow samples on open requests to be scanned into the new box
      boolean enforceRequestedSampleRestrictions = true;
      SampleOperationHome sampleOpHome =
          (SampleOperationHome) EjbHomes.getHome(SampleOperationHome.class);
      SampleOperation sampleOp = sampleOpHome.create();
      String validSampleSetError =
          sampleOp.validSamplesForBoxScan(
              systemSampleIds,
              true,
              enforceRequestedSampleRestrictions,
              false,
              securityInfo,
              boxLayoutDto);
      if (validSampleSetError != null) {
        retry(validSampleSetError);
        return;
      }
    }

    Vector staffNames = new Vector();
    String account = securityInfo.getAccount();
    ListGeneratorHome home = (ListGeneratorHome) EjbHomes.getHome(ListGeneratorHome.class);
    ListGenerator list = home.create();
    staffNames = list.lookupArdaisStaffByAccountId(account);
    request.setAttribute("staff", staffNames);

    servletCtx
        .getRequestDispatcher("/hiddenJsps/iltds/storage/checkOutBox/checkOutBoxConfirm.jsp")
        .forward(request, response);
  }
Пример #10
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;
  }
 private void validateAccountLabelPrinters(Account account, StringBuffer problems) {
   boolean appendComma = problems.length() > 0;
   Map printers = account.getLabelPrinters();
   // if there are no label printers defined for the account, return an error
   if (printers.isEmpty()) {
     if (appendComma) {
       problems.append(",");
     }
     problems.append(" account with id = " + account.getId() + " has no printers defined.");
     appendComma = true;
   } else {
     Map displayNames = new HashMap();
     Iterator iterator = printers.keySet().iterator();
     while (iterator.hasNext()) {
       LabelPrinter printer = (LabelPrinter) printers.get(iterator.next());
       String name = printer.getName();
       // check that the name by which the printer will be displayed (display name if present,
       // otherwise name) is unique
       String displayName = printer.getDisplayName();
       if (ApiFunctions.isEmpty(displayName)) {
         displayName = name;
       }
       if (displayNames.put(displayName, displayName) != null) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " printer with name = "
                 + name
                 + " has the same display name as another printer in the account");
         appendComma = true;
       }
       // make sure the printer is set up for at least one type of printing mechanism
       // (i.e. tcp/ip, email, etc)
       if (!printer.isEmailBasedPrintingEnabled()
           && !printer.isFileBasedPrintingEnabled()
           && !printer.isTcpIpBasedPrintingEnabled()) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(" printer with name = " + name + " has no printing mechanism enabled");
         appendComma = true;
       }
       // make sure all required printing information has been specified
       else {
         if (printer.isEmailBasedPrintingEnabled()) {
           if (ApiFunctions.isEmpty(printer.getEmailAddress())) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no email address.");
             appendComma = true;
           }
           if (ApiFunctions.isEmpty(printer.getEmailSubject())) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no email subject.");
             appendComma = true;
           }
         }
         if (printer.isFileBasedPrintingEnabled()) {
           if (!ApiFunctions.isEmpty(printer.getFileTransferCommand())
               && printer
                       .getFileTransferCommand()
                       .indexOf(Constants.LABEL_PRINTING_TRANSFER_COMMAND_FILE_INSERTION_STRING)
                   < 0) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(
                 " printer with name = "
                     + name
                     + " has a file transfer command with no insertion point for the filename.");
             appendComma = true;
           }
           if (ApiFunctions.isEmpty(printer.getFileName())) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no file name.");
             appendComma = true;
           }
           if (ApiFunctions.isEmpty(printer.getFileExtension())) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no file extension.");
             appendComma = true;
           }
         }
         if (printer.isTcpIpBasedPrintingEnabled()) {
           if (ApiFunctions.isEmpty(printer.getTcpIpHost())) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no tcp/ip host.");
             appendComma = true;
           }
           String tcpIpPort = printer.getTcpIpPort();
           if (ApiFunctions.isEmpty(tcpIpPort)) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(" printer with name = " + name + " has no tcp/ip port.");
             appendComma = true;
           } else {
             if (!ApiFunctions.isInteger(tcpIpPort)) {
               if (appendComma) {
                 problems.append(",");
               }
               problems.append(" printer with name = " + name + " has an invalid tcp/ip port.");
               appendComma = true;
             }
           }
         }
       }
       // validate the label templates specified as available on this printer
       validatePrinterLabelTemplates(account, printer, problems, appendComma);
     }
   }
 }
Пример #12
0
  /**
   * Creates a new <code>PathReportSectionData</code>, initialized from the data in the current row
   * of the result set.
   */
  public PathReportSectionData(ResultSet rs) {
    this();
    try {
      ResultSetMetaData meta = rs.getMetaData();
      int columnCount = meta.getColumnCount();
      HashMap lookup = new HashMap();

      for (int i = 0; i < columnCount; i++) {
        lookup.put(meta.getColumnName(i + 1).toLowerCase(), null);
      }

      if (lookup.containsKey("cell_infiltrate_amt"))
        setCellInfiltrateAmount(rs.getString("cell_infiltrate_amt"));

      if (lookup.containsKey("consent_id")) setConsentId(rs.getString("consent_id"));

      if (lookup.containsKey("create_user")) setCreateUser(rs.getString("create_user"));

      if (lookup.containsKey("diagnosis_concept_id"))
        setDiagnosis(rs.getString("diagnosis_concept_id"));

      if (lookup.containsKey("distant_metastasis"))
        setDistantMetastasis(rs.getString("distant_metastasis"));

      if (lookup.containsKey("distant_metastasis_ind"))
        setDistantMetastasisInd(rs.getString("distant_metastasis_ind"));

      if (lookup.containsKey("extensive_intraductal_comp"))
        setExtensiveIntraductalComp(rs.getString("extensive_intraductal_comp"));

      if (lookup.containsKey("extranodal_spread"))
        setExtranodalSpread(rs.getString("extranodal_spread"));

      if (lookup.containsKey("histological_nuclear_grade"))
        setHistologicalNuclearGrade(rs.getString("histological_nuclear_grade"));

      if (lookup.containsKey("histological_type"))
        setHistologicalType(rs.getString("histological_type"));

      if (lookup.containsKey("inflamm_cell_infiltrate"))
        setInflammCellInfiltrate(rs.getString("inflamm_cell_infiltrate"));

      if (lookup.containsKey("joint_component")) setJointComponent(rs.getString("joint_component"));

      if (lookup.containsKey("last_update_user"))
        setLastUpdateUser(rs.getString("last_update_user"));

      if (lookup.containsKey("lymph_node_notes"))
        setLymphNodeNotes(rs.getString("lymph_node_notes"));

      if (lookup.containsKey("lymph_node_stage"))
        setLymphNodeStage(rs.getString("lymph_node_stage"));

      if (lookup.containsKey("lymph_node_stage_ind"))
        setLymphNodeStageInd(rs.getString("lymph_node_stage_ind"));

      if (lookup.containsKey("lymphatic_vascular_invasion"))
        setLymphaticVascularInvasion(rs.getString("lymphatic_vascular_invasion"));

      if (lookup.containsKey("margins_involved_desc"))
        setMarginsInvolved(rs.getString("margins_involved_desc"));

      if (lookup.containsKey("margins_uninvolved_desc"))
        setMarginsUninvolved(rs.getString("margins_uninvolved_desc"));

      if (lookup.containsKey("other_distant_metastasis"))
        setDistantMetastasisOther(rs.getString("other_distant_metastasis"));

      if (lookup.containsKey("other_dx_name")) setDiagnosisOther(rs.getString("other_dx_name"));

      if (lookup.containsKey("other_finding_tc_name"))
        setTissueFindingOther(rs.getString("other_finding_tc_name"));

      if (lookup.containsKey("other_histo_nuclear_grade"))
        setHistologicalNuclearGradeOther(rs.getString("other_histo_nuclear_grade"));

      if (lookup.containsKey("other_histological_type"))
        setHistologicalTypeOther(rs.getString("other_histological_type"));

      if (lookup.containsKey("other_lymph_node_stage"))
        setLymphNodeStageOther(rs.getString("other_lymph_node_stage"));

      if (lookup.containsKey("other_origin_tc_name"))
        setTissueOriginOther(rs.getString("other_origin_tc_name"));

      if (lookup.containsKey("other_stage_grouping"))
        setStageGroupingOther(rs.getString("other_stage_grouping"));

      if (lookup.containsKey("other_tumor_stage_desc"))
        setTumorStageDescOther(rs.getString("other_tumor_stage_desc"));

      if (lookup.containsKey("other_tumor_stage_type"))
        setTumorStageTypeOther(rs.getString("other_tumor_stage_type"));

      if (lookup.containsKey("path_report_id")) setPathReportId(rs.getString("path_report_id"));

      if (lookup.containsKey("path_report_section_id"))
        setPathReportSectionId(rs.getString("path_report_section_id"));

      if (lookup.containsKey("path_section_notes"))
        setSectionNotes(ApiFunctions.getStringFromClob(rs.getClob("path_section_notes")));

      if (lookup.containsKey("perineural_invasion_ind"))
        setPerineuralInvasion(rs.getString("perineural_invasion_ind"));

      if (lookup.containsKey("primary_gleason_score")) {
        String score = rs.getString("primary_gleason_score");
        if (score != null) setGleasonPrimary(new Integer(score));
      }

      if (lookup.containsKey("primary_ind")) setPrimary(rs.getString("primary_ind"));

      if (lookup.containsKey("secondary_gleason_score")) {
        String score = rs.getString("secondary_gleason_score");
        if (score != null) setGleasonSecondary(new Integer(score));
      }

      if (lookup.containsKey("section_identifier"))
        setSectionIdentifier(rs.getString("section_identifier"));

      if (lookup.containsKey("size_largest_nodal_mets"))
        setSizeLargestNodalMets(rs.getString("size_largest_nodal_mets"));

      if (lookup.containsKey("stage_grouping")) setStageGrouping(rs.getString("stage_grouping"));

      if (lookup.containsKey("tissue_finding_concept_id"))
        setTissueFinding(rs.getString("tissue_finding_concept_id"));

      if (lookup.containsKey("tissue_origin_concept_id"))
        setTissueOrigin(rs.getString("tissue_origin_concept_id"));

      if (lookup.containsKey("total_gleason_score")) {
        String score = rs.getString("total_gleason_score");
        if (score != null) setGleasonTotal(new Integer(score));
      }

      if (lookup.containsKey("total_nodes_examined"))
        setTotalNodesExamined(rs.getString("total_nodes_examined"));

      if (lookup.containsKey("total_nodes_positive"))
        setTotalNodesPositive(rs.getString("total_nodes_positive"));

      if (lookup.containsKey("tumor_configuration"))
        setTumorConfiguration(rs.getString("tumor_configuration"));

      if (lookup.containsKey("tumor_size")) setTumorSize(rs.getString("tumor_size"));

      if (lookup.containsKey("tumor_stage_desc"))
        setTumorStageDesc(rs.getString("tumor_stage_desc"));

      if (lookup.containsKey("tumor_stage_desc_ind"))
        setTumorStageDescInd(rs.getString("tumor_stage_desc_ind"));

      if (lookup.containsKey("tumor_stage_type"))
        setTumorStageType(rs.getString("tumor_stage_type"));

      if (lookup.containsKey("tumor_weight")) setTumorWeight(rs.getString("tumor_weight"));

      if (lookup.containsKey("venous_vessel_invasion"))
        setVenousVesselInvasion(rs.getString("venous_vessel_invasion"));

    } catch (SQLException e) {
      throw new ApiException(e);
    }
  }
  private void validateAccount(Account account, StringBuffer problems) {
    boolean appendComma = problems.length() > 0;
    // validate the account id exists and is a known account id
    String id = ApiFunctions.safeTrim(account.getId());
    if (ApiFunctions.isEmpty(id)) {
      if (appendComma) {
        problems.append(",");
      }
      problems.append(" account with empty id encountered");
      appendComma = true;
    } else {
      ArdaisaccountAccessBean ardaisAccount = null;
      try {
        ardaisAccount = new ArdaisaccountAccessBean(new ArdaisaccountKey(id));
      } catch (Exception e) {
        if (appendComma) {
          problems.append(",");
        }
        problems.append(" account with unknown id (" + id + ") encountered");
        appendComma = true;
      }
    }

    // validate that the bartender command line exists and has the correct insertion points
    String bartenderCommandLine = account.getBartenderCommandLine();
    if (ApiFunctions.isEmpty(bartenderCommandLine)) {
      if (appendComma) {
        problems.append(",");
      }
      problems.append(" account with empty bartenderCommandLine encountered.");
      appendComma = true;
    } else {
      if (bartenderCommandLine.indexOf(Constants.LABEL_PRINTING_INSERTION_STRING_LABEL_PRINTER)
          <= 0) {
        if (appendComma) {
          problems.append(",");
        }
        problems.append(
            " account with bartenderCommandLine having no printer insertion string encountered.");
        appendComma = true;
      }
      if (bartenderCommandLine.indexOf(Constants.LABEL_PRINTING_INSERTION_STRING_LABEL_TEMPLATE)
          <= 0) {
        if (appendComma) {
          problems.append(",");
        }
        problems.append(
            " account with bartenderCommandLine having no template insertion string encountered.");
        appendComma = true;
      }
    }

    // validate the results form definitions in the account
    validateAccountResultsFormDefinitions(account, problems);

    // validate the label template definitions in the account
    validateAccountLabelTemplateDefinitions(account, problems);

    // validate the label printers in the account
    validateAccountLabelPrinters(account, problems);
  }
Пример #14
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);
   }
 }
Пример #15
0
 /* (non-Javadoc)
  * @see com.ardais.bigr.btx.framework.DescribableAsHistoryObject#describeAsHistoryObject()
  */
 public Object describeAsHistoryObject() {
   BtxHistoryAttributes attributes = new BtxHistoryAttributes();
   if (!ApiFunctions.isEmpty(getConsentId())) {
     attributes.setAttribute("consentId", getConsentId());
   }
   if (!ApiFunctions.isEmpty(getCellInfiltrateAmount())) {
     attributes.setAttribute(
         "cellInfiltrateAmount",
         GbossFactory.getInstance().getDescription(getCellInfiltrateAmount()));
   }
   if (!ApiFunctions.isEmpty(getDiagnosis())) {
     attributes.setAttribute("diagnosis", BigrGbossData.getDiagnosisDescription(getDiagnosis()));
   }
   if (!ApiFunctions.isEmpty(getDiagnosisOther())) {
     attributes.setAttribute("diagnosisOther", getDiagnosisOther());
   }
   if (!ApiFunctions.isEmpty(getDistantMetastasis())) {
     attributes.setAttribute(
         "distantMetastasis", GbossFactory.getInstance().getDescription(getDistantMetastasis()));
   }
   if (!ApiFunctions.isEmpty(getDistantMetastasisInd())) {
     attributes.setAttribute("distantMetastasisInd", getDistantMetastasisInd());
   }
   if (!ApiFunctions.isEmpty(getDistantMetastasisOther())) {
     attributes.setAttribute("distantMetastasisOther", getDistantMetastasisOther());
   }
   if (!ApiFunctions.isEmpty(getExtensiveIntraductalComp())) {
     attributes.setAttribute(
         "extensiveIntraductalComp",
         GbossFactory.getInstance().getDescription(getExtensiveIntraductalComp()));
   }
   if (!ApiFunctions.isEmpty(getExtranodalSpread())) {
     attributes.setAttribute(
         "extranodalSpread", GbossFactory.getInstance().getDescription(getExtranodalSpread()));
   }
   if (getGleasonPrimary() != null && !ApiFunctions.isEmpty(getGleasonPrimary().toString())) {
     attributes.setAttribute("gleasonPrimary", getGleasonPrimary().toString());
   }
   if (getGleasonSecondary() != null && !ApiFunctions.isEmpty(getGleasonSecondary().toString())) {
     attributes.setAttribute("gleasonSecondary", getGleasonSecondary().toString());
   }
   if (getGleasonTotal() != null && !ApiFunctions.isEmpty(getGleasonTotal().toString())) {
     attributes.setAttribute("gleasonTotal", getGleasonTotal().toString());
   }
   if (!ApiFunctions.isEmpty(getHistologicalNuclearGrade())) {
     attributes.setAttribute(
         "histologicalNuclearGrade",
         GbossFactory.getInstance().getDescription(getHistologicalNuclearGrade()));
   }
   if (!ApiFunctions.isEmpty(getHistologicalNuclearGradeOther())) {
     attributes.setAttribute("histologicalNuclearGradeOther", getHistologicalNuclearGradeOther());
   }
   if (!ApiFunctions.isEmpty(getHistologicalType())) {
     attributes.setAttribute(
         "histologicalType", GbossFactory.getInstance().getDescription(getHistologicalType()));
   }
   if (!ApiFunctions.isEmpty(getHistologicalTypeOther())) {
     attributes.setAttribute("histologicalTypeOther", getHistologicalTypeOther());
   }
   if (!ApiFunctions.isEmpty(getInflammCellInfiltrate())) {
     attributes.setAttribute(
         "inflammCellInfiltrate",
         GbossFactory.getInstance().getDescription(getInflammCellInfiltrate()));
   }
   if (!ApiFunctions.isEmpty(getJointComponent())) {
     attributes.setAttribute(
         "jointComponent", GbossFactory.getInstance().getDescription(getJointComponent()));
   }
   if (!ApiFunctions.isEmpty(getLymphaticVascularInvasion())) {
     attributes.setAttribute(
         "lymphaticVascularInvasion",
         GbossFactory.getInstance().getDescription(getLymphaticVascularInvasion()));
   }
   if (!ApiFunctions.isEmpty(getLymphNodeNotes())) {
     attributes.setAttribute("lymphNodeNotes", getLymphNodeNotes());
   }
   if (!ApiFunctions.isEmpty(getLymphNodeStage())) {
     attributes.setAttribute(
         "lymphNodeStage", GbossFactory.getInstance().getDescription(getLymphNodeStage()));
   }
   if (!ApiFunctions.isEmpty(getLymphNodeStageOther())) {
     attributes.setAttribute("lymphNodeStageOther", getLymphNodeStageOther());
   }
   if (!ApiFunctions.isEmpty(getLymphNodeStageInd())) {
     attributes.setAttribute("lymphNodeStageInd", getLymphNodeStageInd());
   }
   if (!ApiFunctions.isEmpty(getMarginsInvolved())) {
     attributes.setAttribute("marginsInvolved", getMarginsInvolved());
   }
   if (!ApiFunctions.isEmpty(getMarginsUninvolved())) {
     attributes.setAttribute("marginsUninvolved", getMarginsUninvolved());
   }
   if (!ApiFunctions.isEmpty(getPerineuralInvasion())) {
     attributes.setAttribute(
         "perineuralInvasion", GbossFactory.getInstance().getDescription(getPerineuralInvasion()));
   }
   if (!ApiFunctions.isEmpty(getPrimary())) {
     attributes.setAttribute("primary", getPrimary());
   }
   if (!ApiFunctions.isEmpty(getSectionIdentifier())) {
     attributes.setAttribute(
         "sectionIdentifier", GbossFactory.getInstance().getDescription(getSectionIdentifier()));
   }
   if (!ApiFunctions.isEmpty(getSectionNotes())) {
     attributes.setAttribute("sectionNotes", getSectionNotes());
   }
   if (!ApiFunctions.isEmpty(getSizeLargestNodalMets())) {
     attributes.setAttribute("sizeLargestNodalMets", getSizeLargestNodalMets());
   }
   if (!ApiFunctions.isEmpty(getStageGrouping())) {
     attributes.setAttribute(
         "stageGrouping", GbossFactory.getInstance().getDescription(getStageGrouping()));
   }
   if (!ApiFunctions.isEmpty(getStageGroupingOther())) {
     attributes.setAttribute("stageGroupingOther", getStageGroupingOther());
   }
   if (!ApiFunctions.isEmpty(getTissueFinding())) {
     attributes.setAttribute(
         "tissueFinding", BigrGbossData.getTissueDescription(getTissueFinding()));
   }
   if (!ApiFunctions.isEmpty(getTissueFindingOther())) {
     attributes.setAttribute("tissueFindingOther", getTissueFindingOther());
   }
   if (!ApiFunctions.isEmpty(getTissueOrigin())) {
     attributes.setAttribute(
         "tissueOrigin", BigrGbossData.getTissueDescription(getTissueOrigin()));
   }
   if (!ApiFunctions.isEmpty(getTissueOriginOther())) {
     attributes.setAttribute("tissueOriginOther", getTissueOriginOther());
   }
   if (!ApiFunctions.isEmpty(getTotalNodesExamined())) {
     attributes.setAttribute(
         "totalNodesExamined", GbossFactory.getInstance().getDescription(getTotalNodesExamined()));
   }
   if (!ApiFunctions.isEmpty(getTotalNodesPositive())) {
     attributes.setAttribute(
         "totalNodesPositive", GbossFactory.getInstance().getDescription(getTotalNodesPositive()));
   }
   if (!ApiFunctions.isEmpty(getTumorConfig())) {
     attributes.setAttribute(
         "tumorConfig", GbossFactory.getInstance().getDescription(getTumorConfig()));
   }
   if (!ApiFunctions.isEmpty(getTumorSize())) {
     attributes.setAttribute("tumorSize", getTumorSize());
   }
   if (!ApiFunctions.isEmpty(getTumorStageDesc())) {
     attributes.setAttribute(
         "tumorStageDesc", GbossFactory.getInstance().getDescription(getTumorStageDesc()));
   }
   if (!ApiFunctions.isEmpty(getTumorStageDescInd())) {
     attributes.setAttribute("tumorStageDescInd", getTumorStageDescInd());
   }
   if (!ApiFunctions.isEmpty(getTumorStageDescOther())) {
     attributes.setAttribute("tumorStageDescOther", getTumorStageDescOther());
   }
   if (!ApiFunctions.isEmpty(getTumorStageType())) {
     attributes.setAttribute(
         "tumorStageType", GbossFactory.getInstance().getDescription(getTumorStageType()));
   }
   if (!ApiFunctions.isEmpty(getTumorStageTypeOther())) {
     attributes.setAttribute("tumorStageTypeOther", getTumorStageTypeOther());
   }
   if (!ApiFunctions.isEmpty(getTumorWeight())) {
     attributes.setAttribute("tumorWeight", getTumorWeight());
   }
   if (!ApiFunctions.isEmpty(getVenousVesselInvasion())) {
     attributes.setAttribute(
         "venousVesselInvasion",
         GbossFactory.getInstance().getDescription(getVenousVesselInvasion()));
   }
   return attributes;
 }
Пример #16
0
  /**
   * Populates the full details of the tissue sample data beans specified in the input <code>Map
   * </code>. One or more columns must be specified before calling this method. The only filters are
   * the sample IDs that are specified in the <code>Map</code>.
   *
   * @param sampleDataBeans a <code>Map</code> of {@link com.ardais.bigr.javabeans.SampleData} data
   *     beans, keyed by the ids of the samples
   */
  public void getDetails(Map sampleDataBeans) {

    if (sampleDataBeans.isEmpty()) {
      return;
    }

    long tStart = 0;
    String myClassName = null;
    if (_perfLog.isDebugEnabled()) {
      myClassName = ApiFunctions.shortClassName(getClass().getName());
      _perfLog.debug("    C: START " + myClassName + ".getDetails");
      tStart = System.currentTimeMillis();
    }

    // Create the Maps that will hold the parent data beans.
    Map asmMap = new HashMap();
    Map consentMap = new HashMap();
    Map donorMap = new HashMap();

    // Iterate over all queries.
    Iterator queries = _queries.entrySet().iterator();
    while (queries.hasNext()) {
      long tLoopStart = System.currentTimeMillis();
      Map.Entry entry = (Map.Entry) queries.next();
      String queryKey = (String) entry.getKey();
      if (queryKey.equals(KEY_SAMPLE)) {
        TissueDetailQueryBuilder query = (TissueDetailQueryBuilder) entry.getValue();
        query.getDetails(sampleDataBeans);
        asmMap = query.getAsmData();
      } else if (queryKey.equals(KEY_LIMS)) {
        PathologyEvaluationDetailQueryBuilder query =
            (PathologyEvaluationDetailQueryBuilder) entry.getValue();
        query.getDetailsForSamples(sampleDataBeans);
      } else if (queryKey.equals(KEY_IMAGES)) {
        ImageDetailQueryBuilder query = (ImageDetailQueryBuilder) entry.getValue();
        query.getDetailsForSamples(sampleDataBeans);
      } else if (queryKey.equals(KEY_PROJECT)) {
        ProjectDetailQueryBuilder query = (ProjectDetailQueryBuilder) entry.getValue();
        query.getDetailsForSamples(sampleDataBeans);
      } else if (queryKey.equals(KEY_ORDER)) {
        OrderDetailQueryBuilder query = (OrderDetailQueryBuilder) entry.getValue();
        query.getDetailsForSamples(sampleDataBeans);
      } else if (queryKey.equals(KEY_SHOPPING_CART)) {
        ShoppingCartDetailQueryBuilder query = (ShoppingCartDetailQueryBuilder) entry.getValue();
        query.getDetailsForSamples(sampleDataBeans);
      } else if (queryKey.equals(KEY_ASM)) {
        AsmDetailQueryBuilder query = (AsmDetailQueryBuilder) entry.getValue();
        query.getDetails(asmMap);
        consentMap = query.getConsentData();
      } else if (queryKey.equals(KEY_CONSENT)) {
        ConsentDetailQueryBuilder query = (ConsentDetailQueryBuilder) entry.getValue();
        query.getDetails(consentMap);
        donorMap = query.getDonorData();
      } else if (queryKey.equals(KEY_DONOR)) {
        DonorDetailQueryBuilder query = (DonorDetailQueryBuilder) entry.getValue();
        query.getDetails(donorMap);
      } else if (queryKey.equals(KEY_PATH)) {
        PathologyReportDetailQueryBuilder query =
            (PathologyReportDetailQueryBuilder) entry.getValue();
        query.getDetailsForConsents(consentMap);
      } else if (queryKey.equals(KEY_LOGICAL_REPOSITORY)) {
        LogicalRepositoryDetailQueryBuilder query =
            (LogicalRepositoryDetailQueryBuilder) entry.getValue();
        query.getDetails(sampleDataBeans);
      } else if (queryKey.equals(KEY_SAMPLE_LOCATION)) {
        SampleLocationDetailQueryBuilder query =
            (SampleLocationDetailQueryBuilder) entry.getValue();
        query.getDetails(sampleDataBeans);
      } else if (queryKey.equals(KEY_DIAGNOSTIC)) {
        DiagnosticTestDetailQueryBuilder query =
            (DiagnosticTestDetailQueryBuilder) entry.getValue();
        query.getDetailsForConsents(consentMap);
      } else if (queryKey.equals(KEY_SAMPLE_KC)) {
        KcDetailQueryBuilder query = (KcDetailQueryBuilder) entry.getValue();
        query.getDetails(sampleDataBeans);
      } else if (queryKey.equals(KEY_CONSENT_KC)) {
        KcDetailQueryBuilder query = (KcDetailQueryBuilder) entry.getValue();
        query.getDetails(consentMap);
      } else if (queryKey.equals(KEY_DONOR_KC)) {
        KcDetailQueryBuilder query = (KcDetailQueryBuilder) entry.getValue();
        query.getDetails(donorMap);
      } else {
        throw new ApiException(
            "Unrecognized query key in ProductDetailQueryBuilder.getDetails:" + queryKey);
      }

      if (_perfLog.isDebugEnabled()) {
        long elapsedTime = System.currentTimeMillis() - tLoopStart;
        _perfLog.debug("    D: do detail query " + queryKey + " (" + elapsedTime + " ms)");
      }
    } // while next query

    if (_perfLog.isDebugEnabled()) {
      long elapsedTime = System.currentTimeMillis() - tStart;
      _perfLog.debug("    C: END   " + myClassName + ".getDetails" + " (" + elapsedTime + " ms)");
    }
  }
 private void validateAccountLabelTemplateDefinitions(Account account, StringBuffer problems) {
   boolean appendComma = problems.length() > 0;
   Map templateDefinitions = account.getLabelTemplateDefinitions();
   // if there are no label template definitions defined for the account, return an error
   if (templateDefinitions.isEmpty()) {
     if (appendComma) {
       problems.append(",");
     }
     problems.append(
         " account with id = " + account.getId() + " has no label template definitions defined.");
     appendComma = true;
   } else {
     Map displayNames = new HashMap();
     Iterator iterator = templateDefinitions.keySet().iterator();
     while (iterator.hasNext()) {
       LabelTemplateDefinition templateDefinition =
           (LabelTemplateDefinition) templateDefinitions.get(iterator.next());
       String name = templateDefinition.getName();
       // check that the name by which the template will be displayed (display name if present,
       // otherwise name) is unique
       String displayName = templateDefinition.getDisplayName();
       if (ApiFunctions.isEmpty(displayName)) {
         displayName = name;
       }
       if (displayNames.put(displayName, displayName) != null) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " label template definition with name = "
                 + name
                 + " has the same display name as another template definition in the account");
         appendComma = true;
       }
       // check that the object type is valid
       String objectType = templateDefinition.getObjectType();
       if (ApiFunctions.isEmpty(objectType)) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " label template definition with name = " + name + " has an empty object type");
         appendComma = true;
       } else {
         if (Constants.LABEL_PRINTING_OBJECT_TYPES.get(objectType) == null) {
           if (appendComma) {
             problems.append(",");
           }
           problems.append(
               " label template definition with name = " + name + " has an unknown object type");
           appendComma = true;
         }
       }
       // check that the object subtype(s), if present, is/are valid
       Collection objectSubtypes = templateDefinition.getObjectSubtypesCollection();
       if (!ApiFunctions.isEmpty(objectSubtypes)) {
         // currently only sample objects can have a subtype
         if (!Constants.LABEL_PRINTING_OBJECT_TYPE_SAMPLE.equalsIgnoreCase(objectType)) {
           if (appendComma) {
             problems.append(",");
           }
           problems.append(
               " label template definition with name = "
                   + name
                   + " has object subtype(s) specified but does not have an object type of "
                   + Constants.LABEL_PRINTING_OBJECT_TYPE_SAMPLE);
           appendComma = true;
         }
         Iterator subtypeIterator = objectSubtypes.iterator();
         while (subtypeIterator.hasNext()) {
           String objectSubtype = (String) subtypeIterator.next();
           // make sure the subtype(s) is/are valid sample type(s)
           if (SystemConfiguration.getSampleType(objectSubtype) == null) {
             if (appendComma) {
               problems.append(",");
             }
             problems.append(
                 " label template definition with name = "
                     + name
                     + " has an unknown object subtype value of "
                     + objectSubtype);
             appendComma = true;
           }
         }
       }
       // check that the results form definition name is valid
       String formDefinitionName = templateDefinition.getResultsFormDefinitionName();
       if (ApiFunctions.isEmpty(formDefinitionName)) {
         if (appendComma) {
           problems.append(",");
         }
         problems.append(
             " label template definition with name = "
                 + name
                 + " has no results form definition name");
         appendComma = true;
       } else {
         if (templateDefinition
                 .getParent()
                 .getResultsFormDefinitions()
                 .get(formDefinitionName.toLowerCase())
             == null) {
           if (appendComma) {
             problems.append(",");
           }
           problems.append(
               " label template definition with name = "
                   + name
                   + " references an unknown results form definition name ("
                   + formDefinitionName
                   + ")");
           appendComma = true;
         }
       }
     }
   }
 }
Пример #18
0
 private String getSessionAttributeQualifiedName(String name) {
   String partnerName = getPartnerName();
   return (ApiFunctions.isEmpty(partnerName))
       ? SESSION_ATTRIBUTE_PREFIX + name
       : SESSION_ATTRIBUTE_PREFIX + "." + partnerName + "." + name;
 }