use of org.compiere.model.MSLACriteria in project adempiere by adempiere.
the class SLAGoalProcess method doIt.
// prepare
/**
* Process
* @return info
* @throws Exception
*/
protected String doIt() throws Exception {
log.info("PA_SLA_Goal_ID=" + p_PA_SLA_Goal_ID);
MSLAGoal goal = new MSLAGoal(getCtx(), p_PA_SLA_Goal_ID, get_TrxName());
if (goal.get_ID() == 0)
throw new AdempiereUserError("@PA_SLA_Goal_ID@ " + p_PA_SLA_Goal_ID);
MSLACriteria criteria = MSLACriteria.get(getCtx(), goal.getPA_SLA_Criteria_ID(), get_TrxName());
if (criteria.get_ID() == 0)
throw new AdempiereUserError("@PA_SLA_Criteria_ID@ " + goal.getPA_SLA_Criteria_ID());
SLACriteria pgm = criteria.newInstance();
int no = pgm.createMeasures(goal);
//
goal.setMeasureActual(pgm.calculateMeasure(goal));
goal.setDateLastRun(new Timestamp(System.currentTimeMillis()));
goal.saveEx();
//
return "@Created@ " + no + " - @MeasureActual@=" + goal.getMeasureActual();
}
use of org.compiere.model.MSLACriteria in project adempiere by adempiere.
the class SLAMeasureProcess method doIt.
// prepare
/**
* Process
* @return info
* @throws Exception
*/
protected String doIt() throws Exception {
log.info("PA_SLA_Measure_ID=" + p_PA_SLA_Measure_ID);
MSLAMeasure measure = new MSLAMeasure(getCtx(), p_PA_SLA_Measure_ID, get_TrxName());
if (measure.get_ID() == 0)
throw new AdempiereUserError("@PA_SLA_Measure_ID@ " + p_PA_SLA_Measure_ID);
MSLAGoal goal = new MSLAGoal(getCtx(), measure.getPA_SLA_Goal_ID(), get_TrxName());
if (goal.get_ID() == 0)
throw new AdempiereUserError("@PA_SLA_Goal_ID@ " + measure.getPA_SLA_Goal_ID());
MSLACriteria criteria = MSLACriteria.get(getCtx(), goal.getPA_SLA_Criteria_ID(), get_TrxName());
if (criteria.get_ID() == 0)
throw new AdempiereUserError("@PA_SLA_Criteria_ID@ " + goal.getPA_SLA_Criteria_ID());
SLACriteria pgm = criteria.newInstance();
//
goal.setMeasureActual(pgm.calculateMeasure(goal));
goal.setDateLastRun(new Timestamp(System.currentTimeMillis()));
goal.saveEx();
//
return "@MeasureActual@=" + goal.getMeasureActual();
}
Aggregations