示例#1
0
  /**
   * Overrides the validate method of ActionForm.
   *
   * @return error ActionErrors instance
   * @param mapping Actionmapping instance
   * @param request HttpServletRequest instance
   */
  @Override
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    final ActionErrors errors = super.validate(mapping, request);
    final Validator validator = new Validator();

    try {
      // checks the neoplasticCellularityPercentage
      if (!Validator.isEmpty(this.neoplasticCellularityPercentage)
          && !validator.isDouble(this.neoplasticCellularityPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "cellspecimenreviewparameters.neoplasticcellularitypercentage")));
      }
      // checks the viableCellPercentage
      if (!Validator.isEmpty(this.viableCellPercentage)
          && !validator.isDouble(this.viableCellPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "cellspecimenreviewparameters.viablecellpercentage")));
      }
    } catch (final Exception excp) {
      CellSpecimenReviewParametersForm.logger.error(excp.getMessage(), excp);
      excp.printStackTrace();
    }
    return errors;
  }
示例#2
0
文件: GroupForm.java 项目: NCIP/cab2b
  /* (non-Javadoc)
   * @see edu.wustl.common.actionForm.AbstractActionForm#setAllValues(edu.wustl.common.domain.AbstractDomainObject)
   */
  @Override
  // public void setAllValues(AbstractDomainObject arg0)
  // {
  // TODO Auto-generated method stub

  // }

  /**
   * Overrides the validate method of ActionForm.
   *
   * @param mapping ActionMapping mapping
   * @param request HttpServletRequest request
   * @return ActionErrors ActionErrors
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    Validator validator = new Validator();

    if (createGroupAs != null
        && createGroupAs.equals(ProcessorConstants.GROUP_CREATEAS_NEW)
        && (groupNameText == null || validator.isEmpty(String.valueOf(groupNameText)))) {
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError(
              "errors.item.required", ApplicationProperties.getValue("eav.att.GroupTitle")));
    } else if (createGroupAs != null
        && createGroupAs.equals(ProcessorConstants.GROUP_CREATEFROM_EXISTING)
        && (groupName == null || validator.isEmpty(String.valueOf(groupName)))) {
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError(
              "errors.item.required", ApplicationProperties.getValue("eav.att.GroupTitle")));
    } else if (createGroupAs == null) {
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError(
              "errors.item.required", ApplicationProperties.getValue("eav.att.NewGroup")));
    }

    if ((groupDescription != null)
        && (groupDescription.length() > ProcessorConstants.MAX_LENGTH_DESCRIPTION)) {
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError(
              "errors.maxlength.exceeded",
              ApplicationProperties.getValue("eav.att.Description"),
              ProcessorConstants.MAX_LENGTH_DESCRIPTION));
    }

    if ((groupNameText != null) && (groupNameText.length() > ProcessorConstants.MAX_LENGTH_NAME)) {
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError(
              "errors.maxlength.exceeded",
              ApplicationProperties.getValue("eav.att.GroupTitle"),
              ProcessorConstants.MAX_LENGTH_NAME));
    }
    return errors;
  }
示例#3
0
 /**
  * Checks the validity of numeric value of the component and adds an ActionError object in the
  * ActionErrors object.
  *
  * @param componentName Component which is to be checked.
  * @param labelName Label of the component on the jsp page which is checked.
  * @param errors ActionErrors Object.
  */
 protected void checkValidNumber(
     String componentName, String labelName, ActionErrors errors, Validator validator) {
   if (validator.isEmpty(componentName)) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("errors.item.required", ApplicationProperties.getValue(labelName)));
   } else {
     if (!validator.isNumeric(componentName)) {
       errors.add(
           ActionErrors.GLOBAL_ERROR,
           new ActionError("errors.item.format", ApplicationProperties.getValue(labelName)));
     }
   }
 }
  /**
   * To create new participant and associate it to the report.
   *
   * @param request : request
   * @param reportQueueId : reportQueueId
   * @return String : String
   * @throws Exception : Exception
   */
  private String createNewParticipant(HttpServletRequest request, String reportQueueId)
      throws Exception {

    String errorMessage = null;
    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);

    final Participant participant = Utility.getParticipantFromReportLoaderQueue(reportQueueId);

    final IFactory factory = AbstractFactoryConfig.getInstance().getBizLogicFactory();
    final ParticipantBizLogic participantBizLogic =
        (ParticipantBizLogic) factory.getBizLogic(Participant.class.getName());
    try {
      participantBizLogic.insert(participant, this.getSessionData(request), 0);
    } catch (final Exception e) {
      this.logger.error(e.getMessage(), e);
      // System.out.println("Error Occurred !!!!!");
      errorMessage = ApplicationProperties.getValue("errors.caTies.conflict.genericmessage");
      // Setting the status to NEW
      // reportLoaderQueue.setParticipantCollection(null);
      // reportLoaderQueue.setStatus(CaTIESConstants.
      // PARTICIPANT_CREATION_ERROR);
      // updateReportLoaderQueue(reportLoaderQueue,request);
      return errorMessage;
    }

    final Collection participantColl = new HashSet();
    // Adding the new participant
    participantColl.add(participant);
    reportLoaderQueue.setParticipantCollection(participantColl);
    // The new SCG for this participant will be inserted by the
    // FileProcessorThread

    // Setting the status to NEW
    reportLoaderQueue.setStatus(CaTIESConstants.NEW);
    reportLoaderQueue.setSpecimenCollectionGroup(null);
    this.updateReportLoaderQueue(reportLoaderQueue, request);

    return errorMessage;
  }
  /**
   * Overrides the validate method of ActionForm.
   *
   * @return error ActionErrors instance
   * @param mapping Actionmapping instance
   * @param request HttpServletRequest instance
   */
  @Override
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    final ActionErrors errors = super.validate(mapping, request);
    final Validator validator = new Validator();

    try {

      //         	// checks the neoplasticCellularityPercentage
      if (!Validator.isEmpty(this.neoplasticCellularityPercentage)
          && !validator.isDouble(this.neoplasticCellularityPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "tissuespecimenrevieweventparameters.neoplasticcellularitypercentage")));
      }
      //

      //         	// checks the necrosisPercentage
      if (!Validator.isEmpty(this.necrosisPercentage)
          && !validator.isDouble(this.necrosisPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "tissuespecimenrevieweventparameters.necrosispercentage")));
      }
      //

      //         	// checks the lymphocyticPercentage
      if (!Validator.isEmpty(this.lymphocyticPercentage)
          && !validator.isDouble(this.lymphocyticPercentage, false)) {

        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "tissuespecimenrevieweventparameters.lymphocyticpercentage")));
      }
      //

      //         	// checks the totalCellularityPercentage
      if (!Validator.isEmpty(this.totalCellularityPercentage)
          && !validator.isDouble(this.totalCellularityPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "tissuespecimenrevieweventparameters.totalcellularitypercentage")));
      }
      //

      //         	// checks the histologicalQuality
      //           	if (!validator.isValidOption(histologicalQuality) )
      //            {
      //           		errors.add(ActionErrors.GLOBAL_ERROR, new
      // ActionError("errors.item.required",ApplicationProperties.getValue("tissuespecimenrevieweventparameters.histologicalquality")));
      //            }
      //
    } catch (final Exception excp) {
      TissueSpecimenReviewEventParametersForm.logger.error(excp.getMessage(), excp);
      excp.printStackTrace();
    }
    return errors;
  }
