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
112b2c16
Commit
112b2c16
authored
Jan 05, 2024
by
Sonawane Amol Madhjuar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
c31c0573
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
154 additions
and
0 deletions
+154
-0
Amol/CAS/BatchUploadFileEJB.java
Amol/CAS/BatchUploadFileEJB.java
+154
-0
No files found.
Amol/CAS/BatchUploadFileEJB.java
0 → 100644
View file @
112b2c16
package
ibase
.
utility
.
training
;
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.ejb.BatchUploadFileLocal
;
import
ibase.webitm.ejb.BatchUploadFileRemote
;
import
ibase.webitm.ejb.MasterApplyEJB
;
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 sql query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' AND TRAN_ID__REF IS NULL ";
query
=
"SELECT BATCH_ID FROM BATCHLOAD WHERE (LOAD_STAT ='N' OR ERROR_MSG LIKE '%File not found%') AND RETRY_CTR < 3"
;
//Ended By Mahesh Patidar on 23-SEP-13[to avoid batchloading if tran_id_ref is not null]
}
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 SQL query = "SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' and WIN_NAME='"+objName+"' AND TRAN_ID__REF IS NULL ";
query
=
"SELECT BATCH_ID FROM BATCHLOAD WHERE LOAD_STAT = 'N' AND WIN_NAME='"
+
objName
+
"' AND RETRY_CTR < 3"
;
//Ended By Mahesh Patidar on 23-SEP-13[to avoid batchloading if tran_id_ref is not null]
}
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