Files
HRMS/hrmsEjb/wenrgise/ejb/common/utility/EnrgiseManager.java
2025-07-28 13:56:49 +05:30

67 lines
2.3 KiB
Java

package wenrgise.ejb.common.utility;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.xml.vo.DetailScreen;
import wenrgise.common.xml.vo.DetailScreens;
import wenrgise.common.xml.vo.EnrgiseApp;
import wenrgise.common.xml.vo.EnrgiseForms;
import wenrgise.common.xml.vo.HashedEnrgiseForms;
import wenrgise.common.xml.vo.SingleForm;
public class EnrgiseManager {
private static EnrgiseManager me;
private HashMap oEnrgiseMap = new HashMap();
private HashMap appMap = new HashMap();
public static EnrgiseManager getInstance() {
if (me == null)
me = new EnrgiseManager();
return me;
}
public HashedEnrgiseForms getCachedObject(String name_) {
if (name_ == null || name_.trim().length() <= 0)
return null;
return (HashedEnrgiseForms)this.oEnrgiseMap.get(name_);
}
public void init(EnrgiseForms oEnrgiseForms) {
if (oEnrgiseForms == null)
return;
ArrayList oFormsList = oEnrgiseForms.get_SingleForm();
Iterator oIt = oFormsList.iterator();
while (oIt.hasNext()) {
SingleForm oSingleForm = oIt.next();
String sFormName = oSingleForm.get_FormName();
HashedEnrgiseForms oHashedEnrgiseForms = new HashedEnrgiseForms();
oHashedEnrgiseForms.setSingleForm(oSingleForm);
DetailScreens oDetailScreens = oSingleForm.get_DetailScreens();
ArrayList oDetailList = oDetailScreens.get_DetailScreen();
Iterator oDetailIt = oDetailList.iterator();
while (oDetailIt.hasNext()) {
DetailScreen oDetailScreen = oDetailIt.next();
String sDetailName = oDetailScreen.get_DetailScreenName();
if (!oHashedEnrgiseForms.getDetailMap().containsKey(sDetailName))
oHashedEnrgiseForms.getDetailMap().put(sDetailName, oDetailScreen);
}
if (!this.oEnrgiseMap.containsKey(sFormName))
this.oEnrgiseMap.put(sFormName, oHashedEnrgiseForms);
}
}
public void setEnrApp(EnrgiseApp oEnrApp) {
System.out.println(String.valueOf("DBname---->").concat(String.valueOf(oEnrApp.get_DBName())));
System.out.println(String.valueOf("Module---->").concat(String.valueOf(oEnrApp.get_Module())));
this.appMap.put("DBName", oEnrApp.get_DBName());
this.appMap.put("Module", oEnrApp.get_Module());
}
public HashMap getAppMap() {
return this.appMap;
}
}