112 lines
4.3 KiB
Java
112 lines
4.3 KiB
Java
package wenrgise.common.utility;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import wenrgise.common.exception.EnrgiseSystemException;
|
|
import wenrgise.common.xml.vo.LOV;
|
|
import wenrgise.common.xml.vo.LOVClass;
|
|
import wenrgise.common.xml.vo.LOVInfo;
|
|
import wenrgise.common.xml.vo.Screen;
|
|
import wenrgise.common.xml.vo.ScreenMode;
|
|
import wenrgise.common.xml.vo.ScreenModes;
|
|
import wenrgise.common.xml.vo.Screens;
|
|
import wenrgise.ejb.common.helper.DBObject;
|
|
import wenrgise.ejb.common.helper.QueryRow;
|
|
import wenrgise.ejb.common.helper.QueryValue;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
|
|
public class LOVManager {
|
|
private static LOVManager me;
|
|
|
|
private HashMap oMap = new HashMap();
|
|
|
|
public static LOVManager getInstance() {
|
|
if (me == null)
|
|
me = new LOVManager();
|
|
return me;
|
|
}
|
|
|
|
public LOVInfo getCachedObject(String name_) {
|
|
if (name_ == null || name_.trim().length() <= 0)
|
|
return null;
|
|
return (LOVInfo)this.oMap.get(name_);
|
|
}
|
|
|
|
public void init(LOVClass oLOVClass) {
|
|
if (oLOVClass == null)
|
|
return;
|
|
ArrayList oList = oLOVClass.get_LOV();
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
LOV oLOV = oIt.next();
|
|
String sLOVName = oLOV.get_LovKey();
|
|
Screens oScreens = oLOV.get_Screens();
|
|
Iterator oScreenIt = oScreens.get_Screen().iterator();
|
|
while (oScreenIt.hasNext()) {
|
|
Screen oScreen = oScreenIt.next();
|
|
String sScreenName = oScreen.get_ScreenName();
|
|
ScreenModes oScreenModes = oScreen.get_ScreenModes();
|
|
Iterator oScreenModeIt = oScreenModes.get_ScreenMode().iterator();
|
|
while (oScreenModeIt.hasNext()) {
|
|
ScreenMode oScreenMode = oScreenModeIt.next();
|
|
String sMode = oScreenMode.get_ModeName();
|
|
LOVInfo oLOVInfo = new LOVInfo();
|
|
oLOVInfo.setFacadeName(oScreenMode.get_FacadeName());
|
|
oLOVInfo.setFunctionName(oScreenMode.get_FunctionName());
|
|
oLOVInfo.setInsertFlag(oScreenMode.get_InsertFlag());
|
|
oLOVInfo.setRecursiveFlag(oScreenMode.get_RecursiveFlag());
|
|
String sCombinedKey = String.valueOf(String.valueOf(sLOVName).concat(String.valueOf(sScreenName))).concat(String.valueOf(sMode));
|
|
if (!this.oMap.containsKey(sCombinedKey))
|
|
this.oMap.put(sCombinedKey, oLOVInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void main(String[] argv) {
|
|
LOVManager oLov = new LOVManager();
|
|
oLov.myFunc2();
|
|
}
|
|
|
|
private void myFunc() {
|
|
try {
|
|
String sDate = "12-JAN-1980";
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters.add(new DBObject(1, 1, 4, new Integer(2)));
|
|
oParameters.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate)));
|
|
oParameters.add(new DBObject(3, 2, 4));
|
|
oBean.callProc(oParameters, "BASU_AREA.proc_DateTester(?,?,?)");
|
|
System.out.println("Insert successfull");
|
|
} catch (EnrgiseSystemException oEx) {
|
|
System.out.println(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage())));
|
|
}
|
|
}
|
|
|
|
private void myFunc2() {
|
|
try {
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
oParameters.add(new DBObject(1, 1, 93, EnrgiseUtil.convertToSqlDate("12-JAN-1980")));
|
|
oParameters.add(new DBObject(2, 2, -10));
|
|
oParameters.add(new DBObject(3, 2, 4));
|
|
ArrayList oList2 = oBean.callProc(oParameters, "BASU_AREA.proc_DateTester2(?,?,?)");
|
|
DBObject oOutObject = oList2.get(0);
|
|
ArrayList oList = (ArrayList)oOutObject.getObject();
|
|
Iterator oIt = oList.iterator();
|
|
while (oIt.hasNext()) {
|
|
QueryRow oRow = oIt.next();
|
|
QueryValue oVal = oRow.get("ID");
|
|
String sId = oVal.getString();
|
|
QueryValue oVal2 = oRow.get("purchase_date");
|
|
String sDate = EnrgiseUtil.convertToString(oVal2.getDate());
|
|
System.out.println(String.valueOf(String.valueOf(String.valueOf(String.valueOf("ID is ").concat(String.valueOf(sId))).concat(String.valueOf(" "))).concat(String.valueOf("Purchase Date is "))).concat(String.valueOf(sDate)));
|
|
}
|
|
System.out.println("Fetch successfull");
|
|
} catch (EnrgiseSystemException oEx) {
|
|
System.out.println(String.valueOf("The problem is ").concat(String.valueOf(oEx.getMessage())));
|
|
}
|
|
}
|
|
}
|