first commit

This commit is contained in:
2025-07-28 13:56:49 +05:30
commit e9eb805edb
3438 changed files with 520990 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
package wenrgise.ejb.common.utility;
import java.util.ArrayList;
import java.util.Iterator;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.ejb.common.helper.QueryRow;
public class CommonAdditionalUtility {
public String getUserGroup(String empId) throws EnrgiseApplicationException, EnrgiseSystemException {
String groupId = new String();
String sQuery = String.valueOf(" select group_id from sys_user_group_map m where m.user_system_id = ").concat(String.valueOf(empId));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
groupId = oRow.get("group_id").getString();
}
}
return groupId;
}
public String getHOD(String empId) throws EnrgiseApplicationException, EnrgiseSystemException {
String hodId = new String();
String sQuery = String.valueOf(String.valueOf(" select m.contact_person_id from gen_wrkgrp_mst m where m.id = (select dtl.wkgp_mst_id from hrm_emp_wrkgrp_dtl dtl where dtl.e_per_dtl_id =").concat(String.valueOf(empId))).concat(String.valueOf(")"));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
hodId = oRow.get("CONTACT_PERSON_ID").getString();
}
}
return hodId;
}
public boolean checkValidEmail(String email) throws EnrgiseApplicationException, EnrgiseSystemException {
int atCount = 0;
int dotCount = 0;
boolean flag = true;
int i;
for (i = 0; i < email.length(); i++) {
if (email.charAt(i) == '@')
atCount++;
if (email.charAt(i) == '.')
dotCount++;
}
if (atCount == 1 && dotCount > 0 && email.indexOf("@") != 0 && email.charAt(email.length() - 1) != '.' && email.charAt(email.length() - 1) != '@') {
dotCount = 0;
for (i = email.indexOf("@"); i < email.length(); i++) {
if (email.charAt(i) == '.')
dotCount++;
if (email.indexOf("@") - email.indexOf(".") == -1 || email.lastIndexOf(".") - email.indexOf(".") == 1) {
flag = false;
break;
}
}
} else {
flag = false;
}
if (dotCount == 0 || dotCount > 2)
flag = false;
return flag;
}
public boolean checkValidPan(String panNo) throws EnrgiseApplicationException, EnrgiseSystemException {
boolean flag = true;
panNo = panNo.toUpperCase();
if (panNo.length() != 10) {
flag = false;
} else {
String first = panNo.substring(0, 5);
String second = panNo.substring(5, 9);
int i;
for (i = 0; i < first.length(); i++) {
if (first.charAt(i) < 'A' || first.charAt(i) > 'Z') {
flag = false;
break;
}
}
for (i = 0; i < second.length(); i++) {
if (second.charAt(i) < '0' || second.charAt(i) > '9') {
flag = false;
break;
}
}
if (panNo.charAt(9) < 'A' || panNo.charAt(9) > 'Z')
flag = false;
}
return flag;
}
public ArrayList getDelegatedEmp_Level(String empId, String HdrPrKey, String docTypeId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList outArray = new ArrayList();
String sQuery = "select wt.level_no, wt.delegated_emp_id ";
sQuery = String.valueOf(sQuery).concat(String.valueOf(" from workflow_tasklist wt,workflow_dtl wd,wfl_doc_type_mst wm "));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" where status='P' "));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and delegator_emp_id = "))).concat(String.valueOf(empId));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and doc_dtl_id = "))).concat(String.valueOf(HdrPrKey));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" and wt.workflow_dtl_id=wd.id "));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" and wd.doc_type_mst_id=wm.id "));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and wm.id = "))).concat(String.valueOf(docTypeId));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
outArray.add(oRow.get("level_no").getString());
outArray.add(oRow.get("delegated_emp_id").getString());
}
}
return outArray;
}
public ArrayList getEmp_Level(String HdrPrKey, String docTypeId) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList outArray = new ArrayList();
String sQuery = "select wt.level_no, wt.delegated_emp_id ";
sQuery = String.valueOf(sQuery).concat(String.valueOf(" from workflow_tasklist wt,workflow_dtl wd,wfl_doc_type_mst wm "));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" where status='P' "));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and doc_dtl_id = "))).concat(String.valueOf(HdrPrKey));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" and wt.workflow_dtl_id=wd.id "));
sQuery = String.valueOf(sQuery).concat(String.valueOf(" and wd.doc_type_mst_id=wm.id "));
sQuery = String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and wm.id = "))).concat(String.valueOf(docTypeId));
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oList = oBean.executeQuery(sQuery);
if (oList.size() != 0) {
QueryRow oRow = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
oRow = oIt.next();
outArray.add(oRow.get("level_no").getString());
outArray.add(oRow.get("delegated_emp_id").getString());
}
}
return outArray;
}
}

View File

