Package org.compiere.wf
Class MWorkflow
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_AD_Workflow
org.compiere.wf.MWorkflow
- All Implemented Interfaces:
Serializable,Cloneable,Comparator<Object>,I_AD_Workflow,I_Persistent,Evaluatee,ImmutablePOSupport
Extended WorkFlow Model for AD_Workflow
- Version:
- $Id: MWorkflow.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, www.arhipac.ro
- FR [ 2214883 ] Remove SQL code and Replace for Query
- BF [ 2665963 ] Copy Workflow name in Activity name, Silvano Trinchero, www.freepath.it
- IDEMPIERE-3209 changed functions to public to improve integration support
- See Also:
-
Field Summary
Fields inherited from class org.compiere.model.X_AD_Workflow
ACCESSLEVEL_AD_Reference_ID, ACCESSLEVEL_All, ACCESSLEVEL_ClientOnly, ACCESSLEVEL_ClientPlusOrganization, ACCESSLEVEL_Organization, ACCESSLEVEL_SystemOnly, ACCESSLEVEL_SystemPlusClient, DURATIONUNIT_AD_Reference_ID, DURATIONUNIT_Day, DURATIONUNIT_Hour, DURATIONUNIT_Minute, DURATIONUNIT_Month, DURATIONUNIT_Second, DURATIONUNIT_Year, ENTITYTYPE_AD_Reference_ID, PROCESSTYPE_AD_Reference_ID, PROCESSTYPE_BatchFlow, PROCESSTYPE_ContinuousFlow, PROCESSTYPE_DedicateRepetititiveFlow, PROCESSTYPE_JobShop, PROCESSTYPE_MixedRepetitiveFlow, PROCESSTYPE_Plant, PUBLISHSTATUS_AD_Reference_ID, PUBLISHSTATUS_Released, PUBLISHSTATUS_Test, PUBLISHSTATUS_UnderRevision, PUBLISHSTATUS_Void, WORKFLOWTYPE_AD_Reference_ID, WORKFLOWTYPE_DocumentProcess, WORKFLOWTYPE_DocumentValue, WORKFLOWTYPE_General, WORKFLOWTYPE_Manufacturing, WORKFLOWTYPE_Quality, WORKFLOWTYPE_WizardFields 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_IDFields inherited from interface org.compiere.model.I_AD_Workflow
accessLevel, COLUMNNAME_AccessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_CtxHelp_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Table_ID, COLUMNNAME_AD_WF_Node_ID, COLUMNNAME_AD_WF_Responsible_ID, COLUMNNAME_AD_Workflow_ID, COLUMNNAME_AD_Workflow_UU, COLUMNNAME_AD_WorkflowProcessor_ID, COLUMNNAME_Author, COLUMNNAME_Cost, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_Description, COLUMNNAME_DocumentNo, COLUMNNAME_DocValueLogic, COLUMNNAME_Duration, COLUMNNAME_DurationUnit, COLUMNNAME_EntityType, COLUMNNAME_Help, COLUMNNAME_IsActive, COLUMNNAME_IsBetaFunctionality, COLUMNNAME_IsDefault, COLUMNNAME_IsValid, COLUMNNAME_Limit, COLUMNNAME_MovingTime, COLUMNNAME_Name, COLUMNNAME_OverlapUnits, COLUMNNAME_Priority, COLUMNNAME_ProcessType, COLUMNNAME_PublishStatus, COLUMNNAME_QtyBatchSize, COLUMNNAME_QueuingTime, COLUMNNAME_S_Resource_ID, COLUMNNAME_SetupTime, COLUMNNAME_UnitsCycles, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValidateWorkflow, COLUMNNAME_ValidFrom, COLUMNNAME_ValidTo, COLUMNNAME_Value, COLUMNNAME_Version, COLUMNNAME_WaitingTime, COLUMNNAME_WorkflowType, COLUMNNAME_WorkingTime, COLUMNNAME_Yield, Model, Table_ID, Table_Name -
Constructor Summary
ConstructorsConstructorDescriptionMWorkflow(Properties ctx, int AD_Workflow_ID, String trxName) Create/Load WorkflowMWorkflow(Properties ctx, String AD_Workflow_UU, String trxName) UUID based ConstructorMWorkflow(Properties ctx, ResultSet rs, String trxName) Load ConstructorMWorkflow(Properties ctx, MWorkflow copy) Copy constructorMWorkflow(Properties ctx, MWorkflow copy, String trxName) Copy constructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanafterSave(boolean newRecord, boolean success) Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.protected booleanbeforeSave(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static MWorkflowget(int AD_Workflow_ID) Get Workflow from Cache (immutable)static MWorkflowget(Properties ctx, int AD_Workflow_ID) Get Workflow from Cache (immutable)static MWorkflowgetCopy(Properties ctx, int AD_Workflow_ID, String trxName) Get updateable copy of MWorkflow from cachegetDescription(boolean translated) Get Descriptionstatic MWorkflow[]getDocValue(Properties ctx, int AD_Client_ID, int AD_Table_ID, String trxName) Get Doc Value WorkflowslongGet Duration Base in SecondsintGet Duration Calendar FieldGet the first nodegetHelp(boolean translated) Get HelpintgetLast(int AD_WF_Node_ID, int AD_Client_ID) Get Last Node idgetName(boolean translated) Get NameintgetNext(int AD_WF_Node_ID, int AD_Client_ID) Get first transition (Next Node) node idMWFNode[]getNextNodes(int AD_WF_Node_ID, int AD_Client_ID) Get the next nodesprotected MWFNodegetNode(int AD_WF_Node_ID) Get Node with ID in WorkflowintGet Number of NodesgetNodeNexts(int AD_WF_Node_ID, int AD_Client_ID) Get Transitions (NodeNext) node idMWFNode[]getNodes(boolean ordered, int AD_Client_ID) Get the nodesMWFNode[]getNodesInOrder(int AD_Client_ID) Get Nodes in Sequence OrderintgetPrevious(int AD_WF_Node_ID, int AD_Client_ID) Get (first) Previous Node IDstatic KeyNamePair[]getWorkflowKeyNamePairs(boolean withEmptyElement) Get workflow records accessible to current effective role.static intgetWorkflowSearchKey(MProduct product) Get AD_Workflow_ID for given M_Product_IDbooleanisFirst(int AD_WF_Node_ID, int AD_Client_ID) Is this the first NodebooleanisLast(int AD_WF_Node_ID, int AD_Client_ID) Is this the last NodebooleanisValidFromTo(Timestamp date) Check if this workflow is valid for given datemark PO as immutablevoidReload all nodesstatic ProcessInforunDocumentActionWorkflow(PO po, String docAction) Run document action workflowstart(ProcessInfo pi) Deprecated.start(ProcessInfo pi, String trxName) Start Workflow.startWait(ProcessInfo pi) Deprecated.workflow process run in the same thread, this is meaninglesstoString()String Representationvalidate()Validate workflow configuration.
Set IsValid flag.Methods inherited from class org.compiere.model.X_AD_Workflow
get_AccessLevel, getAccessLevel, getAD_CtxHelp, getAD_CtxHelp_ID, getAD_Table, getAD_Table_ID, getAD_WF_Node, getAD_WF_Node_ID, getAD_WF_Responsible, getAD_WF_Responsible_ID, getAD_Workflow_ID, getAD_Workflow_UU, getAD_WorkflowProcessor, getAD_WorkflowProcessor_ID, getAuthor, getCost, getDescription, getDocumentNo, getDocValueLogic, getDuration, getDurationUnit, getEntityType, getHelp, getKeyNamePair, getLimit, getMovingTime, getName, getOverlapUnits, getPriority, getProcessType, getPublishStatus, getQtyBatchSize, getQueuingTime, getS_Resource, getS_Resource_ID, getSetupTime, getUnitsCycles, getValidateWorkflow, getValidFrom, getValidTo, getValue, getVersion, getWaitingTime, getWorkflowType, getWorkingTime, getYield, initPO, isBetaFunctionality, isDefault, isValid, setAccessLevel, setAD_CtxHelp_ID, setAD_Table_ID, setAD_WF_Node_ID, setAD_WF_Responsible_ID, setAD_Workflow_ID, setAD_Workflow_UU, setAD_WorkflowProcessor_ID, setAuthor, setCost, setDescription, setDocumentNo, setDocValueLogic, setDuration, setDurationUnit, setEntityType, setHelp, setIsBetaFunctionality, setIsDefault, setIsValid, setLimit, setMovingTime, setName, setOverlapUnits, setPriority, setProcessType, setPublishStatus, setQtyBatchSize, setQueuingTime, setS_Resource_ID, setSetupTime, setUnitsCycles, setValidateWorkflow, setValidFrom, setValidTo, setValue, setVersion, setWaitingTime, setWorkflowType, setWorkingTime, setYieldMethods 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_TableAttribute, get_TableAttributeAsBoolean, get_TableAttributeAsInt, get_TableAttributes, 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, validForeignKeysExMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.compiere.model.I_AD_Workflow
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActiveMethods inherited from interface org.compiere.model.I_Persistent
save
-
Constructor Details
-
MWorkflow
UUID based Constructor- Parameters:
ctx- ContextAD_Workflow_UU- UUID keytrxName- Transaction
-
MWorkflow
Create/Load Workflow- Parameters:
ctx- ContextAD_Workflow_ID- IDtrxName- transaction
-
MWorkflow
Load Constructor- Parameters:
ctx- contextrs- result settrxName- transaction
-
MWorkflow
Copy constructor- Parameters:
copy-
-
MWorkflow
Copy constructor- Parameters:
ctx-copy-
-
MWorkflow
Copy constructor- Parameters:
ctx-copy-trxName-
-
-
Method Details
-
get
Get Workflow from Cache (immutable)- Parameters:
AD_Workflow_ID- id- Returns:
- workflow
-
get
Get Workflow from Cache (immutable)- Parameters:
ctx- contextAD_Workflow_ID- id- Returns:
- workflow
-
getCopy
Get updateable copy of MWorkflow from cache- Parameters:
ctx-AD_Workflow_ID-trxName-- Returns:
- MWorkflow
-
getDocValue
public static MWorkflow[] getDocValue(Properties ctx, int AD_Client_ID, int AD_Table_ID, String trxName) Get Doc Value Workflows- Parameters:
ctx- contextAD_Client_ID- clientAD_Table_ID- tabletrxName-- Returns:
- document value workflow array or null
-
getWorkflowKeyNamePairs
Get workflow records accessible to current effective role.- Parameters:
withEmptyElement- if true, first element of the return array is an empty element with (-1,"")- Returns:
- workflow records (AD_Workflow_ID, translated name), order by name
-
getNodeCount
public int getNodeCount()Get Number of Nodes- Returns:
- number of nodes
-
getNodes
Get the nodes- Parameters:
ordered- ordered arrayAD_Client_ID- for client- Returns:
- array of nodes
-
reloadNodes
public void reloadNodes()Reload all nodes -
getFirstNode
Get the first node- Returns:
- first workflow node
-
getNode
Get Node with ID in Workflow- Parameters:
AD_WF_Node_ID- ID- Returns:
- node or null
-
getNextNodes
Get the next nodes- Parameters:
AD_WF_Node_ID- IDAD_Client_ID- for client- Returns:
- array of next nodes or null
-
getNodesInOrder
Get Nodes in Sequence Order- Parameters:
AD_Client_ID- client- Returns:
- Nodes in sequence
-
getNext
public int getNext(int AD_WF_Node_ID, int AD_Client_ID) Get first transition (Next Node) node id- Parameters:
AD_WF_Node_ID- from node idAD_Client_ID-- Returns:
- next AD_WF_Node_ID or 0
-
getNodeNexts
Get Transitions (NodeNext) node id- Parameters:
AD_WF_Node_ID- from node idAD_Client_ID-- Returns:
- array of next nodes
-
getPrevious
public int getPrevious(int AD_WF_Node_ID, int AD_Client_ID) Get (first) Previous Node ID- Parameters:
AD_WF_Node_ID- from node idAD_Client_ID-- Returns:
- next AD_WF_Node_ID or 0
-
getLast
public int getLast(int AD_WF_Node_ID, int AD_Client_ID) Get Last Node id- Parameters:
AD_WF_Node_ID- ignoredAD_Client_ID-- Returns:
- last AD_WF_Node_ID or 0
-
isFirst
public boolean isFirst(int AD_WF_Node_ID, int AD_Client_ID) Is this the first Node- Parameters:
AD_WF_Node_ID- node idAD_Client_ID-- Returns:
- true if node id is first node
-
isLast
public boolean isLast(int AD_WF_Node_ID, int AD_Client_ID) Is this the last Node- Parameters:
AD_WF_Node_ID- node idAD_Client_ID-- Returns:
- true if node id is last node
-
getName
Get Name- Parameters:
translated- translated- Returns:
- Name
-
getDescription
Get Description- Parameters:
translated- translated- Returns:
- Description
-
getHelp
Get Help- Parameters:
translated- translated- Returns:
- Name
-
toString
String Representation- Overrides:
toStringin classX_AD_Workflow- Returns:
- info
-
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:POCalled before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSavein classPO- 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:POCalled after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it. -
start
Deprecated.Start Workflow.- Parameters:
pi- Process Info (Record_ID)- Returns:
- process
-
start
Start Workflow.- Parameters:
pi- Process InfotrxName-- Returns:
- process
-
startWait
Deprecated.workflow process run in the same thread, this is meaninglessStart Workflow and Wait for completion.- Parameters:
pi- process info with Record_ID record for the workflow- Returns:
- process
-
getDurationBaseSec
public long getDurationBaseSec()Get Duration Base in Seconds- Returns:
- duration unit in seconds
-
getDurationCalendarField
public int getDurationCalendarField()Get Duration Calendar Field- Returns:
- Calendar field (Calendar.MINUTE, etc)
-
validate
Validate workflow configuration.
Set IsValid flag.- Returns:
- errors or ""
-
getWorkflowSearchKey
Get AD_Workflow_ID for given M_Product_ID- Parameters:
product-- Returns:
- AD_Workflow_ID
-
isValidFromTo
Check if this workflow is valid for given date- Parameters:
date-- Returns:
- true if valid for given date
-
markImmutable
Description copied from interface:ImmutablePOSupportmark PO as immutable- Specified by:
markImmutablein interfaceImmutablePOSupport- Returns:
- PO
-
runDocumentActionWorkflow
Run document action workflow- Parameters:
po-docAction- DocAction.ACTION_*- Returns:
- ProcessInfo
-