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
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
Rishikesh Santosh Kumar
Component Sharing
Commits
ba9b0fb7
Commit
ba9b0fb7
authored
Jan 05, 2024
by
Sonawane Amol Madhjuar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
68bf0dc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
0 deletions
+157
-0
Amol/CAS/BatchUploadFileEJB.java
Amol/CAS/BatchUploadFileEJB.java
+157
-0
No files found.
Amol/CAS/BatchUploadFileEJB.java
0 → 100644
View file @
ba9b0fb7
package
ibase
.
webitm
.
ejb
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.rmi.RemoteException
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.Statement
;
import
java.util.HashMap
;
import
javax.annotation.PostConstruct
;
import
javax.naming.InitialContext
;
import
org.w3c.dom.Document
;
import
ibase.scheduler.ejb.BaseRegisteredEJB
;
import
ibase.system.config.AppConnectParm
;
import
ibase.system.config.ConnDriver
;
import
ibase.utility.BaseLogger
;
import
ibase.utility.CommonConstants
;
import
ibase.utility.E12GenericUtility
;
import
ibase.webitm.utility.ITMException
;
@javax
.
ejb
.
Stateless
public
class
BatchUploadFileEJB
extends
BaseRegisteredEJB
implements
BatchUploadFileRemote
,
BatchUploadFileLocal
//implements SessionBean
{
@PostConstruct
public
void
ejbCreate
()
{
try
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
String
schedule
(
HashMap
map
)
throws
RemoteException
,
ITMException
{
return
""
;
}
public
String
schedulePriority
(
String
wrkflwPriority
)
throws
RemoteException
,
ITMException
{
return
schedule
(
""
);
}
public
String
schedule
(
String
scheduleParamXML
)
throws
RemoteException
,
ITMException
{
try
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"BatchUploadFileEJB : schedule() : scheduleParamXML["
+
scheduleParamXML
+
"]"
);
batchUpload
(
scheduleParamXML
);
}
catch
(
Exception
e
)
{
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Exception : BatchUploadFileEJB :==>Schedule()"
);
e
.
printStackTrace
();
}
return
""
;
}
public
void
batchUpload
(
String
scheduleParamXML
)
throws
Exception
{
BaseLogger
.
log
(
"2"
,
null
,
null
,
"BatchUploadFileEJB : batchUpload( )"
);
Connection
connection
=
null
;
Statement
statement
=
null
;
ResultSet
resultSet
=
null
;
String
batchId
=
null
;
ibase
.
utility
.
UserInfoBean
userInfoBean
=
new
ibase
.
utility
.
UserInfoBean
(
scheduleParamXML
);
String
objName
=
""
;
String
query
=
""
;
String
transDB
=
""
;
try
{
E12GenericUtility
genericUtility
=
new
E12GenericUtility
();
BaseLogger
.
log
(
"3"
,
null
,
null
,
"scheduleParamXML-----"
+
scheduleParamXML
);
ConnDriver
mConnDriver
=
new
ConnDriver
();
//Changed by Pankaj T on 04-01-18 [changes for multitenancy]
transDB
=
userInfoBean
.
getTransDB
();
connection
=
mConnDriver
.
getConnectDB
(
transDB
);
Document
dom
=
genericUtility
.
parseString
(
scheduleParamXML
);
//Condition Added By Manoj 25/01/2013 to load batch Win Name wise.
objName
=
genericUtility
.
getColumnValue
(
"ACTUALPARAMETER"
,
dom
);
if
(
objName
==
null
)
{
//Changed By Mahesh Patidar on 23-SEP-13[to avoid batchloading if tran_id_ref is not null]
// query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' ";
// old query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' AND TRAN_ID__REF IS NULL ";
//Changed By Amol S on 3-jan-24[to chnage where condition]
query
=
"SELECT BATCH_ID FROM BATCHLOAD WHERE (LOAD_STAT ='N' OR ERROR_MSG LIKE '%File not found%') AND RETRY_CTR < 3"
;
}
else
{
//Changed By Mahesh Patidar on 23-SEP-13[to avoid batchloading if tran_id_ref is not null]
// query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' and WIN_NAME='"+objName+"'";
// old query query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' and WIN_NAME='"+objName+"' AND TRAN_ID__REF IS NULL ";
//Changed By Amol S on 3-jan-24[to chnage where condition]
query
=
"SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' AND WIN_NAME='"
+
objName
+
"' AND RETRY_CTR < 3"
;
}
BaseLogger
.
log
(
"3"
,
null
,
null
,
"Query executed ["
+
query
+
"]"
);
statement
=
connection
.
createStatement
();
resultSet
=
statement
.
executeQuery
(
query
);
String
xtraParams
=
null
;
AppConnectParm
appConnect
=
new
AppConnectParm
();
InitialContext
ctx
=
new
InitialContext
(
appConnect
.
getProperty
()
);
//MasterApplyEJBLocal masterApplyLocal = ( MasterApplyEJBLocal ) ctx.lookup("ibase/MasterApplyEJB/local");
MasterApplyEJB
masterApplyEJB
=
new
MasterApplyEJB
();
while
(
resultSet
.
next
())
{
batchId
=
resultSet
.
getString
(
"BATCH_ID"
);
try
{
masterApplyEJB
.
applyMasterTable
(
batchId
,
xtraParams
,
userInfoBean
);
masterApplyEJB
=
null
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
CommonConstants
.
JBOSSHOME
+
File
.
separator
+
"LOG"
+
File
.
separator
+
userInfoBean
.
getEmpCode
()+
"_"
+
batchId
+
"_BatchUpload.log"
);
byte
convertStringToByte
[]
=
e
.
toString
().
getBytes
();
fileOutputStream
.
write
(
convertStringToByte
);
fileOutputStream
.
close
(
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
resultSet
!=
null
)
{
resultSet
.
close
();
resultSet
=
null
;
}
if
(
statement
!=
null
)
{
statement
.
close
();
statement
=
null
;
}
if
(
connection
!=
null
)
{
connection
.
close
();
connection
=
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