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
47e20af7
Commit
47e20af7
authored
Sep 13, 2024
by
Omkar Ingale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
08bcbaa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
244 additions
and
0 deletions
+244
-0
Task/Mailing List/Metadata/srd /mailingListIC.java
Task/Mailing List/Metadata/srd /mailingListIC.java
+244
-0
No files found.
Task/Mailing List/Metadata/srd /mailingListIC.java
0 → 100644
View file @
47e20af7
package
ibase
.
webitm
.
ejb
.
wsfa
.
transactions
;
import
java.rmi.RemoteException
;
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
ibase.utility.BaseLogger
;
import
ibase.utility.E12GenericUtility
;
import
ibase.utility.UserInfoBean
;
import
ibase.webitm.ejb.ValidatorEJB
;
import
ibase.webitm.utility.ITMException
;
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
;
String
errString
=
null
;
try
{
// The part where conversion begins
if
(
xmlString
!=
null
&&
xmlString
.
trim
().
length
()!=
0
)
{
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
);
}
// passing the dom to itemchanged method
errString
=
itemChanged
(
dom
,
dom1
,
dom2
,
objContext
,
currentColumn
,
editFlag
,
xtraParams
);
System
.
out
.
println
(
"ErrString :"
+
errString
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Exception :SfaTime :itemChanged(String,String):"
+
e
.
getMessage
()
+
":"
);
errString
=
genericUtility
.
createErrorString
(
e
);
}
System
.
out
.
println
(
"returning from SfaTime itemChanged"
);
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
{
System
.
out
.
println
(
"Inside itemchange"
);
//Document headerDom = null;
Connection
conn
=
null
;
PreparedStatement
pstmt
=
null
;
ResultSet
rs
=
null
;
StringBuffer
valueXmlString
=
null
;
String
name
=
""
;
String
email_id
=
""
;
int
currentFormNo
=
0
;
try
{
conn
=
getConnection
();
if
(
objContext
!=
null
&&
objContext
.
trim
().
length
()
>
0
)
{
currentFormNo
=
Integer
.
parseInt
(
objContext
);
}
valueXmlString
=
new
StringBuffer
(
"<?xml version=\"1.0\"?><Root><header><editFlag>"
);
valueXmlString
.
append
(
editFlag
).
append
(
"</editFlag></header>"
);
switch
(
currentFormNo
)
{
case
1
:
valueXmlString
.
append
(
"<Detail1>"
);
if
(
"mail_list_type"
.
equalsIgnoreCase
(
currentColumn
.
trim
()))
{
String
mailListType
=
checkNull
(
genericUtility
.
getColumnValue
(
"mail_list_type"
,
dom
));
// Check for 'S' or 'P'
if
(
"S"
.
equalsIgnoreCase
(
mailListType
))
{
valueXmlString
.
append
(
"<sql_str protect='0'>"
).
append
(
"<![CDATA[]]>"
).
append
(
"</sql_str>\r\n"
);
}
else
if
(
"P"
.
equalsIgnoreCase
(
mailListType
))
{
valueXmlString
.
append
(
"<sql_str protect='1'>"
).
append
(
"<![CDATA[]]>"
).
append
(
"</sql_str>\r\n"
);
}
}
valueXmlString
.
append
(
"</Detail1>\r\n"
);
break
;
case
2
:
System
.
out
.
println
(
"In Case 2"
);
valueXmlString
.
append
(
"<Detail2>"
);
String
sql
=
checkNull
(
genericUtility
.
getColumnValue
(
"sql_str"
,
dom1
));
String
type
=
checkNull
(
genericUtility
.
getColumnValue
(
"mail_list_type"
,
dom1
));
System
.
out
.
println
(
sql
);
System
.
out
.
println
(
"Sql null checker"
);
BaseLogger
.
log
(
"3"
,
null
,
null
,
"createProject >> XmlString :: ["
+
sql
+
"]"
);
if
(
"itm_default"
.
equalsIgnoreCase
(
currentColumn
.
trim
()))
{
if
(
"S"
.
equalsIgnoreCase
(
type
))
{
String
sqltest
=
sql
;
BaseLogger
.
log
(
"3"
,
null
,
null
,
"createProject >> XmlString :: ["
+
sqltest
+
"]"
);
String
[]
selectParts
=
sql
.
toLowerCase
().
split
(
"from"
)[
0
].
replace
(
"select"
,
""
).
trim
().
split
(
","
);
String
firstColumn
=
selectParts
[
0
].
trim
();
String
secondColumn
=
selectParts
.
length
>
1
?
selectParts
[
1
].
trim
()
:
""
;
try
{
pstmt
=
conn
.
prepareStatement
(
sqltest
);
rs
=
pstmt
.
executeQuery
();
if
(
rs
.
next
())
{
name
=
rs
.
getString
(
firstColumn
);
email_id
=
rs
.
getString
(
secondColumn
);
}
valueXmlString
.
append
(
"<name protect='1'><![CDATA["
).
append
(
name
).
append
(
"]]></name>\r\n"
);
valueXmlString
.
append
(
"<email_id protect='1'><![CDATA["
).
append
(
email_id
).
append
(
"]]></email_id>\r\n"
);
}
catch
(
SQLException
e
){
BaseLogger
.
log
(
"3"
,
null
,
null
,
"createProject >> XmlString :: ["
+
"SQL Exception while executing query."
+
"]"
);
}
}
}
valueXmlString
.
append
(
"</Detail2>\r\n"
);
break
;
}
valueXmlString
.
append
(
"</Root>\r\n"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Exception :SfaTime :itemChanged(Document,String):"
+
e
.
getMessage
()
+
":"
);
e
.
printStackTrace
();
}
finally
{
try
{
if
(
conn
!=
null
)
{
conn
.
close
();
conn
=
null
;
}
if
(
rs
!=
null
)
{
rs
.
close
();
rs
=
null
;
}
if
(
pstmt
!=
null
)
{
pstmt
.
close
();
pstmt
=
null
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Exception :SfaTime :Exception in SQL"
+
e
.
getMessage
()
+
":"
);
e
.
printStackTrace
();
}
}
return
valueXmlString
.
toString
();
}
private
String
checkNull
(
String
input
)
{
if
(
input
==
null
)
{
input
=
""
;
}
else
{
input
=
input
.
trim
();
}
return
input
;
}
}
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