Está en la página 1de 13

public DataObject ResumeProcessMultiple(DataObject inputData)

throws Exception {
String policyNumber = "", policyNumbers = "", strAllPolicies = "
", subDocType = "", indexCls = "", itemId = "";
String processinstances = null, piid = null, strExitVal = null,
strFormID = "", strdepartMntType = "", currentDateFormat = null;
String strProcInstAndPol = "";
ServiceManager serviceManager = null;
DBConnectorImpl objDB = null;
WFConnectorImpl objWF = null;
BOFactory factory = null;
DataObject boGetProc = null, boGetPIID = null, boResume = null,
boUpdateStatus = null, boRecordReq = null, boResumeProcess = null;
boolean isResumed = false, isUpdated = false, found = false;
//String objrp = null;
try {
//creating the new reference of ServiceManager.
serviceManager = new ServiceManager();
//Service service = (Service)serviceManager.locateServic
e("DBConnectorPartner");
factory = (BOFactory) serviceManager
.locateService("com/ibm/websphere/bo/BOF
actory");
//fetching policy number information from the container
policyNumber = inputData.getString("KEYVALUE2");
policyNumber = (policyNumber == null) ? "" : policyNumbe
r;
//calling the Log Configuration method to initialize log
object for logging steps.
AWCommon
.loadLogConfiguration(logPropertyfileCon
figuration,
activityRoot + pathSep +
"Unsuspend", policyNumber
+ ".log"
);
log.info("ResumeProcess - Value of Policy Number (policy
NUmber) = "
+ policyNumber);
policyNumbers = inputData.getString("PREVPOLICIES");
//Commented the below code as it is not required
//policyNumbers = (policyNumbers == null) ? "" : policyN
umbers;
log
.info("ResumeProcess - Value of Policy N
umbers (policyNUmbers) = "
+ policyNumbers);
//fetching sub document value from the container
subDocType = inputData.getString("SUBDOCTYPE");
subDocType = (subDocType == null) ? "" : subDocType;
log.info("ResumeProcess - Value of Sub Document (SUBDOCT
YPE) = "
+ subDocType + " for Policy Number = " +
policyNumber);
//fetching Index Class value from the container
indexCls = inputData.getString("INDEXCLASS");
indexCls = (indexCls == null) ? "" : indexCls;
log.info("ResumeProcess - Value of Index Class (INDEXCLA
SS) = "
+ indexCls + " for Policy Number = " + p
olicyNumber);
//fetching ITEMID value from the container
itemId = inputData.getString("ITEMID");
itemId = (itemId == null) ? "" : itemId;
//fetching FormID value from the container
strFormID = inputData.getString("DOCID");
log.info("ResumeProcess - Value of FORMID (strFormID) =
"
+ strFormID);
try {//getting the current date format as set in Propert
y File.
log.info("ResumeProcess - Value of Current Date
Format ="
+ currentDateFormat);
currentDateFormat = ProcessEnvironmentData.singl
eton().get(
"CURRENT_DT_FORMAT");
log.info("ResumeProcess - Value of Current Date
Format = "
+ currentDateFormat + " for Poli
cy Number = "
+ policyNumber);
} catch (Exception e) {
log.error(e.getMessage());
throw new Exception(e);
}
objDB = new DBConnectorImpl();
objWF = new WFConnectorImpl();
//-----------------------
//geting the reference of BO object which will be passed
to fetch Process Instance of NB01 Process for the given policy number
boGetProc = factory.create("http://BSLINewBusiness/com/a
wpl/bo",
"BOGetProcInstanceFromTbl");
//setting Policy Number in the boGetProc DataObject
if (policyNumbers == null || policyNumbers == "") {
log
.info("ResumeProcess - No PrevPo
licies returned by webservice for PolicyNumber"
+ policyNumber);
strAllPolicies = policyNumber;
log.info("ResumeProcess - strAllPolicies set to:
"
+ strAllPolicies);
} else {
strAllPolicies = policyNumber + "," + policyNumb
ers;
log.info("ResumeProcess - strAllPolicies set to:
"
+ strAllPolicies);
}
log
.info("ResumeProcess - Setting POLICYNUM
BER in BO variable boGetProc"
+ strAllPolicies);
boGetProc.setString("POLICYNUMBER", strAllPolicies);
//calling DBConnector Method to search and store the Pro
cess Instance ID of NB01 Process Instance.
objDB.getProcessInstanceFromDB(boGetProc);
//getting the value of Process Instance of NB01 Process
and storing in the local string variable.
strProcInstAndPol = boGetProc.getString("PROCESSINTANCE"
); //This will return the ProcInstances and Corresponding Policy No. They will s
eperated by '|'
log
.info("ResumeProcess - The strProcInstAn
dPol returned by getProcessInstanceFromDB method is: "
+ strProcInstAndPol);
//if(strProcInstAndPol != null) //changed on 09Jan
if (strProcInstAndPol == "") {
strExitVal = "PROCESS NOT RUNNING";
inputData.setString("EXITVAL", strExitVal);
log
.info("ResumeProcess - Value of
ExitVal = "
+ strExitVal
+ " for Policy N
umber (policyNumber) = "
+ policyNumber);
} else {
String strProcInstPolArr[] = strProcInstAndPol.s
plit("\\|");
//Getting the Procinstances
processinstances = strProcInstPolArr[0];
strAllPolicies = strProcInstPolArr[1];
log
.info("ResumeProcess - The proce
ssInstance found from DS Database = "
+ processinstanc
es
+ " for PolicyNu
mbers (policyNumbers) = "
+ strAllPolicies
);
//checking if process instance for given policy
number is found or not
//if found then get the Process Instance ID of t
he process instance to resume the process.
if (processinstances != null) {
int strProcInst = processinstances.index
Of(",");
int strPolNum = strAllPolicies.indexOf("
,");
if (strProcInst == -1 && strPolNum == -1
) {
boGetPIID = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOGetPIID");
//getting the reference of BO wh
ich will store the Process Instance ID of given policy number
boResume = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOSuspend");
//getting the reference for the
BO object used in Update Status procedure.
boUpdateStatus = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOUpdateSuspend
Status");
//uses this information to move
to user indicated by the Department to which document belongs to.
boResumeProcess = factory.create
(
"http://BSLINewB
usiness/com/awpl/bo",
"BOResumeProcess
");
//getting the reference object o
f the BO object which allows us to update the status of requirement in DSAUTOREQ
table.
boRecordReq = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BORecordREQ");
boGetPIID
.setString("PROC
ESSINSTANCE", processinstances);
//calling method of WFConnectorI
mpl to resume the process.
objWF.getPIIDToResume(boGetPIID)
;
//getting the Process Instance I
D value that was set in the BO by the WFConnector Resume Process
piid = boGetPIID.getString("PIID
");
log
.info("ResumePro
cess - Process Instance ID for PolicyNumber (policyNumber) = "
+ strAllPolicies + " is = " + piid);
//-----------------------
//checking if Process Instance I
D is null or not
//if Not Null or empty string th
en resume the process
if ((piid != null) && !(piid.tri
m().equals(""))) {
//Object objgetResume= (
Object)service.invoke("Resume", boResume);
//----------------------
-
//getting the reference
of BO which will store the Process Instance ID of given policy number
//boResume = factory.cre
ate("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BOSuspend");
boResume.setString("PIID
", piid);
//Calling Resume operati
on on WFConnector to resume the process
objWF.Resume(boResume);
//getting the value of i
sResumed container to determine whether the process was resumed or not.
isResumed = boResume.get
Boolean("ISRESUMED");
boResume = null;
//----------------------
-
//objgetResume=null;
//service=null;
//checking whether the p
rocess resumed or not
if (isResumed) {
//service = (Ser
vice)serviceManager.locateService("DBConnectorPartner");
//Object objUpda
teResumeStatus= (Object)service.invoke("updateResumeStatus", boUpdateStatus);
log
.info("ResumeProcess - The NB01 prcess instance for policyNumber "
+ strAllPolicies
+ " resumed sucessfully");
//getting the re
ference for the BO object used in Update Status procedure.
//boUpdateStatus
= factory.create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BOUpdateSuspend
Status");
//setting the va
lue of PROCESSINSTANCE container and STATUS Container in BO object
boUpdateStatus.s
etString("PROCESSINSTANCE",
processinstances);
boUpdateStatus.s
etString("STATUS",
"UNSUSPENDED");
//Caliing Update
ResumeStatus on DBConnector to update the status as unsuspended
objDB.updateResu
meStatus(boUpdateStatus);
//getting the va
lue of ISUPDATED container
isUpdated = boUp
dateStatus
.getBoolean("ISUPDATED");
log
.info("ResumeProcess - The Update ResumeStatus returned from DB: "
+ isUpdated
+ " for PolicyNumber (policyNumber) = "
+ policyNumber);
//------------ N
ew Code Added by Amit Malhotra based on Requirement which started from 07/12/200
7.
//new code to up
date the SUSPENDPROCESSACTIVITY table so that Resume Process
//uses this info
rmation to move to user indicated by the Department to which document belongs to
.
//boResumeProces
s = factory.create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo","BOResumeProcess
");
//setting up the
value of FORMID and Policy Number in boResumeProcess object
boResumeProcess.
setString("POLICYNUMBER",
strAllPolicies);
boResumeProcess.
setString("FORMID", strFormID);
//calling objDB
method to update the status of the SUSPENDPROCESSACTIVITY table to indicate wher
e to resume the process
objDB.resumeProc
essToDept(boResumeProcess);
}
}
//service = (Service)serviceMana
ger.locateService("DBConnectorPartner");
//Object objRecordReq= (Object)s
ervice.invoke("RecordRequirement", boRecordReq);
//getting the reference object o
f the BO object which allows us to update the status of requirement in DSAUTOREQ
table.
//boRecordReq = factory.create("
http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BORecordREQ");
//setting the values of the cont
ainers which will be passed to the method for updating the DSAUTOREQ table.
boRecordReq.setString("PROCESSIN
STANCE",
processinstances
);
boRecordReq.setString("POLICYNUM
BER", strAllPolicies);
boRecordReq.setString("DOCUMENTT
YPE", subDocType);
boRecordReq.setString("DOCUMENTD
ATE", AWCommon
.getCurrentDate(
currentDateFormat));
boRecordReq.setString("REQITEMID
", itemId);
boRecordReq.setString("VIEWSTATU
S", "ACCEPTED");
boRecordReq.setString("INDEXCLAS
S", indexCls);
//calling method / operation to
update the status of the Requirement in DSAUTOREQ table.
objDB.RecordRequirement(boRecord
Req, strFormID);
log
.info("ResumePro
cess - The Record Requirment status updated/created for Policy Number = "
+ policyNumber);
//service=null;
//objRecordReq=null;
/*inputData.setString("EXITVAL",
"COMPLETED");
log.info("The Exitval is set as
COMPLETED");*/
strExitVal = "COMPLETED";
}
else {
log
.info("ResumePro
cess - Splitting the process instances and Policy numbers");
String[] strProcInstArr = proces
sinstances.split("~");
String[] strPolicyNoArr = strAll
Policies.split("~");
//Retrieving the Process Inastan
ce Name
//String strProcInstArr[] = proc
essinstances.split(",");
//Policy Nos for the correspondi
ng Policy Nos
//getting the reference of BO wh
ich will store Process Instance and get the status of resuming the process insta
nce
//Calling GetPIID from WFConnect
or to get PIID
boGetPIID = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOGetPIID");
//getting the reference of BO wh
ich will store the Process Instance ID of given policy number
boResume = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOSuspend");
//getting the reference for the
BO object used in Update Status procedure.
boUpdateStatus = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BOUpdateSuspend
Status");
//uses this information to move
to user indicated by the Department to which document belongs to.
boResumeProcess = factory.create
(
"http://BSLINewB
usiness/com/awpl/bo",
"BOResumeProcess
");
//getting the reference object o
f the BO object which allows us to update the status of requirement in DSAUTOREQ
table.
boRecordReq = factory.create(
"http://BSLINewB
usiness/com/awpl/bo",
"BORecordREQ");
for (int i = 0; i < strProcInstA
rr.length; i++) {
//----------------------
-
//getting the reference
of BO which will store Process Instance and get the status of resuming the proce
ss instance
//boGetPIID = factory.cr
eate("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BOGetPIID");
//setting the value of N
B01 Process Instance into the BO Object, to resume the process instance of NB01
process for the given policy number
//boGetPIID.setString("P
ROCESSINSTANCE", processinstances);
boGetPIID.setString("PRO
CESSINSTANCE",
strProcI
nstArr[i]);
//calling method of WFCo
nnectorImpl to resume the process.
objWF.getPIIDToResume(bo
GetPIID);
//getting the Process In
stance ID value that was set in the BO by the WFConnector Resume Process
piid = boGetPIID.getStri
ng("PIID");
log
.info("R
esumeProcess - Process Instance ID for PolicyNumber (policyNumber) = "
+ strPolicyNoArr[i]
+ " is = "
+ piid);
//----------------------
-
//checking if Process In
stance ID is null or not
//if Not Null or empty s
tring then resume the process
if ((piid != null) && !(
piid.trim().equals(""))) {
//Object objgetR
esume= (Object)service.invoke("Resume", boResume);
//--------------
---------
//getting the re
ference of BO which will store the Process Instance ID of given policy number
//boResume = fac
tory.create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BOSuspend");
boResume.setStri
ng("PIID", piid);
//Calling Resume
operation on WFConnector to resume the process
objWF.Resume(boR
esume);
//getting the va
lue of isResumed container to determine whether the process was resumed or not.
isResumed = boRe
sume.getBoolean("ISRESUMED");
boResume = null;
//--------------
---------
//objgetResume=n
ull;
//service=null;
//checking wheth
er the process resumed or not
if (isResumed) {
//servic
e = (Service)serviceManager.locateService("DBConnectorPartner");
//Object
objUpdateResumeStatus= (Object)service.invoke("updateResumeStatus", boUpdateSta
tus);
log
.info("ResumeProcess - The NB01 prcess instance for policyNumber "
+ strPolicyNoArr[i]
+ " resumed sucessfully");
//gettin
g the reference for the BO object used in Update Status procedure.
//boUpda
teStatus = factory.create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BOUpdat
eSuspendStatus");
//settin
g the value of PROCESSINSTANCE container and STATUS Container in BO object
boUpdate
Status.setString("PROCESSINSTANCE",
strProcInstArr[i]);
boUpdate
Status.setString("STATUS",
"UNSUSPENDED");
//Caliin
g UpdateResumeStatus on DBConnector to update the status as unsuspended
objDB.up
dateResumeStatus(boUpdateStatus);
//gettin
g the value of ISUPDATED container
isUpdate
d = boUpdateStatus
.getBoolean("ISUPDATED");
log
.info("ResumeProcess - The Update ResumeStatus returned from DB: "
+ isUpdated
+ " for PolicyNumber (policyNumber) = "
+ policyNumber);
//------
------ New Code Added by Amit Malhotra based on Requirement which started from 0
7/12/2007.
//new co
de to update the SUSPENDPROCESSACTIVITY table so that Resume Process
//uses t
his information to move to user indicated by the Department to which document be
longs to.
//boResu
meProcess = factory.create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo","BOResum
eProcess");
//settin
g up the value of FORMID and Policy Number in boResumeProcess object
boResume
Process.setString("POLICYNUMBER",
strPolicyNoArr[i]);
boResume
Process.setString("FORMID",
strFormID);
//callin
g objDB method to update the status of the SUSPENDPROCESSACTIVITY table to indic
ate where to resume the process
objDB.re
sumeProcessToDept(boResumeProcess);
}
}
//service = (Service)ser
viceManager.locateService("DBConnectorPartner");
//Object objRecordReq= (
Object)service.invoke("RecordRequirement", boRecordReq);
//getting the reference
object of the BO object which allows us to update the status of requirement in D
SAUTOREQ table.
//boRecordReq = factory.
create("http://NewBuisness_BSLI_VER1.0/com/awpl/bo", "BORecordREQ");
//setting the values of
the containers which will be passed to the method for updating the DSAUTOREQ tab
le.
boRecordReq.setString("P
ROCESSINSTANCE",
strProcI
nstArr[i]);
boRecordReq.setString("P
OLICYNUMBER",
strPolic
yNoArr[i]);
boRecordReq.setString("D
OCUMENTTYPE", subDocType);
boRecordReq.setString("D
OCUMENTDATE", AWCommon
.getCurr
entDate(currentDateFormat));
boRecordReq.setString("R
EQITEMID", itemId);
boRecordReq.setString("V
IEWSTATUS", "ACCEPTED");
boRecordReq.setString("I
NDEXCLASS", indexCls);
//calling method / opera
tion to update the status of the Requirement in DSAUTOREQ table.
objDB.RecordRequirement(
boRecordReq, strFormID);
log
.info("R
esumeProcess - The Record Requirment status updated/created for Policy Number =
"
+ policyNumber);
//service=null;
//objRecordReq=null;
/*inputData.setString("E
XITVAL","COMPLETED");
log.info("The Exitval i
s set as COMPLETED");*/
//strExitVal = "COMPLETE
D";
}//End of for loop
strExitVal = "COMPLETED";
}
if (processinstances != null)
processinstances = null;
if (strAllPolicies != null)
strAllPolicies = null;
if (strProcInstPolArr != null)
strProcInstPolArr = null;
} else {
strExitVal = "PROCESS NOT RUNNING";
/*
inputData.setString("EXITVAL","PROCESS
NOT RUNNING");
log.info("The Exitval is set as PROCESS
NOT RUNNING");*/
}
//setting the value of ExitVal container
inputData.setString("EXITVAL", strExitVal);
log
.info("ResumeProcess - Value of
ExitVal = "
+ strExitVal
+ " for Policy N
umber (policyNumber) = "
+ policyNumber);
}
} catch (Exception e) {
log.error(e.getMessage());
throw new Exception(e);
} finally {
//releasing the objects from memory.
boGetProc = null;
boGetPIID = null;
boResume = null;
boUpdateStatus = null;
boRecordReq = null;
boResumeProcess = null;
objDB = null;
objWF = null;
factory = null;
serviceManager = null;
policyNumber = null;
policyNumbers = null;
strAllPolicies = null;
strProcInstAndPol = null;
subDocType = null;
indexCls = null;
itemId = null;
currentDateFormat = null;
processinstances = null;
piid = null;
strExitVal = null;
}
return inputData;
}

También podría gustarte