Commit 82bcb24b authored by jshaikh's avatar jshaikh

Added new components for workflows

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@180102 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 34c52578
...@@ -78,7 +78,7 @@ public class GenericWorkflowClass { ...@@ -78,7 +78,7 @@ public class GenericWorkflowClass {
} }
String entityCodeInit = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); String entityCodeInit = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
retString = xml2dbObj.invokeWorkflowExternal(domAll, entityCodeInit, wrkflwInit, objName, refSer, tranId); retString = xml2dbObj.invokeWorkflowExternal(domAll, entityCodeInit, wrkflwInit, objName, refSer, tranId, conn);
System.out.println("retString From xml2dbObj.invokeWorkflowExternal --->" + retString); System.out.println("retString From xml2dbObj.invokeWorkflowExternal --->" + retString);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
......
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.GenericWorkflowClass;
import ibase.webitm.utility.ITMException;
@Stateless
public class ConsumpIssueConfWfEJB extends ActionHandlerEJB implements ConsumpIssueConfWfEJBLocal, ConsumpIssueConfWfEJBRemote {
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
System.out.println("@@@@@@@@@@@@@@@@@@@@ ConsumpIssueConfWfEJB @@@@@@@@@@@@@@@@");
String userId = "";
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String status = "",confirmed = "",retString = "";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
conn = getConnection();
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("tran_id ..> " + tranId+" userId: "+userId+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
tranId = checkNull(tranId);
sql = " SELECT confirmed FROM consume_iss WHERE cons_issue = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next()) {
confirmed = rs.getString("confirmed");
}
confirmed = checkNull(confirmed);
closePstmtRs(pStmt, rs);
if(!"Y".equalsIgnoreCase(confirmed) || "".equalsIgnoreCase(confirmed))
{
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
retString = wfGenericClass.invokeWorkflow(conn, tranId, xtraParams, "w_consume_issue", "consume_issue");
if ("success".equalsIgnoreCase(retString))
{
sql = "UPDATE CONSUME_ISS SET CONFIRMED = 'Y' WHERE CONS_ISSUE = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
int updCount = pStmt.executeUpdate();
if (updCount > 0)
{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWS", "");
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
isError=true;
}
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
}
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALCNF", "");
}
} catch (Exception e) {
isError = true;
System.out.println("Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
} finally {
if (conn != null) {
try {
if (isError) {
conn.rollback();
System.out.println("ConsumpIssueConfWfEJB: confirm: Connection Rollback");
} else {
conn.commit();
System.out.println("ConsumpIssueConfWfEJB: confirm: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return errString;
}
private String checkNull(String str) {
if(str == null){
str = "";
}
else{
str = str.trim();
}
return str;
}
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs) {
if (pStmt != null) {
try {
pStmt.close();
} catch (SQLException localSQLException1) {
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Local;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface ConsumpIssueConfWfEJBLocal extends ActionHandlerLocal
{
public String confirm(String paramString1, String paramString2,String paramString3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface ConsumpIssueConfWfEJBRemote extends ActionHandlerRemote
{
public String confirm(String paramString1, String paramString2,String paramString3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis.adv;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.GenericWorkflowClass;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
@Stateless
public class PContractConfWfEJB extends ActionHandlerEJB implements PContractConfWfEJBLocal, PContractConfWfEJBRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
System.out.println("@@@@@@@@@@@@@@@@@@@@ PContractConfWfEJB @@@@@@@@@@@@@@@@");
String userId = "";
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String status = "",confirmed = "",retString = "";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
conn = getConnection();
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("tran_id ..> " + tranId+" userId: "+userId+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
tranId = checkNull(tranId);
sql = " SELECT status,confirmed FROM pcontract_hdr WHERE contract_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next()) {
status = rs.getString("status");
confirmed = rs.getString("confirmed");
}
status = checkNull(status);
confirmed = checkNull(confirmed);
closePstmtRs(pStmt, rs);
if(!"Y".equalsIgnoreCase(confirmed) || "".equalsIgnoreCase(confirmed))
{
if ("O".equalsIgnoreCase(status) || "R".equalsIgnoreCase(status) || "".equalsIgnoreCase(status))
{
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
retString = wfGenericClass.invokeWorkflow(conn, tranId, xtraParams, "w_pcontract", "pcontract");
if ("success".equalsIgnoreCase(retString)) {
sql = "UPDATE PCONTRACT_HDR SET CONFIRMED = 'Y' WHERE CONTRACT_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
int updCount = pStmt.executeUpdate();
if (updCount > 0) {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWS", "");
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
isError=true;
}
} else {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
}
}
else {
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALINT", "");
}
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALCNF", "");
}
} catch (Exception e) {
isError = true;
System.out.println("Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
} finally {
if (conn != null) {
try {
if (isError) {
conn.rollback();
System.out.println("PContractConfWfEJB: confirm: Connection Rollback");
} else {
conn.commit();
System.out.println("PContractConfWfEJB: confirm: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return errString;
}
private String checkNull(String str) {
if(str == null){
str = "";
}
else{
str = str.trim();
}
return str;
}
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs) {
if (pStmt != null) {
try {
pStmt.close();
} catch (SQLException localSQLException1) {
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Local;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface PContractConfWfEJBLocal extends ActionHandlerLocal
{
public String confirm(String paramString1, String paramString2,String paramString3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface PContractConfWfEJBRemote extends ActionHandlerRemote
{
public String confirm(String paramString1, String paramString2, String paramString3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.wrkflw.GenericWorkflowClass;
import ibase.webitm.utility.ITMException;
@Stateless
public class SContractConfWfEJB extends ActionHandlerEJB implements SContractConfWfEJBLocal, SContractConfWfEJBRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
System.out.println("@@@@@@@@@@@@@@@@@@@@ SContractConfWfEJB @@@@@@@@@@@@@@@@");
String userId = "";
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
String status = "",confirmed = "",retString = "";
String[] authencate = new String[2];
authencate[0] = "";
authencate[1] = "";
boolean isError = false;
try {
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
conn = getConnection();
conn.setAutoCommit(false);
userId = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("tran_id ..> " + tranId+" userId: "+userId+" xtraParams: "+xtraParams+" forcedFlag: "+forcedFlag);
tranId = checkNull(tranId);
sql = "SELECT confirmed FROM scontract WHERE contract_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
rs = pStmt.executeQuery();
if (rs.next()) {
confirmed = rs.getString("confirmed");
}
confirmed = checkNull(confirmed);
closePstmtRs(pStmt, rs);
if(!"Y".equalsIgnoreCase(confirmed))
{
GenericWorkflowClass wfGenericClass = new GenericWorkflowClass();
retString = wfGenericClass.invokeWorkflow(conn, tranId, xtraParams, "w_scontract", "scontract");
if ("success".equalsIgnoreCase(retString))
{
sql = "UPDATE SCONTRACT SET CONFIRMED = 'Y' WHERE CONTRACT_NO = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, tranId);
int updCount = pStmt.executeUpdate();
if (updCount > 0)
{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWS", "");
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
isError=true;
}
}
else {
errString = new ITMDBAccessEJB().getErrorString("", "VFMWRKFLWF", "");
}
}
else{
errString = new ITMDBAccessEJB().getErrorString("", "VTMWFALCNF", "");
}
} catch (Exception e) {
isError = true;
System.out.println("Exception: confirm method ..> " + e.getMessage());
e.printStackTrace();
errString = itmDBAccessEJB.getErrorString("", "VFMWRKFLWF", userId);
throw new ITMException(e);
} finally {
if (conn != null) {
try {
if (isError) {
conn.rollback();
System.out.println("SContractConfWfEJB: confirm: Connection Rollback");
} else {
conn.commit();
System.out.println("SContractConfWfEJB: confirm: Connection Commit");
}
conn.close();
conn = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return errString;
}
private String checkNull(String str) {
if(str == null){
str = "";
}
else{
str = str.trim();
}
return str;
}
private void closePstmtRs(PreparedStatement pStmt, ResultSet rs) {
if (pStmt != null) {
try {
pStmt.close();
} catch (SQLException localSQLException1) {
}
pStmt = null;
}
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs = null;
}
}
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Local;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface SContractConfWfEJBLocal extends ActionHandlerLocal
{
public String confirm(String paramString1, String paramString2,String paramString3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.dis.adv;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
@Remote
public interface SContractConfWfEJBRemote extends ActionHandlerRemote
{
public String confirm(String paramString1, String paramString2,String paramString3) throws RemoteException, ITMException;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment