Package org.compiere.model
Class MGoal
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_PA_Goal
-
- org.compiere.model.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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_PA_Goal
CHARTTYPE_AD_Reference_ID, CHARTTYPE_AreaChart, CHARTTYPE_BarChart, CHARTTYPE_LineChart, CHARTTYPE_PieChart, CHARTTYPE_RingChart, CHARTTYPE_WaterfallChart, MEASUREDISPLAY_AD_Reference_ID, MEASUREDISPLAY_Day, MEASUREDISPLAY_Month, MEASUREDISPLAY_Quarter, MEASUREDISPLAY_Total, MEASUREDISPLAY_Week, MEASUREDISPLAY_Year, MEASURESCOPE_AD_Reference_ID, MEASURESCOPE_Day, MEASURESCOPE_Month, MEASURESCOPE_Quarter, MEASURESCOPE_Total, MEASURESCOPE_Week, MEASURESCOPE_Year
-
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_PA_Goal
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Role_ID, COLUMNNAME_AD_User_ID, COLUMNNAME_ChartType, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_DateFrom, COLUMNNAME_DateLastRun, COLUMNNAME_DateTo, COLUMNNAME_Description, COLUMNNAME_GoalPerformance, COLUMNNAME_IsActive, COLUMNNAME_IsSummary, COLUMNNAME_MeasureActual, COLUMNNAME_MeasureDisplay, COLUMNNAME_MeasureScope, COLUMNNAME_MeasureTarget, COLUMNNAME_Name, COLUMNNAME_Note, COLUMNNAME_PA_ColorSchema_ID, COLUMNNAME_PA_Goal_ID, COLUMNNAME_PA_Goal_UU, COLUMNNAME_PA_GoalParent_ID, COLUMNNAME_PA_Measure_ID, COLUMNNAME_RelativeWeight, COLUMNNAME_SeqNo, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MGoal(Properties ctx, int PA_Goal_ID, String trxName)
Standard ConstructorMGoal(Properties ctx, String Name, String Description, BigDecimal MeasureTarget, String trxName)
Base ConstructorMGoal(Properties ctx, ResultSet rs, String trxName)
Load Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
afterSave(boolean newRecord, boolean success)
After Saveprotected boolean
beforeSave(boolean newRecord)
Before SaveColor
getColor()
Get ColorMColorSchema
getColorSchema()
Get the color schema for this goal.double
getGoalPerformanceDouble()
Get Goal Performance as Doublestatic MGoal[]
getGoals(Properties ctx)
Get Accessible GoalsMMeasure
getMeasure()
Get MeasureString
getMeasureDisplay()
Get Measure Displaystatic MGoal[]
getMeasureGoals(Properties ctx, int PA_Measure_ID)
Get Goals with Measurestatic BigDecimal
getMultiplier(MGoal goal)
Get Multiplier from Scope to Displayint
getPercent()
Get Goal Performance in PercentMGoalRestriction[]
getRestrictions(boolean reload)
Get Restriction Linesstatic MGoal[]
getTestGoals(Properties ctx)
Create Test Goalsstatic MGoal[]
getUserGoals(Properties ctx, int AD_User_ID)
Get User GoalsString
getXAxisText()
Get Measure Display Textboolean
isTarget()
Goal has Targetvoid
setGoalPerformance()
Calculate Performance Goal as multipliervoid
setMeasureActual(BigDecimal MeasureActual)
Set Measure ActualString
toString()
String Representationboolean
updateGoal(boolean force)
Update/save Goals for the same measure-
Methods inherited from class org.compiere.model.X_PA_Goal
get_AccessLevel, getAD_Role, getAD_Role_ID, getAD_User, getAD_User_ID, getChartType, getDateFrom, getDateLastRun, getDateTo, getDescription, getGoalPerformance, getKeyNamePair, getMeasureActual, getMeasureScope, getMeasureTarget, getName, getNote, getPA_ColorSchema, getPA_ColorSchema_ID, getPA_Goal_ID, getPA_Goal_UU, getPA_GoalParent, getPA_GoalParent_ID, getPA_Measure, getPA_Measure_ID, getRelativeWeight, getSeqNo, initPO, isSummary, setAD_Role_ID, setAD_User_ID, setChartType, setDateFrom, setDateLastRun, setDateTo, setDescription, setGoalPerformance, setIsSummary, setMeasureDisplay, setMeasureScope, setMeasureTarget, setName, setNote, setPA_ColorSchema_ID, setPA_Goal_ID, setPA_Goal_UU, setPA_GoalParent_ID, setPA_Measure_ID, setRelativeWeight, setSeqNo
-
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock, update_Tree, validForeignKeys
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.compiere.model.I_PA_Goal
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
-
Methods inherited from interface org.compiere.model.I_Persistent
save
-
-
-
-
Constructor Detail
-
MGoal
public MGoal(Properties ctx, int PA_Goal_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextPA_Goal_ID
- idtrxName
- trx
-
MGoal
public MGoal(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- trx
-
MGoal
public MGoal(Properties ctx, String Name, String Description, BigDecimal MeasureTarget, String trxName)
Base Constructor- Parameters:
ctx
- contextName
- NameDescription
- DecsriptionMeasureTarget
- targettrxName
- trx
-
-
Method Detail
-
getUserGoals
public static MGoal[] getUserGoals(Properties ctx, int AD_User_ID)
Get User Goals- Parameters:
ctx
- contextAD_User_ID
- user- Returns:
- array of goals
-
getGoals
public static MGoal[] getGoals(Properties ctx)
Get Accessible Goals- Parameters:
ctx
- context- Returns:
- array of goals
-
getTestGoals
public static MGoal[] getTestGoals(Properties ctx)
Create Test Goals- Parameters:
ctx
- context- Returns:
- array of goals
-
getMeasureGoals
public static MGoal[] getMeasureGoals(Properties ctx, int PA_Measure_ID)
Get Goals with Measure- Parameters:
ctx
- contextPA_Measure_ID
- measure- Returns:
- goals
-
getMultiplier
public static BigDecimal getMultiplier(MGoal goal)
Get Multiplier from Scope to Display- Parameters:
goal
- goal- Returns:
- null if error or multiplier
-
getRestrictions
public MGoalRestriction[] getRestrictions(boolean reload)
Get Restriction Lines- Parameters:
reload
- reload data- Returns:
- array of lines
-
getMeasure
public MMeasure getMeasure()
Get Measure- Returns:
- measure or null
-
updateGoal
public boolean updateGoal(boolean force)
Update/save Goals for the same measure- Parameters:
force
- force to update goal (default once per day)- Returns:
- true if updated
-
setMeasureActual
public void setMeasureActual(BigDecimal MeasureActual)
Set Measure Actual- Specified by:
setMeasureActual
in interfaceI_PA_Goal
- Overrides:
setMeasureActual
in classX_PA_Goal
- Parameters:
MeasureActual
- actual
-
setGoalPerformance
public void setGoalPerformance()
Calculate Performance Goal as multiplier
-
getGoalPerformanceDouble
public double getGoalPerformanceDouble()
Get Goal Performance as Double- Returns:
- performance as multipier
-
getPercent
public int getPercent()
Get Goal Performance in Percent- Returns:
- performance in percent
-
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 interfaceI_PA_Goal
- Overrides:
getMeasureDisplay
in classX_PA_Goal
- Returns:
- Measure Display
-
getXAxisText
public String getXAxisText()
Get Measure Display Text- Returns:
- Measure Display Text
-
isTarget
public boolean isTarget()
Goal has Target- Returns:
- true if target
-
toString
public String toString()
String Representation
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
-