Commit 32af2052 authored by pshinde's avatar pshinde

Source code for Itemchanged and validation and post save for Period Table Generation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100050 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4f5c363d
......@@ -112,6 +112,7 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
Timestamp fromDate=null,tooDate=null;
String divisionList="",frmDateList="";
ArrayList divisionLst = new ArrayList();
boolean validateFlag=false;
String retString="",begPart="",endPart="",mainStr="";
try
{
......@@ -195,7 +196,7 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
{
sql = "select count(*) from country where count_code=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,cntCode.trim());
pstmt.setString(1,cntCode);
rs = pstmt.executeQuery();
if (rs.next())
{
......@@ -213,6 +214,27 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
pstmt = null;
}
System.out.println("dIVISION vALIDATION");
sql="select count(1) from period_appl where ref_code like '%" + cntCode + "%'";
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,cntCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
if (cnt == 0)
{
errCode = "VTDIV1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
......@@ -294,14 +316,19 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
//}
parentNode = parentNodeList.item(selectedRow);
// parentNode = parentNodeList.item(0);
//if( parentNode != null )
if( parentNode != null )
{
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
}
System.out.println("@@@@@@@@@@@@childNodeListLength["+childNodeListLength+"]");
validateFlag=false;
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
if( childNodeListLength > 0 && ctr == (childNodeListLength -1) )
{
validateFlag = true;
}
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
......@@ -396,15 +423,17 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
System.out.println("Period code["+prdCode+"]-Period table Code["+prdTblNo+"]-from date["+frDate+"]To Date["+toDate+"]period closed["+prdClose+"]@@@");
System.out.println("Add Date====="+addDate);
if (childNodeName.equalsIgnoreCase("prd_tblno"))
if (validateFlag)
{
System.out.println("Value inside (getDetailValues=====) Period code["+prdCode+"]-Period table Code["+prdTblNo+"]-from date["+frDate+"]To Date["+toDate+"]period closed["+prdClose+"]@@@");
getValue= getDetailValues(prdCode, prdTblNo, frDate, toDate, prdClose, conn);
System.out.println("getValue from getDetailValues==== "+getValue);
if(getValue)
{
divisionList=divisionList+" "+prdTblNo+",";
System.out.println("divisionList===="+divisionList);
/*if(!divisionLst.contains(prdTblNo))
......@@ -419,14 +448,17 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
}
System.out.println("===============================================================================");
System.out.println("Validation of From Date####");
System.out.println("Value inside (getPeriodValue=====) Period code["+prdCode+"]-Period table Code["+prdTblNo+"]-from date["+frDate+"]To Date["+toDate+"]period closed["+prdClose+"]@@@");
getPeriodValue= getPeriod(prdCode, prdTblNo, frDate, toDate, prdClose, addDate, conn);
System.out.println("getValue from getDetailValues==== "+getPeriodValue);
if(getPeriodValue)
{
frmDateList=frmDateList+" "+prdTblNo+",";
System.out.println("frmDateList===="+frmDateList);
......@@ -438,7 +470,12 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
}
//added
/////////////////////
//////////////////////////
}
......@@ -462,7 +499,16 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
}
}*/
} // end for
}//end of selected row
break; // case 2 end// case 1 end
......@@ -767,6 +813,7 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
else if(currentColumn.trim().equalsIgnoreCase("count_code"))
{
System.out.println("Country code itemchange ");
cntCode = checkNull(genericUtility.getColumnValue("count_code",dom));
prdCode = checkNull(genericUtility.getColumnValue("prd_code",dom));
frDate = checkNull(genericUtility.getColumnValue("fr_date",dom));
......@@ -801,6 +848,16 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
valueXmlString.append("<to_date>").append("<![CDATA["+ toDate +"]]>").append("</to_date>");
valueXmlString.append("<prd_closed>").append("<![CDATA[N]]>").append("</prd_closed>");
valueXmlString.append("</Detail1>");
}else
{
valueXmlString.append("<Detail1 domID='1' objContext='1'>");
valueXmlString.append("<count_code>").append("<![CDATA[]]>").append("</count_code>\r\n");
valueXmlString.append("<count_descr>").append("<![CDATA[]]>").append("</count_descr>\r\n");
valueXmlString.append("<prd_code>").append("<![CDATA["+ prdCode +"]]>").append("</prd_code>");
valueXmlString.append("<fr_date>").append("<![CDATA["+frDate +"]]>").append("</fr_date>");
valueXmlString.append("<to_date>").append("<![CDATA["+ toDate +"]]>").append("</to_date>");
valueXmlString.append("<prd_closed>").append("<![CDATA[N]]>").append("</prd_closed>");
valueXmlString.append("</Detail1>");
}
......@@ -822,6 +879,9 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
System.out.println("prdClose :"+prdClose);
sql="select site_code,ref_code,prd_tblno from period_appl where ref_code like '%" + cntCode + "%'";
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
......@@ -859,13 +919,17 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
/*valueXmlString.append("<Detail2 dbID='' domID='"+prdCnt+"' objName=\"period_tbl\" objContext=\"2\">");
valueXmlString.append("<attribute pkNames=\"\" selected=\"Y\" updateFlag=\"A\" status=\"O\" />");*/
valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
//valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"Y\">\r\n");
//valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"A\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<prd_code>").append("<![CDATA["+ prdCode +"]]>").append("</prd_code>");
valueXmlString.append("<prd_tblno>").append("<![CDATA["+refCode+"]]>").append("</prd_tblno>");
valueXmlString.append("<fr_date>").append("<![CDATA["+frDate +"]]>").append("</fr_date>");
valueXmlString.append("<to_date>").append("<![CDATA["+ toDate +"]]>").append("</to_date>");
valueXmlString.append("<prd_closed>").append("<![CDATA[N]]>").append("</prd_closed>");
//valueXmlString.append("<prd_closed>").append("<![CDATA[N]]>").append("</prd_closed>");
valueXmlString.append("<prd_closed>").append("<![CDATA["+prdClose+"]]>").append("</prd_closed>");
valueXmlString.append("<add_date>").append("<![CDATA["+currDate +"]]>").append("</add_date>");
valueXmlString.append("<chg_date>").append("<![CDATA["+currDate +"]]>").append("</chg_date>");
......@@ -904,8 +968,15 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
System.out.println("String format fromDateStr"+fromDateStr);
System.out.println("String format toDateStr"+toDateStr);
valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
//valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"Y\">\r\n");
//valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<Detail2 domID='" + prdCnt + "' objContext=\"2\" selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append("<prd_code>").append("<![CDATA["+ prdCode +"]]>").append("</prd_code>");
valueXmlString.append("<prd_tblno>").append("<![CDATA["+refCode+"]]>").append("</prd_tblno>");
valueXmlString.append("<fr_date>").append("<![CDATA["+fromDateStr +"]]>").append("</fr_date>");
......@@ -929,6 +1000,21 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
System.out.println("");
}
else if(currentColumn.trim().equals("fr_date"))
{
frDate = checkNull(genericUtility.getColumnValue("fr_date",dom));
System.out.println("@@@@@@@@@@ fr_date called for case 2 frDate["+frDate+"]");
//toDate = checkNull(genericUtility.getColumnValue("to_date",dom1));
valueXmlString.append("<Detail2 objContext=\"2\" selected=\"Y\">\r\n");
// valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append("<fr_date>").append("<![CDATA["+frDate+"]]>").append("</fr_date>");
valueXmlString.append("</Detail2>");
}
System.out.println("valueXmlString from case 2 :" + valueXmlString);
break;
......@@ -1236,6 +1322,8 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
rs = null;
pstmt.close();
pstmt = null;
if(prdCodeNew!=null && prdCodeNew.trim().length()>0)
{
sql="select to_date from period_tbl where prd_code=? and prd_tblno= ?";
pstmt=conn.prepareStatement(sql);
......@@ -1272,6 +1360,7 @@ public class PrdTableGenIC extends ValidatorEJB implements PrdTableGenICLocal, P
{
System.out.println("ELSE ++++++++");
}
}
}
......
/********************************************************
Title : PrdTableGenICLocal [D15JSUN001]
Developer: Priyanka Shinde.
Title : BankGauranteeLocal [F15DSUN018]
Date : 22/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.dis;
......
/********************************************************
Title : PrdTableGenICRemote [D15JSUN001]
Developer: Priyanka Shinde.
Title : BankGauranteeRemote [F15DSUN018]
Date : 22/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.dis;
......
/********************************************************
Title : PrdTableGenPostSave [D15JSUN001]
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.dis;
import org.w3c.dom.*;
......@@ -66,6 +60,7 @@ public class PrdTableGenPostSave extends ValidatorEJB implements PrdTableGenPost
String prdCode="",prdTblNo="",frDate="",toDate="",prdClose="";
String chgUser="",chgTerm="";
String errString = "";
String selectedValue = "",status="",isChanged="";
int cnt=0,updateCount=0,detCnt=0;
ITMDBAccessEJB itmDBAccessEJB = null;
boolean value=false;
......@@ -91,14 +86,35 @@ public class PrdTableGenPostSave extends ValidatorEJB implements PrdTableGenPost
Node detailListNode = hdrDommList.item(dtlCtr);
NodeList detail2List= detailListNode.getChildNodes();
// System.out.println("@@@@@@@@@node name[" + detailListNode.getNodeName()+"]");
System.out.println("detailListNode===="+detailListNode);
if("Detail2".equalsIgnoreCase(detailListNode.getNodeName()))
{
System.out.println("detail2List===="+detail2List);
// System.out.println("@@@@inside detail4----------------");
for (int cntr = 0; cntr < detail2List.getLength(); cntr++)
{
Node detail2Node = detail2List.item(cntr);
System.out.println("detail2Node===="+detail2Node);
if(detail2Node != null && detail2Node.getNodeName().equalsIgnoreCase("attribute"))
{
System.out.println("Check for selected Value######");
selectedValue = detail2Node.getAttributes().getNamedItem("selected").getNodeValue();
System.out.println("selectedValue=========="+selectedValue);
System.out.println("Check for STATUS Value######");
status = detail2Node.getAttributes().getNamedItem("status").getNodeValue();
System.out.println("status=========="+status);
System.out.println("Check for IS_CHANGE Value######");
isChanged = detail2Node.getAttributes().getNamedItem("IS_CHANGE").getNodeValue();
System.out.println("isChanged=========="+isChanged);
}
if("prd_code".equalsIgnoreCase( detail2Node.getNodeName()))
{
if( detail2List.item(cntr).getFirstChild() != null)
......@@ -165,6 +181,13 @@ public class PrdTableGenPostSave extends ValidatorEJB implements PrdTableGenPost
System.out.println("@@@@ctr["+dtlCtr+"]Period code["+prdCode+"]-Period table Code["+prdTblNo+"]-from date["+frDate+"]To Date["+toDate+"]period closed["+prdClose+"]@@@");
if("N".equalsIgnoreCase(status))
{
System.out.println("selected Value for record===="+selectedValue);
sql="select count(1) from period_tbl where prd_code= ? and prd_tblno= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
......@@ -219,11 +242,13 @@ public class PrdTableGenPostSave extends ValidatorEJB implements PrdTableGenPost
pstmt.close();
pstmt = null;
}
if(detCnt>0 ||updateCount>0)
{
System.out.println(">>The selected transaction is confirmed");
errString = itmDBAccessEJB.getErrorString("","VTCONSUCF","","",conn);
}
}//end
}
......
/********************************************************
Title : PrdTableGenPostSaveLocal [D15JSUN001]
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
......
/********************************************************
Title : PrdTableGenPostSaveRemote [D15JSUN001]
Developer: Priyanka Shinde.
********************************************************/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
......
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