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)
...@@ -553,7 +563,8 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -553,7 +563,8 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca
errString = getErrorString("","INVEFDATE ",userId); errString = getErrorString("","INVEFDATE ",userId);
System.out.println("errString befor break" +errString); System.out.println("errString befor break" +errString);
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 ; 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 ;
}
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,123 +1160,153 @@ public class CommissiondetIC extends ValidatorEJB implements CommissiondetICLoca ...@@ -1070,123 +1160,153 @@ 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 ::::::");
String lineNo="",commTable="",effDateStr="",validUptoStr="";
String effDateTemp=null ;
Timestamp effDateTemp2=null ,ValidUptoLastTemp=null, ValidUptoLastTemp2=null,peffDate=null,pvalidUpto=null;
String errString = "",editFlag="";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//String userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
int ctr1=0,k=0,l=1,noOfParent=0;
String dateStr=null,itemCodeTemp="",itemSerTemp="",validUptoTemp="",itemSerTempLast="",itemCodeTempLast="";
java.sql.Timestamp validUptoTemp2=null; System.out.println("Call Check dublicate value ::::::");
String lineNo="",commTable="",effDateStr="",validUptoStr="";
String effDateTemp=null ;
Timestamp effDateTemp2=null ,ValidUptoLastTemp=null, ValidUptoLastTemp2=null,peffDate=null,pvalidUpto=null;
String errString = "",editFlag="";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//String userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
int ctr1=0,k=0,l=1,noOfParent=0;
String dateStr=null,itemCodeTemp="",itemSerTemp="",validUptoTemp="",itemSerTempLast="",itemCodeTempLast="";
NodeList detail3List = dom2.getElementsByTagName("Detail3"); java.sql.Timestamp validUptoTemp2=null;
//NodeList detail1List = dom2.getElementsByTagName("Detail1");
ArrayList arrLstDate=new ArrayList();
if(detail3List != null && detail3List.getLength() > 0) NodeList detail3List = dom2.getElementsByTagName("Detail3");
{ //NodeList detail1List = dom2.getElementsByTagName("Detail1");
noOfParent = detail3List.getLength();
System.out.println("@@@@@@@@ noOfParent [["+noOfParent +"]]");
System.out.println("@@@@ ::lineNo:["+lineNo+"]");
if( peffDateStr != null && pvalidUptoStr !=null && peffDateStr.trim().length() > 0 && pvalidUptoStr.trim().length() > 0 )
{
peffDate = Timestamp.valueOf(genericUtility.getValidDateString(peffDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
pvalidUpto = Timestamp.valueOf(genericUtility.getValidDateString(pvalidUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
System.out.println("@@@@@parent date@@@peffDate["+peffDate+"] ::pvalidUpto["+pvalidUpto+"]");
for ( ctr1 = 0; ctr1 < noOfParent; ctr1++ ) //Loop for each node of current detail
{
ArrayList arrLstDate=new ArrayList();
effDateStr = genericUtility.getColumnValueFromNode( "eff_date", detail3List.item(ctr1) ); if(detail3List != null && detail3List.getLength() > 0)
validUptoStr = genericUtility.getColumnValueFromNode( "valid_upto", detail3List.item(ctr1) ); {
noOfParent = detail3List.getLength();
editFlag = genericUtility.getColumnValueFromNode( "edit_flag", detail3List.item(ctr1) ); System.out.println("@@@@@@@@ noOfParent [["+noOfParent +"]]");
System.out.println("@@@@ ::lineNo:["+lineNo+"]");
lineNo = genericUtility.getColumnValueFromNode( "line_no", detail3List.item(ctr1) );
dateStr = validUptoStr+"@"+effDateStr ;
System.out.println("dateStr[[[[[[[["+dateStr+"]]]]]]]]]");
if( peffDateStr != null && pvalidUptoStr !=null && peffDateStr.trim().length() > 0 && pvalidUptoStr.trim().length() > 0 )
{
peffDate = Timestamp.valueOf(genericUtility.getValidDateString(peffDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
pvalidUpto = Timestamp.valueOf(genericUtility.getValidDateString(pvalidUptoStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
}
System.out.println("@@@@@parent date@@@peffDate["+peffDate+"] ::pvalidUpto["+pvalidUpto+"]");
if(!( plineNo.trim().equalsIgnoreCase(lineNo.trim() ) )) for ( ctr1 = 0; ctr1 < noOfParent; ctr1++ ) //Loop for each node of current detail
{ {
arrLstDate.add(dateStr);
System.out.println("@@@@ added in arraylist"); effDateStr = genericUtility.getColumnValueFromNode( "eff_date", detail3List.item(ctr1) );
validUptoStr = genericUtility.getColumnValueFromNode( "valid_upto", detail3List.item(ctr1) );
editFlag = genericUtility.getColumnValueFromNode( "edit_flag", detail3List.item(ctr1) );
lineNo = genericUtility.getColumnValueFromNode( "line_no", detail3List.item(ctr1) );
dateStr = validUptoStr+"@"+effDateStr ;
System.out.println("dateStr[[[[[[[["+dateStr+"]]]]]]]]]");
if(!( plineNo.trim().equalsIgnoreCase(lineNo.trim() ) ))
{
arrLstDate.add(dateStr);
System.out.println("@@@@ added in arraylist");
}
} }
}
Collections.sort(arrLstDate); Collections.sort(arrLstDate);
System.out.println("@@@@@arrLstDate.size()["+arrLstDate.size()+"]]]:: Sorted::::"+arrLstDate); System.out.println("@@@@@arrLstDate.size()["+arrLstDate.size()+"]]]:: Sorted::::"+arrLstDate);
for( k=0;k< arrLstDate.size();k++) for( k=0;k< arrLstDate.size();k++)
{
String temp = (String) arrLstDate.get(k);
StringTokenizer st = new StringTokenizer(temp,"@");
while(st.hasMoreTokens())
{ {
if( l== 1) String temp = (String) arrLstDate.get(k);
{ StringTokenizer st = new StringTokenizer(temp,"@");
validUptoTemp = st.nextToken(); while(st.hasMoreTokens())
l++; {
if( l== 1)
{
validUptoTemp = st.nextToken();
l++;
}
else if( l== 2)
{
effDateTemp = st.nextToken();
l=1;
}
} }
else if( l== 2)
if( effDateTemp != null && validUptoTemp !=null && effDateTemp.trim().length() > 0 && validUptoTemp.trim().length() > 0 && !("D".equalsIgnoreCase(editFlag)))
{ {
effDateTemp = st.nextToken(); effDateTemp2 = Timestamp.valueOf(genericUtility.getValidDateString(effDateTemp, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
l=1; validUptoTemp2 = Timestamp.valueOf(genericUtility.getValidDateString(validUptoTemp, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
System.out.println("@@@@@date@@@effDateTemp2["+effDateTemp2+"] ::validUptoTemp2["+validUptoTemp2+"]");
if( (effDateTemp2 != null ) && (validUptoTemp2 != null ))
{
//if( (effDateTemp2.equals( peffDate )) )
if( (effDateTemp2.equals( peffDate )) && ( validUptoTemp2.equals(pvalidUpto)) )
{
System.out.println("@@@@@@@ error in date");
return true;
}
}
}
}
return false;
}*/
}
if( effDateTemp != null && validUptoTemp !=null && effDateTemp.trim().length() > 0 && validUptoTemp.trim().length() > 0 && !("D".equalsIgnoreCase(editFlag))) private String checkNllOrBlank(String input) {
if(input == null || input.trim().equals(""))
{
return "0";
}
else
{ {
effDateTemp2 = Timestamp.valueOf(genericUtility.getValidDateString(effDateTemp, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); return input ;
validUptoTemp2 = Timestamp.valueOf(genericUtility.getValidDateString(validUptoTemp, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
} }
System.out.println("@@@@@date@@@effDateTemp2["+effDateTemp2+"] ::validUptoTemp2["+validUptoTemp2+"]");
if( (effDateTemp2 != null ) && (validUptoTemp2 != null )) }
//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( (effDateTemp2.equals( peffDate )) ) if ( nodeName.equalsIgnoreCase( "attribute" ) )
if( (effDateTemp2.equals( peffDate )) && ( validUptoTemp2.equals(pvalidUpto)) )
{ {
System.out.println("@@@@@@@ error in date"); fldValue = currNode.getAttributes().getNamedItem( fldName ).getNodeValue();
return true; 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
} }
return false;
} }
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
}
...@@ -105,7 +105,7 @@ insert into messages(msg_no, msg_str, msg_descr, msg_type, msg_opt, ...@@ -105,7 +105,7 @@ insert into messages(msg_no, msg_str, msg_descr, msg_type, msg_opt,
values ( values (
'VMEFVUTDAT', 'VMEFVUTDAT',
'RECORD ALREADY EXIST!', 'RECORD ALREADY EXIST!',
'Record already exist. Please enter Effective date and valid up to date should be greater then or less then existing detail', 'Record already exist. Please enter Effective date and valid up to date should be greater then or less then existing detail',
'E', 'E',
'Y', 'Y',
sysdate, sysdate,
......
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