@@ -0,0 +1,611 @@
package wenrgise.ejb.common.utility;
import java.sql.BatchUpdateException;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Iterator;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.InputDBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.helper.QueryValue;
public class DBUtilitiesBean {
private String sDbName = "jdbc/conDS";
private ArrayList oOutParameters = null;
private Connection oCon;
private ResultSet oRs;
private Connection oConn = null;
private DataSource oDataSource = null;
private PreparedStatement oDynamicBatchCall = null;
private CallableStatement oBatchCall = null;
private Connection oBatchCon = null;
private Connection oPreParameterCon = null;
private PreparedStatement oPreParameter = null;
private Connection oPreUpsertCon = null;
private PreparedStatement oPreUpsert = null;
private boolean bDynamic = false;
public DBUtilitiesBean() {}
public DBUtilitiesBean(boolean bDynamic) {
this.bDynamic = bDynamic;
}
public void createBatch(String sProcName) throws EnrgiseSystemException {
InitialContext oInitCont = null;
String sParam = String.valueOf(String.valueOf("{ call ").concat(String.valueOf(sProcName))).concat(String.valueOf("}"));
boolean bCreateCoonectionError = false;
try {
Object dataSourceObj = ServiceLocator.getLocator().getLocalService(this.sDbName);
this.oDataSource = (DataSource)dataSourceObj;
this.oBatchCon = this.oDataSource.getConnection();
bCreateCoonectionError = true;
if (!this.bDynamic) {
if (this.oBatchCall != null) {
this.oBatchCall.close();
this.oBatchCall = null;
}
this.oBatchCall = this.oBatchCon.prepareCall(sParam);
bCreateCoonectionError = false;
} else {
if (this.oDynamicBatchCall != null) {
this.oDynamicBatchCall.close();
this.oDynamicBatchCall = null;
}
this.oDynamicBatchCall = this.oBatchCon.prepareStatement(sParam);
bCreateCoonectionError = false;
}
} catch (SQLException oExc) {
System.out.println(oExc.getMessage());
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (this.oBatchCon != null && bCreateCoonectionError) {
if (!this.oBatchCon.isClosed())
this.oBatchCon.close();
this.oBatchCon = null;
}
} catch (SQLException sQLException) {}
}
}
public void addToBatch(ArrayList oParameters) throws EnrgiseSystemException {
if (!this.bDynamic) {
addToProcBatch(oParameters);
} else {
addToDynamicBatch(oParameters);
}
}
private void addToDynamicBatch(ArrayList oParameters) throws EnrgiseSystemException {
try {
Iterator oIter = oParameters.iterator();
while (oIter.hasNext()) {
InputDBObject oObject = oIter.next();
inspectExecuteParameter(oObject, this.oDynamicBatchCall);
}
this.oBatchCall.addBatch();
} catch (SQLException oSqlEx) {
System.out.println(oSqlEx.getMessage());
throw new EnrgiseSystemException(oSqlEx);
} finally {
try {
if (this.oBatchCon != null) {
if (!this.oBatchCon.isClosed())
this.oBatchCon.close();
this.oBatchCon = null;
}
} catch (SQLException sQLException) {}
}
}
private void addToProcBatch(ArrayList oParameters) throws EnrgiseSystemException {
try {
Iterator oIter = oParameters.iterator();
while (oIter.hasNext()) {
DBObject oObject = oIter.next();
inspectParameter(oObject, this.oBatchCall);
}
this.oBatchCall.addBatch();
} catch (SQLException oSqlEx) {
oSqlEx.printStackTrace();
System.out.println(oSqlEx.getMessage());
try {
if (this.oBatchCon != null)
if (!this.oBatchCon.isClosed())
this.oBatchCon.close();
this.oBatchCon = null;
} catch (SQLException sQLException) {}
throw new EnrgiseSystemException(oSqlEx);
}
}
public void executeBatch() throws EnrgiseSystemException {
try {
if (!this.bDynamic) {
this.oBatchCall.executeBatch();
} else {
this.oDynamicBatchCall.executeBatch();
}
} catch (BatchUpdateException oBatchEx) {
System.out.println("Batch Update Failed");
System.out.println(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf("Casue ").concat(String.valueOf(oBatchEx.getCause()))).concat(String.valueOf(" Message "))).concat(String.valueOf(oBatchEx.getMessage()))).concat(String.valueOf(" SQL State "))).concat(String.valueOf(oBatchEx.getSQLState()))).concat(String.valueOf(" Update Count "))).concat(String.valueOf(oBatchEx.getUpdateCounts()))).concat(String.valueOf(" SQL Trace "))).concat(String.valueOf(oBatchEx.getStackTrace())));
throw new EnrgiseSystemException(oBatchEx);
} catch (SQLException oSqlEx) {
System.out.println(String.valueOf("dbutilities").concat(String.valueOf(oSqlEx.getMessage())));
oSqlEx.printStackTrace();
throw new EnrgiseSystemException(oSqlEx);
} finally {
try {
if (this.oBatchCon != null)
if (!this.oBatchCon.isClosed())
this.oBatchCon.close();
} catch (SQLException sQLException) {}
}
}
public int executeUpsert(ArrayList oParameters, String sQuery) throws EnrgiseSystemException {
int iCount = 0;
try {
this.oDataSource = (DataSource)ServiceLocator.getLocator().getLocalService(this.sDbName);
if (this.oPreUpsert != null)
this.oPreUpsert.close();
if (this.oPreUpsertCon != null) {
this.oPreUpsertCon.close();
this.oPreUpsertCon = null;
}
this.oPreUpsertCon = this.oDataSource.getConnection();
this.oPreUpsert = this.oPreUpsertCon.prepareStatement(sQuery);
Iterator oIter = oParameters.iterator();
while (oIter.hasNext()) {
InputDBObject oObject = oIter.next();
inspectExecuteParameter(oObject, this.oPreUpsert);
}
iCount = this.oPreUpsert.executeUpdate();
while (true);
} catch (Exception oExc) {
System.out.println(oExc.getMessage());
oExc.printStackTrace();
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (this.oPreUpsertCon != null) {
if (!this.oPreUpsertCon.isClosed())
this.oPreUpsertCon.close();
this.oPreUpsertCon = null;
}
} catch (SQLException oSqlEx) {
System.out.println(oSqlEx.getMessage());
throw new EnrgiseSystemException(oSqlEx);
}
return iCount;
}
}
public ArrayList executeQuery(ArrayList oParameters, String sQuery) throws EnrgiseSystemException {
ResultSet oRs = null;
ArrayList oResult = null;
try {
this.oDataSource = (DataSource)ServiceLocator.getLocator().getLocalService(this.sDbName);
if (oRs != null) {
oRs.close();
oRs = null;
}
if (this.oPreParameter != null)
this.oPreParameter.close();
if (this.oPreParameterCon != null) {
this.oPreParameterCon.close();
this.oPreParameterCon = null;
}
this.oPreParameterCon = this.oDataSource.getConnection();
this.oPreParameter = this.oPreParameterCon.prepareStatement(sQuery);
Iterator oIter = oParameters.iterator();
while (oIter.hasNext()) {
InputDBObject oObject = oIter.next();
inspectExecuteParameter(oObject, this.oPreParameter);
}
oRs = this.oPreParameter.executeQuery();
if (oRs == null)
throw new EnrgiseSystemException();
oResult = convertToList(oRs);
while (true);
} catch (Exception oExc) {
System.out.println(oExc.getMessage());
oExc.printStackTrace();
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (this.oPreParameterCon != null)
if (this.oPreParameterCon.isClosed())
this.oPreParameterCon.close();
} catch (SQLException oSqlEx) {
System.out.println(oSqlEx.getMessage());
throw new EnrgiseSystemException(oSqlEx);
}
return oResult;
}
}
public ArrayList callProc(ArrayList oParameters, String sProcName) throws EnrgiseSystemException {
CallableStatement oCall = null;
if (this.oOutParameters == null) {
this.oOutParameters = new ArrayList();
} else {
this.oOutParameters.clear();
}
try {
Object datasourceObj = null;
datasourceObj = ServiceLocator.getLocator().getLocalService(this.sDbName);
this.oDataSource = (DataSource)datasourceObj;
Object conObj = this.oDataSource.getConnection();
this.oCon = (Connection)conObj;
if (oCall != null)
oCall.close();
String sParam = String.valueOf(String.valueOf("{ call ").concat(String.valueOf(sProcName))).concat(String.valueOf("}"));
Object callObj = this.oCon.prepareCall(sParam);
oCall = (CallableStatement)callObj;
Iterator oIter = oParameters.iterator();
while (oIter.hasNext()) {
DBObject oObject = oIter.next();
inspectParameter(oObject, oCall);
}
oCall.execute();
Iterator oOutIter = this.oOutParameters.iterator();
while (oOutIter.hasNext())
getOutParameters(oOutIter.next(), oCall);
if (this.oOutParameters.size() >= 3) {
DBObject oErrLog = this.oOutParameters.get(this.oOutParameters.size() - 3);
String sErrorLog = (String)oErrLog.getObject();
DBObject oErrMessage = this.oOutParameters.get(this.oOutParameters.size() - 2);
String sErrorMessage = (String)oErrLog.getObject();
DBObject oErr = this.oOutParameters.get(this.oOutParameters.size() - 1);
Integer oErrorCode = (Integer)oErr.getObject();
if (null != oErrorCode && !oErrorCode.equals(new Integer(0))) {
System.out.println(String.valueOf("Error calling procedure ").concat(String.valueOf(sProcName)));
if (null != sErrorLog)
System.out.println(String.valueOf("Error Log ").concat(String.valueOf(sErrorLog)));
if (null != sErrorMessage)
System.out.println(String.valueOf("Error Message ").concat(String.valueOf(sErrorMessage)));
throw new EnrgiseSystemException();
}
}
return this.oOutParameters;
} catch (Exception oExc) {
System.out.println(oExc.getMessage());
oExc.printStackTrace();
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (this.oCon != null) {
if (!this.oCon.isClosed())
this.oCon.close();
this.oCon = null;
}
} catch (Exception exception) {}
}
}
public ArrayList executeQuery(String sQuery) throws EnrgiseSystemException {
PreparedStatement oPre = null;
ArrayList oResult = null;
try {
this.oDataSource = (DataSource)ServiceLocator.getLocator().getLocalService(this.sDbName);
if (this.oRs != null) {
this.oRs.close();
this.oRs = null;
}
if (oPre != null)
oPre.close();
if (this.oConn != null) {
this.oConn.close();
this.oConn = null;
}
this.oConn = this.oDataSource.getConnection();
oPre = this.oConn.prepareStatement(sQuery);
this.oRs = oPre.executeQuery();
oResult = convertToList(this.oRs);
while (true);
} catch (SQLException oExc) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("From DBUtility ").concat(String.valueOf(oExc.getClass().getName()))).concat(String.valueOf(" "))).concat(String.valueOf(oExc.getMessage())));
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (this.oConn != null)
if (!this.oConn.isClosed())
this.oConn.close();
} catch (SQLException oSqEx) {
throw new EnrgiseSystemException(oSqEx);
}
return oResult;
}
}
public int executeUpsert(String sQuery) throws EnrgiseSystemException {
PreparedStatement oPre = null;
Connection oPreCon = null;
int iCount = 0;
try {
this.oDataSource = (DataSource)ServiceLocator.getLocator().getLocalService(this.sDbName);
if (oPre != null)
oPre.close();
oPreCon = this.oDataSource.getConnection();
oPre = oPreCon.prepareStatement(sQuery);
iCount = oPre.executeUpdate();
while (true);
} catch (SQLException oExc) {
System.out.println(String.valueOf(String.valueOf(String.valueOf("From DBUtility ").concat(String.valueOf(oExc.getClass().getName()))).concat(String.valueOf(" "))).concat(String.valueOf(oExc.getMessage())));
throw new EnrgiseSystemException(oExc);
} finally {
try {
if (oPreCon != null)
if (!oPreCon.isClosed())
oPreCon.close();
} catch (SQLException oSqEx) {
throw new EnrgiseSystemException(oSqEx);
}
return iCount;
}
}
private void inspectParameter(DBObject oDBObject, CallableStatement oCall) throws SQLException {
int iPosition = oDBObject.getPosition();
int iDirection = oDBObject.getDirection();
int iDataType = oDBObject.getDataType();
if (iDirection == 1 || iDirection == 3) {
Object oObject = oDBObject.getObject();
switch (iDataType) {
case 12:
if (oObject != null) {
oCall.setString(iPosition, oObject.toString());
break;
}
oCall.setString(iPosition, (String)null);
break;
case 4:
if (oObject != null) {
oCall.setInt(iPosition, Integer.parseInt(oObject.toString()));
break;
}
oCall.setInt(iPosition, 0);
break;
case 8:
if (oObject != null) {
oCall.setDouble(iPosition, Double.parseDouble(oObject.toString()));
break;
}
oCall.setDouble(iPosition, 0.0D);
break;
case -5:
if (oObject != null) {
oCall.setLong(iPosition, ((Long)oObject).longValue());
break;
}
oCall.setLong(iPosition, 0L);
break;
case 91:
if (oObject != null) {
oCall.setDate(iPosition, (Date)oObject);
break;
}
oCall.setDate(iPosition, (Date)null);
break;
case 93:
if (oObject != null) {
oCall.setTimestamp(iPosition, (Timestamp)oObject);
break;
}
oCall.setTimestamp(iPosition, (Timestamp)null);
break;
case 2000:
if (oObject != null) {
oCall.setObject(iPosition, oObject);
break;
}
oCall.setObject(iPosition, (Object)null);
break;
}
}
if (iDirection == 2 || iDirection == 3) {
oCall.registerOutParameter(iPosition, iDataType);
this.oOutParameters.add(new DBObject(iPosition, iDataType));
}
}
private void inspectExecuteParameter(InputDBObject oDBObject, PreparedStatement oCall) throws SQLException {
int iPosition = oDBObject.getPosition();
int iDataType = oDBObject.getDataType();
Object oObject = oDBObject.getObject();
switch (iDataType) {
case 12:
if (oObject != null) {
oCall.setString(iPosition, oObject.toString());
break;
}
oCall.setString(iPosition, (String)null);
break;
case 1:
if (oObject != null) {
oCall.setString(iPosition, oObject.toString());
break;
}
oCall.setString(iPosition, (String)null);
break;
case 4:
if (oObject != null) {
oCall.setInt(iPosition, Integer.parseInt(oObject.toString()));
break;
}
oCall.setInt(iPosition, 0);
break;
case 8:
if (oObject != null) {
oCall.setDouble(iPosition, Double.parseDouble(oObject.toString()));
break;
}
oCall.setDouble(iPosition, 0.0D);
break;
case -5:
if (oObject != null) {
oCall.setLong(iPosition, ((Long)oObject).longValue());
break;
}
oCall.setLong(iPosition, 0L);
break;
case 91:
if (oObject != null) {
oCall.setDate(iPosition, (Date)oObject);
break;
}
oCall.setDate(iPosition, (Date)null);
break;
case 93:
if (oObject != null) {
oCall.setTimestamp(iPosition, (Timestamp)oObject);
break;
}
oCall.setTimestamp(iPosition, (Timestamp)null);
break;
case 2000:
oCall.setObject(iPosition, oObject);
break;
}
}
private void getOutParameters(DBObject oOutDBObject, CallableStatement oCall) throws SQLException {
int iPosition = oOutDBObject.getPosition();
int iDataType = oOutDBObject.getDataType();
switch (iDataType) {
case 12:
oOutDBObject.setObject(oCall.getString(iPosition));
break;
case 1:
oOutDBObject.setObject(oCall.getString(iPosition));
break;
case 4:
oOutDBObject.setObject(new Integer(oCall.getInt(iPosition)));
break;
case -5:
oOutDBObject.setObject(new Long(oCall.getLong(iPosition)));
break;
case 8:
oOutDBObject.setObject(new Double(oCall.getDouble(iPosition)));
break;
case 91:
oOutDBObject.setObject(oCall.getDate(iPosition));
break;
case 93:
oOutDBObject.setObject(oCall.getTimestamp(iPosition));
break;
case 2000:
oOutDBObject.setObject(oCall.getObject(iPosition));
break;
case -10:
oOutDBObject.setObject(convertToList((ResultSet)oCall.getObject(iPosition)));
break;
}
}
private ArrayList convertToList(ResultSet oRs2) throws SQLException {
if (null == oRs2)
return null;
ResultSetMetaData oRsMt = oRs2.getMetaData();
int iColumnCount = oRsMt.getColumnCount();
int iIndex = 0;
ArrayList oList = new ArrayList();
String[] sColumnName = new String[iColumnCount];
int[] iColumnType = new int[iColumnCount];
for (iIndex = 0; iIndex < iColumnCount; iIndex++) {
sColumnName[iIndex] = oRsMt.getColumnName(iIndex + 1);
iColumnType[iIndex] = oRsMt.getColumnType(iIndex + 1);
}
while (oRs2.next()) {
QueryRow oRow = new QueryRow(iColumnCount);
for (iIndex = 0; iIndex < iColumnCount; iIndex++) {
QueryValue oValue = new QueryValue();
setValue(sColumnName[iIndex], iColumnType[iIndex], oValue, oRs2);
oRow.getRow().put(sColumnName[iIndex].toUpperCase(), oValue);
}
oList.add(oRow);
}
oRs2.close();
oRs2 = null;
return oList;
}
private void setValue(String sColumnName, int iColumnType, QueryValue oValue, ResultSet oRs2) throws SQLException {
switch (iColumnType) {
case 2:
oValue.setString(oRs2.getString(sColumnName));
break;
case 12:
oValue.setString(oRs2.getString(sColumnName));
break;
case 1:
oValue.setString(oRs2.getString(sColumnName));
break;
case 4:
oValue.setInt(oRs2.getInt(sColumnName));
break;
case -5:
oValue.setLong(oRs2.getLong(sColumnName));
break;
case 8:
oValue.setDouble(oRs2.getDouble(sColumnName));
break;
case 91:
oValue.setDate(oRs2.getDate(sColumnName));
break;
case 93:
oValue.setTimestamp(oRs2.getTimestamp(sColumnName));
break;
case 2004:
oValue.setBlob(oRs2.getBlob(sColumnName));
break;
case 2005:
oValue.setClob(oRs2.getClob(sColumnName));
break;
}
}
protected void finalize() {
try {
close();
} catch (SQLException sQLException) {}
}
private void close() throws SQLException {
if (this.oCon != null) {
if (!this.oCon.isClosed())
this.oCon.close();
this.oCon = null;
}
if (this.oConn != null) {
if (!this.oConn.isClosed())
this.oConn.close();
this.oConn = null;
}
}
}

