예제 #1
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);
  }
예제 #2
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);
  }