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;
  }
  // @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());
    }
  }
  // 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);
    }
  }
Exemplo n.º 4
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());
    }
  }
  public void setReportParameterValues(Map parameterValues) {
    ALNTLogger.info(
        this.getClass().getName(),
        "setReportParameterValues()",
        (new StringBuilder("Parameter Value")).append(parameterValues).toString());
    Object accMapParams = parameterValues.get("REPORT_PARAMETERS_MAP");

    p_Id = (String) parameterValues.get("p_Id");
    ALNTLogger.info(
        this.getClass().getName(),
        "setReportParameterValues()",
        (new StringBuilder("p_Id")).append(p_Id).toString());

    Object reportObjLocal = parameterValues.get("REPORT_LOCALE");
    this.parameterTest = parameterValues;
    try {
      ds = new CertifyActionByApproverDataSource(parameterTest);
    } catch (Exception e) {
      ALNTLogger.error(
          this.getClass().getName(),
          "setReportParameterValues(): Error in initializing data source",
          e);
    }

    parameterValues.put("REPORT_DATA_SOURCE", ds);
  }
  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 void setReportParameterValues(Map parameterValues) {
    ALNTLogger.info(
        ActionItemAuditTrailDataSourceService.class.getName(),
        "setReportParameterValues()",
        (new StringBuilder("Parameter Value")).append(parameterValues).toString());

    if (parameterValues.get("assessId") != null) {
      p_assessIdStr = parameterValues.get("assessId").toString();
      p_assessId = Long.parseLong(p_assessIdStr);
      ALNTLogger.info(
          ActionItemAuditTrailDataSourceService.class.getName(),
          "setReportParameterValues()",
          (new StringBuilder("assessId ")).append(p_assessId).toString());
    }

    this.parameterTest = parameterValues;
    try {
      ds = new ActionItemAuditTrailDataSource(parameterTest);
    } catch (Exception e) {
      ALNTLogger.error(
          ActionItemAuditTrailDataSourceService.class.getName(),
          "setReportParameterValues(): Error in initializing data source",
          e);
    }
    parameterValues.put("REPORT_DATA_SOURCE", ds);
  }
 public String fetchUser(HttpServletRequest request) {
   ALNTLogger.info(
       "ALNTHttpHeaderValidator".getClass().getName(),
       "fetchUser",
       "fetching user using HTTP header");
   String headerName = "";
   String encodedHeaderValue = "";
   String userId = "";
   Enumeration headerNames = request.getHeaderNames();
   while (headerNames.hasMoreElements()) {
     headerName = (String) headerNames.nextElement();
     if (headerName.equalsIgnoreCase(CommonConstants.CALLING_APP_LOGGEDIN_USER)) {
       encodedHeaderValue = request.getHeader(headerName);
       break;
     }
   }
   if (encodedHeaderValue != null && !encodedHeaderValue.equals("")) {
     try {
       userId = EncodeDecodeUtil.decodeBase64(encodedHeaderValue);
     } catch (Exception e) {
       ALNTLogger.error("ALNTHttpHeaderValidator".getClass().getName(), "fetchUser", e, true);
       userId = "";
     }
   }
   return userId;
 }
 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 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 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 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 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;
 }
 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 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 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;
 }
Exemplo n.º 18
0
 public List<String> getMitigatedRisks(final String objType, final String objId) {
   RnlCustomReportService rnlCustomReportService = new RnlCustomReportService();
   List<String> mitList = new ArrayList<String>();
   try {
     for (Long id : rnlCustomReportService.getMitigatedRisks(objType, objId)) {
       mitList.add(Long.toString(id));
     }
   } catch (Exception aEx) {
     ALNTLogger.error(this.getClass().getName(), "getMitigatedRisks", aEx, true);
   }
   return mitList;
 }
 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 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 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 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;
  }
Exemplo n.º 23
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());
    }
  }
  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 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;
 }
 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 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 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 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;
 }
Exemplo n.º 30
0
 public String fetchUser(HttpServletRequest request) {
   ALNTLogger.info(
       "ALNTEncodedURLValidator".getClass().getName(),
       "fetchUser",
       "fetching user using Encoded URL");
   String userId = "";
   String encodedUserId =
       request.getQueryString().contains(CommonConstants.CALLING_APP_LOGGEDIN_USER)
           ? request.getParameter(CommonConstants.CALLING_APP_LOGGEDIN_USER)
           : null;
   if (StringUtils.isNotNullOrNotEmpty(encodedUserId)) {
     try {
       userId = EncodeDecodeUtil.decodeBase64(encodedUserId);
     } catch (Exception e) {
       ALNTLogger.error("ALNTEncodedURLValidator".getClass().getName(), "fetchUser", e, true);
       userId = "";
     }
   }
   return userId;
 }