示例#6
0
 /** init method. */
 public void init() {
   ApplicationProperties.initBundle("commands");
   runtime = Runtime.getRuntime();
 }
  /**
   * Overriding the parent class's method to validate the enumerated attribute values
   *
   * @param obj : obj
   * @param dao : dao
   * @param operation : operation
   * @throws BizLogicException : BizLogicException
   * @return boolean
   */
  @Override
  protected boolean validate(Object obj, DAO dao, String operation) throws BizLogicException {
    try {
      final StorageContainer container = (StorageContainer) obj;
      final Map similarContainerMap = container.getSimilarContainerMap();
      final String containerPrefixKey = "simCont:";
      final String parentContainerId = "_parentContainerId";
      final List positionsToBeAllocatedList = new ArrayList();
      final List usedPositionsList = new ArrayList();

      for (int i = 1; i <= container.getNoOfContainers().intValue(); i++) {
        StorageContainerUtil.prepareContainerMap(
            dao,
            similarContainerMap,
            containerPrefixKey,
            positionsToBeAllocatedList,
            usedPositionsList,
            i,
            parentContainerId);
      }
      /*for (int i = 0; i < positionsToBeAllocatedList.size(); i++)
      {
      	StorageContainerUtil.allocatePositionToSingleContainerOrSpecimen(
      			positionsToBeAllocatedList.get(i), similarContainerMap, usedPositionsList,
      			containerPrefixKey, parentContainerId);
      }*/
      if (container.getNoOfContainers().intValue() > 1 && similarContainerMap.size() > 0) {
        for (int i = 1; i <= container.getNoOfContainers().intValue(); i++) {
          final int checkedButtonStatus =
              Integer.parseInt((String) similarContainerMap.get("checkedButton"));
          final String siteId = (String) similarContainerMap.get("simCont:" + i + "_siteId");
          if (checkedButtonStatus == 2 || siteId == null) {
            final String parentContId =
                (String) similarContainerMap.get("simCont:" + i + "_parentContainerId");
            final String positionDimensionOne =
                (String) similarContainerMap.get("simCont:" + i + "_positionDimensionOne");
            final String positionDimensionTwo =
                (String) similarContainerMap.get("simCont:" + i + "_positionDimensionTwo");
            if (parentContId.equals("-1")
                || positionDimensionOne.equals("-1")
                || positionDimensionTwo.equals("-1")) {

              throw this.getBizLogicException(
                  null,
                  "errors.item.required",
                  ApplicationProperties.getValue("similarcontainers.location"));
            }
          } else {
            if (siteId.equals("-1")) {
              throw this.getBizLogicException(
                  null,
                  "errors.item.required",
                  ApplicationProperties.getValue("storageContainer.site"));
            }
          }
        }
      }
    } catch (final ApplicationException exp) {
      this.logger.error(exp.getMessage(), exp);
      exp.printStackTrace();
      throw this.getBizLogicException(exp, exp.getErrorKeyName(), exp.getMsgValues());
    }
    return true;
  }
