/**
* This method will read all the report related data (queries etc) and fills
* it to MemfisReportDom. This MemfisReportDom will be stored in a MemfisMap
* with the report ID as a Key. Assumption is that all the records will be
* selected in a single query with proper grouping.
* <DT><B>History: </B>
* <DD>08-01-2006
*/
public static void populateReports() {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hReportsTemp = new HashMap();
String strQuery = "SELECT REPORT_ID, QUERY_ID, REPORT_NAME, XML_FILE_NAME, REPORT_INFO1, REPORT_INFO2, REPORT_INFO3 FROM " + MemfisConstants.MEMFIS_QUALIFIER + ".MEMFIS_REPORT_TBLE ORDER BY REPORT_ID WITH UR";
MemfisReportDom objReportDom = new MemfisReportDom();
String strReportID = "";
CachedRowSet rs = null;
try {
//CHANGES MADE TO PASS SYSTEM ID AS BLANK AND CONTROL VALUE AS 0;
// CHANGES DONE BY PRABHU 07-04-2009
rs = MemfisDAO.getCachedRowSet(strQuery, "", 0, "");
while (rs.next()) {
if (!strReportID.equals(MemfisGenUtility.emptyString(rs.getString("REPORT_ID")))) {
if (!"".equals(strReportID)) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : Report " + strReportID + " populated." + MemfisDebugUtil.printClassAttribute(objReportDom));
hReportsTemp.put(strReportID, objReportDom);
}
strReportID = MemfisGenUtility.emptyString(rs.getString("REPORT_ID"));
objReportDom = new MemfisReportDom();
objReportDom.setReportId(MemfisGenUtility.emptyString(rs.getString("REPORT_ID")));
objReportDom.setReportName(MemfisGenUtility.emptyString(rs.getString("REPORT_NAME")));
objReportDom.setReportInfo1(MemfisGenUtility.emptyString(rs.getString("REPORT_INFO1")));
objReportDom.setReportInfo2(MemfisGenUtility.emptyString(rs.getString("REPORT_INFO2")));
objReportDom.setReportInfo3(MemfisGenUtility.emptyString(rs.getString("REPORT_INFO3")));
}
objReportDom.getMemfisQueryDom().add(MemfisGenUtility.emptyString(rs.getString("QUERY_ID")));
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : Report " + strReportID + " populated." + MemfisDebugUtil.printClassAttribute(objReportDom));
hReportsTemp.put(strReportID, objReportDom);
} catch (SQLException se) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : SQLException Occured");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : Exception Occured");
} finally {
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_REPORTS, hReportsTemp);
try {
if (rs != null) {
rs.close();
}
} catch (SQLException se) {
se.printStackTrace();
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : OUT");
}
}
/**
* This method will read all the report related data (queries etc) from
* MEMFIS_REP_QRY table.
* <DT><B>History: </B>
* <DD>08-01-2006
*/
public static void populateQueris() {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateQueris() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hQueriesTemp = new HashMap();
String strQuery = "SELECT QUERY_ID, QUERY_VALUE , MAX_ROWS, XML_PARNT_NOD1, XML_PARNT_NOD2, XML_PARNT_NOD3, XML_PARNT_NOD4 FROM " + MemfisConstants.MEMFIS_QUALIFIER + ".MEMFIS_REP_QRY WITH UR";
CachedRowSet rs = null;
String strTemp = null;
try {
//CHANGES MADE TO PASS SYSTEM ID AS BLANK AND CONTROL VALUE AS 0;
// CHANGES DONE BY PRABHU 07-04-2009
rs = MemfisDAO.getCachedRowSet(strQuery, "", 0, "");
while (rs.next()) {
MemfisQueryDom objQueryDom = new MemfisQueryDom();
String strQueryId = MemfisGenUtility.emptyString(rs.getString("QUERY_ID"));
objQueryDom.setQueryId(strQueryId);
strTemp = MemfisGenUtility.emptyString(rs.getString("QUERY_VALUE"));
//System.out.println("BEFORE : " + strTemp);
//strTemp = MemfisDOMGenerator.replaceAll(strTemp, "\"", "'");
strTemp = MemfisDOMGenerator.replaceAll(strTemp, "$QUALIFIER$", MemfisConstants.MEMFIS_QUALIFIER);
//Use hard code qualifier : GVRBVCA as Palani Required 2008.11.17 19:06
//strTemp = MemfisDOMGenerator.replaceAll(strTemp, "$QUALIFIER$", "GVRBVCA");
//System.out.println("AFTER : " + strTemp);
int iMaxRows = rs.getInt("MAX_ROWS");
if (strTemp.toUpperCase().indexOf("FETCH") == -1 && iMaxRows > 0) {
strTemp += (" FETCH FIRST " + iMaxRows + " ROWS ONLY");
}
strTemp += " WITH UR";
objQueryDom.setQueryValue(strTemp);
objQueryDom.setMaxRows(iMaxRows);
objQueryDom.setXMLParentNode1(MemfisGenUtility.emptyString(rs.getString("XML_PARNT_NOD1")));
objQueryDom.setXMLParentNode2(MemfisGenUtility.emptyString(rs.getString("XML_PARNT_NOD2")));
objQueryDom.setXMLParentNode3(MemfisGenUtility.emptyString(rs.getString("XML_PARNT_NOD3")));
objQueryDom.setXMLParentNode4(MemfisGenUtility.emptyString(rs.getString("XML_PARNT_NOD4")));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateReports() : Query " + strQueryId + " populated." + MemfisDebugUtil.printClassAttribute(objQueryDom));
hQueriesTemp.put(strQueryId, objQueryDom);
}
} catch (SQLException se) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateQueris() : SQLException Occured " + se);
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateQueris() : Exception Occured " + e);
} finally {
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_QUERIES, hQueriesTemp);
try {
if (rs != null) {
rs.close();
}
} catch (SQLException se) {
se.printStackTrace();
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateQueris() : OUT");
}
}
/**
* This method will read all the XSL templates for reports and create
* transformer for each xsl templates . This transformer will be stored in a
* MemfisMap with the XSL file name as a Key.
* <DT><B>History: </B>
* <DD>08-01-2006
*/
public static void populateXSLTemplates() {
try {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
domfac.setNamespaceAware(true);
DocumentBuilder dombuilder = domfac.newDocumentBuilder();
HashMap hmTemplatesNew = new HashMap();
ArrayList arrFileList = getFileNameList(MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_PDF_TEMPLATE_PATH);
if (arrFileList.size() == 0) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : OUT : No template found.");
return;
}
String strFileName = "";
TransformerFactory factory = TransformerFactory.newInstance();
for (int i = 0; i < arrFileList.size(); i++) {
strFileName = (String) arrFileList.get(i);
if (strFileName.toUpperCase().endsWith(".XSL")) {
try {
File file = new File(strFileName);
Document doc = dombuilder.parse(file);
Transformer transformer = factory.newTransformer(new DOMSource(doc, MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_PDF_TEMPLATE_PATH + "/"));
transformer.setParameter("versionParam", "2.0");
strFileName = strFileName.toUpperCase();
String strName = strFileName.substring(strFileName.lastIndexOf("/") + 1, strFileName.lastIndexOf(".XSL"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : PDF Template " + strName + " is loaded.");
hmTemplatesNew.put(strName, transformer);
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : " + e);
}
}
}
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_XSL_TEMPLATES, hmTemplatesNew);
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : OUT");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateTemplates() : " + e);
}
}
/**
* This method will read all the XML templates for reports and create
* document for each xml templates . This transformer will be stored in a
* MemfisMap with the XMLl file name as a Key.
* <DT><B>History: </B>
* <DD>08-01-2006
*/
public static void populateXMLTemplates() {
try {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
domfac.setNamespaceAware(true);
DocumentBuilder dombuilder = domfac.newDocumentBuilder();
HashMap hmTemplatesNew = new HashMap();
ArrayList arrFileList = getFileNameList(MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_PDF_TEMPLATE_PATH);
String strFileName = "";
if (arrFileList.size() == 0) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : OUT : No template found.");
return;
}
for (int i = 0; i < arrFileList.size(); i++) {
strFileName = (String) arrFileList.get(i);
if (strFileName.toUpperCase().endsWith(".XML")) {
try {
File file = new File(strFileName);
Document doc = dombuilder.parse(file);
strFileName = strFileName.toUpperCase();
String strName = strFileName.substring(strFileName.lastIndexOf("/") + 1, strFileName.lastIndexOf(".XML"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : XML Template " + strName + " is loaded.");
hmTemplatesNew.put(strName, doc);
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : File " + strFileName + " : " + e);
}
}
}
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_XML_TEMPLATES, hmTemplatesNew);
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : OUT");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateXMLTemplates() : " + e);
}
}
/**
* This method will read all the VO for MLI mapping and create MLIView for each xml .
* This MLIView will be stored in a MemfisMap with the XML file name as a Key.
* <DT><B>History:</B><DD> 06-17-2008
*/
public static void populateViewMapping() {
try {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateViewMapping() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hmMLIViewNew = new HashMap();
ParseMappingXMLToVO.populateMLIMappingTemplate(MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_MLI_VIEW_MAPPING_PATH, hmMLIViewNew);
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_MLI_VIEW_MAPPING, hmMLIViewNew);
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateViewMapping() : OUT");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateViewMapping() : " + e);
}
}
/**
* This method is used to get an ArrayList of files' name including path
*
* @param strFolderName
* String
* @return ArraList of files' name(including path) within the folder
* <DT><B>History: </B>
* <DD>08-01-2006
*/
private static ArrayList getFileNameList(String strFolderName) {
ArrayList arr = new ArrayList();
File file = new File(strFolderName);
String[] filesAndDir = file.list();
for (int i = 0; filesAndDir != null && i < filesAndDir.length; i++) {
File filesAndDir_file = new File(strFolderName + "/" + filesAndDir[i]);
if (filesAndDir_file.isDirectory()) {
arr.addAll(getFileNameList(strFolderName + "/" + filesAndDir[i]));
} else if (filesAndDir_file.isFile()) {
arr.add(strFolderName + "/" + filesAndDir[i]);
}
}
return arr;
}
/**
* This method is used to populate memfis system settings
* <DT><B>History: </B>
* <DD>08-01-2006
*/
public static void populateMemfisSystemSettings() {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
CachedRowSet objCachedRowSet = null;
try {
String DB_MEMFIS_SYSTEM_SETTINGS = "SELECT CTRL_1, KEY_NAME, VALUE FROM " + MemfisConstants.MEMFIS_QUALIFIER + "." + "MEMFIS_PARAM_TBLE WHERE SYSTEM='00' WITH UR";
//CHANGES MADE TO PASS SYSTEM ID AS BLANK AND CONTROL VALUE AS 0;
// CHANGES DONE BY PRABHU 07-04-2009
objCachedRowSet = MemfisDAO.getCachedRowSet(DB_MEMFIS_SYSTEM_SETTINGS, "", 0, "");
String strKeyName = "";
HashMap hmMULTI_ENCODE = new HashMap();
while (objCachedRowSet.next()) {
strKeyName = MemfisGenUtility.emptyString(objCachedRowSet.getString("KEY_NAME"));
if (strKeyName.equals("")) {
continue;
} else if (strKeyName.equalsIgnoreCase("VC_SYSTEM_ID")) {
MemfisConstants.VC_SYSTEM_ID = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : VC_SYSTEM_ID has been populated : " + MemfisConstants.VC_SYSTEM_ID);
} else if (strKeyName.equalsIgnoreCase("MF_SYSTEM_ID")) {
MemfisConstants.MF_SYSTEM_ID = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : MF_SYSTEM_ID has been populated : " + MemfisConstants.MF_SYSTEM_ID);
} else if (strKeyName.equalsIgnoreCase("SB_SYSTEM_ID")) {
MemfisConstants.SB_SYSTEM_ID = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : SB_SYSTEM_ID has been populated : " + MemfisConstants.SB_SYSTEM_ID);
} else if (strKeyName.equalsIgnoreCase("IP_SYSTEM_ID")) {
MemfisConstants.IP_SYSTEM_ID = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : IP_SYSTEM_ID has been populated : " + MemfisConstants.IP_SYSTEM_ID);
} else if (strKeyName.equalsIgnoreCase("WM_SYSTEM_ID")) {
MemfisConstants.WM_SYSTEM_ID = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : WM_SYSTEM_ID has been populated : " + MemfisConstants.WM_SYSTEM_ID);
} else if (strKeyName.equalsIgnoreCase("ACCESS_LOG_ENABLED")) {
MemfisConstants.ACCESS_LOG_ENABLED = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1")).equalsIgnoreCase("true");
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : ACCESS_LOG_ENABLED has been populated : " + MemfisConstants.ACCESS_LOG_ENABLED);
} else if (strKeyName.equalsIgnoreCase("DATE_FORMAT_INPUT")) {
MemfisConstants.DATE_FORMAT_INPUT = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisConstants.DATE_LOCALE = MemfisConstants.DATE_FORMAT_INPUT;
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DATE_FORMAT_INPUT has been populated : " + MemfisConstants.DATE_FORMAT_INPUT);
} else if (strKeyName.equalsIgnoreCase("DATE_FORMAT_DISPLAY")) {
MemfisConstants.DATE_FORMAT_DISPLAY = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DATE_FORMAT_DISPLAY has been populated : " + MemfisConstants.DATE_FORMAT_DISPLAY);
} else if (strKeyName.equalsIgnoreCase("CACHE_REFRESH_INTERVAL")) {
MemfisConstants.CACHE_REFRESH_INTERVAL = MemfisGenUtility.checkLong(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : CACHE_REFRESH_INTERVAL has been populated : " + MemfisConstants.CACHE_REFRESH_INTERVAL);
} else if (strKeyName.equalsIgnoreCase("ECRM_URL")) {
MemfisConstants.ECRM_URL = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : ECRM_URL has been populated : " + MemfisConstants.ECRM_URL);
} else if (strKeyName.equalsIgnoreCase("AI_URL")) {
MemfisConstants.AI_URL = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : AI_URL has been populated : " + MemfisConstants.AI_URL);
} else if (strKeyName.equalsIgnoreCase("BLOCK_ACC_WSDL_URL")) {
MemfisConstants.BLK_ACC_LIST_WSDL_URL = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : BLK_ACC_LIST_WSDL_URL has been populated : " + MemfisConstants.BLK_ACC_LIST_WSDL_URL);
} else if (strKeyName.equalsIgnoreCase("SB_ORDER_INPUT_WSDL_URL")) {
MemfisConstants.SB_ORDER_INPUT_WSDL_URL = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : SB_ORDER_INPUT_WSDL_URL has been populated : " + MemfisConstants.SB_ORDER_INPUT_WSDL_URL);
} else if (strKeyName.equalsIgnoreCase("SB_AGREEMENT_FLAG_WSDL_URL")) {
MemfisConstants.SB_AGREEMENT_FLAG_WSDL_URL = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : SB_ORDER_INPUT_WSDL_URL has been populated : " + MemfisConstants.SB_AGREEMENT_FLAG_WSDL_URL);
//21Dec2011 Mahesh, Added for Direct DB
} else if (strKeyName.equalsIgnoreCase("DirectDB_TimeOut")) {
MemfisConstants.DirectDB_TimeOut = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DirectDB_TimeOut has been populated : " + MemfisConstants.DirectDB_TimeOut);
} else if (strKeyName.equalsIgnoreCase("DirectDB_Activate")) {
MemfisConstants.DirectDB_Activate = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DirectDB_Activate has been populated : " + MemfisConstants.DirectDB_Activate);
} else if (strKeyName.equalsIgnoreCase("AVAILABLE_DB_CTRL_1")) {
//$$-$$ FIX Prabhu
MemfisConstants.AVAILABLE_DB_CTRL_1 = new ArrayList();
String strValue = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
StringTokenizer st = new StringTokenizer(strValue, "_");
while (st.hasMoreElements()) {
MemfisConstants.AVAILABLE_DB_CTRL_1.add(st.nextElement());
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : AVAILABLE_DB_CTRL_1 has been populated : " + MemfisConstants.AVAILABLE_DB_CTRL_1);
}
//START,add by vicky, 2011-08-22
else if (strKeyName.equalsIgnoreCase("DOCUMENTUM_URL_1")) {
MemfisConstants.DOCUMENTUM_URL_1 = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DOCUMENTUM_URL_1 has been populated : " + MemfisConstants.DOCUMENTUM_URL_1);
}
else if (strKeyName.equalsIgnoreCase("DOCUMENTUM_URL_2")) {
MemfisConstants.DOCUMENTUM_URL_2 = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DOCUMENTUM_URL_2 has been populated : " + MemfisConstants.DOCUMENTUM_URL_2);
}
//END,add by Vicky, 2011-08-22
//*****MULLT-REGION CHANGES - 27-04-2009*****
//BIZ GROUP ADDED
else if (strKeyName.equalsIgnoreCase("AVAILABLE_REGION")) {
//$$-$$ FIX Prabhu
MemfisConstants.AVAILABLE_REGION = new ArrayList();
String strValue = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
StringTokenizer st = new StringTokenizer(strValue, "_");
while (st.hasMoreElements()) {
MemfisConstants.AVAILABLE_REGION.add(st.nextElement());
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : AVAILABLE_REGION has been populated : " + MemfisConstants.AVAILABLE_REGION);
} else if (strKeyName.equalsIgnoreCase("LOCALE_LANGUAGE")) {
MemfisConstants.LOCALE_LANGUAGE = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : LOCALE_LANGUAGE has been populated : " + MemfisConstants.LOCALE_LANGUAGE);
} else if (strKeyName.equalsIgnoreCase("LOCALE_COUNTRY")) {
MemfisConstants.strLOCALE_COUNTRY = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
/*
* } else if
* (strKeyName.equalsIgnoreCase("MF_TRANSACTION_NAME")) {
* MemfisConstants.MF_TRANSACTION_NAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.MF_TRANSACTION_NAME =
* MemfisConstants.MF_TRANSACTION_NAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* MF_TRANSACTION_NAME has been populated : " +
* MemfisConstants.MF_TRANSACTION_NAME); } else if
* (strKeyName.equalsIgnoreCase("MF_COBOLPROGRAMNAME")) {
* MemfisConstants.MF_COBOLPROGRAMNAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.MF_COBOLPROGRAMNAME =
* MemfisConstants.MF_COBOLPROGRAMNAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* MF_COBOLPROGRAMNAME has been populated : " +
* MemfisConstants.MF_COBOLPROGRAMNAME); } else if
* (strKeyName.equalsIgnoreCase("SB_TRANSACTION_NAME")) {
* MemfisConstants.SB_TRANSACTION_NAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.SB_TRANSACTION_NAME =
* MemfisConstants.SB_TRANSACTION_NAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* SB_TRANSACTION_NAME has been populated : " +
* MemfisConstants.SB_TRANSACTION_NAME); } else if
* (strKeyName.equalsIgnoreCase("SB_COBOLPROGRAMNAME")) {
* MemfisConstants.SB_COBOLPROGRAMNAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.SB_COBOLPROGRAMNAME =
* MemfisConstants.SB_COBOLPROGRAMNAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* SB_COBOLPROGRAMNAME has been populated : " +
* MemfisConstants.SB_COBOLPROGRAMNAME); } else if
* (strKeyName.equalsIgnoreCase("IP_TRANSACTION_NAME")) {
* MemfisConstants.IP_TRANSACTION_NAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.IP_TRANSACTION_NAME =
* MemfisConstants.IP_TRANSACTION_NAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* IP_TRANSACTION_NAME has been populated : " +
* MemfisConstants.IP_TRANSACTION_NAME); } else if
* (strKeyName.equalsIgnoreCase("IP_COBOLPROGRAMNAME")) {
* MemfisConstants.IP_COBOLPROGRAMNAME =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisInterfaceConstants.IP_COBOLPROGRAMNAME =
* MemfisConstants.IP_COBOLPROGRAMNAME;
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings() :
* IP_COBOLPROGRAMNAME has been populated : " +
* MemfisConstants.IP_COBOLPROGRAMNAME);
*/
} else if (strKeyName.equalsIgnoreCase("META_CONTENT_TYPE")) {
MemfisConstants.META_CONTENT_TYPE = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : META_CONTENT_TYPE has been populated : " + MemfisConstants.META_CONTENT_TYPE);
} else if (strKeyName.equalsIgnoreCase("CONTENT_TYPE")) {
MemfisConstants.CONTENT_TYPE = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : CONTENT_TYPE has been populated : " + MemfisConstants.CONTENT_TYPE);
} else if (strKeyName.equalsIgnoreCase("ENCODE2")) {
MemfisConstants.ENCODE2 = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : ENCODE2 has been populated : " + MemfisConstants.ENCODE2);
/*
* } else if
* (strKeyName.equalsIgnoreCase("MEMFIS_PDF_TITLE")) {
* MemfisConstants.MEMFIS_PDF_TITLE =
* MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
* MemfisLogger.logMessage(MemfisLogger.FATAL, "",
* "MemfisMasterLookup : populateMemfisSystemSettings()
* :MEMFIS_PDF_TITLE has been populated : " +
* MemfisConstants.MEMFIS_PDF_TITLE);
*/
} else if (strKeyName.equalsIgnoreCase("COUNTRY_CODE_LENGTH")) {
try {
MemfisConstants.COUNTRY_CODE_LENGTH = objCachedRowSet.getInt("VALUE1");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : COUNTRY_CODE_LENGTH : Error : " + e.toString());
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : COUNTRY_CODE_LENGTH has been populated : " + MemfisConstants.COUNTRY_CODE_LENGTH);
} else if (strKeyName.equalsIgnoreCase("RC_CODE_LENGTH")) {
try {
MemfisConstants.RC_CODE_LENGTH = objCachedRowSet.getInt("VALUE1");
MemfisInterfaceConstants.RC_CODE_LENGTH = MemfisConstants.RC_CODE_LENGTH;
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : RC_CODE_LENGTH : Error : " + e.toString());
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : RC_CODE_LENGTH has been populated : " + MemfisConstants.RC_CODE_LENGTH);
} else if (strKeyName.equalsIgnoreCase("AO_CODE_LENGTH")) {
try {
MemfisConstants.AO_CODE_LENGTH = objCachedRowSet.getInt("VALUE1");
MemfisInterfaceConstants.AO_CODE_LENGTH = MemfisConstants.AO_CODE_LENGTH;
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : AO_CODE_LENGTH : Error : " + e.toString());
}
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : AO_CODE_LENGTH has been populated : " + MemfisConstants.AO_CODE_LENGTH);
} else if (strKeyName.equalsIgnoreCase("ENCODE")) {
String strCtrl1 = MemfisGenUtility.emptyString(objCachedRowSet.getString("CTRL_1"));
String strValue = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
if ("0".equals(strCtrl1)) {
MemfisConstants.ENCODE = strValue;
}
hmMULTI_ENCODE.put(strCtrl1, strValue);
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : " + strCtrl1 + ":ENCODE has been populated : " + strValue);
} else if (strKeyName.equalsIgnoreCase("VALLAR_COUNTRY_LIST")) {
MemfisConstants.VALLAR_COUNTRY_LIST = MemfisGenUtility.emptyString(objCachedRowSet.getString("VALUE1"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : VALLAR_COUNTRY_LIST has been populated : " + MemfisConstants.VALLAR_COUNTRY_LIST);
}
}
//START,add by vicky, 2011-08-22
if(!"".equals(MemfisConstants.DOCUMENTUM_URL_1))
{
MemfisConstants.DOCUMENTUM_URL = MemfisConstants.DOCUMENTUM_URL_1+MemfisConstants.DOCUMENTUM_URL_2;
}
//END,add by vicky, 2011-08-22
MemfisConstants.HM_MULTI_ENCODE = hmMULTI_ENCODE;
if (MemfisConstants.LOCALE_LANGUAGE != null && MemfisConstants.strLOCALE_COUNTRY != null) {
MemfisConstants.LOCALE_COUNTRY = new Locale(MemfisConstants.LOCALE_LANGUAGE, MemfisConstants.strLOCALE_COUNTRY);
MemfisConstants.DECIMAL_SEPARATOR = (new DecimalFormatSymbols(MemfisConstants.LOCALE_COUNTRY)).getDecimalSeparator();
MemfisInterfaceConstants.DECIMAL_SEPARATOR = MemfisConstants.DECIMAL_SEPARATOR;
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : LOCALE_COUNTRY has been populated : " + MemfisConstants.LOCALE_COUNTRY);
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : DECIMAL_SEPARATOR has been populated : " + MemfisConstants.DECIMAL_SEPARATOR);
}
MemfisDateFormater.resetDateFormater();
} catch (SQLException se) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MFMasterLookup : populateMFSystemSettings() : SQLException Occured : " + se.toString());
se.printStackTrace();
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MFMasterLookup : populateMFSystemSettings() : Exception Occured : " + e.toString());
e.printStackTrace();
} finally {
try {
if (objCachedRowSet != null) {
objCachedRowSet.close();
}
} catch (SQLException se) {
se.printStackTrace();
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateMemfisSystemSettings() : OUT");
}
}
/**
* This method is used to populate currency options
*
* @param strSystemId
* String
* @param strSQL
* String
* <DT><B>History: </B>
* <DD>08-01-2006
* @param strBizGroupID String - BizGroupID will have values as "F" or "C".
* @param strCtrl1 String - this is to avoid calling all control-1, refer VT32205770. By Leo, 2011-08-29
*/
public static void populateCurrency(String strBizGroupID, String strSystemId, String strSQL, String strCtrl1) {
HashMap hCurrency = MemfisCacheEntity.getFromCache(MemfisConstants.OSCACHE_MEMFIS_CURRENCY);
if (hCurrency == null) {
hCurrency = new HashMap();
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_CURRENCY, hCurrency);
}
HashMap hmCurrency = (HashMap)hCurrency.get(strBizGroupID + strSystemId);
if(hmCurrency==null){
hmCurrency = new HashMap();
}
CachedRowSet rs = null;
//By Leo, 2011-08-29, ArrayList arrCachedRowset = new ArrayList();
//By Leo, 2011-08-29, String strCtrl1 = "";
//By Leo, 2011-08-29, String NEW_SQL = strSQL;
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCurrency() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
try {
// Code changes done by Prabhu 07-04-2009
// Getting the CachedRowset ArrayList for the given SQL
//arrCachedRowset = MemfisDAO.getArrayOfCachedRowSet(strSQL, strSystemId, 0, strBizGroupID);
//By Leo, 2011-08-29, int iSize = MemfisConstants.AVAILABLE_DB_CTRL_1.size();
StringBuffer strOption = new StringBuffer();
//By Leo, 2011-08-29, for (int n = 0; n < iSize; n++) {
try {
//rs = (CachedRowSet) arrCachedRowset.get(n);
//$$-$$02-JUNE-2009
//By Leo, 2011-08-29, strSQL = MemfisGenUtility.replaceAll(NEW_SQL, "$CTRL1$", String.valueOf(MemfisConstants.AVAILABLE_DB_CTRL_1.get(n)));
//By Leo, 2011-08-29, rs = MemfisDAO.getCachedRowSet(strSQL, strSystemId, MemfisGenUtility.checkInteger(MemfisConstants.AVAILABLE_DB_CTRL_1.get(n)), strBizGroupID);
rs = MemfisDAO.getCachedRowSet(strSQL, strSystemId, MemfisGenUtility.checkInteger(strCtrl1), strBizGroupID);
strOption = new StringBuffer();
//By Leo, 2011-08-29, strCtrl1 = "";
while (rs.next()) {
String strNewCtrl1 = MemfisGenUtility.emptyString(rs.getString("CTRL_1"));
/*if (!strCtrl1.equalsIgnoreCase("") && !strCtrl1.equalsIgnoreCase(strNewCtrl1)) {
hmCurrency.put(strCtrl1 + ":" + MemfisConstants.FE_DROPDOWN_OPTIONS, strOption.toString());
strOption = new StringBuffer();
}*/
//By Leo, 2011-08-29, strCtrl1 = strNewCtrl1;
String strKey = MemfisGenUtility.emptyString(rs.getString("CURRENCY_CODE"));
ArrayList arrCurrency = new ArrayList();
String strShortCode = MemfisGenUtility.emptyString(rs.getString("SHORT_CODE"));
String strCcyName = MemfisGenUtility.emptyString(rs.getString("CCY_NAME"));
String strCcyPrecision = MemfisGenUtility.emptyString(rs.getString("CCY_PRECISION"));
String strLocalCcyName = MemfisLanguageUtils.getDecodedString(rs.getString("LOCAL_CCY_NAME"), strNewCtrl1);
String strRoundMethod = MemfisLanguageUtils.getDecodedString(rs.getString("ROUND_METHOD"), strNewCtrl1);
arrCurrency.add(strKey);
arrCurrency.add(strCcyName);
arrCurrency.add(strCcyPrecision);
arrCurrency.add(strShortCode);
arrCurrency.add(strLocalCcyName);
arrCurrency.add(strRoundMethod);
hmCurrency.put(strCtrl1 + ":" + strShortCode, arrCurrency);
strOption.append("<OPTION VALUE=\"");
strOption.append(strShortCode);
strOption.append("\" precision=\"");
strOption.append(strCcyPrecision);
strOption.append("\" CurrencyCharCode=\"");
strOption.append(strKey);
strOption.append("\">");
strOption.append(strKey);
strOption.append("</OPTION>");
}
hmCurrency.put(strCtrl1 + ":" + MemfisConstants.FE_DROPDOWN_OPTIONS, strOption.toString());
} catch (SQLException se) {
se.printStackTrace();
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "SQLException from populateCurrency() : " + se.toString());
} catch (Exception e) {
e.printStackTrace();
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "Exception while populateCurrency() : " + e.toString());
}
//By Leo, 2011-08-29, }
} catch (Exception e) {
e.printStackTrace();
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "Exception while populateCurrency() : " + e.toString());
} finally {
//Setting Key as FMM (Functional) or CMM (Conversion)
// like CMM - hmCurrency
hCurrency.put(strBizGroupID + strSystemId, hmCurrency);
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace();
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCurrency() : OUT");
}
}
/**
* This method populates all the records from the VC_COUNTRY table into * HashMap
*
* @param strSystemId : populates country codes for the given system ID.
* String
* @param strSQL
* String
* <DT><B>History: </B>
* <DD>08-01-2006
* @param strBizGroupID String - BizGroupID will have values as "F" or "C".
* @param strCtrl1 String - this is to avoid calling all control-1, refer VT32205770. By Leo, 2011-08-29
*/
public static void populateCountry(String strBizGroupID, String strSystemId, String strSQL, String strCtrl1) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMastersLookup : populateCountry() IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hCountry = MemfisCacheEntity.getFromCache(MemfisConstants.OSCACHE_MEMFIS_COUNTRY);
if (hCountry == null) {
hCountry = new HashMap();
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_COUNTRY, hCountry);
}
HashMap hmCountry = (HashMap) hCountry.get(strBizGroupID + strSystemId);
if(hmCountry == null){
hmCountry = new HashMap();
}
ArrayList objArrayList = null;
CachedRowSet objCachedRowSet = null;
//By Leo, 2011-08-29, ArrayList arrCachedRowset = new ArrayList();
String strCode = "";
//By Leo, 2011-08-29, String strCtrl1 = "";
//By Leo, 2011-08-29, String NEW_SQL = strSQL;
try {
// Code changes done by Prabhu 07-04-2009
// Getting the CachedRowset ArrayList for the given SQL
//arrCachedRowset = MemfisDAO.getArrayOfCachedRowSet(strSQL, strSystemId, 0, strBizGroupID);
//By Leo, 2011-08-29, int iSize = MemfisConstants.AVAILABLE_DB_CTRL_1.size();
StringBuffer strOption = new StringBuffer();
//By Leo, 2011-08-29, for (int n = 0; n < iSize; n++) {
try {
//objCachedRowSet = (CachedRowSet) arrCachedRowset.get(n);
// $$-$$02-JUNE-2009
//By Leo, 2011-08-29, strSQL = MemfisGenUtility.replaceAll(NEW_SQL, "$CTRL1$", String.valueOf(MemfisConstants.AVAILABLE_DB_CTRL_1.get(n)));
//By Leo, 2011-08-29, objCachedRowSet = MemfisDAO.getCachedRowSet(strSQL, strSystemId, MemfisGenUtility.checkInteger(MemfisConstants.AVAILABLE_DB_CTRL_1.get(n)), strBizGroupID);
objCachedRowSet = MemfisDAO.getCachedRowSet(strSQL, strSystemId, MemfisGenUtility.checkInteger(strCtrl1), strBizGroupID);
strOption = new StringBuffer();
//By Leo, 2011-08-29, strCtrl1 = "";
while (objCachedRowSet.next()) {
//By Leo, 2011-08-29, String strNewCtrl1 = MemfisGenUtility.emptyString(objCachedRowSet.getString("CTRL_1"));
/*if (!strCtrl1.equalsIgnoreCase("") && !strCtrl1.equalsIgnoreCase(strNewCtrl1)) {
hmCountry.put(strCtrl1 + ":" + MemfisConstants.FE_DROPDOWN_OPTIONS, strOption.toString());
strOption = new StringBuffer();
}*/
//By Leo, 2011-08-29, strCtrl1 = strNewCtrl1;
objArrayList = new ArrayList();
strCode = MemfisGenUtility.emptyString(objCachedRowSet.getString("COUNTRY_CODE"));
if (strCode.equals("")) {
continue;
}
String strDesc = MemfisGenUtility.emptyString(objCachedRowSet.getString("DESC1"));
String strAlpha02 = MemfisGenUtility.emptyString(objCachedRowSet.getString("ISO_ALPHA02"));
//objArrayList.add(strShortCode);
objArrayList.add(strCode);
objArrayList.add(strAlpha02);
objArrayList.add(strDesc);
hmCountry.put(strCtrl1 + ":" + strCode, objArrayList);
hmCountry.put("ALPHA02:" + strCtrl1 + ":" + strAlpha02, objArrayList);
strOption.append("<OPTION VALUE=\"");
strOption.append(strCode);
strOption.append("\" ALPHA02=\"");
strOption.append(strAlpha02);
strOption.append("\">");
//strOption.append(strShortCode+" - " +strDesc);
if (MemfisConstants.COUNTRY_CODE_LENGTH == 2) {
strOption.append(strAlpha02);
} else {
strOption.append(strCode);
}
strOption.append(" - " + strDesc);
strOption.append("</OPTION>");
}
//SETTING OUTSIDE
hmCountry.put(strCtrl1 + ":" + MemfisConstants.FE_DROPDOWN_OPTIONS, strOption.toString());
} catch (SQLException se) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMastersLookup : populateCountry() : SQLException Occured");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMastersLookup : populateCountry() : Exception Occured");
}
//By Leo, 2011-08-29, }
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMastersLookup : populateCountry() : Exception Occured");
} finally {
//*****MULLT-REGION CHANGES - 27-04-2009*****
//Setting Key as FMM (Functional) or CMM (Conversion)
// like CMM - hmCurrency
hCountry.put(strBizGroupID + strSystemId, hmCountry);
try {
if (objCachedRowSet != null)
objCachedRowSet.close();
} catch (SQLException se) {
se.printStackTrace();
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMastersLookup : populateCountry() OUT");
}
}
/**
* This method will populate the configure infomation of Access Logging.
* <DT><B>History: </B>
* <DD>07-04-2008
*/
public static void populateAccessLog() {
try {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateAccessLog() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hmAccessLogNew = new HashMap();
ArrayList arrFileList = getFileNameList(MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_ACCESSLOG_PATH);
String strFileName;
DocumentBuilderFactory dbf = null;
DocumentBuilder db = null;
Document doc = null;
dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringElementContentWhitespace(true);
dbf.setIgnoringComments(true);
dbf.setExpandEntityReferences(false);
dbf.setNamespaceAware(false);
dbf.setValidating(false);
for (int i = 0; i < arrFileList.size(); i++) {
strFileName = ((String) arrFileList.get(i));
if (strFileName.toUpperCase().endsWith(".XML")) {
String strSysID = strFileName.substring(strFileName.lastIndexOf("_") + 1, strFileName.toUpperCase().lastIndexOf(".XML"));
try {
db = dbf.newDocumentBuilder();
doc = db.parse(strFileName);
Node rootNode = doc.getDocumentElement();
NodeList nList = rootNode.getChildNodes();
String strType[];
String strMLIName = "";
String strReqFuncCode = "";
String strModule = "";
HashMap hmAccessLogModule = null;
for (int iNode = 0; iNode < nList.getLength(); iNode++) {
if (nList.item(iNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
strMLIName = nList.item(iNode).getAttributes().getNamedItem("value").getNodeValue();
NodeList nSubList = nList.item(iNode).getChildNodes();
for (int iSubNode = 0; iSubNode < nSubList.getLength(); iSubNode++) {
if (nSubList.item(iSubNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
strReqFuncCode = nSubList.item(iSubNode).getAttributes().getNamedItem("value").getNodeValue();
NodeList nSSubList = nSubList.item(iSubNode).getChildNodes();
for (int iSSubNode = 0; iSSubNode < nSSubList.getLength(); iSSubNode++) {
if (nSSubList.item(iSSubNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if ("".equals(strReqFuncCode) || strReqFuncCode.indexOf('|') != -1) {
strModule = strSysID + ":" + strMLIName + ":" + "ALL";
} else {
strModule = strSysID + ":" + strMLIName + ":" + strReqFuncCode;
}
hmAccessLogModule = (HashMap) hmAccessLogNew.get(strModule);
if (hmAccessLogModule == null) {
hmAccessLogModule = new HashMap();
if (!"".equals(strReqFuncCode) && strReqFuncCode.indexOf('|') != -1) {
hmAccessLogModule.put("REQ_FUNC_CODE", strReqFuncCode);
}
hmAccessLogNew.put(strModule, hmAccessLogModule);
}
if (nSSubList.item(iSSubNode).getNodeName().equalsIgnoreCase("ENTRY_KEY")) {
ArrayList arrAccessLogEntryKeys = (ArrayList) hmAccessLogModule.get("ENTRY_KEY");
if (arrAccessLogEntryKeys == null) {
arrAccessLogEntryKeys = new ArrayList();
hmAccessLogModule.put("ENTRY_KEY", arrAccessLogEntryKeys);
}
arrAccessLogEntryKeys.add(nSSubList.item(iSSubNode).getFirstChild().getNodeValue());
} else if (nSSubList.item(iSSubNode).getNodeName().equalsIgnoreCase("CUSTOMER_NUMBER")) {
hmAccessLogModule.put("CUSTOMER_NUMBER", nSSubList.item(iSSubNode).getFirstChild().getNodeValue());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
String strName = strFileName.substring(strFileName.lastIndexOf("/") + 1, strFileName.toUpperCase().lastIndexOf(".XML"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateAccessLog() : XML " + strName + " is loaded.");
}
}
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_ACCESS_LOG, hmAccessLogNew);
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateAccessLog() : OUT");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateAccessLog() : " + e);
}
}
/**
* This method will populate the configure infomation of Country Specific.
* <DT><B>History: </B>
* <DD>07-04-2008
*/
public static void populateCountrySpecific() {
try {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCountrySpecific() : IN");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
HashMap hmCountrySpecific = new HashMap();
ArrayList arrFileList = getFileNameList(MemfisConstants.MEMFISWEB_PATH + MemfisConstants.MEMFIS_COUNTRY_SPECIFIC_PATH);
String strFileName;
DocumentBuilderFactory dbf = null;
DocumentBuilder db = null;
Document doc = null;
dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringElementContentWhitespace(true);
dbf.setIgnoringComments(true);
dbf.setExpandEntityReferences(false);
dbf.setNamespaceAware(false);
dbf.setValidating(false);
for (int i = 0; i < arrFileList.size(); i++) {
strFileName = ((String) arrFileList.get(i));
if (strFileName.toUpperCase().endsWith(".XML")) {
String strSysID = strFileName.substring(strFileName.lastIndexOf("_") + 1, strFileName.toUpperCase().lastIndexOf(".XML"));
try {
db = dbf.newDocumentBuilder();
doc = db.parse(strFileName);
Node rootNode = doc.getDocumentElement();
NodeList nList = rootNode.getChildNodes();
String strType;
String strID;
String strMLIName = "";
String strItemCase = "";
String strModule = "";
HashMap hmControlType = null;
for (int iNode = 0; iNode < nList.getLength(); iNode++) {
if (nList.item(iNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
strType = nList.item(iNode).getAttributes().getNamedItem("type").getNodeValue();
hmControlType = (HashMap) hmCountrySpecific.get(strType);
if (hmControlType == null) {
hmControlType = new HashMap();
hmCountrySpecific.put(strType, hmControlType);
}
strID = nList.item(iNode).getAttributes().getNamedItem("id").getNodeValue();
HashMap hmCountrySpecificInd = (HashMap) hmControlType.get(strSysID + ":" + strID);
if (hmCountrySpecificInd == null) {
hmCountrySpecificInd = new HashMap();
hmControlType.put(strSysID + ":" + strID, hmCountrySpecificInd);
}
NodeList nSubList = nList.item(iNode).getChildNodes();
for (int iSubNode = 0; iSubNode < nSubList.getLength(); iSubNode++) {
if (nSubList.item(iSubNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
if (nSubList.item(iSubNode).getNodeName().equalsIgnoreCase("ITEM-DEFAULT")) {
NodeList nSSubList = nSubList.item(iSubNode).getChildNodes();
for (int iSSubNode = 0; iSSubNode < nSSubList.getLength(); iSSubNode++) {
if (nSSubList.item(iSSubNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
hmCountrySpecificInd.put(MemfisGenUtility.emptyString(nSSubList.item(iSSubNode).getNodeName()), nSSubList.item(iSSubNode).getFirstChild().getNodeValue());
}
} else {
strItemCase = MemfisGenUtility.emptyString(nSubList.item(iSubNode).getAttributes().getNamedItem("value").getNodeValue());
HashMap hmParm = (HashMap) hmControlType.get(strSysID + ":" + strID + ":" + strItemCase);
if (hmParm == null) {
hmParm = new HashMap();
hmControlType.put(strSysID + ":" + strID + ":" + strItemCase, hmParm);
}
NodeList nSSubList = nSubList.item(iSubNode).getChildNodes();
for (int iSSubNode = 0; iSSubNode < nSSubList.getLength(); iSSubNode++) {
if (nSSubList.item(iSSubNode).getNodeType() != Node.ELEMENT_NODE) {
continue;
}
hmParm.put(MemfisGenUtility.emptyString(nSSubList.item(iSSubNode).getNodeName()), nSSubList.item(iSSubNode).getFirstChild().getNodeValue());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
String strName = strFileName.substring(strFileName.lastIndexOf("/") + 1, strFileName.toUpperCase().lastIndexOf(".XML"));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCountrySpecific() : XML " + strName + " is loaded.");
}
}
MemfisCacheEntity.putToCache(MemfisConstants.OSCACHE_MEMFIS_COUNTRY_SPECIFIC, hmCountrySpecific);
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCountrySpecific() : OUT");
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateCountrySpecific() : " + e);
}
}
/**
* This method will read the function property file and load it to the memfis map.
* @param m
* @param propName
*/
public static void populateFunctionID(MemfisMap m, String propName) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateFunctionID() : IN : File '" + propName + "'");
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
try {
ResourceBundle res = ResourceBundle.getBundle(propName);
Enumeration enumFuncId = res.getKeys();
while (enumFuncId.hasMoreElements()) {
String key = (String) enumFuncId.nextElement();
m.put(key, MemfisGenUtility.emptyString(res.getString(key)));
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateFunctionID() : Key='" + key + "' Value='" + MemfisGenUtility.emptyString(res.getString(key)) + "'");
}
} catch (Exception e) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateFunctionID() : " + e);
}
MemfisLogger.logMessageWithStackTrace(MemfisLogger.FATAL, "", "current heap memory is " + Runtime.getRuntime().totalMemory());
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "MemfisMasterLookup : populateFunctionID() : OUT : File '" + propName + "'");
}
/**
* This method will get all ctrl_1, and return a arrayList of ctrl_1
* @author zh24736 Vicky
*/
public static ArrayList getAllCtrl1(String systemId)
{
ArrayList arrayCttl1 = new ArrayList();
String strSQL = " SELECT CTRL_1 FROM " + MemfisConstants.MEMFIS_QUALIFIER + ".MEMFIS_CODED_VALUE" + " WHERE STATUS= 'A' AND CODE_INDEX='"+MemfisCodedIndexConstants.FE_CTRL_1+"' AND INV_SYSTEM_ID='"+systemId+"'GROUP BY CTRL_1 ORDER BY CTRL_1 WITH UR";
CachedRowSet rs = null;
rs = null;
try {
rs = MemfisDAO.getCachedRowSet(strSQL, "", 0, "");
while (rs.next()) {
arrayCttl1.add(MemfisGenUtility.emptyString(rs.getString("CTRL_1")));
}
} catch (Exception err) {
MemfisLogger.logMessage(MemfisLogger.FATAL, "", "Exception from getAllCtrl1() method-->" + err.toString());
}
return arrayCttl1;
}
MemfisMasterLookup.java 2
最新推荐文章于 2021-01-27 10:36:41 发布