Commit 8329026c authored by tmahadi's avatar tmahadi

Purchase Milestone pre_save_sign Validator EJB for Completion Date.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98353 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 70dcd9e1
/********************************************************
Title : PurMilstnValidatorEJB
Date : 24/07/2015
Author: Aniket D. Bibave
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.ejb.Stateless; // added for ejb3
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless // added for ejb3
public class PurMilstnValidatorEJB extends ValidatorEJB
implements PurMilstnValidatorEJBLocal,PurMilstnValidatorEJBRemote {
public String wfValData() throws RemoteException,ITMException {
return "";
}
public String itemChanged() throws RemoteException,ITMException {
return "";
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException {
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = "";
try {
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 ) {
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
if(objContext != null && Integer.parseInt(objContext) == 1) {
parentNodeList = dom2.getElementsByTagName("Header0");
parentNode = parentNodeList.item(1);
childNodeList = parentNode.getChildNodes();
for(int x=0;x<childNodeList.getLength();x++) {
childNode = childNodeList.item(x);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("Detail1")) {
errString = wfValData(dom,dom1,dom2,"1",editFlag,xtraParams);
if(errString != null && errString.trim().length()>0)
break;
} else if(childNodeName.equalsIgnoreCase("Detail2")) {
errString = wfValData(dom,dom1,dom2,"2",editFlag,xtraParams);
break;
}
}
} else {
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
} catch(Exception e) {
e.printStackTrace();
throw new ITMException(e);
}
return (errString);
}
public String itemChanged(Document dom, Document dom1,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException {
return "";
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag) throws RemoteException,ITMException {
return "";
}
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException {
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr = 0;
String childNodeName = null;
String errString = "";
String errCode = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String userId = "";
int currentFormNo=0;
int childNodeListLength;
ConnDriver connDriver = new ConnDriver();
String compl_date ="";
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo) {
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++) {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("compl_date")) {
compl_date = getColumnValue("compl_date",dom);
if (compl_date == null || compl_date.trim().length() == 0 )
{
errCode = "VMSITECD1";//This is a pre existing err code
errString = getErrorString("compl_date",errCode,userId);
break;
}
}// end of compl_date
}
break;
}
} catch(Exception e) {
throw new ITMException(e);
} finally {
try {
if(conn != null) {
conn.close();
conn = null;
}
if(pstmt != null) {
pstmt.close();
pstmt =null;
}
if(rs != null) {
rs.close();
rs = null;
}
} catch(Exception d) {
throw new ITMException(d);
}
}
return errString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
public interface PurMilstnValidatorEJBLocal extends ValidatorLocal {
public String wfValData() throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
public interface PurMilstnValidatorEJBRemote extends ValidatorRemote{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() 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