コード例 #1
0
 /**
  * This method adds Data To Print.
  *
  * @param specimen Specimen instance.
  * @param listMap list Map
  * @param printerType printer Type
  * @param printerLocation printer Location
  * @param ipAddress IP Address
  */
 protected void addDataToPrint(
     Specimen specimen,
     List listMap,
     String printerType,
     String printerLocation,
     String ipAddress) {
   final LinkedHashMap dataMap = new LinkedHashMap();
   String label = specimen.getLabel();
   // bug 13100
   // if any property is null the Null pointer exception is thrown while creating
   // string data from Document in getStringFromDocument()
   if (label == null) {
     label = " ";
   }
   String barcode = specimen.getBarcode();
   if (barcode == null) {
     barcode = " ";
   }
   dataMap.put("class", specimen.getClassName());
   dataMap.put("id", specimen.getId().toString());
   dataMap.put("label", label);
   dataMap.put("barcode", barcode);
   dataMap.put("printerType", printerType);
   dataMap.put("printerLocation", printerLocation);
   listMap.add(dataMap);
 }
コード例 #2
0
  /**
   * @param objSpecimen Specimen Object
   * @param specimenList List of Specimen including all child specimen.
   */
  void getAllSpecimenList(Specimen objSpecimen, List specimenList) {

    final Collection childSpecimen = objSpecimen.getChildSpecimenCollection();
    if (childSpecimen != null && !childSpecimen.isEmpty()) {

      final Iterator itr = childSpecimen.iterator();
      while (itr.hasNext()) {
        final Specimen specimen = (Specimen) itr.next();
        specimenList.add(specimen);
        this.getAllSpecimenList(specimen, specimenList);
      }
    }
  }
コード例 #3
0
  /**
   * Overrides the execute method of Action class.
   *
   * @param mapping : mapping
   * @param form : form
   * @param request : request
   * @param response : response
   * @throws IOException : IOException
   * @throws ServletException : ServletException
   * @throws BizLogicException : BizLogicException
   * @return ActionForward : ActionForward
   */
  @Override
  public ActionForward executeSecureAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException, BizLogicException {

    final CreateSpecimenForm createForm = (CreateSpecimenForm) form;
    final String pageOf = request.getParameter(Constants.PAGE_OF);

    final String sourceObjectName = Specimen.class.getName();
    // String[] selectColumnName = {Constants.SYSTEM_IDENTIFIER};

    final String[] whereColumnName = new String[1];
    final Object[] whereColumnValue = new Object[1];

    // checks whether label or barcode is selected
    if (createForm.getRadioButton().equals("1")) {
      whereColumnName[0] = Constants.SYSTEM_LABEL;
      whereColumnValue[0] = createForm.getParentSpecimenLabel().trim();
    } else {
      whereColumnName[0] = Constants.SYSTEM_BARCODE;
      whereColumnValue[0] = createForm.getParentSpecimenBarcode().trim();
    }

    // String[] whereColumnCondition = {"="};

    final IFactory factory = AbstractFactoryConfig.getInstance().getBizLogicFactory();
    final IBizLogic bizLogic = factory.getBizLogic(Constants.DEFAULT_BIZ_LOGIC);
    final List list = bizLogic.retrieve(sourceObjectName, whereColumnName[0], whereColumnValue[0]);

    /**
     * If list is not empty, set the Parent specimen Id and forward to success. If list is null or
     * empty, forward to failure.
     */
    if (list != null && !list.isEmpty()) {
      final Specimen objSpecimen = (Specimen) list.get(0);

      if (objSpecimen.getActivityStatus().equals(Status.ACTIVITY_STATUS_DISABLED.toString())) {
        /**
         * Name : Falguni Sachde Reviewer Name : Sachin Lale Bug ID: 4919 Description: Added new
         * error message and check for pageOf flow, if user clicks directly derived link and
         * specimen status is disabled
         */
        final ActionErrors errors = this.getActionErrors(request);
        errors.add(
            ActionErrors.GLOBAL_ERROR, new ActionError("error.parentobject.disabled", "Specimen"));
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.derived", "Derived Specimen"));
        this.saveErrors(request, errors);
        return mapping.findForward(Constants.FAILURE);
      } else if (objSpecimen.getActivityStatus().equals(Status.ACTIVITY_STATUS_CLOSED.toString())) {
        /**
         * Name : Falguni Sachde Reviewer Name : Sachin Lale Bug ID: 4919 Description: Added new
         * error message and check for pageOf flow, if user clicks directly derived link and
         * specimen status is disabled
         */
        final ActionErrors errors = this.getActionErrors(request);
        errors.add(
            ActionErrors.GLOBAL_ERROR, new ActionError("error.parentobject.closed", "Specimen"));
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.derived", "Derived Specimen"));
        this.saveErrors(request, errors);
        return mapping.findForward(Constants.FAILURE);
      }

      final Long specimen = objSpecimen.getId();
      createForm.setParentSpecimenId("" + specimen.longValue());
      createForm.setReset(false); // Will not reset the parameters
      if (pageOf != null && pageOf.equals(Constants.PAGE_OF_CREATE_SPECIMEN_CP_QUERY)) {
        return mapping.findForward(Constants.PAGE_OF_CREATE_SPECIMEN_CP_QUERY);
      }
      return mapping.findForward(Constants.SUCCESS);
    } else {
      return mapping.findForward(Constants.FAILURE);
    }
  }