Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
webitm-fin-advSupp-20
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ketan Patil
webitm-fin-advSupp-20
Commits
c13c8394
Commit
c13c8394
authored
May 26, 2022
by
Ketan Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added by Pravin for Wildfly20
parent
ed581ae4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
793 additions
and
0 deletions
+793
-0
ibase/webitm/ejb/fin/advfield/AdvanceVoucherSuppSubmit.java
ibase/webitm/ejb/fin/advfield/AdvanceVoucherSuppSubmit.java
+793
-0
No files found.
ibase/webitm/ejb/fin/advfield/AdvanceVoucherSuppSubmit.java
0 → 100644
View file @
c13c8394
package
ibase
.
webitm
.
ejb
.
fin
.
advfield
;
import
ibase.ejb.CommonDBAccessEJB
;
import
ibase.system.config.AppConnectParm
;
import
ibase.system.config.ConnDriver
;
import
ibase.webitm.ejb.ActionHandlerEJB
;
import
ibase.webitm.ejb.ITMDBAccessEJB
;
import
ibase.webitm.ejb.MasterStatefulLocal
;
import
ibase.webitm.ejb.sys_UTL.SignInUpdateWFStatus
;
import
ibase.utility.E12GenericUtility
;
import
ibase.utility.UserInfoBean
;
import
ibase.webitm.utility.GenericWorkflowClass
;
import
ibase.webitm.utility.ITMException
;
import
java.io.ByteArrayInputStream
;
import
java.io.PrintStream
;
import
java.rmi.RemoteException
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
javax.ejb.Stateless
;
import
javax.naming.InitialContext
;
import
javax.xml.parsers.DocumentBuilder
;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.NamedNodeMap
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
@Stateless
public
class
AdvanceVoucherSuppSubmit
extends
ActionHandlerEJB
implements
AdvanceVoucherSuppSubmitLocal
,
AdvanceVoucherSuppSubmitRemote
{
UserInfoBean
userInfo
=
null
;
InitialContext
ctx
=
null
;
public
String
confirm
()
throws
RemoteException
,
ITMException
{
return
""
;
}
public
String
confirm
(
String
paramString1
,
String
paramString2
,
String
paramString3
)
throws
RemoteException
,
ITMException
{
String
str
=
""
;
try
{
System
.
out
.
println
(
"Advance Confirm Process..."
);
str
=
submitCashVoucher
(
paramString1
,
paramString2
);
System
.
out
.
println
(
"result..."
+
str
);
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception ::"
+
localException
.
getMessage
());
throw
new
ITMException
(
localException
);
}
return
str
;
}
private
String
submitCashVoucher
(
String
paramString1
,
String
paramString2
)
throws
RemoteException
,
ITMException
{
Connection
localConnection
=
null
;
Statement
localStatement
=
null
;
PreparedStatement
localPreparedStatement
=
null
;
ResultSet
localResultSet
=
null
;
String
str1
=
""
;
String
str2
=
""
;
String
str3
=
""
;
String
str4
=
""
;
String
str5
=
""
;
String
str6
=
"BASE"
;
double
d1
=
0.0
D
;
String
str7
=
""
;
String
str8
=
""
;
Double
localDouble
=
Double
.
valueOf
(
0.0
D
);
double
d2
=
0.0
D
;
String
str9
=
""
;
String
str10
=
""
;
E12GenericUtility
localE12GenericUtility
=
new
E12GenericUtility
();
ITMDBAccessEJB
localITMDBAccessEJB
=
new
ITMDBAccessEJB
();
ConnDriver
localConnDriver
=
new
ConnDriver
();
try
{
str5
=
localE12GenericUtility
.
getApplDateFormat
();
}
catch
(
Exception
localException1
)
{
System
.
out
.
println
(
"Exception :[generateXML]While Getting Date Format"
+
localException1
.
getMessage
());
}
Date
localDate
=
new
Date
();
SimpleDateFormat
localSimpleDateFormat
=
new
SimpleDateFormat
(
str5
);
java
.
sql
.
Timestamp
currdate
=
new
java
.
sql
.
Timestamp
(
System
.
currentTimeMillis
()
);
try
{
//Comment By sanket J as request by Manoj sir on [21/06/2018]
//localConnection = localConnDriver.getConnectDB("DriverITM");
//localConnection = getConnection() ;
//Added by saiprasad G. for connecting the database[START]
String
loginCode
=
localE12GenericUtility
.
getValueFromXTRA_PARAMS
(
paramString2
,
"loginCode"
);
System
.
out
.
println
(
"LoginCode: "
+
loginCode
);
CommonDBAccessEJB
commonDBAccess
=
new
CommonDBAccessEJB
();
UserInfoBean
userInfo
=
commonDBAccess
.
createUserInfo
(
loginCode
);
System
.
out
.
println
(
"LoginCode:"
+
loginCode
);
String
empLoginCode
=
userInfo
.
getEmpCode
();
System
.
out
.
println
(
"xtraparams in submit:"
+
paramString2
);
try
{
localConnection
=
getConnection
()
;
}
catch
(
Exception
e
)
{
localConnection
=
localConnDriver
.
getConnectDB
(
userInfo
.
getTransDB
());
}
//Added by saiprasad G. for connecting the database[START]
// localStatement = localConnection.createStatement();
str1
=
"SELECT CONFIRMED,NET_AMT,STATUS,NET_AMT__CONV FROM CASH_VOUCHER WHERE TRAN_ID='"
+
paramString1
+
"'"
;
System
.
out
.
println
(
"sql:::::::"
+
str1
);
localPreparedStatement
=
localConnection
.
prepareStatement
(
str1
);
localResultSet
=
localPreparedStatement
.
executeQuery
();
if
(
localResultSet
.
next
())
{
str2
=
localResultSet
.
getString
(
"CONFIRMED"
);
System
.
out
.
println
(
"confirm==>"
+
str2
);
str4
=
localResultSet
.
getString
(
"STATUS"
);
System
.
out
.
println
(
"status==>"
+
str4
);
d2
=
localResultSet
.
getDouble
(
"NET_AMT"
);
System
.
out
.
println
(
"netAmount==>"
+
d2
);
localDouble
=
Double
.
valueOf
(
localResultSet
.
getDouble
(
"NET_AMT__CONV"
));
System
.
out
.
println
(
"convNetAmount:::"
+
localDouble
);
}
if
(
localPreparedStatement
!=
null
)
{
localPreparedStatement
.
close
();
localPreparedStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
String
str11
;
if
(
str2
.
equalsIgnoreCase
(
"Y"
))
{
str11
=
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTALCONF"
,
""
,
""
,
localConnection
);
return
str11
;
}
if
(
str4
.
equalsIgnoreCase
(
"S"
))
{
str3
=
localITMDBAccessEJB
.
getErrorString
(
"submited"
,
"VTINWRFLOW"
,
str6
,
""
,
localConnection
);
str11
=
str3
;
return
str11
;
}
/* if (d2 > 20000.0D)
{
str11 = localITMDBAccessEJB.getErrorString("", "VNAMT1", "", "", localConnection);
return str11;
}*/
int
i
=
getCount
(
"CASH_VOUCHER_DET"
,
"TRAN_ID"
,
paramString1
,
localConnection
);
String
errString
=
""
;
if
(
i
==
0
)
{
errString
=
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTRLNM1"
,
""
,
""
,
localConnection
);
return
errString
;
}
/* str1 = "SELECT SUM(AMOUNT)AS AMOUNT FROM CASH_VOUCHER_CONV WHERE TRAN_ID='" + paramString1 + "'";
localResultSet = localStatement.executeQuery(str1);
if (localResultSet.next())
{
d1 = localResultSet.getDouble("AMOUNT");
System.out.println("amount::" + d1);
}
if (localDouble.doubleValue() > 0.0D)
{
if (d1 != localDouble.doubleValue())
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VTAMOUNT4", "", "", localConnection);
return localObject1;
}
}
if ((localDouble.doubleValue() == 0.0D) && (d1 > 0.0D))
{
localObject1 = localITMDBAccessEJB.getErrorString("", "VMACTCONV", "", "", localConnection);
return localObject1;
}*/
// Object localObject1 = new SignInUpdateWFStatus(); //COMMENTED BY DIPALI
// str9 = ((SignInUpdateWFStatus)localObject1).updateWFStatus(paramString1, "voucher_advsupp", paramString2, str2); //COMMENTED BY DIPALI
str9
=
updateWFStatus
(
paramString1
,
"voucher_advsupp"
,
paramString2
,
str2
);
System
.
out
.
println
(
"result========>"
+
str9
);
System
.
out
.
println
(
"status......["
+
str4
+
"]"
);
Document
localDocument
=
localE12GenericUtility
.
parseString
(
str9
);
Node
localNode
=
localDocument
.
getElementsByTagName
(
"error"
).
item
(
0
);
NamedNodeMap
localNamedNodeMap
=
localNode
.
getAttributes
();
String
str12
=
localNamedNodeMap
.
getNamedItem
(
"id"
).
getNodeValue
();
if
(!
str12
.
trim
().
equalsIgnoreCase
(
"VTSUBMIT"
))
{
if
(
str9
.
trim
().
length
()
!=
0
)
{
localConnection
.
rollback
();
String
str13
=
str9
;
return
str13
;
}
}
else
{
// str8 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "chgTerm");
str8
=
getValueFromXTRA_PARAMS
(
paramString2
,
"chgTerm"
);
//MODIFIED BY DIPALI
System
.
out
.
println
(
"chgTerm......["
+
str8
+
"]"
);
// str7 = ((SignInUpdateWFStatus)localObject1).getValueFromXTRA_PARAMS(paramString2, "loginCode");
//str7 = getValueFromXTRA_PARAMS(paramString2, "loginCode"); //MODIFIED BY DIPALI
str7
=
getValueFromXTRA_PARAMS
(
paramString2
,
"loginCode"
);
//MODIFIED BY DIPALI
System
.
out
.
println
(
"chgUser......["
+
str7
+
"]"
);
System
.
out
.
println
(
"chgDate......["
+
currdate
+
"]"
);
/*
* Changes by Manoj Sarode on 10-Oct-2013 Start
* Update the change date when the transaction is submitted using Submit button
* */
str1
=
"UPDATE CASH_VOUCHER SET CHG_USER= ?,CHG_TERM= ?, CHG_DATE =? WHERE TRAN_ID='"
+
paramString1
+
"'"
;
System
.
out
.
println
(
"sql......["
+
str1
+
"]"
);
localPreparedStatement
=
localConnection
.
prepareStatement
(
str1
);
localPreparedStatement
.
setString
(
1
,
str7
);
localPreparedStatement
.
setString
(
2
,
str8
);
localPreparedStatement
.
setTimestamp
(
3
,
currdate
);
int
j
=
localPreparedStatement
.
executeUpdate
();
localPreparedStatement
.
close
();
localPreparedStatement
=
null
;
//Added by saiprasad G. for invoking workflow[START]
if
(!
"Y"
.
equalsIgnoreCase
(
str2
)
||
str2
.
length
()
<=
0
)
{
GenericWorkflowClass
wfGenericClass
=
new
GenericWorkflowClass
();
String
retString
=
wfGenericClass
.
invokeWorkflow
(
localConnection
,
paramString1
,
paramString2
,
"w_voucher_advsupp"
,
"voucher_advsupp"
);
System
.
out
.
println
(
"return String : "
+
retString
);
}
//Added by saiprasad G. for invoking workflow[ND]
/*
* Changes by Manoj Sarode on 10-Oct-2013 End
* Update the change date when the transaction is submitted using Submit button
* */
}
localConnection
.
commit
();
}
catch
(
Exception
localSQLException2
)
{
System
.
out
.
println
(
"Exception:: [AdvanceVoucherSuppSubmit ]EXCEPTION"
+
localSQLException2
.
getMessage
());
localSQLException2
.
printStackTrace
();
}
finally
{
try
{
if
(
localConnection
!=
null
)
{
// localStatement.close();
if
(
localPreparedStatement
!=
null
)
{
localPreparedStatement
.
close
();
localPreparedStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
localConnection
.
close
();
localConnection
=
null
;
}
}
catch
(
SQLException
localSQLException10
)
{
System
.
out
.
println
(
"Exception inside finally"
+
localSQLException10
.
getMessage
());
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTADHOC1"
,
""
,
""
,
localConnection
);
}
}
return
(
String
)
str9
;
}
int
getCount
(
String
paramString1
,
String
paramString2
,
String
paramString3
,
Connection
paramConnection
)
{
Statement
localStatement
=
null
;
ResultSet
localResultSet
=
null
;
int
i
=
0
;
try
{
if
(
paramString3
==
null
)
paramString3
=
""
;
localStatement
=
paramConnection
.
createStatement
();
String
str
=
"SELECT COUNT(*) AS COUNT FROM "
+
paramString1
+
" WHERE "
+
paramString2
+
" = '"
+
paramString3
+
"'"
;
System
.
out
.
println
(
"sql::"
+
str
);
localResultSet
=
localStatement
.
executeQuery
(
str
);
if
(
localResultSet
.
next
())
{
System
.
out
.
println
(
"inside getCount"
);
i
=
localResultSet
.
getInt
(
"COUNT"
);
System
.
out
.
println
(
"************* COUNT IN "
+
paramString1
+
" ********"
+
i
);
}
localResultSet
.
close
();
localStatement
.
close
();
System
.
out
.
println
(
"************* COUNT out 33 "
+
paramString1
+
" ********"
+
i
);
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Inside getCount Exception *******"
+
localException
.
getMessage
());
localException
.
printStackTrace
();
}
return
i
;
}
//ADDED BY DIPALI [START]
public
String
updateWFStatus
(
String
paramString1
,
String
paramString2
,
String
paramString3
,
String
paramString4
)
throws
ITMException
{
Connection
localConnection
=
null
;
Statement
localStatement
=
null
;
ResultSet
localResultSet
=
null
;
String
str1
=
""
;
Object
localObject
=
""
;
String
str2
=
""
;
String
str3
=
""
;
String
str4
=
""
;
String
str5
=
""
;
String
str6
=
""
;
String
str7
=
""
;
String
str8
=
""
;
String
str9
=
""
;
String
str10
=
""
;
String
str11
=
paramString4
;
String
signStatus
=
""
,
lineNo
=
""
;
int
i
=
0
;
int
j
=
0
;
str8
=
getValueFromXTRA_PARAMS
(
paramString3
,
"loginCode"
);
System
.
out
.
println
(
"Inside SignInUpdateWfStatus...........loginCode "
+
str8
);
str9
=
getValueFromXTRA_PARAMS
(
paramString3
,
"loginSiteCode"
);
ITMDBAccessEJB
localITMDBAccessEJB
=
new
ITMDBAccessEJB
();
try
{
ConnDriver
localConnDriver
=
new
ConnDriver
();
CommonDBAccessEJB
commonDBAccessEJB
=
new
CommonDBAccessEJB
();
this
.
userInfo
=
commonDBAccessEJB
.
createUserInfo
(
str8
);
System
.
out
.
println
(
"userInfo in advanceVoucherFieldSubmit["
+
this
.
userInfo
+
"]"
);
localConnection
=
localConnDriver
.
getConnectDB
(
this
.
userInfo
.
getTransDB
());
System
.
out
.
println
(
" CONFIRMED STATUS IS :"
+
str11
);
if
(
str11
.
equalsIgnoreCase
(
"Y"
))
{
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTINWRFLOW"
,
""
,
""
,
localConnection
);
}
str1
=
"SELECT REF_SER FROM TRANSETUP WHERE TRAN_WINDOW='w_"
+
paramString2
+
"'"
;
System
.
out
.
println
(
"sql is "
+
str1
);
localStatement
=
localConnection
.
createStatement
();
localResultSet
=
localStatement
.
executeQuery
(
str1
);
if
(
localResultSet
.
next
())
{
str10
=
localResultSet
.
getString
(
"REF_SER"
);
System
.
out
.
println
(
"refSer====="
+
str10
);
}
if
(
localStatement
!=
null
)
{
localStatement
.
close
();
localStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
str1
=
"SELECT PASS_WD FROM USERS WHERE CODE='"
+
str8
+
"' "
;
System
.
out
.
println
(
"sql is "
+
str1
);
localStatement
=
localConnection
.
createStatement
();
localResultSet
=
localStatement
.
executeQuery
(
str1
);
while
(
localResultSet
.
next
())
{
str6
=
localResultSet
.
getString
(
1
);
System
.
out
.
println
(
"password====="
+
str6
);
}
if
(
localStatement
!=
null
)
{
localStatement
.
close
();
localStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
str1
=
"SELECT nvl(MAX(LINE_NO),0) as LINE_NO FROM OBJ_SIGN_TRANS WHERE REF_ID= '"
+
paramString1
+
"' AND REF_SER='"
+
str10
+
"' "
;
System
.
out
.
println
(
"sql is "
+
str1
);
localStatement
=
localConnection
.
createStatement
();
localResultSet
=
localStatement
.
executeQuery
(
str1
);
while
(
localResultSet
.
next
())
{
lineNo
=
localResultSet
.
getString
(
"LINE_NO"
);
System
.
out
.
println
(
"lineNo=="
+
lineNo
);
}
if
(
localStatement
!=
null
)
{
localStatement
.
close
();
localStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
str1
=
"SELECT sign_status FROM OBJ_SIGN_TRANS WHERE REF_ID= '"
+
paramString1
+
"' AND REF_SER='"
+
str10
+
"' AND line_no = '"
+
lineNo
+
"'"
;
System
.
out
.
println
(
"sql is "
+
str1
);
localStatement
=
localConnection
.
createStatement
();
localResultSet
=
localStatement
.
executeQuery
(
str1
);
while
(
localResultSet
.
next
())
{
signStatus
=
localResultSet
.
getString
(
"sign_status"
);
System
.
out
.
println
(
"signStatus=="
+
signStatus
);
}
if
(
localStatement
!=
null
)
{
localStatement
.
close
();
localStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
if
(
signStatus
.
equalsIgnoreCase
(
"S"
)
||
signStatus
.
equalsIgnoreCase
(
"U"
))
{
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTINWRFLOW"
,
""
,
""
,
localConnection
);
}
System
.
out
.
println
(
"before userCodeArr"
);
String
[]
arrayOfString
=
{
str8
,
str6
};
System
.
out
.
println
(
"after userCodeArr="
+
arrayOfString
.
length
);
localObject
=
getDetailXmlString
(
paramString2
,
"1"
,
"E"
,
paramString1
,
"01/08/04:31/08/08:"
);
System
.
out
.
println
(
"after xmlString=="
+
(
String
)
localObject
);
j
=
Integer
.
parseInt
(
getDisparams
(
"999999"
,
str10
+
"_SIGN_NUMCOLS"
,
this
.
userInfo
));
while
(
j
>=
1
)
{
System
.
out
.
println
(
"no of key"
+
j
);
str5
=
getDisparams
(
"999999"
,
str10
+
"_SIGN_KEYNAME"
+
j
,
this
.
userInfo
);
str4
=
getDisparams
(
"999999"
,
str10
+
"_SIGN_KEYVALUE"
+
j
,
this
.
userInfo
);
str3
=
makeChangeInXml
((
String
)
localObject
,
str5
,
str4
);
if
(
str3
.
equals
(
"NO MATCH FOUND"
))
{
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTNOKEY"
,
""
,
""
,
localConnection
);
}
if
(
str3
.
equals
(
"SAME VALUE"
))
{
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTSAMEDATA"
,
""
,
""
,
localConnection
);
}
localObject
=
str3
;
j
--;
}
System
.
out
.
println
(
"Final xml string is "
+
(
String
)
localObject
);
str2
=
headerInfo
(
paramString2
,
"1"
,
"E"
,
"EDIT"
,
paramString1
);
str7
=
saveRecords
((
String
)
localObject
,
str2
);
System
.
out
.
println
(
" result string is "
+
str7
);
if
(
str7
.
equalsIgnoreCase
(
"CONFIRMED"
))
{
return
localITMDBAccessEJB
.
getErrorString
(
""
,
"VTSUBMIT "
,
""
,
""
,
localConnection
);
}
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception ::"
+
localException
.
getMessage
());
throw
new
ITMException
(
localException
);
}
finally
{
if
(
localConnection
!=
null
)
{
try
{
//localStatement.close();
if
(
localStatement
!=
null
)
{
localStatement
.
close
();
localStatement
=
null
;
}
if
(
localResultSet
!=
null
)
{
localResultSet
.
close
();
localResultSet
=
null
;
}
localConnection
.
close
();
localConnection
=
null
;
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
return
str7
;
}
public
String
headerInfo
(
String
paramString1
,
String
paramString2
,
String
paramString3
,
String
paramString4
,
String
paramString5
)
{
StringBuffer
localStringBuffer
=
new
StringBuffer
();
localStringBuffer
.
append
(
"<Root>"
);
localStringBuffer
.
append
(
"<Header0>"
);
localStringBuffer
.
append
(
"<objName><![CDATA["
+
paramString1
+
"]]></objName>"
);
localStringBuffer
.
append
(
"<pkValues><![CDATA["
).
append
(
paramString5
).
append
(
"]]></pkValues>"
);
localStringBuffer
.
append
(
"<pageContext><![CDATA[2]]></pageContext>"
);
localStringBuffer
.
append
(
"<objContext><![CDATA[1]]></objContext>"
);
localStringBuffer
.
append
(
"<editFlag><![CDATA["
).
append
(
paramString3
).
append
(
"]]></editFlag>"
);
localStringBuffer
.
append
(
"<focusedColumn><![CDATA[]]></focusedColumn>"
);
localStringBuffer
.
append
(
"<action><![CDATA["
).
append
(
paramString4
).
append
(
"]]></action>"
);
localStringBuffer
.
append
(
"<elementName><![CDATA[]]></elementName>"
);
localStringBuffer
.
append
(
"<keyValue><![CDATA[1]]></keyValue>"
);
localStringBuffer
.
append
(
"<taxKeyValue><![CDATA[]]></taxKeyValue>"
);
localStringBuffer
.
append
(
"<saveLevel><![CDATA[1]]></saveLevel>"
);
localStringBuffer
.
append
(
"<forcedSave><![CDATA[false]]></forcedSave>"
);
localStringBuffer
.
append
(
"<taxInFocus><![CDATA[false]]></taxInFocus>"
);
localStringBuffer
.
append
(
"<description>Header0 members</description>"
);
localStringBuffer
.
append
(
"</Header0>"
);
return
localStringBuffer
.
toString
();
}
public
String
getValueFromXTRA_PARAMS
(
String
paramString1
,
String
paramString2
)
{
String
str
=
""
;
try
{
int
i
=
paramString1
.
indexOf
(
paramString2
);
int
j
=
paramString1
.
indexOf
(
"="
,
i
);
int
k
=
paramString1
.
indexOf
(
"~"
,
j
);
if
(
k
<
0
)
{
k
=
paramString1
.
length
();
}
str
=
paramString1
.
substring
(
j
+
1
,
k
);
System
.
out
.
println
(
"Value of "
+
paramString2
+
" : "
+
str
);
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception ::getValueFromXTRA_PARAMS :==>\n"
+
localException
.
getMessage
());
}
return
str
;
}
private
String
getDisparams
(
String
paramString1
,
String
paramString2
,
UserInfoBean
userInfo
)
throws
ITMException
{
String
str1
=
""
;
String
str2
=
""
;
Connection
localConnection
=
null
;
ResultSet
localResultSet
=
null
;
Statement
localStatement
=
null
;
try
{
System
.
out
.
println
(
"in DISPARAMS "
);
ConnDriver
localConnDriver
=
new
ConnDriver
();
localConnection
=
localConnDriver
.
getConnectDB
(
userInfo
.
getTransDB
());
localStatement
=
localConnection
.
createStatement
();
str2
=
"SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE ='"
+
paramString1
+
"' AND VAR_NAME ='"
+
paramString2
+
"'"
;
System
.
out
.
println
(
"sql is of disparm"
+
str2
);
localResultSet
=
localStatement
.
executeQuery
(
str2
);
if
(!
localResultSet
.
next
())
{
str1
=
"NULLFOUND"
;
}
else
{
str1
=
localResultSet
.
getString
(
1
);
}
localStatement
.
close
();
localConnection
.
close
();
localConnection
=
null
;
}
catch
(
Exception
localException
)
{
throw
new
ITMException
(
localException
);
}
if
(
str1
==
null
)
str1
=
""
;
System
.
out
.
println
(
"value of disparm"
+
str1
);
return
str1
;
}
public
String
getDetailXmlString
(
String
paramString1
,
String
paramString2
,
String
paramString3
,
String
paramString4
,
String
paramString5
)
{
String
str
=
""
;
try
{
AppConnectParm
localAppConnectParm
=
new
AppConnectParm
();
this
.
ctx
=
new
InitialContext
(
localAppConnectParm
.
getProperty
());
MasterStatefulLocal
localMasterStatefulLocal
=
(
MasterStatefulLocal
)
this
.
ctx
.
lookup
(
"ibase/MasterStatefulEJB/local"
);
if
(
this
.
userInfo
!=
null
)
{
localMasterStatefulLocal
.
setUserInfo
(
this
.
userInfo
);
}
str
=
localMasterStatefulLocal
.
getDetailXMLDomString
(
paramString1
,
paramString2
,
paramString3
,
paramString4
,
paramString5
);
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"exception is"
+
localException
.
getMessage
());
}
return
str
;
}
public
String
makeChangeInXml
(
String
paramString1
,
String
paramString2
,
String
paramString3
)
{
boolean
bool
=
false
;
StringBuffer
localStringBuffer
=
new
StringBuffer
(
paramString1
);
String
str
=
"<"
+
paramString2
+
">"
;
System
.
out
.
println
(
"match String :::::::::"
+
str
);
System
.
out
.
println
(
"xml:::::::::"
+
paramString1
);
int
i
=
paramString1
.
indexOf
(
str
);
if
(
i
==
-
1
)
{
return
"NO MATCH FOUND"
;
}
int
j
=
i
+
str
.
length
();
int
k
=
j
+
paramString3
.
trim
().
length
();
System
.
out
.
println
(
"Index ::["
+
i
+
"]startposition["
+
j
+
"]endposition["
+
k
);
bool
=
localStringBuffer
.
substring
(
j
,
k
).
equals
(
paramString3
.
trim
());
if
(
bool
)
{
return
"SAME VALUE"
;
}
localStringBuffer
.
delete
(
j
,
k
);
localStringBuffer
.
insert
(
j
,
paramString3
.
trim
());
return
localStringBuffer
.
toString
();
}
public
String
saveRecords
(
String
paramString1
,
String
paramString2
)
throws
ITMException
{
String
str
=
""
;
StringBuffer
localStringBuffer
=
null
;
try
{
AppConnectParm
localAppConnectParm
=
new
AppConnectParm
();
this
.
ctx
=
new
InitialContext
(
localAppConnectParm
.
getProperty
());
localStringBuffer
=
new
StringBuffer
(
paramString1
);
int
i
=
0
;
int
j
=
0
;
int
k
=
0
;
i
=
localStringBuffer
.
toString
().
indexOf
(
"</Header0>"
);
j
=
localStringBuffer
.
toString
().
indexOf
(
"</group0>"
);
k
=
"</group0>"
.
length
();
localStringBuffer
.
delete
(
i
,
j
+
k
);
i
=
paramString1
.
indexOf
(
"<DocumentRoot>"
);
j
=
paramString1
.
indexOf
(
"<description>Header0 members</description>"
);
k
=
"<description>Header0 members</description>"
.
length
();
localStringBuffer
.
replace
(
i
,
j
+
k
,
paramString2
);
i
=
localStringBuffer
.
toString
().
indexOf
(
"</DocumentRoot>"
);
k
=
"</DocumentRoot>"
.
length
();
localStringBuffer
.
replace
(
i
,
i
+
k
,
"</Root>"
);
System
.
out
.
println
(
"xml String is "
+
localStringBuffer
);
MasterStatefulLocal
localMasterStatefulLocal
=
(
MasterStatefulLocal
)
this
.
ctx
.
lookup
(
"ibase/MasterStatefulEJB/local"
);
str
=
localMasterStatefulLocal
.
processRequest
(
this
.
userInfo
,
localStringBuffer
.
toString
(),
false
,
null
);
System
.
out
.
println
(
"retString=1===>"
+
str
);
str
=
parseXmlString
(
str
);
System
.
out
.
println
(
"retString=2===>"
+
str
);
if
(
str
.
equals
(
"Success"
))
{
str
=
"CONFIRMED"
;
}
else
{
System
.
out
.
println
(
"Error while submitting button is clicked."
);
}
}
catch
(
ITMException
localITMException
)
{
System
.
out
.
println
(
"ITMException :FeedBackServlet :saveRecords :==>"
);
throw
localITMException
;
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception :FeedBackServlet :saveRecords :==>"
);
throw
new
ITMException
(
localException
);
}
System
.
out
.
println
(
"Return String in SampleIssue 2"
);
return
str
;
}
private
static
Document
createDom
(
String
paramString
)
{
Document
localDocument
=
null
;
try
{
DocumentBuilderFactory
localDocumentBuilderFactory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
localDocumentBuilder
=
localDocumentBuilderFactory
.
newDocumentBuilder
();
ByteArrayInputStream
localByteArrayInputStream
=
new
ByteArrayInputStream
(
paramString
.
getBytes
());
localDocument
=
localDocumentBuilder
.
parse
(
localByteArrayInputStream
);
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception occures in xmlDocument :"
+
localException
);
}
return
localDocument
;
}
public
String
parseXmlString
(
String
paramString
)
{
System
.
out
.
println
(
"retString !"
+
paramString
);
int
i
=
0
;
Document
localDocument
=
null
;
try
{
localDocument
=
createDom
(
paramString
);
Object
localObject1
=
null
;
Node
localNode
=
null
;
Object
localObject2
=
null
;
NodeList
localNodeList
=
null
;
int
j
=
0
;
int
k
=
0
;
String
str1
=
""
;
String
str2
=
""
;
localNodeList
=
localDocument
.
getElementsByTagName
(
"Detail"
);
j
=
localNodeList
.
getLength
();
System
.
out
.
println
(
j
);
for
(
int
m
=
0
;
m
<
j
;
m
++)
{
localNode
=
localNodeList
.
item
(
m
);
paramString
=
localNode
.
getFirstChild
().
getNodeValue
();
System
.
out
.
println
(
"child node is detail tag is and retString "
+
paramString
);
}
}
catch
(
Exception
localException
)
{
System
.
out
.
println
(
"Exception occures in xmlDocument :"
+
localException
);
}
return
paramString
;
}
//ADDED BY DIPALI [END]
/* private String getValueFromFinparam(String paramString1, String paramString2, Connection paramConnection) throws ITMException {
String str1 = "";
String str2 = "";
ResultSet localResultSet = null;
Statement localStatement = null;
try
{
localStatement = paramConnection.createStatement();
str2 = "SELECT VAR_VALUE FROM FINPARM WHERE PRD_CODE ='" + paramString1 + "' AND VAR_NAME ='" + paramString2 + "'";
System.out.println("sql of fin praram" + str2);
localResultSet = localStatement.executeQuery(str2);
if (localResultSet.next())
{
str1 = localResultSet.getString(1);
}
else
{
str1 = "NULLFOUND";
}
if (localStatement != null)
localStatement.close();
}
catch (Exception localException)
{
throw new ITMException(localException);
}
return str1;
}*/
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment