Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Marketing Servlet
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
Marketing Servlet
Commits
0628cdfd
Commit
0628cdfd
authored
Apr 24, 2023
by
Ketan Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace UnallocatedMrketingDoc.java
parent
4dd449ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
49 deletions
+134
-49
src/ibase/webitm/marketing/servlet/UnallocatedMrketingDoc.java
...base/webitm/marketing/servlet/UnallocatedMrketingDoc.java
+134
-49
No files found.
src/ibase/webitm/marketing/servlet/UnallocatedMrketingDoc.java
View file @
0628cdfd
...
...
@@ -9,6 +9,7 @@ import java.sql.Connection;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
...
...
@@ -25,11 +26,10 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
String
strGetObj
=
"select obj_name from unallocated_attach WHERE STATUS='N' AND upper(obj_name) = 'MARKETING_BILL' group by obj_name"
;
String
objName
=
""
;
Connection
conn
=
null
;
PreparedStatement
pstmtParamName
=
null
;
PreparedStatement
pstmtParamName2
=
null
;
ResultSet
rsCnt2
=
null
;
ResultSet
rsCnt
=
null
;
PreparedStatement
pstmtParamName
=
null
;
ResultSet
rsCnt2
=
null
;
ResultSet
rsCnt
=
null
;
try
{
ConnDriver
connDriver
=
new
ConnDriver
();
conn
=
connDriver
.
getConnectDB
(
"DriverITM"
);
...
...
@@ -59,13 +59,10 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
pstmtParamName
=
null
;
rsCnt
.
close
();
rsCnt
=
null
;
//added by sangita 21-4-23
pstmtParamName2
.
close
();
pstmtParamName2
=
null
;
rsCnt2
.
close
();
rsCnt2
=
null
;
//added by sangita 21-4-23
if
(
docIds
!=
null
&&
!
docIds
.
isEmpty
())
{
unallocDocIds
=
""
;
...
...
@@ -100,36 +97,13 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
var25
.
printStackTrace
();
}
finally
{
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
closePreparedStatement
(
pstmtParamName2
);
closeResultSet
(
rsCnt2
);
if
(
rsCnt2
!=
null
)
{
rsCnt2
.
close
();
rsCnt2
=
null
;
}
if
(
rsCnt
!=
null
)
{
rsCnt
.
close
();
rsCnt
=
null
;
}
if
(
pstmtParamName
!=
null
)
{
pstmtParamName
.
close
();
pstmtParamName
=
null
;
}
if
(
pstmtParamName2
!=
null
)
{
pstmtParamName2
.
close
();
pstmtParamName2
=
null
;
}
conn
.
close
();
}
...
...
@@ -206,13 +180,17 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
String
objName
=
""
;
Connection
conn
=
null
;
HashMap
newUnAllocDocMap
=
new
HashMap
();
PreparedStatement
pstmtParamName
=
null
;
PreparedStatement
pstmtParamName2
=
null
;
ResultSet
rsCnt
=
null
;
ResultSet
rsCnt2
=
null
;
try
{
ConnDriver
connDriver
=
new
ConnDriver
();
conn
=
connDriver
.
getConnectDB
(
"DriverITM"
);
PreparedStatement
pstmtParamName
=
conn
.
prepareStatement
(
pstmtParamName
=
conn
.
prepareStatement
(
"select obj_name from unallocated_attach WHERE STATUS='N' AND upper(obj_name) = 'MARKETING_BILL' group by obj_name"
);
ResultSet
rsCnt
=
pstmtParamName
.
executeQuery
();
rsCnt
=
pstmtParamName
.
executeQuery
();
ArrayList
docIds
;
while
(
rsCnt
.
next
())
{
...
...
@@ -231,7 +209,7 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
strGetDocId
=
"select doc_id from UNALLOCATED_ATTACH where STATUS='N' and OBJ_NAME = ? order by Added_on ,ref_id"
;
}
PreparedStatement
pstmtParamName2
=
conn
.
prepareStatement
(
strGetDocId
);
pstmtParamName2
=
conn
.
prepareStatement
(
strGetDocId
);
pstmtParamName2
.
setString
(
1
,
rsCnt
.
getString
(
1
));
if
(
endTime
!=
null
&&
endTime
.
trim
().
length
()
>
0
)
{
if
(
inProcessDocIds
!=
null
&&
inProcessDocIds
.
trim
().
length
()
>
0
)
{
...
...
@@ -244,16 +222,19 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
pstmtParamName2
.
setString
(
2
,
inProcessDocIds
);
}
ResultSet
rsCnt2
=
pstmtParamName2
.
executeQuery
();
rsCnt2
=
pstmtParamName2
.
executeQuery
();
docIds
=
new
ArrayList
();
while
(
rsCnt2
.
next
())
{
docIds
.
add
(
rsCnt2
.
getString
(
1
));
}
closePreparedStatement
(
pstmtParamName2
);
closeResultSet
(
rsCnt2
);
this
.
mapList
.
put
(
objName
,
docIds
);
newUnAllocDocMap
.
put
(
objName
,
docIds
);
}
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
System
.
out
.
println
(
"\n====================================== In appendDocument() ==========================================\n"
);
...
...
@@ -272,6 +253,13 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
}
finally
{
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmtParamName2
);
closeResultSet
(
rsCnt2
);
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
conn
.
close
();
}
...
...
@@ -298,18 +286,22 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
public
String
getDocumentTime
()
{
Connection
conn
=
null
;
String
maxTime
=
""
;
ResultSet
rsCnt
=
null
;
PreparedStatement
pstmtParamName
=
null
;
try
{
ConnDriver
connDriver
=
new
ConnDriver
();
conn
=
connDriver
.
getConnectDB
(
"DriverITM"
);
String
sql
=
"SELECT to_char(MAX(added_on), 'dd/MM/yy HH24:MI:SS') FROM UNALLOCATED_ATTACH where STATUS='N'"
;
PreparedStatement
pstmtParamName
=
conn
.
prepareStatement
(
pstmtParamName
=
conn
.
prepareStatement
(
"SELECT to_char(MAX(added_on), 'dd/MM/yy HH24:MI:SS') FROM UNALLOCATED_ATTACH where STATUS='N'"
);
for
(
ResultSet
rsCnt
=
pstmtParamName
.
executeQuery
();
rsCnt
.
next
();
maxTime
=
rsCnt
.
getString
(
1
))
{
for
(
rsCnt
=
pstmtParamName
.
executeQuery
();
rsCnt
.
next
();
maxTime
=
rsCnt
.
getString
(
1
))
{
;
}
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
System
.
out
.
println
(
"maxTime = ["
+
maxTime
+
"]"
);
}
catch
(
SQLException
var19
)
{
var19
.
printStackTrace
();
...
...
@@ -318,6 +310,8 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
}
finally
{
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
conn
.
close
();
}
...
...
@@ -330,6 +324,8 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
conn
.
close
();
}
...
...
@@ -406,6 +402,8 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
}
finally
{
try
{
if
(
localConn
&&
conn
!=
null
)
{
closePreparedStatement
(
pstmt
);
conn
.
close
();
conn
=
null
;
}
...
...
@@ -417,6 +415,7 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
try
{
if
(
localConn
&&
conn
!=
null
)
{
conn
.
close
();
conn
=
null
;
}
...
...
@@ -442,6 +441,10 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
if
(
rs
.
next
())
{
refSer
=
rs
.
getString
(
"REF_SER"
)
==
null
?
""
:
rs
.
getString
(
"REF_SER"
);
}
pStmt
.
close
();
pStmt
=
null
;
rs
.
close
();
rs
=
null
;
}
catch
(
Exception
var17
)
{
System
.
out
.
println
(
"[UnallocatedMrketingDoc] :: [getRefSer()] :: "
+
var17
.
getMessage
());
throw
new
ITMException
(
var17
);
...
...
@@ -496,6 +499,10 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
if
(
rs
.
next
())
{
refId
=
rs
.
getString
(
"REF_ID"
)
==
null
?
""
:
rs
.
getString
(
"REF_ID"
);
}
pStmt
.
close
();
pStmt
=
null
;
rs
.
close
();
rs
=
null
;
}
catch
(
Exception
var18
)
{
System
.
out
.
println
(
"[UnallocatedMrketingDoc] :: [getRefId()] :: "
+
var18
.
getMessage
());
throw
new
ITMException
(
var18
);
...
...
@@ -541,15 +548,19 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
String
objName
=
""
;
Connection
conn
=
null
;
HashMap
newUnAllocDocMap
=
new
HashMap
();
PreparedStatement
pstmtParamName
=
null
;
PreparedStatement
pstmtParamName2
=
null
;
ResultSet
rsCnt2
=
null
;
ResultSet
rsCnt
=
null
;
try
{
ConnDriver
connDriver
=
new
ConnDriver
();
conn
=
connDriver
.
getConnectDB
(
"DriverITM"
);
String
strGetObj
=
"select obj_name from unallocated_attach WHERE STATUS='N' AND upper(obj_name) = 'MARKETING_BILL' group by obj_name"
;
ArrayList
docIds
=
new
ArrayList
();
PreparedStatement
pstmtParamName
=
conn
.
prepareStatement
(
pstmtParamName
=
conn
.
prepareStatement
(
"select obj_name from unallocated_attach WHERE STATUS='N' AND upper(obj_name) = 'MARKETING_BILL' group by obj_name"
);
ResultSet
rsCnt
=
pstmtParamName
.
executeQuery
();
rsCnt
=
pstmtParamName
.
executeQuery
();
String
unallocDocIds
;
while
(
rsCnt
.
next
())
{
...
...
@@ -557,14 +568,17 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
System
.
out
.
println
(
"objName = ["
+
objName
+
"]"
);
unallocDocIds
=
""
;
unallocDocIds
=
"SELECT DOC_ID FROM UNALLOCATED_ATTACH WHERE STATUS='N' AND OBJ_NAME = ? AND ADDED_TO_MAP != 1 ORDER BY ADDED_ON, REF_ID"
;
PreparedStatement
pstmtParamName2
=
conn
.
prepareStatement
(
unallocDocIds
);
pstmtParamName2
=
conn
.
prepareStatement
(
unallocDocIds
);
pstmtParamName2
.
setString
(
1
,
objName
);
ResultSet
rsCnt2
=
pstmtParamName2
.
executeQuery
();
rsCnt2
=
pstmtParamName2
.
executeQuery
();
while
(
rsCnt2
.
next
())
{
docIds
.
add
(
rsCnt2
.
getString
(
1
));
}
pstmtParamName2
.
close
();
pstmtParamName
=
null
;
rsCnt2
.
close
();
rsCnt2
=
null
;
newUnAllocDocMap
.
put
(
objName
,
docIds
);
}
...
...
@@ -596,6 +610,10 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
}
finally
{
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmtParamName
);
closeResultSet
(
rsCnt
);
closePreparedStatement
(
pstmtParamName2
);
closeResultSet
(
rsCnt2
);
conn
.
close
();
}
...
...
@@ -650,6 +668,7 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmt
);
conn
.
close
();
conn
=
null
;
}
...
...
@@ -659,6 +678,8 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
}
finally
{
try
{
if
(
conn
!=
null
)
{
closePreparedStatement
(
pstmt
);
conn
.
close
();
conn
=
null
;
}
...
...
@@ -679,4 +700,68 @@ public class UnallocatedMrketingDoc implements UnallocatedMrketingDocRemote, Una
return
updateCnt
;
}
private
void
closePreparedStatement
(
PreparedStatement
pstmt
)
{
if
(
pstmt
!=
null
)
{
try
{
if
(!
pstmt
.
isClosed
())
{
pstmt
.
close
();
}
}
catch
(
SQLException
e
)
{
System
.
out
.
println
(
"PreparedStatement::>> Exception is ["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
}
finally
{
pstmt
=
null
;
}
}
}
private
void
closeStatement
(
Statement
stmt
)
{
if
(
stmt
!=
null
)
{
try
{
if
(!
stmt
.
isClosed
())
{
stmt
.
close
();
}
}
catch
(
SQLException
e
)
{
System
.
out
.
println
(
"Statement::>> Exception is ["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
}
finally
{
stmt
=
null
;
}
}
}
private
void
closeResultSet
(
ResultSet
rs
)
{
if
(
rs
!=
null
)
{
try
{
if
(!
rs
.
isClosed
())
{
rs
.
close
();
}
}
catch
(
SQLException
e
)
{
System
.
out
.
println
(
"ResultSet::>> Exception is ["
+
e
.
getMessage
()+
"]"
);
e
.
printStackTrace
();
}
finally
{
rs
=
null
;
}
}
}
}
\ 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