Class MGoal

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_PA_Goal, I_Persistent, Evaluatee

public class MGoal extends X_PA_Goal
Performance Goal
Version:
$Id: MGoal.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
  • BF [ 1887674 ] Deadlock when try to modify PA Goal's Measure Target
  • BF [ 1760482 ] New Dashboard broke old functionality
  • BF [ 1887691 ] I get NPE if the PA Goal's target is 0
  • See Also:
    • Constructor Details

      • MGoal

        public MGoal(Properties ctx, String PA_Goal_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        PA_Goal_UU - UUID key
        trxName - Transaction
      • MGoal

        public MGoal(Properties ctx, int PA_Goal_ID, String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        PA_Goal_ID - id
        trxName - trx
      • MGoal

        public MGoal(Properties ctx, ResultSet rs, String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set
        trxName - trx
      • MGoal

        public MGoal(Properties ctx, String Name, String Description, BigDecimal MeasureTarget, String trxName)
        Parameters:
        ctx - context
        Name - Name
        Description - Description
        MeasureTarget - target
        trxName - trx
    • Method Details

      • getUserGoals

        public static MGoal[] getUserGoals(Properties ctx, int AD_User_ID)
        Get User Goals (will call updateGoal for each record)
        Parameters:
        ctx - context
        AD_User_ID - user
        Returns:
        array of goals
      • getGoals

        public static MGoal[] getGoals(Properties ctx)
        Get Accessible Goals ((will call updateGoal for each record)
        Parameters:
        ctx - context
        Returns:
        array of goals
      • getTestGoals

        public static MGoal[] getTestGoals(Properties ctx)
        Create Dummy Test Goals
        Parameters:
        ctx - context
        Returns:
        array of goals
      • getMeasureGoals

        public static MGoal[] getMeasureGoals(Properties ctx, int PA_Measure_ID)
        Get Goals for a performance measurement
        Parameters:
        ctx - context
        PA_Measure_ID - performance measurement
        Returns:
        goals
      • getMultiplier

        public static BigDecimal getMultiplier(MGoal goal)
        Get Multiplier for the goal's combination of Measurement Scope and Measurement Display
        Parameters:
        goal - goal
        Returns:
        multiplier value or 1 (measure display is null) or null (for MEASURESCOPE_Total and MEASUREDISPLAY_Total)
      • getRestrictions

        public MGoalRestriction[] getRestrictions(boolean reload)
        Get Restriction Lines
        Parameters:
        reload - true to reload data
        Returns:
        array of lines
      • getMeasure

        public MMeasure getMeasure()
        Get Measure
        Returns:
        measure or null
      • updateGoal

        public boolean updateGoal(boolean force)
        Update/save measurement for Goals
        Parameters:
        force - force to update goal even if it has not reach the next update interval (default is 30 minutes interval)
        Returns:
        true if updated
      • setMeasureActual

        public void setMeasureActual(BigDecimal MeasureActual)
        Set Actual Measurement value
        Specified by:
        setMeasureActual in interface I_PA_Goal
        Overrides:
        setMeasureActual in class X_PA_Goal
        Parameters:
        MeasureActual - actual
      • setGoalPerformance

        public void setGoalPerformance()
        Calculate Performance Goal
      • getGoalPerformanceDouble

        public double getGoalPerformanceDouble()
        Get Goal Performance value as Double
        Returns:
        goal performance value
      • getPercent

        public int getPercent()
        Get Goal Performance value in Percent
        Returns:
        goal performance value in percent (i.e 5 percent if value is 0.05)
      • getColor

        public Color getColor()
        Get Color
        Returns:
        color - white if no target
      • getColorSchema

        public MColorSchema getColorSchema()
        Get the color schema for this goal.
        Returns:
        the color schema
      • getMeasureDisplay

        public String getMeasureDisplay()
        Get Measure Display
        Specified by:
        getMeasureDisplay in interface I_PA_Goal
        Overrides:
        getMeasureDisplay in class X_PA_Goal
        Returns:
        Measure Display (MEASUREDISPLAY_*)
      • getXAxisText

        public String getXAxisText()
        Get Measure Display Text
        Returns:
        Measure Display Text for X axis
      • isTarget

        public boolean isTarget()
        Goal has Target
        Returns:
        true if has measurement target value
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_PA_Goal
        Returns:
        info
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success