コード例 #1
0
  public void setLookupCache() // EntityConstansts
      {
    if (lookIdMeaningMap == null) {
      lookIdMeaningMap = new HashMap<String, String>();
    }

    ILookUpService lookUpService = (ILookUpService) ServiceLocator.findService("lookUpService");

    try {

      List<String> types = new ArrayList<String>();
      types.add(CommonConstants.LookUpTypes.MASTER_DATA_STATUS);
      types.add(CommonConstants.LookUpTypes.COMPLIANCE_CLASS_TYPE);
      types.add(CommonConstants.LookUpTypes.MASTER_DATA_IS_REPORTABLE);

      Map<String, List<LookUp>> lookupMap = lookUpService.loadLookupByTypes(types);

      if (lookupMap != null && lookupMap.size() > 0) {
        for (Iterator it = lookupMap.values().iterator(); it.hasNext(); ) {
          List lookList = (List) it.next();
          for (Iterator it2 = lookList.iterator(); it2.hasNext(); ) {
            LookUp lkup = (LookUp) it2.next();
            lookIdMeaningMap.put(lkup.getId().toString(), lkup.getMeaning());
          }
        }
      } //

    } catch (ALNTBaseException e) {
      ALNTLogger.error(
          this.getClass().getName(),
          "Failed to load lookup value for master data status ",
          e.getMessage());
    }
  }
コード例 #2
0
 public SysConnector getDoNotHireRulesConnector()
     throws ALNTApplicationException, ALNTSystemException {
   String sysConnId = getConfigParamValue(DO_NOT_HIRE_RULES_CONN);
   if (sysConnId != null && !"".equals(sysConnId)) {
     Long sysId = Long.parseLong(sysConnId);
     ISystemConnectorConfigDataService sysConnService =
         (ISystemConnectorConfigDataService)
             ServiceLocator.findService("systemConnectorConfigDataService");
     SysConnector sysConn = sysConnService.loadSystemConnector(sysId);
     return sysConn;
   }
   return null;
 }
コード例 #3
0
  public List loadMasterDataAuditTrail(String sixNpModelType, Long sixNpPrimaryKeyId)
      throws ALNTApplicationException, ALNTSystemException {

    SixNPAuditExtractor sixNPAuditExtractor =
        (SixNPAuditExtractor) ServiceLocator.findService("sixNPAuditExtractor");
    List<AuditMessage> auditMsgList =
        sixNPAuditExtractor.getAuditMessages(sixNpPrimaryKeyId, sixNpModelType);

    if (auditMsgList != null && !auditMsgList.isEmpty()) {
      Collections.sort(
          auditMsgList, new ModelComparator("relevanceTime", CommonConstants.ASCENDING_SORT_TYPE));
    } else {
      auditMsgList = new ArrayList<AuditMessage>();
    }
    return auditMsgList;
  }
コード例 #4
0
  public Boolean isReportActive(Long repoSeqId) {
    IPersistenceService persistenceService =
        (IPersistenceService) ServiceLocator.findService("hibernatePesistenceService");
    ;
    List activeFlagList =
        persistenceService.executeQuery(
            " from "
                + EntityConstansts.ReportsAuthDetails
                + " where repoSeqid= "
                + repoSeqId
                + " and activeFlag = 0");

    if (activeFlagList != null && !activeFlagList.isEmpty()) {
      return false;
    }
    return true;
  }
