Commit 330a048b authored by nkhan's avatar nkhan

Added by Nasruddin khan


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102564 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 205f22c4
......@@ -40,9 +40,12 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
try
{
dom = parseString(xmlString);
System.out.println("Inside Dom :: =======>>>>"+xmlString);
dom1 = parseString(xmlString1);
System.out.println("Inside Dom1 :: =======>>>>"+xmlString1);
dom2 = parseString(xmlString2);
System.out.println("@@@@@@@@ wfValData called");
System.out.println("Inside Dom2 :: =======>>>>"+xmlString2);
System.out.println("@@@@@@@@ wfValData called !!!!!!!");
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
......@@ -87,14 +90,17 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
String itminfo ="";
java.sql.Timestamp validUptoTemp2=null;
String commCriteria = "";
double maxAmount = 0.0;
double minAmount = 0.0;
double commPercentage = 0.0;
try
{
System.out.println("@@@@@@@@ wfvaldata called");
System.out.println("@@@@@@@@ wfvaldata called !!!!!!!!!!!!!!!!!!!!!!");
//Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
connDriver = null;
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
......@@ -114,6 +120,9 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ::["+childNodeName);
if(childNodeName.equalsIgnoreCase("comm_table") && ("A".equalsIgnoreCase(editFlag)) )
{
......@@ -213,12 +222,16 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
}
}
}
} // end for
break;
case 2:
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
......@@ -431,13 +444,189 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
break ;
}
}
//changed by Nasruddin khan 20/JUL/2016 [D16DFOR001] Start
commCriteria = genericUtility.getColumnValue("comm_criteria", dom1);
System.out.println("commCriteria ::: ["+commCriteria);
if(commCriteria != null && commCriteria.trim().length()>0){
if(!"I".equalsIgnoreCase(commCriteria)){
errString = itmDBAccessEJB.getErrorString("","VMINTRNREC",userId);
break;
}
}
System.out.println("Inside detail 2 validation :::::::::");
}
break;
// changed by Nasruddin khan [20/JUL/16 D16DFOR001] END
// changed by Nasruddin khan [19/JUL/16 D16DFOR001] END
case 3:
parentNodeList = dom.getElementsByTagName("Detail3");
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("comm_table"))//start comm_table
{
System.out.println("validation comm_table executed");
commTable = genericUtility.getColumnValue("comm_table",dom);
if(commTable == null || commTable.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("","VMCOMTBNUL",userId);
break ;
}
} // end comm_table
if(childNodeName.equalsIgnoreCase("line_no")) // start line_no
{
System.out.println("validation line no executed");
lineNo = genericUtility.getColumnValue("line_no",dom);
if(lineNo == null || lineNo.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("","VNLINENONU",userId);
break ;
}
} //end line_no
else if(childNodeName.equalsIgnoreCase("eff_date")) //start eff_date
{
effDateStr =genericUtility.getColumnValue("eff_date",dom);
validUptoStr =genericUtility.getColumnValue("valid_upto",dom);
System.out.println("@@@@@@@@@@ date validation : eff date");
if(effDateStr==null || effDateStr.trim().length()==0)
{
errString = getErrorString("eff_from","VMEFDTNULL",userId);
break;
}
else
{
if(validUptoStr == null || validUptoStr.trim().length()==0)
{
errString = itmDBAccessEJB.getErrorString("","VMVALDTNUL",userId);
break ;
}
effDate= Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUpto= Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("effDate date is :=> " + effDate);
System.out.println("validUpto date is :=> " + validUpto);
if( !validUpto.after(effDate) && !( validUpto.equals(effDate) ) )
{
System.out.println("effFrom.after(validUpto");
errString = getErrorString("","INVEFDATE ",userId);
System.out.println("errString befor break" +errString);
break;
}
}
} //end eff_date
else if(childNodeName.equalsIgnoreCase("valid_upto")) // start valid_upto
{
System.out.println("@@@@@@@@@@ date validation : valid upto");
effDateStr =genericUtility.getColumnValue("eff_date",dom);
validUptoStr =genericUtility.getColumnValue("valid_upto",dom);
if((effDateStr != null) && (validUptoStr != null))
{
effDate= Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUpto= Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("effDate date is :=> " + effDate);
System.out.println("validUpto date is :=> " + validUpto);
if( !validUpto.after(effDate) && !( validUpto.equals(effDate) ) )
{
//Valid upto cannot be less than effective date
errString = itmDBAccessEJB.getErrorString("","INVEFDATE",userId);
break ;
}
}
else
{
//Date cannot be empty. Please enter valid date.
errString = itmDBAccessEJB.getErrorString("","VMVALDTNUL",userId);
break ;
}
if(isDulplicateDate(dom2,effDateStr,validUptoStr)){
System.out.println("inside return valuee !!!!!!!!!============");
System.out.println("VMEFVUTDAT");
errString = itmDBAccessEJB.getErrorString("","VMEFVUTDAT",userId);
break ;
}
} // end valid_upto
else if(childNodeName.equalsIgnoreCase("comm_type")) // start comm_type
{
System.out.println("validation comm_type executed");
commType = genericUtility.getColumnValue("comm_type",dom);
if(commType == null || commType.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("","VMCOMTYPNU",userId);
break ;
}
} // end comm_type
else if(childNodeName.equalsIgnoreCase("comm_perc")) // start comm_perc
{
System.out.println("validation comm perc executed");
commPercentage = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("comm_perc",dom)));
if( commPercentage <= 0 || commPercentage > 100 ){
System.out.println("commission persentace should be greter then zero and less then hundread");
errString = itmDBAccessEJB.getErrorString("","VTCOMAMTPR",userId);
break ;
}
}// end comm_perc
else if(childNodeName.equalsIgnoreCase("max_amt")){ // start if max_amt
maxAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("max_amt",dom)));
if( maxAmount <= 0 ){
System.out.println("Max Amount should be greater then Zero");
errString = itmDBAccessEJB.getErrorString("","VTMXAMTPR",userId);
break ;
}
} // end if max_amt
else if(childNodeName.equalsIgnoreCase("min_amt")){ // start if min_amt
minAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("min_amt",dom)));
maxAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("max_amt",dom)));
System.out.println("Minimum amount ["+ minAmount + "]Minimum amount ["+ minAmount + "]" );
if( minAmount <= 0 || minAmount >= maxAmount ){
errString = itmDBAccessEJB.getErrorString("","VTMINAMT",userId);
break ;
}
} // end min_amt
commCriteria = genericUtility.getColumnValue("comm_criteria", dom1);
System.out.println("commCriteria ::: ["+commCriteria);
if(commCriteria != null && commCriteria.trim().length()>0){
if(!"V".equalsIgnoreCase(commCriteria)){
errString = itmDBAccessEJB.getErrorString("","VMINTRNSEC",userId);
break;
}
}
}
// changed by Nasruddin khan [19/JUL/16 D16DFOR001] END
break;
} //END switch
itminfo = itemCode + itemSer;
boolean res = duplicateCheck (dom,dom2,itminfo,effDateStr,validUptoStr,lineNo); //comment by kunal on 22/02/13
System.out.println("@@@@ res::"+res);
......@@ -478,6 +667,117 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return errString;
}//END OF VALIDATION
// changed by Nasruddin khan [19/JUL/16 D16DFOR001] START
private boolean isDulplicateDate(Document dom2, String effDateStr2, String validUptoStr2) {
System.out.println(" inside duplicate ======");
System.out.println("dom2 ["+dom2+"]");
System.out.println("effDateStr2 ["+effDateStr2+"]");
System.out.println("validUptoStr2 ["+validUptoStr2+"]");
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String effDateStr = "", validUptoStr = "";
boolean isDulplicate = false;
Timestamp effDate = null;
Timestamp effDate2 = null;
Timestamp validUpto = null;
Timestamp validUpto2 = null;
String updateFlag = "";
try
{
effDate2 = Timestamp.valueOf(genericUtility.getValidDateString(effDateStr2, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
validUpto2 = Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr2, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println("After Date Conversion ::::");
System.out.println("Before Detail 3");
parentList = dom2.getElementsByTagName("Detail3");
System.out.println("After Detail 3");
int parentNodeListLength = parentList.getLength();
System.out.println("Before First Loop1 ");
for (int prntCtr = parentNodeListLength; prntCtr > 0; prntCtr-- )
{
System.out.println("After First Loop ");
parentNode = parentList.item(prntCtr-1);
childList = parentNode.getChildNodes();
System.out.println("childList "+childList.getLength());
for (int ctr = 0; ctr < childList.getLength(); ctr++)
{
System.out.println("After Second Loop ");
childNode = childList.item(ctr);
System.out.println("before :::::: child node");
System.out.println("childNode>>>>"+childNode);
System.out.println("After Child node");
if ( childNode != null && childNode.getNodeName().equalsIgnoreCase("attribute") )
{
updateFlag = childNode.getAttributes().getNamedItem("updateFlag").getNodeValue();
System.out.println("Update Flag ::"+updateFlag);
}
if ( childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("eff_date") )
{
effDateStr = childNode.getFirstChild().getNodeValue().trim();
effDate =Timestamp.valueOf(genericUtility.getValidDateString(effDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(" effDateStr :::::::"+ effDateStr);
}
if ( childNode != null && childNode.getFirstChild() != null && childNode.getNodeName().equalsIgnoreCase("valid_upto") )
{
validUptoStr = childNode.getFirstChild().getNodeValue().trim();
validUpto =Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(" effDateStr :::::::"+ validUpto);
}
}
if(!updateFlag.equalsIgnoreCase("D"))
{
if (!effDate2.before(effDate) && !( effDate2.equals(effDate) ))
{
if(effDate2.after(validUpto)){
isDulplicate = false;
}
else{
isDulplicate = true;
break;
}
}
if (!validUpto2.after(validUpto) && !(validUpto2.equals(validUpto)))
{
isDulplicate = true;
break;
}
}
}
}catch(Exception e){
System.out.println("CommissiondetIC.isDulplicateDate() ["+ e);
e.printStackTrace();
}
System.out.println("CommissiondetIC.isDulplicateDate() isDulplicate ::"+isDulplicate);
return isDulplicate;
}
private String checkNllOrBlank(String input) {
if(input == null || input.trim().equals(""))
{
return "0";
}
else
{
return input ;
}
}
//changed by Nasruddin khan [19/JUL/16 D16DFOR001] END
public String itemChanged(String xmlString, String xmlString1, String xmlString2,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("@@@@@@@ default itemChanged called");
......@@ -621,13 +921,12 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
valueXmlString.append( "<eff_date><![CDATA[" ).append(sysDate).append( "]]></eff_date>\r\n" );
valueXmlString.append( "<valid_upto><![CDATA[" ).append( fSysDate ).append( "]]></valid_upto>\r\n" );
}
else if( currentColumn.trim().equalsIgnoreCase( "item_code" ) )
{
System.out.println("-------------------item_code-----------------------");
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
itemCode = genericUtility.getColumnValue("item_code", dom);
System.out.println("item_code = "+itemCode);
if(itemCode != null && itemCode.trim().length() > 0 )
......@@ -715,6 +1014,10 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
NodeList detail2List = dom2.getElementsByTagName("Detail2");
NodeList detail1List = dom2.getElementsByTagName("Detail1");
ArrayList arrLstDate=new ArrayList();
if(detail2List != null && detail2List.getLength() > 0)
......@@ -849,15 +1152,6 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return false;
}
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input;
}
}
......
......@@ -2,12 +2,14 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
//public interface SOrderForm extends ValidatorLocal,EJBObject
@Local // added for ejb3
public interface CommissiondetICLocal
public interface CommissiondetICLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
......
......@@ -3,13 +3,14 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
//public interface SOrderForm extends ValidatorLocal,EJBObject
@Remote // added for ejb3
public interface CommissiondetICRemote
public interface CommissiondetICRemote extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
......
......@@ -98,6 +98,7 @@ implements CustomerLocal, CustomerRemote
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";//changed by Nasruddin [19/JUL/16 ]
try
{
this.finCommon = new FinCommon();
......@@ -1317,7 +1318,36 @@ implements CustomerLocal, CustomerRemote
errFields.add(childNodeName.toLowerCase());
}
}
}
}//Changed By Nasruddin khan [19/JUL/16] START
else if( childNodeName.equalsIgnoreCase("comm_table")){
commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom));
if( commTable != null && commTable.trim().length() > 0){
cnt = 0;
sql = "select count(1) as cnt from comm_hdr where comm_table = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, commTable);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VMCOMMTBCD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//Changed By Nasruddin khan [19/JUL/16] END
// else if(childNodeName.equalsIgnoreCase("cust_code__pd")){
// custCodePd =
// checkNull(this.genericUtility.getColumnValue(
......
......@@ -101,6 +101,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
ConnDriver connDriver = new ConnDriver();
int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";
try
{
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
......@@ -526,6 +527,35 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
}
}
}
//Changed By Nasruddin khan [19/JUL/16] START
else if( childNodeName.equalsIgnoreCase("comm_table")){
commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom));
if( commTable != null && commTable.trim().length() > 0){
count = 0;
sql = "select count(1) as count from comm_hdr where comm_table = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, commTable);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt("count");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (count == 0)
{
errCode = "VMCOMMTBCD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//Changed By Nasruddin khan [19/JUL/16] END
}
break; //end case 1 validation.
......
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