View File

@@ -0,0 +1,38 @@
package wenrgise.ejb.common.utility;
import java.util.logging.Logger;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;
import wenrgise.common.utility.UserInfo;
public class EnrgiseDisplayUserTag extends BodyTagSupport {
public static Logger log = Logger.getLogger("wenrgise.common.taglib.enrgise.EnrgiseDisplayUserTag");
public int doStartTag() throws JspException {
try {
String sessionBeanName = ParamUtil.getSessionBeanName();
UserInfo oUserInfo = (UserInfo)RequestUtils.lookup(this.pageContext, sessionBeanName, "userInfo", "session");
if (null != oUserInfo) {
String sEmp = RequestUtils.message(this.pageContext, null, "org.apache.struts.action.LOCALE", "wenrgise.common.user.name", null);
StringBuffer sbOutString = new StringBuffer(sEmp);
sbOutString.append(oUserInfo.getUserName());
sbOutString.append("(");
sbOutString.append(oUserInfo.getUserId());
sbOutString.append(")");
sbOutString.append(" ");
String sSite = RequestUtils.message(this.pageContext, null, "org.apache.struts.action.LOCALE", "wenrgise.common.site.name", null);
sbOutString.append(sSite);
sbOutString.append(oUserInfo.getSiteName());
sbOutString.append("(");
sbOutString.append(oUserInfo.getSiteCode());
sbOutString.append(")");
ResponseUtils.write(this.pageContext, sbOutString.toString());
}
} catch (Exception oEx) {
log.info(oEx.getMessage());
}
return 2;
}
}

