Commit 99cfbca7 authored by kdabholkar's avatar kdabholkar

commited by kaustubh for gstRegForm2 changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106122 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a4748e88
...@@ -241,6 +241,14 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -241,6 +241,14 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
pstmt = null; pstmt = null;
} }
} }
retString= insertUserSignAcc(xmlstring,xtraParams,forcedFlag, conn);
}//End if Detail1 not found }//End if Detail1 not found
else else
{ {
...@@ -297,6 +305,142 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote ...@@ -297,6 +305,142 @@ public class GSTRegNoPosEJB extends ValidatorEJB implements GSTRegNoPosEJBRemote
return retString; return retString;
} }
public String insertUserSignAcc(String xmlstring, String xtraParams, String forcedFlag, Connection conn) throws ITMException
{
String userId="",signMethod="",serviceProvider="",serviceUri="",clientID="",clientSecret="",docType="",editFlag="";
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
try
{
Document dom = genericUtility.parseString(xmlstring);
NodeList detail1NodeList =dom.getElementsByTagName("Detail2");
int detail3NodeListlen = detail1NodeList.getLength();
for(int ctrH = 0; ctrH < detail3NodeListlen ; ctrH++)
{
userId="";signMethod="";serviceProvider="";serviceUri="";clientID="";clientSecret="";docType="";editFlag="";
NodeList childNodeList = detail1NodeList.item(ctrH).getChildNodes();
int childNodeListlen = childNodeList.getLength();
System.out.println("insertUserSignAcc childNodeListlen>>>>>"+childNodeListlen);
for(int ctrD = 0; ctrD < childNodeListlen ; ctrD++)
{
Node childNode = childNodeList.item(ctrD);
System.out.println("insertUserSignAcc childNode.getNodeName()>>"+childNode.getNodeName());
if(childNode != null && "user_id".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
userId = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "sign_method".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
signMethod = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "service_provider".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
serviceProvider = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "service_uri".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
serviceUri = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "client_id".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
clientID = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "client_secret".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
clientSecret = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "doc_type".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
docType = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
else if(childNode != null && "edit_flag".equalsIgnoreCase(childNode.getNodeName()) && childNode.getFirstChild() != null)
{
editFlag = checkNullAndTrim(childNode.getFirstChild().getNodeValue());
}
}
System.out.println("@@EditFlag["+editFlag+"]");
System.out.println("docType:: "+docType+"signMethod::"+signMethod);
if("A".equalsIgnoreCase(editFlag))
{
sql = " insert into user_sign_acc (user_id,sign_method,service_provider,service_uri,client_id,client_secret,doc_type) values(?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,userId);
pstmt.setString(2,signMethod);
pstmt.setString(3,serviceProvider);
pstmt.setString(4,serviceUri);
pstmt.setString(5,clientID);
pstmt.setString(6,clientSecret);
pstmt.setString(7,docType);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else if("E".equalsIgnoreCase(editFlag))
{
sql = " update user_sign_acc set service_provider=?,service_uri=?,client_id=?,client_secret=? where user_id=? and doc_type=? and sign_method=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,serviceProvider);
pstmt.setString(2,serviceUri);
pstmt.setString(3,clientID);
pstmt.setString(4,clientSecret);
pstmt.setString(5,userId);
pstmt.setString(6,docType);
pstmt.setString(7,signMethod);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
}
}
catch(Exception ex)
{
System.out.println("Exception inside insertUserSignAcc==>"+ex.getMessage());
throw new ITMException(ex);
}
finally
{
try{
if (rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();pstmt = null;
}
}
catch(Exception ex)
{
System.out.println("exception "+ex);
}
}
return retString;
}
private static String checkNullAndTrim(String input) private static String checkNullAndTrim(String input)
{ {
if (input==null) if (input==null)
......
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