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 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);
  }
  // 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);
    }
  }
 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;
 }
Esempio n. 5
0
  public static boolean isUserLocked(Long value, Map<String, String> mapConnectorParams) {
    ALNTLogger.debug(LDAPUtility.class.getName(), "isUserLocked()", "entered for value : " + value);
    boolean accountLocked = false;
    int UF_ACCOUNTDISABLE = 0x0002;
    String encodePwd =
        LDAPUtility.getLdapColumnName(
            mapConnectorParams, CommonConstants.LDAP_PWD_ENCODING_COLUMN_NAME);
    boolean pwdEncodeEnabled = true;

    if (StringUtils.isNotNullOrNotEmpty(encodePwd) && encodePwd.equalsIgnoreCase("No")) {
      pwdEncodeEnabled = false;
    } else {

      pwdEncodeEnabled = true;
    }

    if (pwdEncodeEnabled) {

      if (value != null && ((value & UF_ACCOUNTDISABLE) == UF_ACCOUNTDISABLE)) {
        accountLocked = true;
      }
    } else {
      if (value != null && (value.intValue() == 1)) accountLocked = true;
      else accountLocked = false;
    }
    ALNTLogger.debug(
        LDAPUtility.class.getName(), "isUserLocked()", "accountLocked : " + accountLocked);
    return accountLocked;
  }
  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);
  }
  // @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 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 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 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;
  }
Esempio n. 11
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 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 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 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 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 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 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 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 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;
 }
Esempio n. 21
0
 public RemediationLookup getRemediatedLookup(final String objType, final String objId) {
   if (jdbcTemplate == null) {
     ALNTLogger.info(
         RiskAnalyticsDAO.class.getName(),
         "getRemediatedLookup():",
         new StringBuilder(
             "*** RiskAnalyticsDAO not initiated.  Return empty RemediationLookup object"));
     // System.out.println("*** RiskAnalyticsDAO not initiated.  Return empty RemediationLookup
     // object");
     return new RemediationLookup();
   }
   return (RemediationLookup)
       jdbcTemplate.query(
           GET_REMED_OBJS_SQL,
           new PreparedStatementSetter() {
             public void setValues(PreparedStatement ps) throws SQLException {
               ps.setString(1, objType);
               ps.setString(2, objId);
             }
           },
           new ResultSetExtractor() {
             public Object extractData(ResultSet rs) throws SQLException {
               RemediationLookup remedMap = new RemediationLookup();
               while (rs.next()) {
                 String sysId = rs.getString(1);
                 String attrValue = rs.getString(2);
                 String attrName = rs.getString(3);
                 String element = null;
                 if ("Action".equals(attrName)) {
                   element = attrName;
                   attrName = "id";
                 } else {
                   element = "AuthBy";
                   attrName = attrName.substring(0, 1).toLowerCase() + attrName.substring(1);
                 }
                 ALNTLogger.info(
                     RiskAnalyticsDAO.class.getName(),
                     "extractData():",
                     new StringBuilder(
                         "add remed obj "
                             + sysId
                             + " "
                             + element
                             + " "
                             + attrName
                             + " "
                             + attrValue));
                 // System.out.println("add remed obj " + sysId + " " + element + " " + attrName +
                 // " " + attrValue);
                 remedMap.add(sysId, element, attrName, attrValue);
               }
               return remedMap;
             }
           });
 }
 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;
 }
  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();
    }
  } //
 // 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;
 }
Esempio n. 25
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 String getReqClosingWSPasswd() {
   String value = "";
   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;
 }
 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 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 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;
 }