View File

@@ -0,0 +1,52 @@
package wenrgise.ejb.common.utility;
import java.rmi.RemoteException;
import java.util.Locale;
import java.util.logging.Logger;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import wenrgise.common.utility.UserInfo;
import wenrgise.ejb.common.session.UserSession;
import wenrgise.ejb.common.session.UserSessionHome;
public class EnrgiseListener implements HttpSessionListener {
static final Logger log = Logger.getLogger("wenrgise.common.utility.EnrgiseListener");
public void sessionCreated(HttpSessionEvent sEvent) {
try {
System.out.println("Creating Session---->");
HttpSession session = sEvent.getSession();
UserSession oUser = (UserSession)session.getAttribute(ParamUtil.getSessionBeanName());
if (oUser == null) {
UserSessionHome oUserHome = (UserSessionHome)ServiceLocator.getLocator().getService("UserSession");
oUser = oUserHome.create();
UserInfo oUserInfo = new UserInfo();
oUser.setUserInfo(oUserInfo);
Locale oLocale = (Locale)session.getAttribute("locale");
oUser.setUserLocale((Locale)session.getAttribute("locale"));
session.setAttribute(ParamUtil.getSessionBeanName(), oUser);
}
} catch (RemoteException oRmt) {
log.severe(oRmt.getMessage());
} catch (CreateException oCrt) {
log.severe(oCrt.getMessage());
} catch (Exception oExCc) {
log.severe(oExCc.getMessage());
}
}
public void sessionDestroyed(HttpSessionEvent sEvent) {
try {
HttpSession session = sEvent.getSession();
if (session != null) {
UserSession oUser = (UserSession)session.getAttribute(ParamUtil.getSessionBeanName());
oUser.remove();
}
} catch (RemoveException removeException) {
} catch (RemoteException remoteException) {}
}
}

