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 ...@@ -40,9 +40,12 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
try try
{ {
dom = parseString(xmlString); dom = parseString(xmlString);
System.out.println("Inside Dom :: =======>>>>"+xmlString);
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
System.out.println("Inside Dom1 :: =======>>>>"+xmlString1);
dom2 = parseString(xmlString2); 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); errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
} }
...@@ -87,11 +90,14 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -87,11 +90,14 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
String itminfo =""; String itminfo ="";
java.sql.Timestamp validUptoTemp2=null; java.sql.Timestamp validUptoTemp2=null;
String commCriteria = "";
double maxAmount = 0.0;
double minAmount = 0.0;
double commPercentage = 0.0;
try try
{ {
System.out.println("@@@@@@@@ wfvaldata called"); System.out.println("@@@@@@@@ wfvaldata called !!!!!!!!!!!!!!!!!!!!!!");
//Changes and Commented By Bhushan on 09-06-2016 :START //Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
...@@ -115,6 +121,9 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -115,6 +121,9 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println("childNodeName ::["+childNodeName);
if(childNodeName.equalsIgnoreCase("comm_table") && ("A".equalsIgnoreCase(editFlag)) ) if(childNodeName.equalsIgnoreCase("comm_table") && ("A".equalsIgnoreCase(editFlag)) )
{ {
System.out.println("validation comm_table executed"); System.out.println("validation comm_table executed");
...@@ -215,10 +224,14 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -215,10 +224,14 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
} }
} // end for } // end for
break; break;
case 2: case 2:
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
...@@ -431,8 +444,184 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -431,8 +444,184 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
break ; 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 } //END switch
...@@ -478,6 +667,117 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -478,6 +667,117 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return errString; return errString;
}//END OF VALIDATION }//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 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"); System.out.println("@@@@@@@ default itemChanged called");
...@@ -621,13 +921,12 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -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( "<eff_date><![CDATA[" ).append(sysDate).append( "]]></eff_date>\r\n" );
valueXmlString.append( "<valid_upto><![CDATA[" ).append( fSysDate ).append( "]]></valid_upto>\r\n" ); valueXmlString.append( "<valid_upto><![CDATA[" ).append( fSysDate ).append( "]]></valid_upto>\r\n" );
} }
else if( currentColumn.trim().equalsIgnoreCase( "item_code" ) ) else if( currentColumn.trim().equalsIgnoreCase( "item_code" ) )
{ {
System.out.println("-------------------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); System.out.println("item_code = "+itemCode);
if(itemCode != null && itemCode.trim().length() > 0 ) if(itemCode != null && itemCode.trim().length() > 0 )
...@@ -715,6 +1014,10 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -715,6 +1014,10 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
NodeList detail2List = dom2.getElementsByTagName("Detail2"); NodeList detail2List = dom2.getElementsByTagName("Detail2");
NodeList detail1List = dom2.getElementsByTagName("Detail1"); NodeList detail1List = dom2.getElementsByTagName("Detail1");
ArrayList arrLstDate=new ArrayList(); ArrayList arrLstDate=new ArrayList();
if(detail2List != null && detail2List.getLength() > 0) if(detail2List != null && detail2List.getLength() > 0)
...@@ -849,15 +1152,6 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -849,15 +1152,6 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return false; return false;
} }
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input;
}
} }
......
...@@ -2,12 +2,14 @@ package ibase.webitm.ejb.dis; ...@@ -2,12 +2,14 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3 import javax.ejb.Local; // added for ejb3
//public interface SOrderForm extends ValidatorLocal,EJBObject //public interface SOrderForm extends ValidatorLocal,EJBObject
@Local // added for ejb3 @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; 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; ...@@ -3,13 +3,14 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3 import javax.ejb.Remote; // added for ejb3
//public interface SOrderForm extends ValidatorLocal,EJBObject //public interface SOrderForm extends ValidatorLocal,EJBObject
@Remote // added for ejb3 @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; 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 ...@@ -98,6 +98,7 @@ implements CustomerLocal, CustomerRemote
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";//changed by Nasruddin [19/JUL/16 ]
try try
{ {
this.finCommon = new FinCommon(); this.finCommon = new FinCommon();
...@@ -1317,7 +1318,36 @@ implements CustomerLocal, CustomerRemote ...@@ -1317,7 +1318,36 @@ implements CustomerLocal, CustomerRemote
errFields.add(childNodeName.toLowerCase()); 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")){ // else if(childNodeName.equalsIgnoreCase("cust_code__pd")){
// custCodePd = // custCodePd =
// checkNull(this.genericUtility.getColumnValue( // checkNull(this.genericUtility.getColumnValue(
......
...@@ -101,6 +101,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -101,6 +101,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
int currentFormNo = 0; int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = "";
try try
{ {
SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat sdf1= new SimpleDateFormat(genericUtility.getDBDateFormat());
...@@ -526,6 +527,35 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -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. 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