Exemplo n.º 1
0
  private AppConfig buildappConfigDetails(
      final AppConfig appConfig, final List<AppConfigValues> unitDetail) {
    final Set<AppConfigValues> unitSet = new HashSet<AppConfigValues>();

    for (final AppConfigValues unitdetail : unitDetail)
      if (unitdetail.getEffectiveFrom() != null && !"".equals(unitdetail.getValue())) {
        unitdetail.setKey(appConfig);
        unitSet.add(unitdetail);
      }
    appConfig.getAppDataValues().clear();

    appConfig.getAppDataValues().addAll(unitSet);

    return appConfig;
  }
Exemplo n.º 2
0
  private String getApprovalStatusForBills() {
    String statusid = "";
    AppConfig appConfig = null;
    String query = "from AppConfig where key_name = '" + expType + "BillApprovalStatus'";
    if (LOGGER.isDebugEnabled()) LOGGER.debug(">>>>>Query=:" + query);
    appConfig = (AppConfig) persistenceService.find(query);
    if (LOGGER.isDebugEnabled())
      LOGGER.debug("Total app config values = " + appConfig.getAppDataValues().size());
    if (appConfig.getAppDataValues().size() == 0) {

      throw new ValidationException(
          Arrays.asList(
              new ValidationError(
                  "Status for bill approval",
                  "App Config value is missing for exp type :" + expType)));
    }
    for (AppConfigValues appConfigVal : appConfig.getAppDataValues()) {

      String configvalue = appConfigVal.getValue();
      EgwStatus egwstatus =
          egwStatusDAO.getStatusByModuleAndCode(
              configvalue.substring(0, configvalue.indexOf("|")),
              configvalue.substring(configvalue.indexOf("|") + 1));
      if (null == egwstatus || null == egwstatus.getId()) {
        throw new ValidationException(
            Arrays.asList(
                new ValidationError(
                    "Status for bill approval",
                    " status for "
                        + expType
                        + " approval is not present in Egwstatus for app config value : "
                        + configvalue)));
      } else {
        statusid =
            statusid.isEmpty() ? egwstatus.getId().toString() : statusid + "," + egwstatus.getId();
      }
    }

    return statusid;
  }