Commit 8173ca9d authored by psawant's avatar psawant

ForecastIndicator Master UI related Changes.

Item change on the item_code field

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198304 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 48bcf202
......@@ -184,7 +184,7 @@ public class ForecastIndicator extends ValidatorEJB implements ForecastIndicator
if(columnValue == null || columnValue.length()==0)
{
errCode = "VTINVPROJ0";
errCode = "VTMONATD09";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
......@@ -208,7 +208,7 @@ public class ForecastIndicator extends ValidatorEJB implements ForecastIndicator
}
System.out.println("Count value for prd_code---["+cnt1+"]");
if(cnt1 == 0){
errCode = "VTINVPROJ1";
errCode = "VTMONATD10";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
......@@ -220,7 +220,7 @@ public class ForecastIndicator extends ValidatorEJB implements ForecastIndicator
{
System.out.println(" growthPerc -----["+columnValue+"]");
if(columnValue == null || columnValue.length() == 0)
if(columnValue.equalsIgnoreCase("0") || columnValue.length() == 0)
{
errCode = "VGROWPERC";
errList.add( errCode );
......@@ -232,13 +232,7 @@ public class ForecastIndicator extends ValidatorEJB implements ForecastIndicator
{
System.out.println(" reasCode -----["+columnValue+"]");
if(columnValue == null || columnValue.length() == 0)
{
errCode = "VTREAS";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(columnValue.length() > 0)
if(columnValue.length() > 0)
{
sql= "select count(*) from gencodes where fld_value = ? and fld_name ='REAS_CODE'";
......@@ -339,4 +333,168 @@ public class ForecastIndicator extends ValidatorEJB implements ForecastIndicator
return errStringXml.toString();
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
System.out.println("xmlString xmlString"+ xmlString + "xmlString1 xmlString1 "+xmlString1 +"xmlString2 xmlString2 "+xmlString2);
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0)
{
dom2 = parseString(xmlString2);
}
valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
System.out.println("valueXmlString[" + valueXmlString + "]");
}
catch (Exception e)
{
System.out.println("Exception :itemChanged :" + e.getMessage());
throw new ITMException(e);
}
System.out.println("VALUE HELLO[" + valueXmlString + "]");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,String editFlag, String xtraParams) throws RemoteException, ITMException
{
E12GenericUtility genericUtility = new E12GenericUtility();
System.out.println("dom 156163546854626 "+ genericUtility.serializeDom(dom) + "dom1 "+genericUtility.serializeDom(dom1)+"dom2 "+genericUtility.serializeDom(dom2));
System.out.println("in the itemchange method ");
String sql = "",grwthPerc ="",periodCode= "0",itemdescr ="",itemCode = "",descr="",prdCode="",columnValue ="";
StringBuffer valueXmlString = new StringBuffer();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
ConnDriver connDriver = new ConnDriver();
int currentFormNo = 0;
int ctr = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
int childNodeListLength = 0;
try
{
conn = getConnection();
conn.setAutoCommit(false);
connDriver = null;
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext.trim());
}
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>");
switch (currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
ctr = 0;
valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr++;
if(childNode.getFirstChild()!=null)//first child of the node !equals to null then
{
columnValue = childNode.getFirstChild().getNodeValue();
}
else
{
columnValue = "";
}
} while (ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
System.out.println("in the itmdefault ");
grwthPerc = genericUtility.getColumnValue("growth_perc", dom);
if(grwthPerc == null || grwthPerc.trim().length() == 0)
{
valueXmlString.append("<growth_perc>").append("<![CDATA[" + periodCode +"]]>").append("</growth_perc>");
}
prdCode = genericUtility.getColumnValue("prd_code", dom);
if(prdCode == null || prdCode.trim().length() == 0)
{
//valueXmlString.append("<prd_code>").append("<![CDATA[" + prdCode +"]]>").append("</prd_code>");
}
}
else if(currentColumn.trim().equalsIgnoreCase("item_code"))
{
itemCode = genericUtility.getColumnValue("item_code", dom);
itemdescr = genericUtility.getColumnValue("item_descr", dom);
System.out.println("itemcode in the itemchange method "+itemCode);
sql = "select descr from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString("descr");
System.out.println("itemcode descr in the itemchange method "+descr);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("<item_descr>").append("<![CDATA[" + descr +"]]>").append("</item_descr>");
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+ e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
connDriver = null;
}
catch(Exception d)
{
d.printStackTrace();
}
}
return valueXmlString.toString();
}
}
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