first commit
This commit is contained in:
64
hrmsEjb/wenrgise/common/utility/EnrgiseManager.java
Normal file
64
hrmsEjb/wenrgise/common/utility/EnrgiseManager.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package wenrgise.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) {
|
||||
this.appMap.put("DBName", oEnrApp.get_DBName());
|
||||
this.appMap.put("Module", oEnrApp.get_Module());
|
||||
}
|
||||
|
||||
public HashMap getAppMap() {
|
||||
return this.appMap;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user