robbinma
Newbie
Karma: 1
Posts: 13
|
 |
« on: October 29, 2009, 09:30:02 am » |
|
Hello,
I am writing a java utility to update the status of some job plans. It changes the status but it doesn't apply all the relevant status rules e.g. duration must be > 0. Setting a plan status to active when no labor is set.
The validate method doesn't appear to fail. The save method also works without raising any errors.
I'm guessing that the duration rule must be set at the front-end rather than on the MBO. Alternatively I may have missed something. This feels more likely as I would expect the labor rule to be set at the MBO level.
Someone else has suggested using Escalations for this but it seems to need a time interval attribute which isn't available.
Could someone have a look and point me in the right direction?
Cheers,
Mark
// retrieved unique job plan into mbosetremote boolean valiWarningFlg; mbosetremote.getWarnings(); // clear any old warnings out mbosetremote.validate(); // TODO: checking the object
valiWarningFlg = mbosetremote.hasWarnings(); if (valiWarningFlg) { System.out.println("Validation generated warnings"); MXException[] mboWarn = mbosetremote.getWarnings();
MXException tempMboWarn; for(int excepCnt = 0; excepCnt < mboWarn.length; excepCnt ++){ tempMboWarn = mboWarn[excepCnt]; System.out.println(tempMboWarn.getDisplayMessage()); } } else { System.out.println("Validation didn't generate warnings"); } if(mbosetremote.count() == 1) { MboRemote tempMBO; tempMBO = mbosetremote.moveFirst(); JobPlanRemote jp = (JobPlanRemote)tempMBO; jp.changeStatus("Active", new Date(),"Auto approved", MboConstants.NONE); try { jp.getThisMboSet().save(); } catch (Exception saveExcep) { System.out.println("Problem saving MBO Excep"+saveExcep.getMessage()); } }
|