View File

@@ -0,0 +1,66 @@
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;
}
}

View File

@@ -0,0 +1,56 @@
package wenrgise.ejb.common.utility;
import com.tcs.wenrgise.util.common.FWXMLUtility;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;
import wenrgise.common.xml.vo.EnrgiseApp;
import wenrgise.common.xml.vo.EnrgiseForms;
import wenrgise.common.xml.vo.LOVClass;
public class EnrgisePlugIn implements PlugIn {
static final Logger log = Logger.getLogger("wenrgise.ejb.common.utility.EnrgisePlugIn");
private String formPathName = "/WEB-INF/EnrgiseConfig.xml";
private String pathName = "/WEB-INF/EnrgiseLOV.xml";
private String appPath = "/WEB-INF/EnrgiseApp.xml";
private String reportPathName = "/WEB-INF/EnrgiseReport.xml";
private String wflImplPathName = "/WEB-INF/WflDocParameters.xml";
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException {
try {
System.out.println("I am in enrgise plugIn for HRMS--->");
String appPathTest = calculatePath(servlet, this.appPath);
String configPathTest = calculatePath(servlet, this.formPathName);
String lovPathTest = calculatePath(servlet, this.pathName);
EnrgiseForms oEnrgiseForms = (EnrgiseForms)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseForms", configPathTest);
EnrgiseManager.getInstance().init(oEnrgiseForms);
LOVClass oLOVClass = (LOVClass)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.LOVClass", lovPathTest);
LOVManager.getInstance().init(oLOVClass);
EnrgiseApp oEnrgiseApp = (EnrgiseApp)FWXMLUtility.xmlToObject("wenrgise.common.xml.vo.EnrgiseApp", appPathTest);
EnrgiseManager.getInstance().setEnrApp(oEnrgiseApp);
} catch (Exception oEx) {
log.severe(oEx.getMessage());
}
}
public void destroy() {}
private String calculatePath(ActionServlet servlet, String sPath) {
return servlet.getServletContext().getRealPath(sPath);
}
public String getFormPathName() {
return this.formPathName;
}
public void setFormPathName(String newFormPathName) {
this.formPathName = newFormPathName;
}
}

