Commit 8df61299 authored by nkhan's avatar nkhan

Added by Nasruddin khan


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102622 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9a2d7646
...@@ -20,6 +20,8 @@ import org.w3c.dom.Document; ...@@ -20,6 +20,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import com.ibm.db2.jcc.a.p;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
...@@ -459,11 +461,9 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -459,11 +461,9 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
break; break;
// changed by Nasruddin khan [20/JUL/16 D16DFOR001] END // changed by Nasruddin khan [20/JUL/16 D16DFOR001] END
// changed by Nasruddin khan [19/JUL/16 D16DFOR001] END // changed by Nasruddin khan [19/JUL/16 D16DFOR001] START
case 3: case 3:
parentNodeList = dom.getElementsByTagName("Detail3"); parentNodeList = dom.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
...@@ -518,13 +518,23 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -518,13 +518,23 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
break ; break ;
} }
} }
if("F".equalsIgnoreCase(commType)){
if ( commPercentage <= 0){
System.out.println("Fixed vALUE sHOULD BE GREATER THEN ZERO ");
errString = itmDBAccessEJB.getErrorString("","VTCOMAMTFX",userId);
break ;
}
}
}// end comm_perc }// end comm_perc
else if(childNodeName.equalsIgnoreCase("eff_date")) //start eff_date else if(childNodeName.equalsIgnoreCase("eff_date")) //start eff_date
{ {
effDateStr =genericUtility.getColumnValue("eff_date",dom); effDateStr =genericUtility.getColumnValue("eff_date",dom);
validUptoStr =genericUtility.getColumnValue("valid_upto",dom); validUptoStr =genericUtility.getColumnValue("valid_upto",dom);
commTable = genericUtility.getColumnValue("comm_table", dom1);
System.out.println("@@@@@@@@@@ date validation : eff date"); System.out.println("@@@@@@@@@@ date validation : eff date");
if(effDateStr==null || effDateStr.trim().length()==0) if(effDateStr==null || effDateStr.trim().length()==0)
...@@ -555,6 +565,7 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -555,6 +565,7 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
break; break;
} }
} }
} //end eff_date } //end eff_date
...@@ -595,7 +606,8 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -595,7 +606,8 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
} // end valid_upto } // end valid_upto
else if(childNodeName.equalsIgnoreCase("min_amt")){ // start if min_amt else if(childNodeName.equalsIgnoreCase("min_amt"))
{ // start if min_amt
minAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("min_amt",dom))); minAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("min_amt",dom)));
maxAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("max_amt",dom))); maxAmount = Double.parseDouble(checkNllOrBlank(genericUtility.getColumnValue("max_amt",dom)));
...@@ -606,9 +618,86 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -606,9 +618,86 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
} }
if(minAmount >= maxAmount){ if(minAmount >= maxAmount){
errString = itmDBAccessEJB.getErrorString("","VTMINAAMT",userId); errString = itmDBAccessEJB.getErrorString("","VTMINAMT",userId);
break ;
}
else
{
String effdatestr = genericUtility.getColumnValue( "eff_date", dom ) != null ? genericUtility.getColumnValue( "eff_date", dom ) : null;
String vuptodatestr = genericUtility.getColumnValue( "valid_upto", dom ) != null ? genericUtility.getColumnValue( "valid_upto", dom ) : null;
String updateFlag ="";
String lineNo1 = genericUtility.getColumnValue( "line_no", dom ) != null ? genericUtility.getColumnValue( "line_no", dom ) : "";
lineNo1 = lineNo1.trim();
String lineNoDet="";
String effdateDet = null;
String valuptoDet = null;
System.out.println("lineNo1.......["+lineNo1+"] ");
System.out.println("effdatestr.......["+effdatestr+"] ");
System.out.println("vuptodatestr.......["+vuptodatestr+"] ");
//System.out.println("lineNo1.......["+lineNo1+"] ");
java.sql.Timestamp efDtDomTimeStp = null;
java.sql.Timestamp vuptodtDomTimeStp = null;
java.sql.Timestamp efDtDetTimeStp = null;
java.sql.Timestamp vuptodtDetTimeStp = null;
NodeList detail2List = dom2.getElementsByTagName("Detail3");
int detail2ListLen = detail2List.getLength();
for(int detail2Idx = 0; detail2Idx < detail2ListLen ; detail2Idx++ )
{
Node currDetail = detail2List.item( detail2Idx );
NodeList currDetNodes = currDetail.getChildNodes();
updateFlag = getNodeValue( currDetail, "updateFlag", true );
effdateDet = getNodeValue( currDetail, "eff_date", false );
valuptoDet = getNodeValue( currDetail, "valid_upto", false );
lineNoDet = getNodeValue( currDetail, "line_no", false );
System.out.println("updateFlag.......["+updateFlag+"] ");
System.out.println("effdateDet.......["+effdateDet+"] ");
System.out.println("lineNoDet.......["+lineNoDet+"] ");
if( (!lineNoDet.equals(lineNo1)) && (!updateFlag.equals("D") ) )
{
if( (effdateDet != null) && (valuptoDet != null) )
{
System.out.println("Inside first if condition.......");
efDtDomTimeStp = Timestamp.valueOf(genericUtility.getValidDateString(effdatestr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
vuptodtDomTimeStp = Timestamp.valueOf(genericUtility.getValidDateString(vuptodatestr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
efDtDetTimeStp = Timestamp.valueOf(genericUtility.getValidDateString(effdateDet, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
vuptodtDetTimeStp = Timestamp.valueOf(genericUtility.getValidDateString(valuptoDet, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
if( efDtDomTimeStp.compareTo ( efDtDetTimeStp ) >= 0 && efDtDomTimeStp.compareTo ( vuptodtDetTimeStp ) <= 0)
{
errString = itmDBAccessEJB.getErrorString("","INVEFDATE",userId);
break ;
}
if( efDtDomTimeStp.compareTo ( efDtDetTimeStp ) <= 0 && vuptodtDomTimeStp.compareTo ( vuptodtDetTimeStp ) >= 0)
{
errString = itmDBAccessEJB.getErrorString("","INVEFDATE",userId);
break ; break ;
} }
if( vuptodtDomTimeStp.compareTo ( efDtDetTimeStp ) >= 0 && vuptodtDomTimeStp.compareTo ( vuptodtDetTimeStp ) < 0)
{
errString = itmDBAccessEJB.getErrorString("","INVEFDATE",userId);
break ;
}
if( efDtDomTimeStp.compareTo ( efDtDetTimeStp ) == 0 || vuptodtDomTimeStp.compareTo ( vuptodtDetTimeStp ) == 0)
{
errString = itmDBAccessEJB.getErrorString("","INVEFDATE",userId);
break ;
}
/* if( deprDet.equals(deprtype) && assetCode.equalsIgnoreCase( assetDet ) )
{
errString = itmDBAccessEJB.getErrorString("depr_type","VTDEPRDUP",userId);
break ;
} */
}
}
}
}
} // end min_amt } // end min_amt
else if(childNodeName.equalsIgnoreCase("max_amt")){ // start if max_amt else if(childNodeName.equalsIgnoreCase("max_amt")){ // start if max_amt
...@@ -656,12 +745,13 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -656,12 +745,13 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return errString; return errString;
} }
// changed by Nasruddin khan [22/JUL/16 D16DFOR001] start /* // changed by Nasruddin khan [22/JUL/16 D16DFOR001] start
boolean result = isDulplicateDate(dom,dom2,effDateStr,validUptoStr,lineNo); boolean result = isDulplicateDate(dom2,effDateStr,validUptoStr);
if( result == true){ if( result == true){
errString = itmDBAccessEJB.getErrorString("","VMEFVUTDAT",userId); errString = itmDBAccessEJB.getErrorString("","VMEFVUTDAT",userId);
return errString; return errString;
} }*/
// changed by Nasruddin khan [22/JUL/16 D16DFOR001] end // changed by Nasruddin khan [22/JUL/16 D16DFOR001] end
}//END TRY }//END TRY
catch(Exception e) catch(Exception e)
...@@ -1070,7 +1160,7 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -1070,7 +1160,7 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
return false; return false;
} }
// changed by Nasruddin khan [19/JUL/16 D16DFOR001] START // changed by Nasruddin khan [19/JUL/16 D16DFOR001] START
private boolean isDulplicateDate(Document dom,Document dom2,String peffDateStr,String pvalidUptoStr,String plineNo) throws ITMException, Exception { /*private boolean isDulplicateDate(Document dom,Document dom2,String peffDateStr,String pvalidUptoStr,String plineNo) throws ITMException, Exception {
System.out.println("Call Check dublicate value ::::::"); System.out.println("Call Check dublicate value ::::::");
...@@ -1168,10 +1258,10 @@ private boolean isDulplicateDate(Document dom,Document dom2,String peffDateStr,S ...@@ -1168,10 +1258,10 @@ private boolean isDulplicateDate(Document dom,Document dom2,String peffDateStr,S
} }
} }
return false; return false;
} }*/
private String checkNllOrBlank(String input) { private String checkNllOrBlank(String input) {
if(input == null || input.trim().equals("")) if(input == null || input.trim().equals(""))
{ {
...@@ -1183,10 +1273,40 @@ private String checkNllOrBlank(String input) { ...@@ -1183,10 +1273,40 @@ private String checkNllOrBlank(String input) {
} }
} }
//changed by Nasruddin khan [19/JUL/16 D16DFOR001] END //changed by Nasruddin khan [19/JUL/16 D16DFOR001] END
//changed by Nasruddin khan [25/JUL/16 D16DFOR001] START
private String getNodeValue( Node currDet, String fldName, boolean isAttribute )
{
String fldValue = null;
boolean isFound = false;
NodeList currNodes = currDet.getChildNodes();
int currDetLen = currNodes.getLength();
for(int detIdx = 0; detIdx < currDetLen && !isFound ; detIdx++ )
{
Node currNode = currNodes.item( detIdx );
String nodeName = currNode.getNodeName();
if( isAttribute == true )
{
if ( nodeName.equalsIgnoreCase( "attribute" ) )
{
fldValue = currNode.getAttributes().getNamedItem( fldName ).getNodeValue();
isFound = true;
}
}
else if ( currNode.getNodeType() == Node.ELEMENT_NODE && nodeName.equalsIgnoreCase( fldName ) )
{
fldValue = currNode.getFirstChild() != null ? currNode.getFirstChild().getNodeValue().trim() : null;
isFound = true;
}
}
return fldValue;
//changed by Nasruddin khan [25/JUL/16 D16DFOR001] START
}
} }
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