コード例 #5
0
  public void jobExecutionVetoed(JobExecutionContext context) {
    ALNTLogger.info(this.getClass().getName(), "jobExecutionVetoed()", "Begin");
    try {
      ISchedulerConfigService schedulerConfigService =
          (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService");

      Object jobId = context.getJobDetail().getJobDataMap().get("JOB_ID");
      Object id = context.getJobDetail().getJobDataMap().get("JobStatus_ID");
      JobStatus jobStatus =
          schedulerConfigService.loadJobStatus(new Long(jobId.toString()), new Long(id.toString()));
      String jobPgmName = (String) context.getJobDetail().getJobDataMap().get("JOB_NAME");
      jobStatus.setJobStatus(CommonConstants.JOB_STATUS_WAITING);
      jobStatus.setJobName(jobPgmName);
      schedulerConfigService.saveJobStatus(jobStatus);
      ALNTLogger.info(this.getClass().getName(), "jobExecutionVetoed()", "End");
    } catch (ALNTSystemException e) {
      ALNTLogger.error(
          this.getClass().getName(), "jobExecutionVetoed()", "Error ::" + e.getMessage());
    } catch (ALNTApplicationException e) {
      ALNTLogger.error(
          this.getClass().getName(), "jobExecutionVetoed()", "Error ::" + e.getMessage());
    }
  }
コード例 #6
0
  public List getAllAccessReports() throws ALNTApplicationException, ALNTSystemException {
    IPersistenceService persistenceService =
        (IPersistenceService) ServiceLocator.findService("hibernatePesistenceService");
    ;
    List accessReportsList =
        persistenceService.executeQuery(
            " from "
                + EntityConstansts.JiResourceFolder
                + " resFolder where resFolder.parentFolder in (select id from "
                + EntityConstansts.JiResourceFolder
                + " folder where folder.uri in ('/organizations/organization_1/reports/ACCESS','/organizations/organization_1/reports/ADHOC/ACCESS'))");
    // +"and resFolder.id not in (SELECT repoSeqid FROM "+ EntityConstansts.ReportsAuthDetails +"
    // where rad.activeFlag = 0))");

    /*List accessReportsList = persistenceService.executeQuery(" from "+EntityConstansts.JiResourceFolder+
    " resFolder where resFolder.parentFolder in (select id from "+EntityConstansts.JiResourceFolder + " folder where folder.uri in ('/reports/ACCESS','/reports/ADHOC/ACCESS'))" +
    		" and resFolder.id not in (SELECT repoSeqid FROM ReportAuthDetails where activeFlag = 0)");*/
    // List accessReportsList = persistenceService.executeQuery("select resFolder.label as label
    // from "+ EntityConstansts.JiResourceFolder +" resFolder where resFolder.uri in
    // ('/reports/ACCESS','/reports/ADHOC/ACCESS') ");

    return accessReportsList;
  }
コード例 #7
0
public class CriticalityNameIdCache extends AbstractNameIdMappingCache {

  private IMasterDataConfigDataService madterDataConfigDataService =
      (IMasterDataConfigDataService) ServiceLocator.findService("masterDataConfigDataService");
  private static CriticalityNameIdCache singleton = null;

  public CriticalityNameIdCache() {
    super("CriticalityNameId");
  }

  @Override
  public void init() {
    singleton = this;
    super.init();
  }

  public static String lookupId(String name) {
    return singleton == null ? name : singleton.getId(name);
  }

  public static String lookupName(String id) {
    return singleton == null ? id : singleton.getName(id);
  }

  public Collection<INameIdPair> loadAll() {
    try {
      return new ArrayList<INameIdPair>(madterDataConfigDataService.loadCriticality());
    } catch (Exception e) {
      throw new RuntimeException("Failed to load Process name/id into cache", e);
    }
  }

  public static CriticalityNameIdCache getInstance() {
    return singleton;
  }
}
コード例 #8
0
  @SuppressWarnings("unchecked")
  public void jobToBeExecuted(JobExecutionContext context) {
    ALNTLogger.info(this.getClass().getName(), "jobToBeExecuted()", "Begin");
    try {
      ISchedulerConfigService schedulerConfigService =
          (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService");

      JobDetail jobDetails = context.getJobDetail();
      Long id = (Long) jobDetails.getJobDataMap().get("JOB_ID");
      String jobPgmName = (String) jobDetails.getJobDataMap().get("JOB_NAME");

      String triggerGroup = context.getTrigger().getGroup();
      boolean recoveringJob = false;
      JobStatus jobStatus = null;
      if (!StringUtils.isEmpty(triggerGroup) && triggerGroup.equals("RECOVERING_JOBS")) {
        recoveringJob = true;
        jobDetails.getJobDataMap().put(SchedulerUtil.RECOVERING_JOB, Boolean.TRUE);

        List<JobStatus> jobStatusList = null;
        try {
          jobStatusList =
              schedulerConfigService.loadJobStatus(
                  jobDetails.getJobDataMap().getLongValue("JOB_ID"));
          if (null != jobStatusList && jobStatusList.size() > 0) {
            jobStatus = jobStatusList.get(jobStatusList.size() - 1);
            jobDetails
                .getJobDataMap()
                .put(SchedulerUtil.RECOVERING_JOB_STATUS_ID, jobStatus.getId());
            jobStatus.setJobStatus(CommonConstants.JOB_STATUS_RUNNING);
          }
        } catch (Exception ex) {
          ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted", ex);
        }
      }

      if (jobStatus == null) {
        jobStatus = new JobStatus();
        jobStatus.setJobId(id);
        Date nextFireTime = context.getNextFireTime();
        jobStatus.setNextFireTime(nextFireTime);
        jobStatus.setJobName(jobPgmName);
        jobStatus.setCreationDate(new Date());
        jobStatus.setJobStatus(CommonConstants.JOB_STATUS_RUNNING);
      }

      Job job = context.getJobInstance();
      if (job instanceof IJobsWithResult) {
        IJobsWithResult jobWithResult = (IJobsWithResult) job;
        JobResultWriter writer = new JobResultWriter();
        writer.setCreateDate(jobStatus.getCreationDate());
        writer.setJobId(id);
        writer.init();
        jobWithResult.setResultWriter(writer);
      }
      if (jobDetails.getJobDataMap().containsKey(SchedulerUtil.RETRYING_JOB)
          && jobDetails.getJobDataMap().containsKey(SchedulerUtil.FAILED_JOB_STATUS_ID)
          && jobDetails.getJobDataMap().containsKey(SchedulerUtil.RETRYING_JOB_STATUS_ID)) {
        if (jobDetails.getJobDataMap().getBoolean(SchedulerUtil.RETRYING_JOB)) {
          jobStatus.setOriginalFailedId(
              jobDetails.getJobDataMap().getLong(SchedulerUtil.FAILED_JOB_STATUS_ID));
          jobStatus.setRetryForId(
              jobDetails.getJobDataMap().getLong(SchedulerUtil.RETRYING_JOB_STATUS_ID));
        }
      }

      jobStatus = schedulerConfigService.saveJobStatus(jobStatus);

      jobDetails.getJobDataMap().put("JobStatus_ID", jobStatus.getId());
      if (recoveringJob) {

      } else if (jobStatus.getRetryForId() != null) {
        JobStatus retryingForJobStatus =
            schedulerConfigService.loadJobStatusByStatusId(jobStatus.getRetryForId());
        if (retryingForJobStatus != null) {
          // get the job status object that simply says retrying and append it with new job status
          // id
          retryingForJobStatus.setJobStatus(
              CommonConstants.JOB_STATUS_RETRIED + " - " + jobStatus.getId());
          schedulerConfigService.saveJobStatus(retryingForJobStatus);
        }
      }

      ALNTLogger.info(this.getClass().getName(), "jobToBeExecuted()", "End");
    } catch (ALNTSystemException e) {
      ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted()", "Error ::" + e.getMessage());
    } catch (ALNTApplicationException e) {
      ALNTLogger.error(this.getClass().getName(), "jobToBeExecuted", "Error ::" + e.getMessage());
    }
  }
コード例 #9
0
  public void jobWasExecuted(JobExecutionContext context, JobExecutionException arg1) {
    SchedulerMailUtil mailUtil = new SchedulerMailUtil();
    ALNTLogger.info(this.getClass().getName(), "jobWasExecuted()", "Begin");
    try {
      ISchedulerConfigService schedulerConfigService =
          (ISchedulerConfigService) ServiceLocator.findService("schedulerConfigService");
      Job job = context.getJobInstance();
      if (job instanceof IJobsWithResult) {
        IJobsWithResult jobWithResult = (IJobsWithResult) job;
        JobResultWriter writer = jobWithResult.getResultWriter();
        if (writer != null) {
          writer.getLogWriter().flush();
          writer.getLogWriter().close();
          writer.getResultWriter().flush();
          writer.getResultWriter().close();
        }
      }
      Object jobId = context.getJobDetail().getJobDataMap().get("JOB_ID");
      Object id = context.getJobDetail().getJobDataMap().get("JobStatus_ID");
      String jobPgmName = (String) context.getJobDetail().getJobDataMap().get("JOB_NAME");
      ScheduledJobs scheduledJobs =
          schedulerConfigService.loadScheduledJob(new Long(jobId.toString()));
      ALNTLogger.info(getName(), "Got NotificationDetail object from ScheduledJobs");

      // Getting notification object to send the notification email to user
      scheduledNotificationDetail = scheduledJobs.getScheduledNotificationDetail();

      JobStatus jobStatus =
          schedulerConfigService.loadJobStatus(new Long(jobId.toString()), new Long(id.toString()));
      if (CommonConstants.SCHEDULE_IMMEDIATE.equalsIgnoreCase(scheduledJobs.getInterval())) {
        scheduledJobs.setActiveStatus(false);
      } else if (CommonConstants.SCHEDULE_ONCE.equalsIgnoreCase(scheduledJobs.getInterval())) {
        scheduledJobs.setActiveStatus(false);
      } else if (scheduledJobs.getInterval().startsWith(CommonConstants.SCHEDULE_PERIODICALLY)) {
        if (null == context.getNextFireTime()) {
          scheduledJobs.setActiveStatus(false);
        }
      }

      if (CommonConstants.JOB_STATUS_CANCELING.equalsIgnoreCase(jobStatus.getJobStatus())) {
        scheduledJobs.setActiveStatus(false);
        jobStatus.setJobStatus(CommonConstants.JOB_STATUS_CANCELED);

      } else {
        jobStatus.setJobStatus(CommonConstants.JOB_STATUS_COMPLETED);
        if (arg1 != null) {
          jobStatus.setJobStatus(CommonConstants.JOB_STATUS_FAILED);
        } else if (context
            .getJobDetail()
            .getJobDataMap()
            .containsKey(CommonConstants.JOB_STATUS_SKIPPED)) {
          jobStatus.setJobStatus(CommonConstants.JOB_STATUS_SKIPPED);
          context.getJobDetail().getJobDataMap().remove(CommonConstants.JOB_STATUS_SKIPPED);
        }
        if (context.getJobDetail() != null
            && context.getJobDetail().getJobDataMap() != null
            && context
                .getJobDetail()
                .getJobDataMap()
                .containsKey(CommonConstants.NO_VALID_FEED_FILE_EXISTS)) {
          jobStatus.setJobStatus(
              CommonConstants.JOB_STATUS_FAILED + "- " + CommonConstants.NO_VALID_FEED_FILE_EXISTS);
          context.getJobDetail().getJobDataMap().remove(CommonConstants.NO_VALID_FEED_FILE_EXISTS);
        }
        // completionTime=context.getFireTime();

        JobStage jobStage =
            schedulerConfigService.loadJobStage(
                jobStatus.getOriginalFailedId() == null
                    ? jobStatus.getId()
                    : jobStatus.getOriginalFailedId());
        if (jobStage != null) {
          jobStatus.setLastKnowStage(jobStage.getJobStage());
        }
      }

      // Sending notification email to user with status of current job with defined parameters or
      // with standard parameters
      // If the notification has not been configured for current running job then
      // scheduledNotificationDetail object will be null
      // so we are checking for that the notification has been configured for this or not
      if (scheduledNotificationDetail != null) {
        if (job instanceof IJobWithExtendedMailSubstVar) {
          Map<String, String> mapParams =
              ((IJobWithExtendedMailSubstVar) job).getMailSubstVarValues();
          mapParams.putAll(this.getStandardJobParams(scheduledJobs));
          mailUtil.sendMail(scheduledNotificationDetail, jobStatus.getJobStatus(), mapParams);
        } else {
          mailUtil.sendMail(
              scheduledNotificationDetail,
              jobStatus.getJobStatus(),
              this.getStandardJobParams(scheduledJobs));
        }
      }

      jobStatus.setCompleteTime(new Date());
      jobStatus.setJobName(jobPgmName);

      schedulerConfigService.saveScheduledJobWithoutScheduleJob(scheduledJobs);
      schedulerConfigService.saveJobStatus(jobStatus);

      ALNTLogger.info(this.getClass().getName(), "jobWasExecuted()", "End");
    } catch (ALNTSystemException e) {
      ALNTLogger.error(this.getClass().getName(), "jobWasExecuted()", "Error ::" + e.getMessage());
    } catch (ALNTApplicationException e) {
      ALNTLogger.error(this.getClass().getName(), "jobWasExecuted()", ":Error ::" + e.getMessage());
    }
  }
コード例 #10
0
/** @author Asif */
public class JNDIDatabaseConnectorService extends AbstractDatabaseConnectorService {
  private ISystemConnectorConfigDataService sysConService =
      (ISystemConnectorConfigDataService)
          ServiceLocator.findService("systemConnectorConfigDataService");

  // @Override
  protected Connection getDBConnection(Map<String, String> params)
      throws ALNTApplicationException, ALNTSystemException {
    try {
      String jndiName = null;
      String providerFactory = null;
      String url = null;
      String userName = null;
      String password = null;

      jndiName = params.get(CommonConstants.SYS_CON_ATTR_DB_JNDI_NAME);
      providerFactory = params.get(CommonConstants.SYS_CON_ATTR_DB_PROVIDER_FACTORY);
      url = params.get(CommonConstants.SYS_CON_ATTR_DB_PROVIDER_URL);
      userName = params.get(CommonConstants.SYS_CON_ATTR_DB_USER_NAME);
      password = PasswordUtil.decryptPassword(params.get(CommonConstants.SYS_CON_ATTR_DB_PASSWORD));

      if (jndiName == null
          || providerFactory == null
          || url == null
          || userName == null
          || password == null) {
        throw new ALNTApplicationException(
            ErrorCode.ILLEGAL_ARGUMENT_OR_ARGUMENT_NOT_PASSED,
            "Needed connection parameters not available! "
                + "The parameters needed are: "
                + CommonConstants.SYS_CON_ATTR_DB_JNDI_NAME
                + ", "
                + CommonConstants.SYS_CON_ATTR_DB_PROVIDER_FACTORY
                + ", "
                + CommonConstants.SYS_CON_ATTR_DB_PROVIDER_URL
                + ", "
                + CommonConstants.SYS_CON_ATTR_DB_USER_NAME
                + ", "
                + CommonConstants.SYS_CON_ATTR_DB_PASSWORD);
      }

      Properties prop = new Properties();
      prop.put(InitialContext.INITIAL_CONTEXT_FACTORY, providerFactory);
      prop.put(InitialContext.PROVIDER_URL, url);
      prop.put(InitialContext.SECURITY_PRINCIPAL, userName);
      prop.put(InitialContext.SECURITY_CREDENTIALS, password);

      InitialContext initialContext = new InitialContext(prop);
      DataSource dataSource = (DataSource) initialContext.lookup(jndiName);
      return dataSource.getConnection();
    } catch (SQLException ex) {
      ALNTLogger.error(this.getClass().getName(), ex);
      throw new ALNTApplicationException(ErrorCode.CONNECTOR_EXCEPTION, ex.getMessage());
    } catch (NamingException ex) {
      ALNTLogger.error(this.getClass().getName(), ex);
      throw new ALNTApplicationException(ErrorCode.CONNECTOR_EXCEPTION, ex.getMessage());
    }
  }

  public IConnectorConnection testConnection(SysConnector config)
      throws ALNTApplicationException, ALNTSystemException {
    return getConnection(config);
  }

  public void releaseConnection(SysConnector sysConnector)
      throws ALNTApplicationException, ALNTSystemException {
    // TODO Auto-generated method stub

  }

  public List getRequiredAttributes() throws ALNTApplicationException, ALNTSystemException {

    List<SysParam> sysParams = new ArrayList<SysParam>();
    sysParams.add(new SysParam("jndiName", "JNDI Name"));
    sysParams.add(new SysParam("providerFactory", "Provider Factory"));
    sysParams.add(new SysParam("url", "Url"));
    sysParams.add(new SysParam("userName", "User Name"));
    sysParams.add(new SysParam("password", "Password"));

    return sysParams;
  }
}
コード例 #11
0
public class ApplicationConfigService extends AbstractDataService
    implements IApplicationConfigService, CommonConstants {

  /*Alert Control configuration parameter constants ends*/

  private FileUploadUtil fileUploadUtil =
      (FileUploadUtil) ServiceLocator.findService("fileUploadUtil");

  public ApplicationConfigDAO applicationConfigDAO;

  public List getConfigParams() throws ALNTApplicationException, ALNTSystemException {

    List configParamList = null;
    try {
      configParamList = applicationConfigDAO.load();
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getConfigParams",
          "Error in loading Application config list ::");
      handleException(ex);
    }
    return configParamList;
  }

  public List getConfigParams(String category)
      throws ALNTApplicationException, ALNTSystemException {

    List configParamList = null;
    try {
      configParamList = applicationConfigDAO.loadByCategory(category);
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getConfigParams",
          "Error in loading Application config list ::");
      handleException(ex);
    }
    return configParamList;
  }

  public ApplicationConfig getConfigParam(String configParamName)
      throws ALNTApplicationException, ALNTSystemException {

    ApplicationConfig configParam = null;
    try {
      configParam = applicationConfigDAO.load(configParamName);
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(), "getConfigParam", "Error in loading Application config  ::");
      handleException(ex);
    }
    return configParam;
  }

  public List getConfigParamsForLike(String configParamName)
      throws ALNTApplicationException, ALNTSystemException {

    List configParamList = null;
    try {
      configParamList = applicationConfigDAO.loadLike(configParamName);
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getConfigParamsForLike",
          "Error in loading Application config list ::");
      handleException(ex);
    }
    return configParamList;
  }

  public String getConfigParamValue(String configParamName)
      throws ALNTApplicationException, ALNTSystemException {
    return getConfigParamValue(configParamName, false);
  }

  public int getConfigParamValueInt(String configParamName, int defaultValue)
      throws ALNTApplicationException, ALNTSystemException {
    String val = getConfigParamValue(configParamName, false);
    if (val != null) {
      try {
        return Integer.parseInt(val.trim());
      } catch (NumberFormatException e) {
        ALNTLogger.error(this.getClass().getName(), "getConfigParamValueInt", e);
      }
    }
    return defaultValue;
  }

  public String getConfigParamValue(String configParamName, boolean getConfigParamLabel)
      throws ALNTApplicationException, ALNTSystemException {
    String configParamValue = null;
    String configParamLabel = null;
    try {
      if (getConfigParamLabel) {
        ApplicationConfig applicationConfig = applicationConfigDAO.load(configParamName);
        if (null != applicationConfig) {
          configParamValue = applicationConfig.getConfigParamValue();
          configParamLabel = applicationConfig.getConfigParamLabel();
        }
      } else {
        configParamValue = CacheManager.getApplicationConfig(configParamName);
      }

    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getConfigParamValue",
          "Error in loading Application config ::" + configParamName);
      handleException(ex);
    }
    if (getConfigParamLabel && StringUtils.isNotNullOrNotEmpty(configParamLabel))
      return configParamLabel + " : " + configParamValue;
    return configParamValue;
  }

  public boolean isDisplaySaraReports() {
    boolean display = false;
    try {
      String strGraphDisplayInInboxPage = getConfigParamValue(SHOW_SARA_REPORTS);
      display = doesStringRepresentTrue(strGraphDisplayInInboxPage);
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "isDisplaySaraReports()",
          "Error getting value for isDisplaySaraReports: " + e.getMessage());
    }
    return display;
  }

  public String getCC40AnalysisType() {
    String strCC40AnalysisType = "0";
    try {
      strCC40AnalysisType = getConfigParamValue(CC40_ANALYSIS_TYPE);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getCC40AnalysisType()",
          "Error getting value for getCC40AnalysisType:" + e.getMessage());
      strCC40AnalysisType = "0";
    }
    return strCC40AnalysisType;
  }

  public String getRIAnalysisType() {
    String strRIAnalysisType = "Activity";
    try {
      strRIAnalysisType = getConfigParamValue(RI_ANALYSIS_TYPE);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getRIAnalysisType()",
          "Error getting value for getRIAnalysisType:" + e.getMessage());
      strRIAnalysisType = "Activity";
    }
    return strRIAnalysisType;
  }

  public int displayRiskDetlsVertically() {
    int value = 3;
    try {
      String displayRiskDetls = getConfigParamValue(SHOW_RISK_DETAILS_VERTICALLY);
      if (null != displayRiskDetls) {
        value = Integer.parseInt(displayRiskDetls);
      }
    } catch (Exception e) {
      value = 3;
    }
    return value;
  }

  public Long getProvisionExternalRolesEnabled() {
    Long value = new Long(0);
    try {
      String showExternalRoles = getConfigParamValue(SHOW_EXTERNAL_ROLES);
      value = Long.parseLong(showExternalRoles);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getProvisionExternalRolesEnabled()",
          "Error getting value for getProvisionExternalRolesEnabled:" + e.getMessage());
      value = new Long(0);
    }
    return value;
  }

  public boolean isKeywordSearchEnabled() {
    boolean show = true;
    try {
      String showKwrdSearch = getConfigParamValue(SHOW_KEYWORD_SEARCH);
      show = doesStringRepresentTrue(showKwrdSearch);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "isKeywordSearchEnabled()",
          "Error getting value for isKeywordSearchEnabled:" + e.getMessage());
      show = true;
    }
    return show;
  }

  public String getMitigatedRiskColor() {
    // TODO Shd provide a default color
    String strMigatedRiskColor = "";
    try {
      strMigatedRiskColor = getConfigParamValue(MITIGATED_RISK_COLOR);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getMitigatedRiskColor()",
          "Error getting value for getMitigatedRiskColor:" + e.getMessage());
      strMigatedRiskColor = "";
    }
    return strMigatedRiskColor;
  }

  public String getDefaultProvPassword() {
    String defPassword = "******";
    try {
      defPassword = getConfigParamValue(DEFAULT_PROV_PASSWORD);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getDefaultProvPassword()",
          "Error getting value for getDefaultProvPassword: "******"P@$$w0rd";
    }
    return defPassword;
  }

  public String getAdminUserIds() {
    String userIds = "";
    try {
      userIds = getConfigParamValue(ADMIN_USERS);
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "getAdminUserIds()",
          "Error getting value for getAdminUserIds: " + e.getMessage());
    }
    return userIds;
  }

  // This is used for Exchange parameters, not for ldap
  public String getExchangeParametersToModify() {
    String parameters = "";
    try {
      parameters = getConfigParamValue(EXCHANGE_PROV_PARAMETERS_THAT_CAN_BE_CHANGED);
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "getLDAPParametersToModify()",
          "Error getting value for getLDAPParametersToModify: " + e.getMessage());
    }
    return parameters;
  }

  // This is used for getting Ldap parameters.
  public String getADParametersToModify() {
    String parameters = "";
    try {
      parameters = getConfigParamValue(AD_PROV_PARAMETERS_THAT_CAN_BE_CHANGED);
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "getLDAPParametersToModify()",
          "Error getting value for getLDAPParametersToModify: " + e.getMessage());
    }
    return parameters;
  }

  public String getConfigLogDir() {
    String parameters = "";
    try {
      parameters = getConfigParamValueForLogDir(CONFIG_LOG_DIR, true);
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "getLDAPParametersToModify()",
          "Error getting value for getLDAPParametersToModify: " + e.getMessage());
    }
    return parameters;
  }

  public String getConfigParamValueForLogDir(String configParamName, boolean getConfigParamLabel)
      throws ALNTApplicationException, ALNTSystemException {
    String configParamValue = null;
    String configParamLabel = null;
    try {
      if (getConfigParamLabel) {
        ApplicationConfig applicationConfig = applicationConfigDAO.load(configParamName);
        if (null != applicationConfig) {
          configParamValue = applicationConfig.getConfigParamValue();
          configParamLabel = applicationConfig.getConfigParamLabel();
        }
      } else {
        configParamValue = CacheManager.getApplicationConfig(configParamName);
      }

    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getConfigParamValueForLogDir",
          "Error in loading Application config ::" + configParamName);
      handleException(ex);
    }
    return configParamValue;
  }

  private boolean doesStringRepresentTrue(String str) {
    if (str == null) {
      return false;
    }
    str = str.trim().toLowerCase();
    boolean representsTrue = str.startsWith("y") || str.startsWith("t") || str.startsWith("1");
    return representsTrue;
  }

  public String getShardBaseFolder() throws ALNTApplicationException, ALNTSystemException {
    String sharedFolder = getConfigParamValue(CommonConstants.SHARED_FOLDER);
    if (sharedFolder != null
        && !(sharedFolder.equals(""))
        && (sharedFolder.length() > 0)
        && (!sharedFolder.endsWith("\\"))) sharedFolder.substring(0, sharedFolder.length() - 3);
    return sharedFolder;
  }

  public String getShardInboundFolder() throws ALNTApplicationException, ALNTSystemException {
    String sharedFolder = getConfigParamValue(CommonConstants.SHARED_FOLDER);
    if (StringUtils.isNullOrEmpty(sharedFolder)) return "";
    StringBuffer inbounFolder = new StringBuffer(sharedFolder);
    if (sharedFolder != null
        && !(sharedFolder.equals(""))
        && (sharedFolder.length() > 0)
        && (!sharedFolder.endsWith("\\"))) inbounFolder.append(CommonConstants.fileSeparator);
    // sharedFolder.substring(0, sharedFolder.length() - 3);
    inbounFolder.append(CommonConstants.INBOUND_FOLDER);
    return inbounFolder.toString();
  }

  public String getShardOutboundFolder() throws ALNTApplicationException, ALNTSystemException {
    String sharedFolder = getConfigParamValue(CommonConstants.SHARED_FOLDER);
    if (StringUtils.isNullOrEmpty(sharedFolder)) return "";
    StringBuffer outbounFolder = new StringBuffer(sharedFolder);
    if (sharedFolder != null
        && !(sharedFolder.equals(""))
        && (sharedFolder.length() > 0)
        && (!sharedFolder.endsWith("\\"))) outbounFolder.append(CommonConstants.fileSeparator);
    outbounFolder.append(CommonConstants.OUTBOUND_FOLDER);
    return outbounFolder.toString();
  }

  public String getImportExportFolder() throws ALNTApplicationException, ALNTSystemException {
    String sharedFolder = getConfigParamValue(CommonConstants.SHARED_FOLDER);
    if (sharedFolder != null
        && !(sharedFolder.equals(""))
        && (sharedFolder.length() > 0)
        && (!sharedFolder.endsWith("\\"))) {
      StringBuffer outbounFolder = new StringBuffer(sharedFolder);
      outbounFolder.append(CommonConstants.fileSeparator);
      outbounFolder.append(CommonConstants.IMPORT_EXPORT_FOLDER);
      return outbounFolder.toString();
    }

    return "";
  }

  public String getLogLevel() throws ALNTApplicationException, ALNTSystemException {
    String strLogLevel = getConfigParamValue(LOG_LEVEL);
    if (null == strLogLevel) {
      strLogLevel = CommonConstants.DEFAULT_LOG_LEVEL;
    }
    return strLogLevel;
  }

  public String[] getLogCategories() {
    String[] logCategories = null;
    String logCategory = null;
    try {
      logCategory = getConfigParamValue(LOG_CATEGORY);
    } catch (ALNTBaseException e) {
      ALNTLogger.error(this.getClass().getName(), "getLogCategory()", e);
    }
    if (null != logCategory && !("").equals(logCategory)) {
      logCategories = logCategory.split(",");
    } else {
      logCategories = CommonConstants.LOGGER_CATEGORY;
    }
    return logCategories;
  }

  public long getSleepTimeForExchangeEmail() {
    long sleepTime = SLEEPTIME_FOR_EXCHANGE_EMAIL;
    try {
      String sleepTimeforExchaneEmail = getConfigParamValue(CONFIG_PARAM_SLEEP_TIME_EXCHANGE);
      if ((sleepTimeforExchaneEmail != null) && (sleepTimeforExchaneEmail.trim().length() > 0)) {
        sleepTime = Long.parseLong(sleepTimeforExchaneEmail.trim());
      }
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getSleepTimeForExchangeEmail()",
          "Error getting sleeptime for exchange:" + e.getMessage());
    }
    return sleepTime;
  }

  public boolean isRequiredToSendEmailOnPasswordChange()
      throws ALNTApplicationException, ALNTSystemException {
    boolean sendMailReq = false;
    String configValue = getConfigParamValue(PASSWORD_CHANGE_EMAIL_REQ);
    if (null != configValue && ("true").equalsIgnoreCase(configValue)) {
      sendMailReq = true;
    }
    return sendMailReq;
  }

  public String getForChangePasswordMailFormat()
      throws ALNTApplicationException, ALNTSystemException {
    return getConfigParamValue(PASSWORD_CHANGE_MSG);
  }

  public long getSleepTimeForFetchingUBDN() {
    long sleepTime = SLEEPTIME_FOR_LDAP_BASE_DN;

    try {
      String sleepTimeforldap = getConfigParamValue(CONFIG_PARAM_SLEEP_TIME_LDAP);
      if ((sleepTimeforldap != null) && (sleepTimeforldap.trim().length() > 0)) {
        sleepTime = Long.parseLong(sleepTimeforldap.trim());
      }
    } catch (Exception e) {
      ALNTLogger.warn(
          this.getClass().getName(),
          "getSleepTimeForFetchingUBDN()",
          "Error getting value for sleep time for ldap: " + e.getMessage());
    }
    return sleepTime;
  }

  public ApplicationConfig getApplicationConfig(String configParamName)
      throws ALNTSystemException, ALNTApplicationException {
    try {
      return applicationConfigDAO.load(configParamName);
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getApplicationConfig",
          "Error in loading Application config ::" + configParamName);
      handleException(ex);
    }
    return null;
  }

  public List saveApplicationConfigList(List applicationConfigList)
      throws ALNTApplicationException, ALNTSystemException {
    List oldAppConfigList = applicationConfigDAO.load();
    List savedList = applicationConfigDAO.save(applicationConfigList);
    String df = null;
    String param = null;
    if (null != savedList && null != applicationConfigList) {
      Iterator saveIter = savedList.iterator();
      while (saveIter.hasNext()) {
        ApplicationConfig applConfig = (ApplicationConfig) saveIter.next();
        if (CONFIG_LOG_DIR.equalsIgnoreCase(applConfig.getConfigParamName())
            || LOG_LEVEL.equalsIgnoreCase(applConfig.getConfigParamName())
            || NEW_AUDIABLE_SOUND_PATH.equalsIgnoreCase(applConfig.getConfigParamName())) {
          String oldParamValue =
              getConfigParamValue(oldAppConfigList, applConfig.getConfigParamName());
          if (null != oldParamValue) {
            if (!oldParamValue.equalsIgnoreCase(applConfig.getConfigParamValue())) {
              if (CONFIG_LOG_DIR.equalsIgnoreCase(applConfig.getConfigParamName())) {
                ALNTLogger.info(
                    this.getClass().getName(),
                    "saveApplicationConfigList",
                    "reload the LoggerConfig");
                System.setProperty(
                    CommonConstants.LOG_DIR_KEY, applConfig.getConfigParamValue() + "/");
                LoggerConfigUtil.resetLogDir(applConfig.getConfigParamValue());
                // ALNTLogger.reloadConfiguration(ALNTLogger.class.getResource("LoggerConf.xml"));
              } /*else if(LOG_LEVEL.equalsIgnoreCase(applConfig.getConfigParamName())) {
                	String logLevel = CommonConstants.DEFAULT_LOG_LEVEL;
                	if(null != applConfig.getConfigParamValue())
                		logLevel = applConfig.getConfigParamValue().toUpperCase();
                	CommonUtil.resetLogLevel(logLevel);
                }*/ else if (NEW_AUDIABLE_SOUND_PATH.equalsIgnoreCase(
                  applConfig.getConfigParamName())) {
                ALNTLogger.info(
                    this.getClass().getName(),
                    "saveApplicationConfigList",
                    "InboxMessage Alert Sound modified");
                try {
                  fileUploadUtil.writeFileIntoServerLoc(applConfig.getConfigParamValue());
                } catch (Exception e) {
                  ALNTLogger.error(
                      this.getClass().getName(),
                      "saveApplicationConfigList",
                      "Issue on File upload ");
                }
              }
            }
          }
        } /*else if (CommonConstants.Application_Date_Format.equalsIgnoreCase(applConfig.getConfigParamName()) ||
          		CommonConstants.APPL_TIME_FORMAT.equalsIgnoreCase(applConfig.getConfigParamName()) ||
          		CommonConstants.APPL_FLEX_TIME_FORMAT.equalsIgnoreCase(applConfig.getConfigParamName())){
          	df = applConfig.getConfigParamValue();
          	param = applConfig.getConfigParamName();
          }*/ else if (APPL_BANNER_IMAGE.equalsIgnoreCase(
            applConfig.getConfigParamName())) {
          CacheManager.updateBannerImageName(applConfig.getConfigParamValue());
        }
      }
    }

    /*if(StringUtils.isNotNullOrNotEmpty(df) && StringUtils.isNotNullOrNotEmpty(param)){
    	LookUp lkup= (LookUp) CommonBusinessDeligate.getInstance().loadLookupById(new Long(df));
    	String dateformatStr = (lkup!=null)?lkup.getMeaning():null;
    	GlobalizationBD globalizationBD = new GlobalizationBD();
    	if(CommonConstants.Application_Date_Format.equalsIgnoreCase(param)) {
    		I18NUtil.updateResBundle(CommonConstants.Application_Date_Format, dateformatStr);
    	} else if(CommonConstants.APPL_TIME_FORMAT.equalsIgnoreCase(param)) {
    		I18NUtil.updateResBundle(CommonConstants.APPL_TIME_FORMAT, dateformatStr);
    	}
    }*/
    try {
      ApplicationConfigCache.getInstance().reloadAll();
    } catch (CacheEventException e) {
      ALNTLogger.error(this.getClass().getName(), "saveApplicationConfigList()", e);
    }
    return savedList;
  }

  public String getApplicationConfigFromCache(String paramName) {
    return CacheManager.getApplicationConfig(paramName);
  }

  public ApplicationConfig saveUserIDDataSourceType(String dataSourceType)
      throws ALNTApplicationException, ALNTSystemException {
    ApplicationConfig retApplConfig = null;
    try {
      ApplicationConfig exApplConfig = getConfigParam(CommonConstants.APPL_USERID_DATASOURCE_TYPE);
      if (null == exApplConfig)
        throw new ALNTApplicationException(
            ErrorCode.OBJECT_NOT_AVAILABLE,
            "Application cofig not exists: " + CommonConstants.APPL_USERID_DATASOURCE_TYPE);
      exApplConfig.setConfigParamValue(dataSourceType);
      retApplConfig = (ApplicationConfig) applicationConfigDAO.save(exApplConfig);
      ApplicationConfigCache.getInstance().reloadAll();
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "saveApplicationConfig()", ex);
      handleException(ex);
    }
    return retApplConfig;
  }

  public ApplicationConfigDAO getApplicationConfigDAO() {
    return applicationConfigDAO;
  }

  public void setApplicationConfigDAO(ApplicationConfigDAO applicationConfigDAO) {
    this.applicationConfigDAO = applicationConfigDAO;
  }

  public Boolean printStackTrace() {
    Boolean print = Boolean.FALSE;
    //		try{
    //			String showKwrdSearch = getConfigParamValue(PRINT_STACK_TRACE);
    //			print =  doesStringRepresentTrue(showKwrdSearch);
    //		}catch(Exception e ){
    //			ALNTLogger.warn(ApplicationConfigService.class.getName(), "printStackTrace()", "Error
    // getting value for printStackTrace:"+ e.getMessage());
    //			print = Boolean.FALSE;
    //		}
    return print;
  }

  public Boolean getDoDateValidationForRoles() {
    Boolean value = Boolean.TRUE;
    try {
      String ddvr = getConfigParamValue(DO_DATE_VALIDATION_FOR_ROLES);
      value = doesStringRepresentTrue(ddvr);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getProvisionExternalRolesEnabled()",
          "Error getting value for getProvisionExternalRolesEnabled:" + e.getMessage());
    }
    return value;
  }

  public String getReqClosingWSURI() {
    String value = "";
    try {
      value = getConfigParamValue(REQ_CLOS_WS_URI);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getReqClosingWSURI()",
          "Error getting value for getReqClosingWSURI:" + e.getMessage());
    }
    return value;
  }

  public String getReqClosingWSUser() {
    String value = "";
    try {
      value = getConfigParamValue(REQ_CLOS_WS_USERID);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getReqClosingWSUser()",
          "Error getting value for getReqClosingWSUser:"******"";
    try {
      value = getConfigParamValue(REQ_CLOS_WS_PASSWORD);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getReqClosingWSPasswd()",
          "Error getting value for getReqClosingWSPasswd:" + e.getMessage());
    }
    return value;
  }

  private String getConfigParamValue(List applicationConfigList, String configParam) {
    if (null == applicationConfigList
        || applicationConfigList.size() <= 0
        || null == configParam
        || configParam.equals("")) {
      return null;
    }
    Iterator applConfigIter = applicationConfigList.iterator();
    while (applConfigIter.hasNext()) {
      ApplicationConfig applConfig = (ApplicationConfig) applConfigIter.next();
      if (configParam.equalsIgnoreCase(applConfig.getConfigParamName())) {
        return applConfig.getConfigParamValue();
      }
    }
    return null;
  }

  public String getLDAPUnlockValue() {
    String ldapValue = "";
    try {
      ldapValue = getConfigParamValue(LDAP_UNLOCK_VALUE);
    } catch (Exception e) {
      ALNTLogger.warn(
          ApplicationConfigService.class.getName(),
          "getLDAPUnlockValue()",
          "Error getting value for LDAPUnlockValue:" + e.getMessage());
    }
    return ldapValue;
  }

  public List getAllConfigParams() throws ALNTApplicationException, ALNTSystemException {

    List configParamList = null;
    try {
      configParamList = applicationConfigDAO.loadAll();
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getAllConfigParams",
          "Error in loading Application config list ::");
      handleException(ex);
    }
    return configParamList;
  }

  public boolean displayProvWarnings() throws ALNTApplicationException, ALNTSystemException {
    String displayProvWarnings = getConfigParamValue(DISPLAY_PROV_WARNINGS);
    return doesStringRepresentTrue(displayProvWarnings);
  }

  public boolean getContinueForSamePerNum() throws ALNTApplicationException, ALNTSystemException {
    boolean ret = true;
    try {
      String perNum = getConfigParamValue(CONTINUE_FOR_SAME_PER_NUM);
      ret = doesStringRepresentTrue(perNum);
    } catch (NumberFormatException ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "getContinueForSamePerNum",
          "Error in loading Application config list ::");
    }
    return ret;
  }

  public boolean fetchMitCtrlsForSpecificiedRisk()
      throws ALNTApplicationException, ALNTSystemException {
    boolean value = true;
    try {
      String displayProvWarnings = getConfigParamValue(SEARCH_MITIGATIONS_SUPPORT_WILD_CARDS);
      value = doesStringRepresentTrue(displayProvWarnings);
    } catch (Exception ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "supportWildCardsInSearchMitigation()",
          "Error in loading Application config list ::");
      handleException(ex);
    }
    return value;
  }

  public String getAttachmentFolder() throws ALNTApplicationException, ALNTSystemException {
    String attachmentFolder = getConfigParamValue(CommonConstants.ATTACHMENT_FOLDER);
    if (attachmentFolder == null) return "";
    StringBuffer inbounFolder = new StringBuffer(attachmentFolder);
    if (attachmentFolder != null
        && !(attachmentFolder.equals(""))
        && (attachmentFolder.length() > 0)
        && (!attachmentFolder.endsWith("/")))
      inbounFolder.append(CommonConstants.FILE_DIR_DELIMETER);
    return inbounFolder.toString();
  }

  public List getAllAccessReports() throws ALNTApplicationException, ALNTSystemException {
    IPersistenceService persistenceService =
        (IPersistenceService) ServiceLocator.findService("hibernatePesistenceService");
    ;
    List accessReportsList =
        persistenceService.executeQuery(
            " from "
                + EntityConstansts.JiResourceFolder
                + " resFolder where resFolder.parentFolder in (select id from "
                + EntityConstansts.JiResourceFolder
                + " folder where folder.uri in ('/organizations/organization_1/reports/ACCESS','/organizations/organization_1/reports/ADHOC/ACCESS'))");
    // +"and resFolder.id not in (SELECT repoSeqid FROM "+ EntityConstansts.ReportsAuthDetails +"
    // where rad.activeFlag = 0))");

    /*List accessReportsList = persistenceService.executeQuery(" from "+EntityConstansts.JiResourceFolder+
    " resFolder where resFolder.parentFolder in (select id from "+EntityConstansts.JiResourceFolder + " folder where folder.uri in ('/reports/ACCESS','/reports/ADHOC/ACCESS'))" +
    		" and resFolder.id not in (SELECT repoSeqid FROM ReportAuthDetails where activeFlag = 0)");*/
    // List accessReportsList = persistenceService.executeQuery("select resFolder.label as label
    // from "+ EntityConstansts.JiResourceFolder +" resFolder where resFolder.uri in
    // ('/reports/ACCESS','/reports/ADHOC/ACCESS') ");

    return accessReportsList;
  }

  public String getAccessReportName() throws ALNTApplicationException, ALNTSystemException {
    String reportName = getConfigParamValue(SHOW_REQ_ACTION_REPORT);
    return reportName;
  }

  public SysConnector getDoNotHireRulesConnector()
      throws ALNTApplicationException, ALNTSystemException {
    String sysConnId = getConfigParamValue(DO_NOT_HIRE_RULES_CONN);
    if (sysConnId != null && !"".equals(sysConnId)) {
      Long sysId = Long.parseLong(sysConnId);
      ISystemConnectorConfigDataService sysConnService =
          (ISystemConnectorConfigDataService)
              ServiceLocator.findService("systemConnectorConfigDataService");
      SysConnector sysConn = sysConnService.loadSystemConnector(sysId);
      return sysConn;
    }
    return null;
  }

  public JiResourceFolder getAccessReportLabel()
      throws ALNTApplicationException, ALNTSystemException {
    List accessReportList = getAllAccessReports();
    Iterator accessReportListIter = accessReportList.iterator();
    String accessReportName = getAccessReportName();
    while (accessReportListIter.hasNext()) {
      JiResourceFolder report = (JiResourceFolder) accessReportListIter.next();
      String reportName = report.getName();
      if (reportName.indexOf("_files") > 0)
        reportName = new String(reportName.substring(0, reportName.indexOf("_files")));
      if (reportName.equals(accessReportName)) {
        return report;
      }
    }
    return null;
  }

  public Boolean isReportActive(Long repoSeqId) {
    IPersistenceService persistenceService =
        (IPersistenceService) ServiceLocator.findService("hibernatePesistenceService");
    ;
    List activeFlagList =
        persistenceService.executeQuery(
            " from "
                + EntityConstansts.ReportsAuthDetails
                + " where repoSeqid= "
                + repoSeqId
                + " and activeFlag = 0");

    if (activeFlagList != null && !activeFlagList.isEmpty()) {
      return false;
    }
    return true;
  }

  public String getUserIDDataSourceType() throws ALNTApplicationException, ALNTSystemException {
    String userIdDataSrcType = null;
    try {
      userIdDataSrcType = getConfigParamValue(CommonConstants.APPL_USERID_DATASOURCE_TYPE);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getUserIDDataSourceType()", ex);
      handleException(ex);
    }
    return userIdDataSrcType;
  }

  public String getBannerImageName() throws ALNTApplicationException, ALNTSystemException {
    String imageName = null;
    try {
      imageName = getConfigParamValue(APPL_BANNER_IMAGE);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getBannerImageName()", ex);
      handleException(ex);
    }
    return imageName;
  }

  public String getApplDateFormat() throws ALNTApplicationException, ALNTSystemException {
    String applDateFormat = null;
    try {
      applDateFormat = getConfigParamValue(CommonConstants.Application_Date_Format);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getApplDateFormat()", ex);
      handleException(ex);
    }
    return applDateFormat;
  }

  public String getApplTimeFormat() throws ALNTApplicationException, ALNTSystemException {
    String applTimeFormat = null;
    try {
      applTimeFormat = getConfigParamValue(CommonConstants.APPL_TIME_FORMAT);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getApplTimeFormat()", ex);
      handleException(ex);
    }
    return applTimeFormat;
  }

  public String getApplFlexTimeFormat() throws ALNTApplicationException, ALNTSystemException {
    String applFlexTimeFormat = null;
    try {
      applFlexTimeFormat = getConfigParamValue(CommonConstants.APPL_FLEX_TIME_FORMAT);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getApplFlexTimeFormat()", ex);
      handleException(ex);
    }
    return applFlexTimeFormat;
  }

  public String getHRUserFileLocation() throws ALNTApplicationException, ALNTSystemException {
    String fileLoc = null;
    try {
      fileLoc = getConfigParamValue(HRUSER_FILE_LOCATION);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getApplHRUserFileLocation()", ex);
      handleException(ex);
    }
    return fileLoc;
  }

  public String getHRUserRequestFileLocation()
      throws ALNTApplicationException, ALNTSystemException {
    String fileLoc = null;
    try {
      fileLoc = getConfigParamValue(HRUSER_REQUEST_LOCATION);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getHRUserRequestFileLocation()", ex);
      handleException(ex);
    }
    return fileLoc;
  }

  public String getNdaFormTemplateLocation() throws ALNTApplicationException, ALNTSystemException {

    String sharedFolder = getShardBaseFolder();
    StringBuffer ndaFormFolder = new StringBuffer(sharedFolder);
    try {

      if (sharedFolder != null
          && !(sharedFolder.equals(""))
          && (sharedFolder.length() > 0)
          && (!sharedFolder.endsWith("\\"))) ndaFormFolder.append(CommonConstants.fileSeparator);
      String ndaFormLocation = getConfigParamValue(NDA_FORM_TEMPLATE_LOCATION);
      if (ndaFormLocation != null) ndaFormFolder.append(ndaFormLocation);
      else return null;

    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getHRUserRequestFileLocation()", ex);
      handleException(ex);
    }
    return ndaFormFolder.toString();
  }

  public String getZSAPFileDilimiter() throws ALNTApplicationException, ALNTSystemException {
    String fileDelimiter = null;
    try {
      fileDelimiter = getConfigParamValue(ZSAP_FILE_DELIMITER);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getHRUserRequestFileLocation()", ex);
      handleException(ex);
    }
    return fileDelimiter;
  }

  public String getImpExpJobFileLocation() throws ALNTApplicationException, ALNTSystemException {
    String impExpJobFileLoc = null;
    try {
      impExpJobFileLoc = getConfigParamValue(IMPEXPJOB_FILE_LOCATION);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getImpExpJobFileLocation()", ex);
      handleException(ex);
    }
    return impExpJobFileLoc;
  }

  public boolean searchInactiveMasterUsers() throws ALNTApplicationException, ALNTSystemException {
    boolean ret = true;
    try {
      String value = getConfigParamValue(SEARCH_INACTIVE_MASTER_USERS);
      ret = doesStringRepresentTrue(value);
    } catch (NumberFormatException ex) {
      ALNTLogger.error(
          this.getClass().getName(),
          "searchInactiveMasterUsers",
          "Error in loading Application config list ::");
    }
    return ret;
  }

  public String getSSO2SECLibrary() throws ALNTApplicationException, ALNTSystemException {
    String sso2SECLibrary = null;
    try {
      sso2SECLibrary = getConfigParamValue(SSO2_SEC_LIBRARY);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getSSO2SECLibrary()", ex);
      handleException(ex);
    }
    return sso2SECLibrary;
  }

  public String getSSO2TicketFilePath() throws ALNTApplicationException, ALNTSystemException {
    String sso2TicketFilePath = null;
    try {
      sso2TicketFilePath = getConfigParamValue(SSO2_TICKET_FILE_PATH);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getSSO2TicketFilePath()", ex);
      handleException(ex);
    }
    return sso2TicketFilePath;
  }

  public String getSSO2TicketLibrary() throws ALNTApplicationException, ALNTSystemException {
    String sso2TicketLibrary = null;
    try {
      sso2TicketLibrary = getConfigParamValue(SSO2_TICKET_LIBRARY);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getSSO2TicketLibrary()", ex);
      handleException(ex);
    }
    return sso2TicketLibrary;
  }

  public String getSupportedFileActions() throws ALNTApplicationException, ALNTSystemException {
    String supportedActions = null;
    try {
      supportedActions = getConfigParamValue(SUPPORTED_FILE_ACTIONS);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getSupportedFileActions()", ex);
      handleException(ex);
    }
    return supportedActions;
  }

  // ABHISHEK chnages for document search start.
  public void saveDocumentSearchConfig(String roleName, int numOfDays)
      throws ALNTApplicationException, ALNTSystemException {
    try {
      ALNTLogger.debug(
          this.getClass().getName(),
          "setDocumentSearchConfig()",
          "Saving the role and number of days details : ");
      ApplicationConfig roleConfig = new ApplicationConfig();
      ApplicationConfig dayConfig = new ApplicationConfig();
      roleConfig = applicationConfigDAO.load("DOCUMENT_CHANGE_ROLE");
      dayConfig = applicationConfigDAO.load("DOCUMENT_CHANGE_DAYS");
      roleConfig.setConfigParamValue(roleName);
      dayConfig.setConfigParamValue(String.valueOf(numOfDays));
      applicationConfigDAO.saveDocumentSearchConfig(roleConfig);
      applicationConfigDAO.saveDocumentSearchConfig(dayConfig);
      try {
        ApplicationConfigCache.getInstance().reloadAll();
      } catch (CacheEventException e) {
        ALNTLogger.debug(this.getClass().getName(), "setDocumentSearchConfig()", e);
      }

    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "setDocumentSearchConfig()", ex);
      handleException(ex);
    }
  }

  // abhishek changes for document change end.

  public String getSponsorTerminateReqCategry()
      throws ALNTApplicationException, ALNTSystemException {
    String reqCategory = null;
    try {
      reqCategory = getConfigParamValue(REQ_CATEG_FOR_SPONSOR_TERMINATE);
      ALNTLogger.debug(
          this.getClass().getName(),
          "getSponsorTerminateReqCategry()",
          "Request category for sposnor terminate : " + reqCategory);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getSponsorTerminateReqCategry()", ex);
      handleException(ex);
    }
    return reqCategory;
  }

  public String getBrowserPageTitle() throws ALNTApplicationException, ALNTSystemException {
    String title = null;
    try {
      title = getConfigParamValue(BROWSER_PAGE_TITLE);
      ALNTLogger.debug(
          this.getClass().getName(),
          "getBrowserPageTitle()",
          "Browser page title configured as : " + title);
    } catch (Exception ex) {
      ALNTLogger.error(this.getClass().getName(), "getBrowserPageTitle()", ex);
      handleException(ex);
    }
    return StringUtils.isEmpty(title) ? I18NUtil.getI18NValue("browser.title.default") : title;
  }
}
コード例 #12
0
public class OrganizationBusinessDeligate extends AbstractBusinessDeligate {