View File

@@ -0,0 +1,28 @@
package wenrgise.ejb.common.utility;
import java.rmi.RemoteException;
import java.util.logging.Logger;
import javax.ejb.RemoveException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionActivationListener;
import javax.servlet.http.HttpSessionEvent;
import wenrgise.ejb.common.session.UserSession;
public class EnrgiseSessionListener implements HttpSessionActivationListener {
static final Logger log = Logger.getLogger("wenrgise.common.Utility.EnrgiseSessionListener");
public void sessionDidActivate(HttpSessionEvent sessionEvent) {}
public void sessionWillPassivate(HttpSessionEvent sessionEvent) {
try {
HttpSession oS = sessionEvent.getSession();
UserSession oUser = (UserSession)oS.getAttribute(ParamUtil.getSessionBeanName());
if (oUser != null)
oUser.remove();
} catch (RemoteException oExc) {
log.severe(String.valueOf("The reason ").concat(String.valueOf(oExc.getMessage())));
} catch (RemoveException oEx) {
log.severe(String.valueOf("The reason ").concat(String.valueOf(oEx.getMessage())));
}
}
}

View File

@@ -0,0 +1,65 @@
package wenrgise.ejb.common.utility;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
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;
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();
}
}

View File

@@ -0,0 +1,95 @@
package wenrgise.ejb.common.utility;
import java.util.ArrayList;
import wenrgise.common.xml.vo.DetailScreen;
import wenrgise.common.xml.vo.DetailScreens;
import wenrgise.common.xml.vo.HashedEnrgiseForms;
import wenrgise.common.xml.vo.SingleForm;
public class ParamUtil {
public static String getDBName() {
return (String)EnrgiseManager.getInstance().getAppMap().get("DBName");
}
public static String getModuleName() {
return (String)EnrgiseManager.getInstance().getAppMap().get("Module");
}
public static String getQueryVO(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_EnrgiseQueryVO();
}
public static String getHeaderBD(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderBD();
}
public static String getHeaderSaveRequired(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderSave();
}
public static String getPseudoHeaderFlag(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_PseudoHeader();
}
public static String getDetailBD(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailBD();
}
public static String getDetailArrayName(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailArrayName();
}
public static String getDetailBeanName(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return oDetailScreen.get_DetailBean();
}
public static String getSessionBeanName() {
String s = String.valueOf(getModuleName()).concat(String.valueOf("_UserSession"));
return String.valueOf(getModuleName()).concat(String.valueOf("_UserSession"));
}
public static String getHeaderBean(String sFormName) {
try {
System.out.println(String.valueOf("I am in paramUtil-->").concat(String.valueOf(sFormName)));
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return oHashedEnrgiseForms.getSingleForm().get_HeaderBean();
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
public static int getHeaderSize(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
return Integer.parseInt(oHashedEnrgiseForms.getSingleForm().get_HeaderSize());
}
public static int getDetailRecordPerPage(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return Integer.parseInt(oDetailScreen.get_DetailRecordPerPage());
}
public static int getMaxDetailPages(String sFormName, String sScreenName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
DetailScreen oDetailScreen = (DetailScreen)oHashedEnrgiseForms.getDetailMap().get(sScreenName);
return Integer.parseInt(oDetailScreen.get_DetailPagesPerSlot());
}
public static ArrayList getDetailList(String sFormName) {
HashedEnrgiseForms oHashedEnrgiseForms = EnrgiseManager.getInstance().getCachedObject(sFormName);
SingleForm oSingleForm = oHashedEnrgiseForms.getSingleForm();
DetailScreens oDetailScreens = oSingleForm.get_DetailScreens();
return oDetailScreens.get_DetailScreen();
}
}

View File

@@ -0,0 +1,50 @@
package wenrgise.ejb.common.utility;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.DetailSizeValues;
public class PositionResolver {
public static long getStartPosition(BaseQueryVO oBaseQueryVO, long lTotalCount) {
int iMaxHeaderSize = oBaseQueryVO.getMaxHeaderSize();
long lPositionRequested = oBaseQueryVO.getPositionRequested();
if (lPositionRequested != 0L) {
long l;
return l = lPositionRequested;
}
int iStep = (int)(lTotalCount / iMaxHeaderSize);
long lStartPosition;
return lStartPosition = (iStep * iMaxHeaderSize + 1);
}
public static long getLastPosition(BaseQueryVO oBaseQueryVO, long lTotalCount) {
long lLastPosition;
int iMaxHeaderSize = oBaseQueryVO.getMaxHeaderSize();
long lPositionRequested = oBaseQueryVO.getPositionRequested();
if (lPositionRequested != 0L) {
if (lPositionRequested + iMaxHeaderSize - 1L < lTotalCount) {
lLastPosition = lPositionRequested + iMaxHeaderSize - 1L;
} else {
lLastPosition = lTotalCount;
}
} else {
lLastPosition = lTotalCount;
}
return lLastPosition;
}
public static long getDetailFirstPosition(int iStartPage, long lTotalDetailRecord, DetailSizeValues oDetailSizeValues) {
int iDetailRecordPerPage = oDetailSizeValues.getDetailRecordPerPage();
int iMaxPage = oDetailSizeValues.getMaxPages();
if (lTotalDetailRecord > ((iStartPage - 1) * iDetailRecordPerPage))
return ((iStartPage - 1) * iDetailRecordPerPage + 1);
return 1L;
}
public static long getDetailLastPosition(int iStartPage, long lTotalDetailRecord, DetailSizeValues oDetailSizeValues) {
int iDetailRecordPerPage = oDetailSizeValues.getDetailRecordPerPage();
int iMaxPage = oDetailSizeValues.getMaxPages();
if (lTotalDetailRecord > ((iStartPage + iMaxPage - 1) * iDetailRecordPerPage))
return ((iStartPage + iMaxPage - 1) * iDetailRecordPerPage);
return lTotalDetailRecord;
}
}

View File

@@ -0,0 +1,91 @@
package wenrgise.ejb.common.utility;
import java.util.HashMap;
import javax.ejb.EJBLocalHome;
import javax.naming.Context;
import javax.naming.NamingException;
import wenrgise.common.exception.EnrgiseSystemException;
public class ServiceLocator {
private HashMap homeCache;
private final HashMap cacheMap = new HashMap();
private static ServiceLocator serviceLocator = new ServiceLocator();
private ServiceLocator() {
try {
this.homeCache = new HashMap();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static ServiceLocator getLocator() {
return serviceLocator;
}
public Object getService(String jndiName) throws EnrgiseSystemException {
try {
if (!this.homeCache.containsKey(jndiName.trim())) {
System.out.println("Test For Service Locator ---->");
System.out.println(String.valueOf("JNDI Name ---->").concat(String.valueOf(jndiName)));
Context context = myContextProvider.getContext();
System.out.println(String.valueOf("Context Name ---->").concat(String.valueOf(context.getNameInNamespace())));
System.out.println(String.valueOf("Context").concat(String.valueOf(context.getEnvironment())));
System.out.println("Context security java.naming.security.credentials");
System.out.println("Context url is java.naming.provider.url");
System.out.println(String.valueOf("jndiName : ").concat(String.valueOf(context.lookup(jndiName))));
this.homeCache.put(jndiName.trim(), context.lookup(jndiName.trim()));
System.out.println(String.valueOf("After JNDI Name ---->").concat(String.valueOf(jndiName)));
}
} catch (NamingException oNa) {
oNa.printStackTrace();
System.out.println(oNa.getExplanation());
throw new EnrgiseSystemException(oNa);
} catch (Exception oEx) {
oEx.printStackTrace();
throw new EnrgiseSystemException(oEx);
}
return this.homeCache.get(jndiName.trim());
}
public Object getLocalService(String jndiHomeName) throws EnrgiseSystemException {
Object obj = null;
try {
Context context = myContextProvider.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
obj = this.cacheMap.get(jndiHomeName);
} else {
obj = context.lookup(jndiHomeName);
this.cacheMap.put(jndiHomeName, obj);
}
} catch (NamingException ne) {
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
}
return obj;
}
public EJBLocalHome getLocalHome(String jndiHomeName) throws EnrgiseSystemException {
System.out.println(String.valueOf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").concat(String.valueOf(jndiHomeName)));
EJBLocalHome home = null;
try {
Context context = myContextProvider.getLocalContext();
if (this.cacheMap.containsKey(jndiHomeName)) {
home = (EJBLocalHome)this.cacheMap.get(jndiHomeName);
} else {
home = (EJBLocalHome)context.lookup(String.valueOf("java:comp/env/").concat(String.valueOf(jndiHomeName)));
this.cacheMap.put(jndiHomeName, home);
}
} catch (NamingException ne) {
System.out.println(ne);
ne.printStackTrace();
throw new EnrgiseSystemException(ne);
} catch (Exception oEx) {
oEx.printStackTrace();
throw new EnrgiseSystemException(oEx);
}
return home;
}
}

View File

@@ -0,0 +1,44 @@
package wenrgise.ejb.common.utility;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class myContextProvider {
private Context ctx = null;
public static InitialContext localContext;
static {
try {
localContext = new InitialContext();
} catch (NamingException oNx) {
oNx.printStackTrace();
}
}
private static myContextProvider objContextProvider = new myContextProvider();
private myContextProvider() {
try {
Hashtable env = new Hashtable();
System.out.println("Test for ContextProvider -->");
env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
env.put("java.naming.provider.url", "t3://weblogicServer:7001");
env.put("java.naming.security.principal", "weblogic");
env.put("java.naming.security.credentials", "weblogic");
this.ctx = new InitialContext();
} catch (Throwable e) {
e.printStackTrace();
}
}
public static Context getContext() {
return objContextProvider.ctx;
}
public static InitialContext getLocalContext() {
return localContext;
}
}