Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
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
2
Merge Requests
2
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
Gagandeep Singh Bhatia
Component Sharing
Commits
ff3b4f1e
Commit
ff3b4f1e
authored
Sep 16, 2024
by
Omkar.Ingale@proteustech.in
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validation commit
parent
56ddd64c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
55 deletions
+117
-55
Task/Mailing List/Java component/mailingListIC.java
Task/Mailing List/Java component/mailingListIC.java
+117
-55
No files found.
Task/Mailing List/Java component/mailingListIC.java
View file @
ff3b4f1e
...
...
@@ -5,11 +5,12 @@ import java.sql.Connection;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
ibase.utility.BaseLogger
;
import
ibase.utility.E12GenericUtility
;
import
ibase.utility.UserInfoBean
;
import
ibase.webitm.ejb.ValidatorEJB
;
import
ibase.webitm.utility.ITMException
;
...
...
@@ -17,55 +18,9 @@ public class mailingListIC extends ValidatorEJB {
E12GenericUtility
genericUtility
=
new
E12GenericUtility
();
public
String
buildMailXMLStr
(
HashMap
<
String
,
Object
>
mailFormatDetails
,
UserInfoBean
userInfo
)
{
BaseLogger
.
log
(
"2"
,
null
,
null
,
"Emailscheduler buildMailXMLStr calling-----------------"
);
String
mailXMLStr
=
""
;
// Fetch mail format details from the database
String
emailID
=
mailFormatDetails
.
get
(
"SEND_TO"
).
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"emailID ["
+
emailID
+
"]"
);
String
body
=
mailFormatDetails
.
get
(
"BODY"
).
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"body ["
+
body
+
"]"
);
// String formatCode = mailFormatDetails.get("FORMAT_CODE").toString();
// BaseLogger.log("3", null, null, "formatCode [" + formatCode + "]");
String
formatCode
=
""
;
// String copyto = mailFormatDetails.get("COPY_TO").toString();
// BaseLogger.log("3", null, null, "copyto [" + copyto + "]");
String
system
=
mailFormatDetails
.
get
(
"SUBJECT"
).
toString
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"system ["
+
system
+
"]"
);
String
objName
=
""
;
String
workDateApp
=
""
;
try
{
BaseLogger
.
log
(
"2"
,
null
,
null
,
"Inside try block method: buildMailXMLStr ---"
);
mailXMLStr
=
"<ROOT><TRANS_INFO><OBJ_NAME>"
+
objName
+
"</OBJ_NAME>"
+
"<REF_SER></REF_SER><REF_ID>"
+
workDateApp
+
"</REF_ID>"
+
"<LINE_NO>1</LINE_NO></TRANS_INFO>"
+
"<EMAIL_TYPE></EMAIL_TYPE><ENTITY_CODE></ENTITY_CODE>"
+
"<FORMAT_CODE>"
+
formatCode
+
"</FORMAT_CODE>"
+
"<LINK_ADDR></LINK_ADDR>"
+
"<TO_ADD>"
+
emailID
+
" </TO_ADD>"
+
"<CC_ADD>"
+
mailFormatDetails
.
get
(
"COPY_TO"
)
+
"</CC_ADD>"
+
"<BCC_ADD>"
+
mailFormatDetails
.
get
(
"BLIND_COPY"
)
+
"</BCC_ADD>"
+
"<BODY_TEXT>"
+
body
+
"</BODY_TEXT>"
+
"<SUBJECT>"
+
mailFormatDetails
.
get
(
"SUBJECT"
)
+
"</SUBJECT>"
+
"</ROOT>"
;
System
.
out
.
println
(
"mailXMLStr....::"
+
mailXMLStr
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"0"
,
null
,
null
,
"Exception from buildMailXMLStr ["
+
system
+
"]"
);
e
.
printStackTrace
();
}
return
mailXMLStr
;
}
@Override
public
String
itemChanged
(
String
xmlString
,
String
xmlString1
,
String
xmlString2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
// initially setting value for dom as null
Document
dom
=
null
;
Document
dom1
=
null
;
Document
dom2
=
null
;
...
...
@@ -73,7 +28,6 @@ public class mailingListIC extends ValidatorEJB {
try
{
// The part where conversion begins
if
(
xmlString
!=
null
&&
xmlString
.
trim
().
length
()!=
0
)
{
...
...
@@ -101,12 +55,6 @@ public class mailingListIC extends ValidatorEJB {
return
errString
;
}
// This method is used for data handeling in application
// objcontext holds form no.
// extraparams holds the default credential of logged in user in string format.
@Override
public
String
itemChanged
(
Document
dom
,
Document
dom1
,
Document
dom2
,
String
objContext
,
String
currentColumn
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
...
...
@@ -229,6 +177,120 @@ public class mailingListIC extends ValidatorEJB {
}
// For validation
@Override
public
String
wfValData
(
String
xmlString
,
String
xmlString1
,
String
xmlString2
,
String
objContext
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
// Initially dom values are set to null
Document
dom
=
null
;
Document
dom1
=
null
;
Document
dom2
=
null
;
String
errString
=
null
;
// To check what is it printing
System
.
out
.
println
(
"xmlString["
+
xmlString
+
"]"
);
System
.
out
.
println
(
"xmlString1["
+
xmlString1
+
"]"
);
System
.
out
.
println
(
"xmlString2["
+
xmlString2
+
"]"
);
// To validate weather the xml is not empty and neither null.
try
{
if
(
xmlString
!=
null
&&
xmlString
.
trim
().
length
()!=
0
)
{
// This satisfies both condition so we can convert this xml to dom.
dom
=
genericUtility
.
parseString
(
xmlString
);
}
if
(
xmlString1
!=
null
&&
xmlString1
.
trim
().
length
()!=
0
)
{
dom1
=
genericUtility
.
parseString
(
xmlString1
);
}
if
(
xmlString2
!=
null
&&
xmlString2
.
trim
().
length
()!=
0
)
{
dom2
=
genericUtility
.
parseString
(
xmlString2
);
}
// Here we call another method where we pass this newly created dom file.
errString
=
wfValData
(
dom
,
dom1
,
dom2
,
objContext
,
editFlag
,
xtraParams
);
System
.
out
.
println
(
"ErrString: "
+
errString
);
}
catch
(
Exception
e
)
// Catch any other exception
{
System
.
out
.
println
(
"Exception: SfaTime: wfValData(String xmlString): "
+
e
.
getMessage
()
+
":"
);
errString
=
genericUtility
.
createErrorString
(
e
);
e
.
printStackTrace
();
}
System
.
out
.
println
(
"Returning from SfaTime wfValData"
);
// If there is no error we return the errString value which will come from consequetive method.
return
(
errString
);
}
@Override
public
String
wfValData
(
Document
dom
,
Document
dom1
,
Document
dom2
,
String
objContext
,
String
editFlag
,
String
xtraParams
)
throws
RemoteException
,
ITMException
{
System
.
out
.
println
(
"Inside SfaTime validation"
);
NodeList
parentNodeList
=
null
;
NodeList
childNodeList
=
null
;
Node
parentNode
=
null
;
Node
childNode
=
null
;
Connection
conn
=
null
;
String
childNodeName
=
null
;
String
errorString
=
""
;
String
userId
=
""
;
int
ctr
=
0
;
int
currentFormNo
=
0
;
int
childNodeListLength
=
0
;
try
{
conn
=
getConnection
();
userId
=
getValueFromXTRA_PARAMS
(
xtraParams
,
"loginEmpCode"
);
if
(
objContext
!=
null
&&
objContext
.
trim
().
length
()>
0
)
{
currentFormNo
=
Integer
.
parseInt
(
objContext
);
}
parentNodeList
=
dom
.
getElementsByTagName
(
"Detail"
+
currentFormNo
);
parentNode
=
parentNodeList
.
item
(
0
);
childNodeList
=
parentNode
.
getChildNodes
();
childNodeListLength
=
childNodeList
.
getLength
();
for
(
ctr
=
0
;
ctr
<
childNodeListLength
;
ctr
++)
{
childNode
=
childNodeList
.
item
(
ctr
);
childNodeName
=
childNode
.
getNodeName
();
switch
(
currentFormNo
)
{
case
1
:
BaseLogger
.
log
(
"3"
,
null
,
null
,
"In case 1 of validation"
);
String
mailListType
=
checkNull
(
genericUtility
.
getColumnValue
(
"mail_list_type"
,
dom
));
BaseLogger
.
log
(
"3"
,
null
,
null
,
"[below mailListType value : ("
+
mailListType
+
") ]"
);
if
(
"S"
.
equalsIgnoreCase
(
mailListType
))
{
if
(
childNodeName
.
equalsIgnoreCase
(
"sql_str"
))
{
if
(
childNode
.
getFirstChild
()==
null
)
{
errorString
=
getErrorString
(
"sql_str"
,
"VTBISINTSQ"
,
userId
);
break
;
}
}
}
}
}
}
catch
(
Exception
e
)
{
}
return
errorString
;
}
private
String
checkNull
(
String
input
)
{
if
(
input
==
null
)
...
...
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