Commit 93d5c86f authored by msingh's avatar msingh

Changes merging for ddwms.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99108 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c359eb59
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class ItemAttribute extends ValidatorEJB implements ItemAttributeLocal, ItemAttributeRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String wfValData() 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;
try
{
System.out.println("Val xmlString :: " + xmlString );
System.out.println("Val xmlString1 :: " + xmlString1 );
System.out.println("Val xmlString2 :: " + xmlString2 );
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
dom2 = parseString(xmlString2);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException( e );
}
return (errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("wfValData.....called..");
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr=0,currentFormNo =0,childNodeListLength =0;
String loginSite="",userId="";
String childNodeName = null,childNodeValue = null;
String errString = "";
Connection conn = null;
SimpleDateFormat simpleDateFormat = null;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
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();
System.out.println("itmAttr_codechildNodeName.editFlag." + childNodeName+".." + editFlag);
if(childNode.getFirstChild()!= null)
{
childNodeValue = childNode.getFirstChild().getNodeValue();
}
if(childNodeName.equalsIgnoreCase("ATTRIB_CODE") )
{
if (childNode.getFirstChild() == null)
{
errString = getErrorString("ATTRIB_CODE","VMATTCOD",userId);
break ;
}
}
else if(childNodeName.equalsIgnoreCase("DESCR"))
{
if (childNode.getFirstChild() == null)
{
errString = getErrorString("DESCR","VMDESCR",userId);
break ;
}
}
}
break;
}//END SWITCH
}//END TRY
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
errString=e.getMessage();
}
finally
{
try
{
if(conn!=null)
{
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::"+errString);
return errString;
}
}
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class ItemAttributeIC extends ValidatorEJB implements ItemAttributeICLocal, ItemAttributeICRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String wfValData() 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;
try
{
System.out.println("Val xmlString :: " + xmlString );
System.out.println("Val xmlString1 :: " + xmlString1 );
System.out.println("Val xmlString2 :: " + xmlString2 );
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
dom2 = parseString(xmlString2);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException( e );
}
return (errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("wfValData.....called..");
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr=0,currentFormNo =0,childNodeListLength =0;
String loginSite="",userId="";
String childNodeName = null,childNodeValue = null;
String errString = "";
Connection conn = null;
SimpleDateFormat simpleDateFormat = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String attribCode = "";
String sql = "";
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
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();
System.out.println("itmAttr_codechildNodeName.editFlag." + childNodeName+".." + editFlag);
if(childNode.getFirstChild()!= null)
{
childNodeValue = childNode.getFirstChild().getNodeValue();
}
if(childNodeName.equalsIgnoreCase("ATTRIB_CODE") )
{
if (childNode.getFirstChild() == null)
{
errString = getErrorString("ATTRIB_CODE","VMATTCOD",userId);
break ;
}
}
else if(childNodeName.equalsIgnoreCase("DESCR"))
{
if (childNode.getFirstChild() == null)
{
errString = getErrorString("DESCR","VMDESCR",userId);
break ;
}
}
}
break;
}//END SWITCH
System.out.println("EditFlag : "+editFlag);
if(!"E".equalsIgnoreCase(editFlag))
{
attribCode = checkNull(genericUtility.getColumnValue("attrib_code", dom));
sql =" SELECT count(1) FROM ITEM_ATTRIBUTE WHERE attrib_code=? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, attribCode);
rs = pstmt.executeQuery();
int count=0;
if(rs.next())
{
count = rs.getInt(1);
}
pstmt.close();
rs.close();
if(count != 0 )
{
errString = getErrorString("attrib_id","VTEXIST",userId);
return errString;
}
}
}//END TRY
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
errString=e.getMessage();
}
finally
{
try
{
if(conn!=null)
{
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
System.out.println("ErrString ::"+errString);
return errString;
}
private String checkNull( String input )
{
if(input == null)
{
input = "";
}
return input;
}
}
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface ItemAttributeICLocal 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;
}
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.w3c.dom.Document;
@Remote
public interface ItemAttributeICRemote 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;
}
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface ItemAttributeLocal 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;
}
/*
* Author:Manish Singh
* Date:28-Apr-15
* Request ID:D15AKAT017 (Item Attribute)
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.w3c.dom.Document;
@Remote
public interface ItemAttributeRemote 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;
}
This diff is collapsed.
/**
* PURPOSE : DefaultItemChanged for Item Attribute Values master
* AUTHOR : Samadhan On 28/04/2015
* Obj_name : itm_attrib_val
* Request Id: D15AKAT013
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface ItmAttribValICLocal extends ibase.webitm.ejb.ValidatorLocal
{
public String itemChanged() throws RemoteException, ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String xtraParams) throws RemoteException, ITMException;
}
/**
* PURPOSE : DefaultItemChanged for Item Attribute Values master
* AUTHOR : Samadhan On 21/04/2015
* Obj_name : itm_attrib_val
* Request Id: D15AKAT014
*/
package ibase.webitm.ejb.wms;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Remote
public interface ItmAttribValICRemote extends ibase.webitm.ejb.ValidatorRemote
{
public String itemChanged() throws RemoteException, ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String xtraParams) throws RemoteException, ITMException;
}
\ No newline at end of file
/**
* PURPOSE : post save for Item Attribute Values master
* AUTHOR : Samadhan On 25/05/2015
* Obj_name : itm_attrib_val
* Request Id: D15BKAT003
*/
package ibase.webitm.ejb.wms;
import ibase.utility.CommonConstants;
import ibase.webitm.bean.wms.Attribute;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.wms.CommonWmsUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@javax.ejb.Stateless
public class ItmAttribValPos extends ValidatorEJB implements ItmAttribValPosLocal, PhyItemVerifyPosRemote
{
String apiAttribUrl="";
public String postSave()throws RemoteException,ITMException
{
return "";
}
public String postSave(String domString, String tranId,String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
String errString = "";
String siteCode = "";
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
int childNodeListLength = 0;
Document dom = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String empCode = "",loginCode= "";
CommonWmsUtil wmsUtil = new CommonWmsUtil();
try
{
if(editFlag.equalsIgnoreCase("A"))
{
CommonConstants.setIBASEHOME();
setDDSalesConfig();
GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("STRING{"+domString+"}");
dom = genericUtility.parseString(domString);
siteCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" );
System.out.println("********* login site code ["+siteCode+"]");
loginCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
System.out.println("********* login code ["+loginCode+"]");
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength= childNodeList.getLength();
String attribCode="",attribId="",descr="",shDescr="",activeYN="",sortOrder="",udfStr1="",udfStr2="",udfStr3="",udfStr4="",udfStr5="",itemAtrDescr="";
for ( int i = 0; i < childNodeListLength; i++ )
{
Node childNode = childNodeList.item(i);
String nodeName = childNode.getNodeName();
if (nodeName.equalsIgnoreCase("attrib_code"))
{
if ( childNode != null && childNode.getFirstChild() != null )
{
attribCode = checkNull(childNode.getFirstChild().getNodeValue());
}
}
if (nodeName.equalsIgnoreCase("attrib_id"))
{
if ( childNode != null && childNode.getFirstChild() != null )
{
attribId = checkNull(childNode.getFirstChild().getNodeValue());
}
}
if (nodeName.equalsIgnoreCase("descr"))
{
if ( childNode != null && childNode.getFirstChild() != null )
{
descr = checkNull(childNode.getFirstChild().getNodeValue());
}
}
}
Attribute objAttrib = new Attribute();
//Changed by wasim on 14-08-2015 to set apiKey for magento [START]
String apiKey = wmsUtil.getDDSalesConfig("API_KEY");
objAttrib.setApiKey(apiKey);
//Changed by wasim on 14-08-2015 to set apiKey for magento [START]
//Changed by samadhan start for integrate SIZE attribute only Start
/*
if(attribCode.equalsIgnoreCase("S001") || attribCode.equalsIgnoreCase("S002") || attribCode.equalsIgnoreCase("S003"))
{
objAttrib.setAttrName("SIZE");
}
else
{
objAttrib.setAttrName(attribCode);
}
*/
objAttrib.setAttrName(attribCode);
//Changed by samadhan start for integrate SIZE attribute only End
/*if(attribCode.equalsIgnoreCase("SIZE"))
{
objAttrib.setAttrValue(attribId);
}
else
{
objAttrib.setAttrValue(descr);
}*/
objAttrib.setAttrValue(descr);
int apiAttribCode = 0;
String sql="";
int attribCnt = 0;
sql = "select count(*) from itm_attrib_val where attrib_id = ? and attrib_code='SIZE_TYPE' ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1, attribCode);
rs=pstmt.executeQuery();
if(rs.next())
{
attribCnt = rs.getInt(1);
}
pstmt.close();
rs.close();
if(attribCnt>0)
{
sql = "select udf__str1 from itm_attrib_val where attrib_id = ? and attrib_code = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1, attribId);
pstmt.setString(2, "SIZE");
rs=pstmt.executeQuery();
if(rs.next())
{
apiAttribCode = rs.getInt(1);
}
}
else
{
apiAttribCode = wmsUtil.CallAttribute(objAttrib, apiAttribUrl);
}
updateAttribUdfStr(apiAttribCode,attribCode,attribId,conn);
}
}
catch(Exception e)
{
try
{
System.out.println("Exception "+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
finally
{
try
{
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
}
private void updateAttribUdfStr(int apiAttribCode, String attribCode,String attribId,Connection conn)
{
String sql = "";
PreparedStatement pstmt = null;
try
{
sql = "update itm_attrib_val set udf__str1 = ? where attrib_code = ? and attrib_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(apiAttribCode));
pstmt.setString(2, attribCode);
pstmt.setString(3, attribId);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}
catch(Exception e)
{
}
}
public String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input))
{
input= "";
}
return input.trim();
}
private void setDDSalesConfig()
{
CommonConstants objCommon =new CommonConstants();
GenericUtility genericUtility=GenericUtility.getInstance();
String fileName = null,xmlString = "",xmlFileName = "";
Document dom=null;
String sCurrentLine = "";
String xmlFile="DDSalesConfig";
System.out.println(" in setDDSalesConfig -------------------------");
System.out.println("CommonConstants.APPLICATION_CONTEXT-->>["+CommonConstants.APPLICATION_CONTEXT+"]");
System.out.println("CommonConstants.JBOSSHOME-->>["+CommonConstants.JBOSSHOME+"]");
if(CommonConstants.APPLICATION_CONTEXT != null)
{
xmlFileName = CommonConstants.APPLICATION_CONTEXT + "setting" + File.separator + "DDSalesConfig.xml";
}
else
{
xmlFileName = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator +"setting" + File.separator +"DDSalesConfig.xml";
}
StringBuilder sb = new StringBuilder();
System.out.println("xmlFileName-->>["+xmlFileName+"]");
try
{
BufferedReader br = new BufferedReader(new FileReader(xmlFileName));
while (( sCurrentLine = br.readLine()) != null)
{
sb.append(sCurrentLine);
}
xmlString =sb.toString();
System.out.println("DDSalesConfig xmlString---->>["+xmlString+"]");
dom = genericUtility.parseString(xmlString);
if(dom != null)
{
this.apiAttribUrl = genericUtility.getColumnValue("ATTRIB_OPTION_API_URL",dom);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
/**
* PURPOSE : post save for Item Attribute Values master
* AUTHOR : Samadhan On 25/05/2015
* Obj_name : itm_attrib_val
* Request Id: D15BKAT003
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Local
public interface ItmAttribValPosLocal extends ValidatorLocal
{
public String postSave()throws RemoteException,ITMException;
public String postSave( String domString,String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
}
\ No newline at end of file
/**
* PURPOSE : post save for Item Attribute Values master
* AUTHOR : Samadhan On 25/05/2015
* Obj_name : itm_attrib_val
* Request Id: D15BKAT003
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
@javax.ejb.Remote
public interface ItmAttribValPosRemote extends ValidatorRemote
{
public String postSave()throws RemoteException,ITMException;
public String postSave( String domString,String tranId, String editFlag, String xtraParams, Connection conn ) 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