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
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:
-
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, UUID_NEW_RECORD, 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
ConstructorDescriptionMGoal
(Properties ctx, int PA_Goal_ID, String trxName) Standard ConstructorMGoal
(Properties ctx, String PA_Goal_UU, String trxName) UUID based ConstructorMGoal
(Properties ctx, String Name, String Description, BigDecimal MeasureTarget, String trxName) MGoal
(Properties ctx, ResultSet rs, String trxName) Load Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
afterSave
(boolean newRecord, boolean success) After Saveprotected boolean
beforeSave
(boolean newRecord) Before SavegetColor()
Get ColorGet the color schema for this goal.double
Get Goal Performance value as Doublestatic MGoal[]
getGoals
(Properties ctx) Get Accessible Goals ((will call updateGoal for each record)Get MeasureGet Measure Displaystatic MGoal[]
getMeasureGoals
(Properties ctx, int PA_Measure_ID) Get Goals for a performance measurementstatic BigDecimal
getMultiplier
(MGoal goal) Get Multiplier for the goal's combination of Measurement Scope and Measurement Displayint
Get Goal Performance value in PercentgetRestrictions
(boolean reload) Get Restriction Linesstatic MGoal[]
getTestGoals
(Properties ctx) Create Dummy Test Goalsstatic MGoal[]
getUserGoals
(Properties ctx, int AD_User_ID) Get User Goals (will call updateGoal for each record)Get Measure Display Textboolean
isTarget()
Goal has Targetvoid
Calculate Performance Goalvoid
setMeasureActual
(BigDecimal MeasureActual) Set Actual Measurement valuetoString()
String Representationboolean
updateGoal
(boolean force) Update/save measurement for GoalsMethods 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, buildInsertSQL, 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_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, 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, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, 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, toInsertSQL, 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 Details
-
MGoal
UUID based Constructor- Parameters:
ctx
- ContextPA_Goal_UU
- UUID keytrxName
- Transaction
-
MGoal
Standard Constructor- Parameters:
ctx
- contextPA_Goal_ID
- idtrxName
- trx
-
MGoal
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- trx
-
MGoal
public MGoal(Properties ctx, String Name, String Description, BigDecimal MeasureTarget, String trxName) - Parameters:
ctx
- contextName
- NameDescription
- DescriptionMeasureTarget
- targettrxName
- trx
-
-
Method Details
-
getUserGoals
Get User Goals (will call updateGoal for each record)- Parameters:
ctx
- contextAD_User_ID
- user- Returns:
- array of goals
-
getGoals
Get Accessible Goals ((will call updateGoal for each record)- Parameters:
ctx
- context- Returns:
- array of goals
-
getTestGoals
Create Dummy Test Goals- Parameters:
ctx
- context- Returns:
- array of goals
-
getMeasureGoals
Get Goals for a performance measurement- Parameters:
ctx
- contextPA_Measure_ID
- performance measurement- Returns:
- goals
-
getMultiplier
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
Get Restriction Lines- Parameters:
reload
- true to reload data- Returns:
- array of lines
-
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
Set Actual Measurement value- Specified by:
setMeasureActual
in interfaceI_PA_Goal
- Overrides:
setMeasureActual
in classX_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
Get Color- Returns:
- color - white if no target
-
getColorSchema
Get the color schema for this goal.- Returns:
- the color schema
-
getMeasureDisplay
Get Measure Display- Specified by:
getMeasureDisplay
in interfaceI_PA_Goal
- Overrides:
getMeasureDisplay
in classX_PA_Goal
- Returns:
- Measure Display (MEASUREDISPLAY_*)
-
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
String Representation -
beforeSave
protected boolean beforeSave(boolean newRecord) Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success) After Save
-