Produced by Araxis Merge on 12/13/2018 10:35:22 AM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\controller | BatchProcessController.java | Fri Dec 7 17:36:18 2018 UTC |
| 2 | v12.5_iter_7_build 51.zip\TRM_Upgrade\src\main\java\gov\va\med\ccht\controller | BatchProcessController.java | Wed Dec 12 22:33:38 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 894 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /********* ********** ********** ********** ********** ********** ********* | |
| 2 | * Copyrig ht � 2010 VHA. All r ights rese rved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | package go v.va.med.c cht.contro ller; | |
| 5 | ||
| 6 | import jav a.io.Seria lizable; | |
| 7 | import jav a.util.Arr ayList; | |
| 8 | import jav a.util.Col lection; | |
| 9 | import jav a.util.Col lections; | |
| 10 | import jav a.util.Has hMap; | |
| 11 | import jav a.util.Ite rator; | |
| 12 | import jav a.util.Lis t; | |
| 13 | import jav a.util.Map ; | |
| 14 | import jav a.util.Set ; | |
| 15 | ||
| 16 | import org .quartz.Cr onSchedule Builder; | |
| 17 | import org .quartz.Cr onTrigger; | |
| 18 | import org .quartz.Jo bDetail; | |
| 19 | import org .quartz.Sc hedulerExc eption; | |
| 20 | import org .quartz.Tr igger; | |
| 21 | import org .quartz.Tr iggerBuild er; | |
| 22 | import org .springfra mework.bat ch.core.Ba tchStatus; | |
| 23 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 24 | import org .springfra mework.sch eduling.qu artz.CronT riggerBean ; | |
| 25 | import org .springfra mework.sch eduling.qu artz.JobDe tailBean; | |
| 26 | import org .springfra mework.ste reotype.Co ntroller; | |
| 27 | ||
| 28 | import gov .va.med.cc ht.model.C CHTRoles; | |
| 29 | import gov .va.med.cc ht.model.S chedule; | |
| 30 | import gov .va.med.cc ht.service .common.Ba tchProcess TriggerGro ups; | |
| 31 | import gov .va.med.cc ht.service .report.Sc heduleConv ersionServ ice; | |
| 32 | import gov .va.med.cc ht.ui.mode l.BatchPro cessDetail Form; | |
| 33 | import gov .va.med.cc ht.ui.mode l.Formatte dDateForm; | |
| 34 | import gov .va.med.cc ht.ui.mode l.ReportSc heduleForm ; | |
| 35 | import gov .va.med.fw .batchproc ess.BatchP rocessDeta il; | |
| 36 | import gov .va.med.fw .batchproc ess.BatchP rocessDeta ilStatus; | |
| 37 | import gov .va.med.fw .batchproc ess.BatchP rocessInvo ker; | |
| 38 | import gov .va.med.fw .batchproc ess.BatchP rocessServ ice; | |
| 39 | import gov .va.med.fw .model.bat chprocess. JobConfig; | |
| 40 | import gov .va.med.fw .schedulin g.Scheduli ngService; | |
| 41 | import gov .va.med.fw .schedulin g.TriggerS tatus; | |
| 42 | import gov .va.med.fw .security. Permission ; | |
| 43 | import gov .va.med.fw .security. SecurityCo ntextHelpe r; | |
| 44 | import gov .va.med.fw .security. UserPrinci pal; | |
| 45 | import gov .va.med.fw .service.A bstractCom ponent; | |
| 46 | import gov .va.med.fw .service.C onfigurati onConstant s; | |
| 47 | import gov .va.med.fw .service.S erviceExce ption; | |
| 48 | import gov .va.med.fw .service.j ms.JMSPayl oad; | |
| 49 | import gov .va.med.fw .service.j ms.Message ProducerEx ception; | |
| 50 | import gov .va.med.fw .service.j ms.Message ProducerSe rvice; | |
| 51 | import gov .va.med.fw .service.j ms.Synchro nousMessag eProducerS erviceImpl ; | |
| 52 | import gov .va.med.fw .util.date .TimeZoneU tils; | |
| 53 | ||
| 54 | /** | |
| 55 | * | |
| 56 | * | |
| 57 | * IHTA oh rs_web Nov 12, 2010 | |
| 58 | * | |
| 59 | * @author DNS | |
| 60 | */ | |
| 61 | ||
| 62 | @Controlle r | |
| 63 | public cla ss BatchPr ocessContr oller exte nds Abstra ctComponen t implemen ts CCHTRol es { | |
| 64 | ||
| 65 | pu blic stati c final in t MAX_USER _ID_LENGTH = 30; | |
| 66 | pu blic stati c final St ring JOB_N AME = "job Name"; | |
| 67 | pu blic stati c final St ring JOB_P ARAMETERS = "jobPara meters"; | |
| 68 | pu blic stati c final St ring USER_ ID = "user Id"; | |
| 69 | ||
| 70 | pr ivate Batc hProcessIn voker batc hProcessIn voker; | |
| 71 | @A utowired | |
| 72 | pr ivate Batc hProcessSe rvice batc hProcessSe rvice; | |
| 73 | @A utowired | |
| 74 | pr ivate Sche dulingServ ice schedu lingServic e; | |
| 75 | // @A utowired | |
| 76 | // pr ivate JobL auncher jo bLauncherx ; | |
| 77 | // @A utowired | |
| 78 | // pr ivate JobL ocator job Locator; | |
| 79 | pr ivate Mess ageProduce rService m essageProd ucerServic e; | |
| 80 | ||
| 81 | // bean name for batch payload d efined in cchtJms.xm l | |
| 82 | pr ivate Stri ng runBatc hJobJMSPay loadName = "runBatch JobJMSPayl oad"; | |
| 83 | @A utowired | |
| 84 | pr ivate Sche duleConver sionServic e schedule Conversion Service; | |
| 85 | @A utowired | |
| 86 | pr ivate Repo rtConversi onService reportConv ersionServ ice; | |
| 87 | ||
| 88 | pu blic Batch ProcessCon troller() { | |
| 89 | batc hProcessIn voker = ne w BatchPro cessInvoke r(); | |
| 90 | mess ageProduce rService = new Synch ronousMess ageProduce rServiceIm pl(); | |
| 91 | } | |
| 92 | ||
| 93 | /* * | |
| 94 | * Get Activ e jobs | |
| 95 | * | |
| 96 | * @return | |
| 97 | * @throws E xception | |
| 98 | * / | |
| 99 | pu blic List getActiveJ obs() thro ws Excepti on { | |
| 100 | List activeJob s = batchP rocessServ ice.getJob Results(Ba tchStatus. STARTED); | |
| 101 | retu rn activeJ obs; | |
| 102 | } | |
| 103 | ||
| 104 | pu blic void cancelActi veJob(long jobResult Id) throws Exception { | |
| 105 | batc hProcessSe rvice.canc elActiveJo b(jobResul tId); | |
| 106 | } | |
| 107 | ||
| 108 | pu blic void markActive JobAsError (long jobR esultId) t hrows Exce ption { | |
| 109 | batc hProcessSe rvice.errA ctiveJob(j obResultId ); | |
| 110 | } | |
| 111 | ||
| 112 | @S uppressWar nings("unc hecked") | |
| 113 | pu blic List< BatchProce ssDetailFo rm> getAll Jobs() thr ows Except ion { | |
| 114 | User Principal user = Sec urityConte xtHelper.g etSecurity Context(). getUserPri ncipal(); | |
| 115 | Coll ection<Bat chProcessD etail> job s = getBat chProcessD etails(); | |
| 116 | List <BatchProc essDetailF orm> jobAn dTriggerSt atus = new ArrayList <BatchProc essDetailF orm>(jobs. size()); | |
| 117 | // n ow iterate through a nd determi ne the dyn amic piece s from the | |
| 118 | // S cheduler.. ..next Fir e time, et c | |
| 119 | Iter ator itr = jobs != n ull ? jobs .iterator( ) : null; | |
| 120 | Batc hProcessDe tail detai l = null; | |
| 121 | Batc hProcessDe tailForm f orm = null ; | |
| 122 | Trig gerStatus triggerSta tus = null ; | |
| 123 | whil e (itr != null && it r.hasNext( )) { | |
| 124 | detail = (BatchP rocessDeta il) itr.ne xt(); | |
| 125 | form = new Batch ProcessDet ailForm(); | |
| 126 | boolea n canExecu teOrView = true; | |
| 127 | // set batch pro cess detai ls name, g roup .. | |
| 128 | form.s etJobName( detail.get JobName()) ; | |
| 129 | form.s etGroupNam e(detail.g etGroupNam e()); | |
| 130 | form.s etJobDescr iption(det ail.getJob Descriptio n()); | |
| 131 | form.s etTriggerN ame(detail .getTrigge rName()); | |
| 132 | form.s etTriggerG roup(detai l.getTrigg erGroup()) ; | |
| 133 | ||
| 134 | // set trigger s tatus and next fire time | |
| 135 | if (or g.apache.c ommons.lan g3.StringU tils.isNot Empty(deta il.getTrig gerName()) ) { | |
| 136 | triggerS tatus = sc hedulingSe rvice.getT riggerStat us(detail. getTrigger Name(), de tail.getTr iggerGroup ()); | |
| 137 | if (trig gerStatus != null) { | |
| 138 | form.setSt atus(trigg erStatus.g etStatus() ); | |
| 139 | form.setNe xtFireTime (triggerSt atus.getNe xtFireTime ()); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 143 | JobCon fig jobCon fig = batc hProcessSe rvice.getJ obConfig(d etail.getJ obName(), detail.get GroupName( )); | |
| 144 | if (jo bConfig != null) { | |
| 145 | if (jobC onfig.getJ obSchedule () != null ) { | |
| 146 | form.setJo bSchedule( jobConfig. getJobSche dule()); | |
| 147 | form.setJo bScheduleD escription (jobConfig .getJobSch eduleDescr iption()); | |
| 148 | if (org.ap ache.commo ns.lang3.S tringUtils .isNotEmpt y(jobConfi g.getJobSc heduleText ())) { | |
| 149 | Sc hedule sch edule = sc heduleConv ersionServ ice.toSche dule(jobCo nfig.getJo bScheduleT ext()); | |
| 150 | Re portSchedu leForm rsF orm = new ReportSche duleForm() ; | |
| 151 | re portConver sionServic e.convert( schedule, rsForm); | |
| 152 | fo rm.setRepo rtSchedule (rsForm); | |
| 153 | } | |
| 154 | } | |
| 155 | form.set EmailDistr ibutionLis t(jobConfi g.getEmail Distributi onList()); | |
| 156 | canExecu teOrView = isAllowed ToExecuteO rViewBatch Job(user, jobConfig. getPermiss ions()); | |
| 157 | } | |
| 158 | if (ca nExecuteOr View) { | |
| 159 | jobAndTr iggerStatu s.add(form ); | |
| 160 | } | |
| 161 | } | |
| 162 | Coll ections.so rt(jobAndT riggerStat us); | |
| 163 | retu rn jobAndT riggerStat us; | |
| 164 | } | |
| 165 | ||
| 166 | pu blic void executeBat chProcess( String job DetailsNam e, String invocation ArgsStrArr ay) throws Exception { | |
| 167 | send MessageFor execution( jobDetails Name, invo cationArgs StrArray); | |
| 168 | } | |
| 169 | ||
| 170 | pu blic void reschedule (BatchProc essDetailF orm batchP rocessDeta ilForm) th rows Excep tion { | |
| 171 | Stri ng jobName = batchPr ocessDetai lForm.getJ obName(); | |
| 172 | Stri ng groupNa me = batch ProcessDet ailForm.ge tGroupName (); | |
| 173 | Stri ng newSche dule = bat chProcessD etailForm. getJobSche dule(); | |
| 174 | Stri ng jobSche duleDescri ption = ba tchProcess DetailForm .getJobSch eduleDescr iption(); | |
| 175 | Repo rtSchedule Form repor tScheduleF orm = batc hProcessDe tailForm.g etReportSc hedule(); | |
| 176 | Stri ng trigger Name = bat chProcessD etailForm. getTrigger Name(); | |
| 177 | Stri ng trigger Group = ba tchProcess DetailForm .getTrigge rGroup(); | |
| 178 | ||
| 179 | JobC onfig jobC onfig = ba tchProcess Service.ge tJobConfig (jobName, groupName) ; | |
| 180 | if ( jobConfig == null) { | |
| 181 | jobCon fig = new JobConfig( ); | |
| 182 | jobCon fig.setNam e(jobName) ; | |
| 183 | jobCon fig.setGro up(groupNa me); | |
| 184 | } | |
| 185 | // N ew schedul e is empty | |
| 186 | if ( org.apache .commons.l ang3.Strin gUtils.isE mpty(newSc hedule)) { | |
| 187 | return ; | |
| 188 | } | |
| 189 | ||
| 190 | jobC onfig.setJ obSchedule (newSchedu le); | |
| 191 | jobC onfig.setJ obSchedule Descriptio n(jobSched uleDescrip tion); | |
| 192 | // c onvert the schedule object | |
| 193 | Sche dule sched ule = new Schedule() ; | |
| 194 | repo rtConversi onService. convert(sc hedule, re portSchedu leForm); | |
| 195 | jobC onfig.setJ obSchedule Text(sched uleConvers ionService .toText(sc hedule)); | |
| 196 | batc hProcessSe rvice.save JobConfig( jobConfig) ; | |
| 197 | Trig ger trigge r = schedu lingServic e.getTrigg er(trigger Name, trig gerGroup); | |
| 198 | ||
| 199 | if ( trigger != null && t rigger ins tanceof Cr onTrigger) { | |
| 200 | ||
| 201 | CronTr igger cron Trigger = TriggerBui lder | |
| 202 | .newTrigge r() | |
| 203 | .withSched ule(CronSc heduleBuil der.cronSc hedule(job Config.get JobSchedul e()).inTim eZone(Time ZoneUtils. getTimeZon e())) | |
| 204 | .build(); | |
| 205 | ||
| 206 | schedu lingServic e.reschedu le(trigger Name, trig gerGroup, cronTrigge r); | |
| 207 | } el se { | |
| 208 | ||
| 209 | // Con struct the name by c onfigurati on standar ds | |
| 210 | if (or g.apache.c ommons.lan g3.StringU tils.isEmp ty(trigger Name)) { | |
| 211 | triggerN ame = (job Name.subst ring(0, 1) ).toLowerC ase() + jo bName.subs tring(1) + "CronTrig ger"; | |
| 212 | } | |
| 213 | try { | |
| 214 | CronTrig gerBean cr onTriggerB ean = (Cro nTriggerBe an) getCom ponent(tri ggerName); | |
| 215 | if (cron TriggerBea n != null) { | |
| 216 | ||
| 217 | CronTrigge r cronTrig ger = Trig gerBuilder | |
| 218 | .new Trigger() | |
| 219 | .wit hSchedule( CronSchedu leBuilder. cronSchedu le(jobConf ig.getJobS chedule()) .inTimeZon e(TimeZone Utils.getT imeZone()) ) | |
| 220 | .bui ld(); | |
| 221 | ||
| 222 | JobDetail jobDetail = cronTrig gerBean.ge tJobDetail (); | |
| 223 | if (jobDet ail != nul l) | |
| 224 | sc hedulingSe rvice.sche dule(jobDe tail, cron Trigger); | |
| 225 | else | |
| 226 | sc hedulingSe rvice.sche dule(cronT rigger); | |
| 227 | } | |
| 228 | } catc h (Excepti on e) { | |
| 229 | throw ne w Exceptio n( | |
| 230 | "M issing or invalid co nfiguratio n, could n ot schedul e the batc h job for " + jobNam e); | |
| 231 | } | |
| 232 | } | |
| 233 | } | |
| 234 | ||
| 235 | pu blic void updateConf ig(BatchPr ocessDetai lForm batc hProcessDe tailForm) throws Exc eption { | |
| 236 | JobC onfig jobC onfig = ba tchProcess Service.ge tJobConfig (batchProc essDetailF orm.getJob Name(), | |
| 237 | batchPro cessDetail Form.getGr oupName()) ; | |
| 238 | if ( jobConfig == null) { | |
| 239 | jobCon fig = new JobConfig( ); | |
| 240 | jobCon fig.setNam e(batchPro cessDetail Form.getJo bName()); | |
| 241 | jobCon fig.setGro up(batchPr ocessDetai lForm.getG roupName() ); | |
| 242 | } | |
| 243 | ||
| 244 | jobC onfig.setE mailDistri butionList (batchProc essDetailF orm.getEma ilDistribu tionList() ); | |
| 245 | batc hProcessSe rvice.save JobConfig( jobConfig) ; | |
| 246 | ||
| 247 | Stri ng trigger Status = b atchProces sDetailFor m.getStatu s(); | |
| 248 | Stri ng previou sTriggerSt atus = bat chProcessD etailForm. getPreviou sTriggerSt atus(); | |
| 249 | if ( org.apache .commons.l ang3.Strin gUtils.isN otEmpty(tr iggerStatu s) && !tri ggerStatus .equals(pr eviousTrig gerStatus) ) { | |
| 250 | if (Tr iggerStatu s.NORMAL_S TATUS.equa ls(trigger Status)) { | |
| 251 | scheduli ngService. resumeJob( batchProce ssDetailFo rm.getJobN ame(), bat chProcessD etailForm. getGroupNa me()); | |
| 252 | } else if (Trigg erStatus.P AUSED_STAT US.equals( triggerSta tus)) { | |
| 253 | scheduli ngService. pauseJob(b atchProces sDetailFor m.getJobNa me(), batc hProcessDe tailForm.g etGroupNam e()); | |
| 254 | } | |
| 255 | } | |
| 256 | } | |
| 257 | ||
| 258 | pu blic void pauseAll() throws Ex ception { | |
| 259 | sche dulingServ ice.pauseT riggerGrou p(BatchPro cessTrigge rGroups.ST ATIC_BATCH _JOBS); | |
| 260 | } | |
| 261 | ||
| 262 | pu blic void resumeAll( ) throws E xception { | |
| 263 | sche dulingServ ice.resume TriggerGro up(BatchPr ocessTrigg erGroups.S TATIC_BATC H_JOBS); | |
| 264 | } | |
| 265 | ||
| 266 | @S uppressWar nings("unc hecked") | |
| 267 | pu blic List getJobHist ory(String jobName) throws Exc eption { | |
| 268 | Batc hProcessDe tailStatus job = get BatchProce ssDetailSt atus(jobNa me); | |
| 269 | List jobResult s = batchP rocessServ ice.getFin ishedJobRe sults(job. getBatchPr ocessDetai l().getJob Name(), | |
| 270 | job.getB atchProces sDetail(). getJobGrou p()); | |
| 271 | retu rn jobResu lts; | |
| 272 | } | |
| 273 | ||
| 274 | pu blic Batch ProcessDet ailForm vi ewExecuteW ithArgs(St ring jobNa me) throws Exception { | |
| 275 | Batc hProcessDe tailForm f orm = new BatchProce ssDetailFo rm(); | |
| 276 | Batc hProcessDe tailStatus job = get BatchProce ssDetailSt atus(jobNa me); | |
| 277 | conv ert(job, f orm); | |
| 278 | retu rn form; | |
| 279 | } | |
| 280 | ||
| 281 | pu blic Batch ProcessSer vice getBa tchProcess Service() { | |
| 282 | retu rn batchPr ocessServi ce; | |
| 283 | } | |
| 284 | ||
| 285 | pu blic void setBatchPr ocessServi ce(BatchPr ocessServi ce batchPr ocessServi ce) { | |
| 286 | this .batchProc essService = batchPr ocessServi ce; | |
| 287 | } | |
| 288 | ||
| 289 | pu blic Batch ProcessInv oker getBa tchProcess Invoker() { | |
| 290 | retu rn batchPr ocessInvok er; | |
| 291 | } | |
| 292 | ||
| 293 | pu blic void setBatchPr ocessInvok er(BatchPr ocessInvok er batchPr ocessInvok er) { | |
| 294 | this .batchProc essInvoker = batchPr ocessInvok er; | |
| 295 | } | |
| 296 | ||
| 297 | pu blic Sched ulingServi ce getSche dulingServ ice() { | |
| 298 | retu rn schedul ingService ; | |
| 299 | } | |
| 300 | ||
| 301 | pu blic void setSchedul ingService (Schedulin gService s chedulingS ervice) { | |
| 302 | this .schedulin gService = schedulin gService; | |
| 303 | } | |
| 304 | ||
| 305 | // pu blic JobLa uncher get JobLaunche r() { | |
| 306 | // retu rn jobLaun cher; | |
| 307 | // } | |
| 308 | // | |
| 309 | // pu blic void setJobLaun cher(JobLa uncher job Launcher) { | |
| 310 | // this .jobLaunch er = jobLa uncher; | |
| 311 | // } | |
| 312 | // | |
| 313 | // pu blic JobLo cator getJ obLocator( ) { | |
| 314 | // retu rn jobLoca tor; | |
| 315 | // } | |
| 316 | // | |
| 317 | // pu blic void setJobLoca tor(JobLoc ator jobLo cator) { | |
| 318 | // this .jobLocato r = jobLoc ator; | |
| 319 | // } | |
| 320 | ||
| 321 | pu blic Messa geProducer Service ge tMessagePr oducerServ ice() { | |
| 322 | retu rn message ProducerSe rvice; | |
| 323 | } | |
| 324 | ||
| 325 | pu blic void setMessage ProducerSe rvice(Mess ageProduce rService m essageProd ucerServic e) { | |
| 326 | this .messagePr oducerServ ice = mess ageProduce rService; | |
| 327 | } | |
| 328 | ||
| 329 | pu blic Strin g getRunBa tchJobJMSP ayloadName () { | |
| 330 | retu rn runBatc hJobJMSPay loadName; | |
| 331 | } | |
| 332 | ||
| 333 | pu blic void setRunBatc hJobJMSPay loadName(S tring runB atchJobJMS PayloadNam e) { | |
| 334 | this .runBatchJ obJMSPaylo adName = r unBatchJob JMSPayload Name; | |
| 335 | } | |
| 336 | ||
| 337 | pu blic Sched uleConvers ionService getSchedu leConversi onService( ) { | |
| 338 | retu rn schedul eConversio nService; | |
| 339 | } | |
| 340 | ||
| 341 | pu blic void setSchedul eConversio nService(S cheduleCon versionSer vice sched uleConvers ionService ) { | |
| 342 | this .scheduleC onversionS ervice = s cheduleCon versionSer vice; | |
| 343 | } | |
| 344 | ||
| 345 | pu blic Repor tConversio nService g etReportCo nversionSe rvice() { | |
| 346 | retu rn reportC onversionS ervice; | |
| 347 | } | |
| 348 | ||
| 349 | pu blic void setReportC onversionS ervice(Rep ortConvers ionService reportCon versionSer vice) { | |
| 350 | this .reportCon versionSer vice = rep ortConvers ionService ; | |
| 351 | } | |
| 352 | ||
| 353 | ||
| 354 | ||
| 355 | /* * | |
| 356 | * Get the j ob name an d send a m essage to execute th e job asyn c | |
| 357 | * | |
| 358 | * @param jo bDetailsNa me | |
| 359 | * @param in vocationAr gsStrArray | |
| 360 | * @throws E xception | |
| 361 | * / | |
| 362 | pr ivate void sendMessa geForexecu tion(Strin g jobDetai lsName, St ring invoc ationArgsS trArray) | |
| 363 | throws MessagePr oducerExce ption { | |
| 364 | ||
| 365 | JobD etailBean jobDetails Bean = (Jo bDetailBea n) getAppl icationCon text().get Bean(jobDe tailsName) ; | |
| 366 | Stri ng jobName = (String ) jobDetai lsBean.get JobDataMap ().get(JOB _NAME); | |
| 367 | ||
| 368 | Map< String, Ob ject> map = new Hash Map<String , Object>( ); | |
| 369 | map. put(JOB_NA ME, jobNam e); | |
| 370 | map. put(JOB_PA RAMETERS, invocation ArgsStrArr ay); | |
| 371 | map. put(USER_I D, Securit yContextHe lper.getSe curityCont ext().getU serPrincip al().getUs erCredenti als().getU serID()); | |
| 372 | ||
| 373 | JMSP ayload jms PayLoad = (JMSPayloa d) getAppl icationCon text().get Bean(getRu nBatchJobJ MSPayloadN ame()); | |
| 374 | jmsP ayLoad.set Payload((S erializabl e) map); | |
| 375 | ||
| 376 | // s et header properties | |
| 377 | Map< String, Se rializable > props = new HashMa p<String, Serializab le>(); | |
| 378 | Stri ng logical UserName = jobName; | |
| 379 | if ( logicalUse rName.leng th() > MAX _USER_ID_L ENGTH) { | |
| 380 | logica lUserName = logicalU serName.su bstring(0, MAX_USER_ ID_LENGTH) ; | |
| 381 | } | |
| 382 | prop s.put(Conf igurationC onstants.D EFAULT_MES SAGE_TYPE, jmsPayLoa d.getTarge tServiceDe scriptor() ); | |
| 383 | prop s.put(Conf igurationC onstants.D EFAULT_MES SAGE_INITI ATER, logi calUserNam e); | |
| 384 | prop s.put(Conf igurationC onstants.D EFAULT_MES SAGE_ORIGI NATING_TIM EZONE, Tim eZoneUtils .getTimeZo ne().getID ()); | |
| 385 | ||
| 386 | mess ageProduce rService.s end((Seria lizable) j msPayLoad. getPayload (), props) ; | |
| 387 | } | |
| 388 | ||
| 389 | pr ivate Batc hProcessDe tailStatus getBatchP rocessDeta ilStatus(S tring jobN ame) | |
| 390 | throws Scheduler Exception, ServiceEx ception { | |
| 391 | ||
| 392 | Batc hProcessDe tailStatus status = new BatchP rocessDeta ilStatus() ; | |
| 393 | Batc hProcessDe tail detai l = getBat chProcessD etail(jobN ame); | |
| 394 | stat us.setBatc hProcessDe tail(detai l); | |
| 395 | // c all Schedu ler to get trigger s tatus | |
| 396 | Trig gerStatus triggerSta tus = sche dulingServ ice.getTri ggerStatus (detail.ge tTriggerNa me(), | |
| 397 | detail.g etTriggerG roup()); | |
| 398 | stat us.setTrig gerStatus( triggerSta tus); | |
| 399 | JobC onfig jobC onfig = ba tchProcess Service.ge tJobConfig (detail.ge tJobName() , detail.g etGroupNam e()); | |
| 400 | if ( jobConfig != null) { | |
| 401 | status .setEmailD istributio nList(jobC onfig.getE mailDistri butionList ()); | |
| 402 | } | |
| 403 | retu rn status; | |
| 404 | } | |
| 405 | ||
| 406 | @S uppressWar nings("unc hecked") | |
| 407 | pr ivate Coll ection get BatchProce ssDetails( ) { | |
| 408 | retu rn batchPr ocessInvok er.getBatc hProcessDe tails(); | |
| 409 | } | |
| 410 | ||
| 411 | pr ivate Batc hProcessDe tail getBa tchProcess Detail(Str ing jobNam e) { | |
| 412 | retu rn batchPr ocessInvok er.getBatc hProcessDe tail(jobNa me); | |
| 413 | } | |
| 414 | ||
| 415 | pr ivate bool ean isAllo wedToExecu teOrViewBa tchJob(Use rPrincipal user, Set <Permissio n> permiss ions) { | |
| 416 | if ( permission s != null && permiss ions.size( ) > 0) { | |
| 417 | for (P ermission permission : permiss ions) { | |
| 418 | String c ode = perm ission.get Name(); | |
| 419 | if (user .isPermiss ionGranted (code)) { | |
| 420 | return tru e; | |
| 421 | } | |
| 422 | } | |
| 423 | } el se { | |
| 424 | return true; | |
| 425 | } | |
| 426 | retu rn false; | |
| 427 | } | |
| 428 | ||
| 429 | pr ivate void convert(B atchProces sDetailSta tus batchP rocessDeta ilStatus, BatchProce ssDetailFo rm form) { | |
| 430 | if ( batchProce ssDetailSt atus == nu ll) | |
| 431 | return ; | |
| 432 | form .setEmailD istributio nList(batc hProcessDe tailStatus .getEmailD istributio nList()); | |
| 433 | ||
| 434 | Batc hProcessDe tail detai l = batchP rocessDeta ilStatus.g etBatchPro cessDetail (); | |
| 435 | if ( detail != null) { | |
| 436 | form.s etJobName( detail.get JobName()) ; | |
| 437 | form.s etJobDescr iption(det ail.getJob Descriptio n()); | |
| 438 | form.s etTriggerN ame(detail .getTrigge rName()); | |
| 439 | form.s etTriggerG roup(detai l.getTrigg erGroup()) ; | |
| 440 | } | |
| 441 | ||
| 442 | Trig gerStatus triggerSta tus = batc hProcessDe tailStatus .getTrigge rStatus(); | |
| 443 | if ( triggerSta tus != nul l) { | |
| 444 | form.s etStatus(t riggerStat us.getStat us()); | |
| 445 | form.s etNextFire Time(trigg erStatus.g etNextFire Time()); | |
| 446 | } | |
| 447 | } | |
| 448 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.