Commit 97d0d4b0 authored by ssalve's avatar ssalve

inserted method getObjNameFromDom to get obj_name


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105882 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 09f77f13
...@@ -89,14 +89,14 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -89,14 +89,14 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
String cust_name = "",tax_reg_no = ""; String cust_name = "",tax_reg_no = "";
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
conn = getConnection(); conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo:::"+currentFormNo); System.out.println("currentFormNo:::"+currentFormNo);
switch(currentFormNo) switch(currentFormNo)
{ {
case 1: case 1:
...@@ -263,7 +263,7 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -263,7 +263,7 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
tran_type = checkNull(genericUtility.getColumnValue("tran_type", dom)).trim(); tran_type = checkNull(genericUtility.getColumnValue("tran_type", dom)).trim();
cust_name = checkNull(genericUtility.getColumnValue("cust_name", dom)).trim(); cust_name = checkNull(genericUtility.getColumnValue("cust_name", dom)).trim();
if((tran_type.equalsIgnoreCase("03")) || (tran_type.equalsIgnoreCase("04")) || (tran_type.equalsIgnoreCase("05")) || tran_type.equalsIgnoreCase("06")) if((tran_type.equalsIgnoreCase("03")) || (tran_type.equalsIgnoreCase("04")))
{ {
if(cust_name == null || cust_name.trim().length() == 0) if(cust_name == null || cust_name.trim().length() == 0)
{ {
...@@ -533,6 +533,9 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -533,6 +533,9 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
java.util.Date doc_date=null; java.util.Date doc_date=null;
String loginSite = ""; String loginSite = "";
SimpleDateFormat sdf; SimpleDateFormat sdf;
//changes done by sarita 13.06.2017
NodeList parentList = null;
String objName="";
try try
{ {
conn = getConnection(); conn = getConnection();
...@@ -551,6 +554,11 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -551,6 +554,11 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
case 1 : case 1 :
{ {
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
// Added by sarita on 13.06.2017 :START
parentList = dom.getElementsByTagName( "Detail" + currentFormNo );
objName = getObjNameFromDom( dom, "objName", "1" );
System.out.println("Inside Itemchange OBJ Name="+objName);
//Added by sarita on 13.06.2017 :END
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
...@@ -560,32 +568,63 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -560,32 +568,63 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
System.out.println("currentColumn-------->>[" + currentColumn + "]"); System.out.println("currentColumn-------->>[" + currentColumn + "]");
if("itm_default".equalsIgnoreCase(currentColumn.trim())) if("itm_default".equalsIgnoreCase(currentColumn.trim()))
{ {
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<tran_date>").append("<![CDATA[" + sdf.format(new Date())+ "]]>").append("</tran_date>"); valueXmlString.append("<tran_date>").append("<![CDATA[" + sdf.format(new Date())+ "]]>").append("</tran_date>");
//*****************changes for rec_type non-editable fields ************************** //*****************changes for rec_type non-editable fields **************************
sql = "select fld_value,descr from gencodes where fld_name='REC_TYPE' and mod_name='W_GSTR'"; // Added by sarita on 13.06.2017 :START
pstmt = conn.prepareStatement(sql); if("gstr".equalsIgnoreCase(objName))
rs = pstmt.executeQuery();
while(rs.next())
{ {
rec_type = rs.getString("fld_value"); sql = "select fld_value,descr from gencodes where fld_name='REC_TYPE' and mod_name='W_GSTR'";
recDescr = rs.getString("descr"); pstmt = conn.prepareStatement(sql);
if(rec_type.equalsIgnoreCase("1") && recDescr.equalsIgnoreCase("GSTR1")) rs = pstmt.executeQuery();
while(rs.next())
{ {
valueXmlString.append("<rec_type>").append("<![CDATA["+rec_type+"]]>").append("</rec_type>"); rec_type = rs.getString("fld_value");
valueXmlString.append("<rec_type_descr>").append("<![CDATA["+recDescr+"]]>").append("</rec_type_descr>"); recDescr = rs.getString("descr");
if(rec_type.equalsIgnoreCase("1") && recDescr.equalsIgnoreCase("GSTR1"))
{
valueXmlString.append("<rec_type>").append("<![CDATA["+rec_type+"]]>").append("</rec_type>");
valueXmlString.append("<rec_type_descr>").append("<![CDATA["+recDescr+"]]>").append("</rec_type_descr>");
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
} }
} }
if(pstmt != null) else if("gstr_purc".equalsIgnoreCase(objName))
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{ {
rs.close(); sql = "select fld_value,descr from gencodes where fld_name='REC_TYPE' and mod_name='W_GSTR'";
rs = null; pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
rec_type = rs.getString("fld_value");
recDescr = rs.getString("descr");
if(rec_type.equalsIgnoreCase("2") && recDescr.equalsIgnoreCase("GSTR2"))
{
valueXmlString.append("<rec_type>").append("<![CDATA["+rec_type+"]]>").append("</rec_type>");
valueXmlString.append("<rec_type_descr>").append("<![CDATA["+recDescr+"]]>").append("</rec_type_descr>");
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
} }
//Added by sarita 13.06.2017 :END
//*****************changes for rec_type non-editable fields ************************** //*****************changes for rec_type non-editable fields **************************
}//end of if block for itm_default }//end of if block for itm_default
else if("itm_defaultedit".equalsIgnoreCase(currentColumn.trim())) else if("itm_defaultedit".equalsIgnoreCase(currentColumn.trim()))
...@@ -992,4 +1031,34 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal ...@@ -992,4 +1031,34 @@ public class GstrIC extends ValidatorEJB implements GstrICRemote, GstrICLocal
} }
return msgType; return msgType;
} }
// Added by sarita on 13.06.2017 to get obj_name
private String getObjNameFromDom( Document dom, String attribute, String objContext ) throws RemoteException,ITMException
{
System.out.println("Inside getObjNameFromDom method");
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String objName = "";
int detailListLength = 0;
try
{
detailList = dom.getElementsByTagName("Detail"+objContext);
detailListLength = detailList.getLength();
System.out.println("detailList>>>"+detailList.getLength());
System.out.println("detailListLength>>>"+detailListLength);
for (int ctr = 0; ctr < detailListLength; ctr++)
{
System.out.println("Inside for loop....");
currDetail = detailList.item(ctr);
System.out.println("currDetail>>>>>>"+currDetail);
objName = currDetail.getAttributes().getNamedItem(attribute).getNodeValue();
System.out.println("objName>>>>>>"+objName);
}
}
catch ( Exception e )
{
throw new ITMException(e);
}
return objName;
}
} }
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