  private static OrganizationBusinessDeligate organizationBusinessDeligate =
      new OrganizationBusinessDeligate();
  private IOrganizationService masterDataService =
      (IOrganizationService) ServiceLocator.findService("organizationDataService");
  private ILookUpService lookupService =
      (ILookUpService) ServiceLocator.findService("lookUpService");
  private IMasterDataConfigDataService facilityService =
      (IMasterDataConfigDataService) ServiceLocator.findService("masterDataConfigDataService");
  private IRelationshipService relationDataService =
      (IRelationshipService) ServiceLocator.findService("relationshipService");

  private ISixNPCommonService sixNpCommonService =
      (ISixNPCommonService) ServiceLocator.findService("sixNPDataService");

  public List loadAuditTrail(Organization obj)
      throws ALNTApplicationException, ALNTSystemException {

    if (obj != null) {
      return sixNpCommonService.loadAuditTrail(obj.getClass().getName(), obj.getId());
    } else {
      ALNTLogger.debug(
          this.getClass().getName(), "loadAuditTrail", "Failed to Load audit trail {" + obj + "}");
      return new ArrayList();
    }
  } //

  public List loadAllParentOrganizations() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadAllParentOrganizations();
  }

  public static OrganizationBusinessDeligate getInstance() {
    return new OrganizationBusinessDeligate();
  }
  // dev track 2575
  public void saveRoleOrgRelationship(
      RoleDetails role, List<RoleAuthorizationDetails> roleAuthDetails)
      throws ALNTApplicationException, ALNTSystemException {
    masterDataService.saveRoleOrgRelationship(role, roleAuthDetails);
  } // end 2575

  public List loadAllOrganizations() throws ALNTApplicationException, ALNTSystemException {
    return loadAllOrganizations(false);
  }

  public List loadAllOrganizations(Boolean masterData)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadAllOrganizations(masterData);
  }

  public List loadOrganizations() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadOrganizations();
  }

  public List loadAllOrganizationsName() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadAllOrganizationsName();
  }

  public Organization saveOrganization(Organization organization)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.saveOrganization(organization);
  }

  public Organization loadByOrganizationId(Long objId)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadByOrganizationId(objId);
  }

  public Organization loadByOrganizationName(String orgName)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadByOrganizationName(orgName);
  }

  public boolean removeOrganizationById(Long objId) {
    boolean exists = true;
    boolean deleted = false;
    try {
      Organization idObj = masterDataService.loadByOrganizationId(objId);
      if ((idObj.getChildren() != null && idObj.getChildren().size() > 0)
          || (idObj.getProcessList() != null && idObj.getProcessList().size() > 0)
          || (idObj.getProjectList() != null && idObj.getProjectList().size() > 0)
          || (idObj.getObjectiveList() != null && idObj.getObjectiveList().size() > 0)
          || (idObj.getComplianceList() != null && idObj.getComplianceList().size() > 0)
          || (idObj.getRiskList() != null && idObj.getRiskList().size() > 0)) exists = false;
      if (exists) {
        List lst =
            relationDataService.load6NPnonDeletedRelationship(
                idObj.getId(), CommonConstants.Organization);
        if (lst != null && lst.size() > 0) exists = false;
      }
      if (exists) {
        masterDataService.removeOrganization(idObj);
        deleted = true;
      }
    } catch (ALNTSystemException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationById ", e.getMessage());

    } catch (ALNTApplicationException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationById ", e.getMessage());
    }
    return deleted;
  }

  public boolean removeOrganizationByName(String objName) {
    boolean exists = true;
    boolean deleted = false;
    try {
      Organization idObj = masterDataService.loadByOrganizationName(objName);
      if ((idObj.getChildren() != null && idObj.getChildren().size() > 0)
          || (idObj.getProcessList() != null && idObj.getProcessList().size() > 0)
          || (idObj.getProjectList() != null && idObj.getProjectList().size() > 0)
          || (idObj.getObjectiveList() != null && idObj.getObjectiveList().size() > 0)
          || (idObj.getComplianceList() != null && idObj.getComplianceList().size() > 0)
          || (idObj.getRiskList() != null && idObj.getRiskList().size() > 0)) exists = false;
      if (exists) {
        List lst =
            relationDataService.load6NPnonDeletedRelationship(
                idObj.getId(), CommonConstants.Organization);
        if (lst != null && lst.size() > 0) exists = false;
      }
      if (exists) {
        masterDataService.removeOrganization(idObj);
        deleted = true;
      }
    } catch (ALNTSystemException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationByName ", e.getMessage());

    } catch (ALNTApplicationException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationByName ", e.getMessage());
    }
    return deleted;
  }

  public boolean removeOrganizationByObject(Organization idObj) {
    boolean exists = true;
    boolean deleted = false;
    try {
      // RnlOrganization idObj = masterDataService.loadByOrganizationName(objName);
      if ((idObj.getChildren() != null && idObj.getChildren().size() > 0)
          || (idObj.getProcessList() != null && idObj.getProcessList().size() > 0)
          || (idObj.getProjectList() != null && idObj.getProjectList().size() > 0)
          || (idObj.getObjectiveList() != null && idObj.getObjectiveList().size() > 0)
          || (idObj.getComplianceList() != null && idObj.getComplianceList().size() > 0)
          || (idObj.getRiskList() != null && idObj.getRiskList().size() > 0)) exists = false;
      if (exists) {
        List lst =
            relationDataService.load6NPnonDeletedRelationship(
                idObj.getId(), CommonConstants.Organization);
        if (lst != null && lst.size() > 0) exists = false;
      }
      if (exists) {
        masterDataService.removeOrganization(idObj);
        deleted = true;
      }
    } catch (ALNTSystemException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationByObject ", e.getMessage());

    } catch (ALNTApplicationException e) {
      ALNTLogger.error(this.getClass().getName(), "removeOrganizationByObject ", e.getMessage());
    }
    return deleted;
  }

  public List getLookUp(Locale locale, String type)
      throws ALNTApplicationException, ALNTSystemException {
    List values = null;
    values = lookupService.loadLookupByType(type);
    return values;
  }

  public List getLookUpByCode(Locale locale, String type, Long code)
      throws ALNTApplicationException, ALNTSystemException {
    List values = null;
    values = lookupService.loadLookupByCodeNType(code.longValue(), type);
    return values;
  }

  public LookUp getLookUpByMeaning(Locale locale, String type, String meaning)
      throws ALNTApplicationException, ALNTSystemException {
    LookUp values = null;
    values = lookupService.getLookupByTypeMeaning(type, meaning);
    return values;
  }

  // Charanjit Singh Dhaliwal
  public List getChildOrganization(List selOrgList)
      throws ALNTApplicationException, ALNTSystemException {
    List childList = new ArrayList();
    Iterator selOrgItr = selOrgList.iterator();
    while (selOrgItr.hasNext()) {
      Organization selOrgDtls = (Organization) selOrgItr.next();
      if (!childList.contains(selOrgDtls)) childList.add(selOrgDtls);
      if (selOrgDtls.getChildren() != null && selOrgDtls.getChildren().size() > 0) {
        getChildren(selOrgDtls, childList);
      }
    }
    return childList;
  }
  // Charanjit Singh Dhaliwal
  public void getChildren(Organization childObj, List childList) {
    if (childObj.getChildren() != null && childObj.getChildren().size() > 0) {
      Iterator childOrgItr = childObj.getChildren().iterator();
      while (childOrgItr.hasNext()) {
        Organization childOrgDtls = (Organization) childOrgItr.next();
        if (!childList.contains(childOrgDtls)) childList.add(childOrgDtls);
        if (childOrgDtls.getChildren() != null && childOrgDtls.getChildren().size() > 0) {
          getChildren(childOrgDtls, childList);
        }
      }
    }
    // return childList;
  }

  // Charanjit Singh Dhaliwal
  public List getSecondLevelOrganizations() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.getSecondLevelOrganizations();
  }

  // Charanjit Singh Dhaliwal
  public List getTopLevelOrganizations() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.getTopLevelOrganizations();
  }

  public List getAllFacilities() throws ALNTApplicationException, ALNTSystemException {
    return facilityService.loadFacilities();
  }

  public List loadOrganizationsWithoutRoot() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadOrganizationsWithoutRoot();
  }

  public Organization loadAssignDeatils(Organization organization)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadAssignDeatils(organization, true);
  }

  public List loadRootNodes() throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadRootNodes();
  }

  public Organization loadAssignRelnId(Organization organization)
      throws ALNTApplicationException, ALNTSystemException {
    return masterDataService.loadAssignRelnId(organization);
  }
}