示例#8
0
  public int doEndTag() {
    if (!isDataValid()) {
      return EVAL_PAGE;
    }
    try {
      StringBuffer stringBuffer = new StringBuffer();
      stringBuffer.append(
          "<div style='border:solid 1px; padding:1px; height:500px; overflow:auto;' width='100%'>");
      stringBuffer.append(
          "<table class='dataTable' width='100%' cellpadding='4' cellspacing='0' border='1'>");

      stringBuffer.append("<thead><tr class='formTitle'>");
      stringBuffer.append("<th width='5%' align='center'>");
      stringBuffer.append(ApplicationProperties.getValue("record.id"));
      stringBuffer.append("</th><th>Delete</th>");
      stringBuffer.append("</tr></thead>");

      stringBuffer.append("<tbody>");
      for (EntityRecord entityRecord : this.entityRecordList) {
        stringBuffer.append("<tr><td>");

        Long recordId = entityRecord.getRecordId();
        if (recordId != null) {
          //					stringBuffer.append("<input type='checkbox' name='deleteCheckbox'
          // id='deleteCheckbox' value=" + recordId.toString() + "/>");
          //					stringBuffer.append("</td><td>");

          stringBuffer.append("<span style='cursor:hand' ");
          stringBuffer.append("onclick=\"setRecordListTarget(");

          String target =
              "'/dynamicExtensions/LoadDataEntryFormAction.do?containerIdentifier="
                  + this.containerIdentifier
                  + "&recordIdentifier="
                  + recordId.toString()
                  + "&showFormPreview=false"
                  + "&mode="
                  + mode
                  + "'";

          stringBuffer.append(target);
          stringBuffer.append(")\">");

          stringBuffer.append("Record No. " + recordId.toString());
          stringBuffer.append("</span>");
          stringBuffer.append("</td><td>");

          stringBuffer.append("<span style='cursor:hand' ");
          stringBuffer.append(
              "onclick='deleteRecord("
                  + this.containerIdentifier
                  + " , "
                  + recordId.toString()
                  + " ,\""
                  + mode
                  + "\""
                  + ")'>");
          stringBuffer.append("Delete </span>");
        }
        stringBuffer.append("</td></tr>");
      }

      stringBuffer.append("</tbody>");

      stringBuffer.append("</table></div>");

      JspWriter out = pageContext.getOut();
      out.println(stringBuffer.toString());
    } catch (IOException e) {
      Logger.out.debug("IOException. No response generated.");
    }
    return EVAL_PAGE;
  }
  /* (non-Javadoc)
   * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    final ActionErrors errors = new ActionErrors();
    final Validator validator = new Validator();
    double aliquotQuantity = 0;
    double initialQuantity = 0;
    try {
      if (validator.isEmpty(this.className)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required", ApplicationProperties.getValue("specimen.type")));
      }
      //			if(this.labelGenType.equals("2") && validator.isEmpty(this.labelFormat))
      //			{
      //				errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
      //						"collectionProtocol.labelformat", ApplicationProperties
      //						.getValue("collectionProtocol.labelformat")));
      //			}
      if (validator.isEmpty(this.type)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required", ApplicationProperties.getValue("specimen.subType")));
      }
      final List specimenClassList =
          CDEManager.getCDEManager()
              .getPermissibleValueList(Constants.CDE_NAME_SPECIMEN_CLASS, null);
      if (!Validator.isEnumeratedValue(specimenClassList, this.className)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.invalid", ApplicationProperties.getValue("specimen.type")));
      }

      if (!Validator.isEnumeratedValue(AppUtility.getSpecimenTypes(this.className), this.type)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.invalid", ApplicationProperties.getValue("specimen.subType")));
      }

      if (!validator.isEmpty(this.quantity)) {
        try {
          this.quantity = new BigDecimal(this.quantity).toPlainString();
          if (AppUtility.isQuantityDouble(this.className, this.type)) {
            if (!validator.isDouble(this.quantity, true)) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.required", ApplicationProperties.getValue("specimen.quantity")));
            }
          } else {
            if (!validator.isNumeric(this.quantity, 0)) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.format", ApplicationProperties.getValue("specimen.quantity")));
            }
          }
        } catch (final NumberFormatException exp) {
          CreateSpecimenTemplateForm.logger.info(exp.getMessage(), exp);
          exp.printStackTrace();
          errors.add(
              ActionErrors.GLOBAL_ERROR,
              new ActionError(
                  "errors.item.format", ApplicationProperties.getValue("specimen.quantity")));
        }

      } else {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format", ApplicationProperties.getValue("specimen.quantity")));
      }

      if (!this.quantityPerAliquot.equals("")) {
        if (this.quantityPerAliquot != null && this.quantityPerAliquot.trim().length() != 0) {
          try {
            this.quantityPerAliquot = new BigDecimal(this.quantityPerAliquot).toPlainString();
            if (AppUtility.isQuantityDouble(this.className, this.type)) {
              if (!validator.isDouble(this.quantityPerAliquot.trim())) {
                errors.add(
                    ActionErrors.GLOBAL_ERROR,
                    new ActionError(
                        "errors.item.format",
                        ApplicationProperties.getValue("aliquots.qtyPerAliquot")));
              }
            } else {
              if (!validator.isPositiveNumeric(this.quantityPerAliquot.trim(), 1)) {
                errors.add(
                    ActionErrors.GLOBAL_ERROR,
                    new ActionError(
                        "errors.item.format",
                        ApplicationProperties.getValue("aliquots.qtyPerAliquot")));
              }
            }
          } catch (final NumberFormatException exp) {
            CreateSpecimenTemplateForm.logger.error(exp.getMessage(), exp);
            exp.printStackTrace();
            errors.add(
                ActionErrors.GLOBAL_ERROR,
                new ActionError(
                    "errors.item.format",
                    ApplicationProperties.getValue("aliquots.qtyPerAliquot")));
          }
        }
      }

      if (!this.noOfAliquots.equals("")) {
        this.noOfAliquots = AppUtility.isValidCount(this.noOfAliquots, errors);

        if (!validator.isNumeric(this.noOfAliquots, 1)) {
          errors.add(
              ActionErrors.GLOBAL_ERROR,
              new ActionError(
                  "errors.item.format",
                  ApplicationProperties.getValue("specimenArrayAliquots.noOfAliquots")));
        } else {
          try {
            if (this.quantityPerAliquot.equals("")) {
              if (this.quantity.equals("0") || this.quantity.equals("0")) {
                errors.add(
                    ActionErrors.GLOBAL_ERROR,
                    new ActionError(
                        "errors.invalid", ApplicationProperties.getValue("specimen.quantity")));
              } else {
                aliquotQuantity =
                    Double.parseDouble(this.quantity) / Double.parseDouble(this.noOfAliquots);
                initialQuantity =
                    Double.parseDouble(this.quantity)
                        - (aliquotQuantity * Double.parseDouble(this.noOfAliquots));
              }
            } else {
              aliquotQuantity = Double.parseDouble(this.quantityPerAliquot);
              initialQuantity = Double.parseDouble(this.quantity);
              initialQuantity =
                  initialQuantity - (aliquotQuantity * Double.parseDouble(this.noOfAliquots));
            }
            if (initialQuantity < 0) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.invalid",
                      ApplicationProperties.getValue("cpbasedentry.quantityperaliquot")));
            }
            //						if(this.labelGenTypeForAliquot.equals("2") &&
            // validator.isEmpty(this.labelFormatForAliquot))
            //						{
            //							errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
            //									"sp.req.aliquot.labelformat", ApplicationProperties
            //									.getValue("sp.req.aliquot.labelformat")));
            //						}
          } catch (final NumberFormatException exp) {
            CreateSpecimenTemplateForm.logger.error(exp.getMessage(), exp);
            errors.add(
                ActionErrors.GLOBAL_ERROR,
                new ActionError(
                    "errors.item.format", ApplicationProperties.getValue("specimen.quantity")));
          }
        }
      }

      if (this.tissueSite.equals("")) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required", ApplicationProperties.getValue("specimen.tissueSite")));
      }

      if (this.tissueSide.equals("")) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required", ApplicationProperties.getValue("specimen.tissueSide")));
      }

      if (this.noOfAliquots != null && !this.noOfAliquots.equals("")) {
        if (!this.storageLocationForAliquotSpecimen.equals("Auto")
            && !this.storageLocationForAliquotSpecimen.equals("Manual")
            && !this.storageLocationForAliquotSpecimen.equals("Virtual")) {
          errors.add(
              ActionErrors.GLOBAL_ERROR,
              new ActionError(
                  "errors.item.required",
                  ApplicationProperties.getValue("cpbasedentry.aliquotstoragelocation")));
        }
      }
      if (!this.storageLocationForSpecimen.equals("Auto")
          && !this.storageLocationForSpecimen.equals("Manual")
          && !this.storageLocationForSpecimen.equals("Virtual")) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required",
                ApplicationProperties.getValue("cpbasedentry.specimenstoragelocation")));
      }
      if (this.pathologicalStatus.equals("")) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.required",
                ApplicationProperties.getValue("specimen.pathologicalStatus")));
      }
      final List tissueSiteList =
          CDEManager.getCDEManager().getPermissibleValueList(Constants.CDE_NAME_TISSUE_SITE, null);
      if (!Validator.isEnumeratedValue(tissueSiteList, this.tissueSite)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.invalid", ApplicationProperties.getValue("specimen.tissueSite")));
      }

      final List tissueSideList =
          CDEManager.getCDEManager().getPermissibleValueList(Constants.CDE_NAME_TISSUE_SIDE, null);
      if (!Validator.isEnumeratedValue(tissueSideList, this.tissueSide)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.invalid", ApplicationProperties.getValue("specimen.tissueSide")));
      }

      final List pathologicalStatusList =
          CDEManager.getCDEManager()
              .getPermissibleValueList(Constants.CDE_NAME_PATHOLOGICAL_STATUS, null);

      if (!Validator.isEnumeratedValue(pathologicalStatusList, this.pathologicalStatus)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.invalid",
                ApplicationProperties.getValue("specimen.pathologicalStatus")));
      }

      if ((this.collectionEventUserId) == 0L) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError("errors.item.required", "Collection Event's user"));
      }

      // checks the collectionProcedure
      if (!validator.isValidOption(this.getCollectionEventCollectionProcedure())) {
        final String message =
            ApplicationProperties.getValue("collectioneventparameters.collectionprocedure");
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.item.required", message));
      }

      final List procedureList =
          CDEManager.getCDEManager()
              .getPermissibleValueList(Constants.CDE_NAME_COLLECTION_PROCEDURE, null);
      if (!Validator.isEnumeratedValue(
          procedureList, this.getCollectionEventCollectionProcedure())) {
        final String message = ApplicationProperties.getValue("cpbasedentry.collectionprocedure");
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.invalid", message));
      }
      // Container validation
      if (!validator.isValidOption(this.getCollectionEventContainer())) {
        final String message =
            ApplicationProperties.getValue("collectioneventparameters.container");
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.item.required", message));
      }
      final List containerList =
          CDEManager.getCDEManager().getPermissibleValueList(Constants.CDE_NAME_CONTAINER, null);
      if (!Validator.isEnumeratedValue(containerList, this.getCollectionEventContainer())) {
        final String message =
            ApplicationProperties.getValue("collectioneventparameters.container");
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.invalid", message));
      }
      if ((this.receivedEventUserId) == 0L) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError("errors.item.required", "Received Event's user"));
      }
      final List qualityList =
          CDEManager.getCDEManager()
              .getPermissibleValueList(Constants.CDE_NAME_RECEIVED_QUALITY, null);
      if (!Validator.isEnumeratedValue(qualityList, this.receivedEventReceivedQuality)) {
        final String message = ApplicationProperties.getValue("cpbasedentry.receivedquality");
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.invalid", message));
      }

      if (this.className.equals(Constants.MOLECULAR)) {
        if (!validator.isDouble(this.concentration, true)) {
          errors.add(
              ActionErrors.GLOBAL_ERROR,
              new ActionError(
                  "errors.item.format", ApplicationProperties.getValue("specimen.concentration")));
        }
      }

      if (this.noOfDeriveSpecimen >= 1) {
        boolean bSpecimenClass = false;
        boolean bSpecimenType = false;
        //				boolean validateLabel = false;
        //				boolean labelGenType = false;
        //				boolean labelFormat = false;
        final Map deriveSpecimenMap = this.deriveSpecimenMap();
        final Iterator it = deriveSpecimenMap.keySet().iterator();
        while (it.hasNext()) {
          final String key = (String) it.next();
          String mapValue = (String) deriveSpecimenMap.get(key);
          if (!bSpecimenClass) {
            if (key.indexOf("specimenClass") != -1 && !validator.isValidOption(mapValue)) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.selected",
                      ApplicationProperties.getValue("collectionprotocol.specimenclass")));
              bSpecimenClass = true;
            }
          }
          //					if(!labelGenType)
          //					{
          //						if ((key.indexOf("_labelGenType")) != -1 && mapValue != null)
          //						{
          //							if (mapValue.equals("2"))
          //							{
          //								validateLabel=true;
          //								labelGenType = true;
          //							}
          //						}
          //
          //					}
          //					if(!labelFormat && labelGenType)
          //					{
          //						if(validateLabel && (key.indexOf("_labelFormat")) != -1 &&
          // validator.isEmpty(mapValue))
          //						{
          //							labelFormat = true;
          //							errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
          //									"sp.req.derivative.labelformat", ApplicationProperties
          //									.getValue("sp.req.derivative.labelformat")));
          //						}
          //					}
          if ((key.indexOf("_concentration")) != -1 && mapValue != null) {
            mapValue = new BigDecimal(mapValue).toPlainString();
            if (!validator.isDouble(mapValue, true)) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.format",
                      ApplicationProperties.getValue("specimen.concentration")));
            }
          }

          if (!bSpecimenType) {
            if (key.indexOf("specimenType") != -1 && !validator.isValidOption(mapValue)) {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.selected",
                      ApplicationProperties.getValue("collectionprotocol.specimetype")));
              bSpecimenType = true;
            }
          }

          if ((key.indexOf("_quantity")) != -1) {
            if (!validator.isEmpty(mapValue)) {
              try {
                mapValue = new BigDecimal(mapValue).toPlainString();
                if (AppUtility.isQuantityDouble(this.className, this.type)) {
                  if (!validator.isDouble(mapValue, true)) {
                    errors.add(
                        ActionErrors.GLOBAL_ERROR,
                        new ActionError(
                            "errors.item.required",
                            ApplicationProperties.getValue("specimen.quantity")));
                  }
                } else {
                  if (!validator.isNumeric(mapValue, 0)) {
                    errors.add(
                        ActionErrors.GLOBAL_ERROR,
                        new ActionError(
                            "errors.item.format",
                            ApplicationProperties.getValue(
                                "cpbasedentry.derivedspecimen.quantity")));
                  }
                }
              } catch (final NumberFormatException exp) {
                CreateSpecimenTemplateForm.logger.error(exp.getMessage(), exp);
                errors.add(
                    ActionErrors.GLOBAL_ERROR,
                    new ActionError(
                        "errors.item.format",
                        ApplicationProperties.getValue("cpbasedentry.derivedspecimen.quantity")));
              }
            } else {
              errors.add(
                  ActionErrors.GLOBAL_ERROR,
                  new ActionError(
                      "errors.item.format",
                      ApplicationProperties.getValue("cpbasedentry.derivedspecimen.quantity")));
            }
          }
        }
      }
    } catch (final Exception excp) {
      CreateSpecimenTemplateForm.logger.error(excp.getMessage(), excp);
      excp.printStackTrace();
    }
    return errors;
  }