Search in sources :

Example 1 with MSLACriteria

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();
}
Also used : MSLACriteria(org.compiere.model.MSLACriteria) AdempiereUserError(org.compiere.util.AdempiereUserError) MSLAGoal(org.compiere.model.MSLAGoal) MSLACriteria(org.compiere.model.MSLACriteria) Timestamp(java.sql.Timestamp)

Example 2 with MSLACriteria

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();
}
Also used : MSLACriteria(org.compiere.model.MSLACriteria) AdempiereUserError(org.compiere.util.AdempiereUserError) MSLAGoal(org.compiere.model.MSLAGoal) MSLACriteria(org.compiere.model.MSLACriteria) Timestamp(java.sql.Timestamp) MSLAMeasure(org.compiere.model.MSLAMeasure)

Aggregations

Timestamp (java.sql.Timestamp)2 MSLACriteria (org.compiere.model.MSLACriteria)2 MSLAGoal (org.compiere.model.MSLAGoal)2 AdempiereUserError (org.compiere.util.AdempiereUserError)2 MSLAMeasure (org.compiere.model.MSLAMeasure)1