コード例 #1
0
  public void validate() {
    String actionName = "";
    if (parameters.get(ACTION_NAME) != null && parameters.get(ACTION_NAME)[0] != null)
      actionName = parameters.get(ACTION_NAME)[0];

    if (!(actionName.equalsIgnoreCase(REJECT_ACTION)
        || actionName.equalsIgnoreCase(CANCEL_ACTION))) {
      if (voucherHeader.getVoucherDate() == null)
        addFieldError("voucherDate", getText("arf.payment.voucherdate.required"));
      if (!DateUtils.compareDates(
          voucherHeader.getVoucherDate(), advanceRequisition.getAdvanceRequisitionDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.payment.voucherdate.lessthan.advancerequisitiondate"));
      if (!DateUtils.compareDates(new Date(), voucherHeader.getVoucherDate()))
        addFieldError(
            "advanceRequisitionDate",
            getText("arf.validate.payment.voucherdate.greaterthan.currentDate"));

      if (StringUtils.isBlank(commonBean.getBankId()) || commonBean.getBankId().equals("-1"))
        addFieldError("commonBean.bankId", getText("arf.bankbranch.required"));

      if (StringUtils.isBlank(commonBean.getAccountNumberId())
          || commonBean.getAccountNumberId().equals("-1"))
        addFieldError("commonBean.accountNumberId", getText("arf.accountnumber.required"));
      if (StringUtils.isBlank(commonBean.getModeOfPayment()))
        addFieldError("commonBean.modeOfPayment", getText("arf.modeOfPayment.required"));
    }
  }
コード例 #2
0
  public String searchList() {
    getPersistenceService().getSession().setDefaultReadOnly(true);
    getPersistenceService().getSession().setFlushMode(FlushMode.MANUAL);
    boolean isError = false;
    if (fromDate != null && toDate == null) {
      addFieldError("enddate", getText("search.endDate.null"));
      isError = true;
    }
    if (toDate != null && fromDate == null) {
      addFieldError("startdate", getText("search.startDate.null"));
      isError = true;
    }

    if (!DateUtils.compareDates(toDate, fromDate)) {
      addFieldError("enddate", getText("greaterthan.endDate.fromDate"));
      isError = true;
    }

    if (isError) {
      return "search";
    }

    setPageSize(WorksConstants.PAGE_SIZE);
    super.search();

    if (searchResult != null
        && searchResult.getList() != null
        && !searchResult.getList().isEmpty()) {
      setTenderType();
    }
    return "search";
  }
コード例 #3
0
ファイル: WorkOrder.java プロジェクト: nsdevaraj/eGov
  public Date getExpectedCompletionDate() {
    if (getContractPeriod() != null && StringUtils.isNotBlank(getContractPeriod())) {
      final Date date =
          DateUtils.add(
              getWorkOrderDate(), Calendar.DAY_OF_MONTH, Integer.parseInt(getContractPeriod()));
      expectedCompletionDate = date;
    }

    return expectedCompletionDate;
  }
コード例 #4
0
 @SkipValidation
 @Action(
     value = "/stillBirthRegistration-newform",
     results = {@Result(name = NEW, type = "dispatcher")})
 public String newOnlineform() {
   LOGGER.debug("New Still Birth Registration Online form");
   stillBirthRegistration.setRegistrationDate(DateUtils.today());
   buildNewBirthForm(stillBirthRegistration);
   registrationMode = "online";
   return NEW;
 }
コード例 #5
0
  @Override
  public void validate() {

    if (stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration.getDateOfEvent().after(DateUtils.today()))
      addActionError(getMessage("dateOfEvent.today.validate"));

    if (stillBirthRegistration.getRegistrationDate() != null
        && stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration
            .getDateOfEvent()
            .after(stillBirthRegistration.getRegistrationDate()))
      addActionError(getMessage("dateOfEvent.registration.validate"));

    if (placeTypeTemp != null
        && !EMPTY.equals(placeTypeTemp)
        && BndConstants.HOSPTIAL.equalsIgnoreCase(placeTypeTemp)
        && stillBirthRegistration.getEstablishment() == null)
      addActionError(getMessage("hospitalname.required"));
    // For Offline mode validating registration number....
    if (OFFLINE.equals(mode)
        && stillBirthRegistration.getRegistrationNo() != null
        && !EMPTY.equals(stillBirthRegistration.getRegistrationNo().trim()))
      if (stillBirthRegistration.getRegistrationUnit() != null
          && birthRegistrationService.checkUniqueRegistrationNumber(
              stillBirthRegistration.getRegistrationUnit().getId(),
              stillBirthRegistration.getId(),
              stillBirthRegistration.getRegistrationNo(),
              BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                  ? stillBirthRegistration.getRegistrationDate()
                  : stillBirthRegistration.getDateOfEvent(),
              BndConstants.STILLBIRTHNUM)) addActionError(getMessage("registration.number.exists"));
      else if (BndUtils.isNum(stillBirthRegistration.getRegistrationNo().trim())) {
        final int eventYear =
            BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                ? BndDateUtils.getCurrentYear(stillBirthRegistration.getRegistrationDate())
                : BndDateUtils.getCurrentYear(stillBirthRegistration.getDateOfEvent());
        final RegKeys regNumRange =
            regKeyService.getRegKeyByRegUnitAndDate(
                stillBirthRegistration.getRegistrationUnit(),
                eventYear,
                numberGenerationService.buildObjectType(
                    stillBirthRegistration, eventYear, BndConstants.STILLBIRTHNUM));
        if (regNumRange != null) {
          final Integer regNumber = Integer.valueOf(stillBirthRegistration.getRegistrationNo());
          if (regNumber >= regNumRange.getMinValue())
            addActionError(
                getMessage("regNumber.minvalue.validate")
                    .concat(" ")
                    .concat(regNumRange.getMinValue().toString()));
        }
      }
  }