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
public class MWorkflow extends X_AD_Workflow implements ImmutablePOSupport
WorkFlow Model- 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:
- Serialized Form
-
-
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_Wizard
-
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_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
Constructors Constructor Description MWorkflow(Properties ctx, int AD_Workflow_ID, String trxName)
Create/Load WorkflowMWorkflow(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMWorkflow(Properties ctx, MWorkflow copy)
MWorkflow(Properties ctx, MWorkflow copy, String trxName)
MWorkflow(MWorkflow copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
afterSave(boolean newRecord, boolean success)
After Save.protected boolean
beforeSave(boolean newRecord)
Before Savestatic MWorkflow
get(int AD_Workflow_ID)
Get Workflow from Cache (immutable)static MWorkflow
get(Properties ctx, int AD_Workflow_ID)
Get Workflow from Cache (immutable)static MWorkflow
getCopy(Properties ctx, int AD_Workflow_ID, String trxName)
Get updateable copy of MWorkflow from cacheString
getDescription(boolean translated)
Get Descriptionstatic MWorkflow[]
getDocValue(Properties ctx, int AD_Client_ID, int AD_Table_ID, String trxName)
Get Doc Value Workflowlong
getDurationBaseSec()
Get Duration Base in Secondsint
getDurationCalendarField()
Get Duration CalendarFieldMWFNode
getFirstNode()
Get the first nodeString
getHelp(boolean translated)
Get Helpint
getLast(int AD_WF_Node_ID, int AD_Client_ID)
Get very Last NodeString
getName(boolean translated)
Get Nameint
getNext(int AD_WF_Node_ID, int AD_Client_ID)
Get first transition (Next Node) of IDMWFNode[]
getNextNodes(int AD_WF_Node_ID, int AD_Client_ID)
Get the next nodesprotected MWFNode
getNode(int AD_WF_Node_ID)
Get Node with ID in Workflowint
getNodeCount()
Get Number of NodesMWFNodeNext[]
getNodeNexts(int AD_WF_Node_ID, int AD_Client_ID)
Get Transitions (NodeNext) of IDMWFNode[]
getNodes(boolean ordered, int AD_Client_ID)
Get the nodesMWFNode[]
getNodesInOrder(int AD_Client_ID)
Get The Nodes in Sequence Orderint
getPrevious(int AD_WF_Node_ID, int AD_Client_ID)
Get (first) Previous Node of IDstatic int
getWorkflowSearchKey(MProduct product)
Get AD_Workflow_ID for given M_Product_IDboolean
isFirst(int AD_WF_Node_ID, int AD_Client_ID)
Is this the first Nodeboolean
isLast(int AD_WF_Node_ID, int AD_Client_ID)
Is this the last Nodeboolean
isValidFromTo(Timestamp date)
Check if the workflow is valid for given datestatic void
main(String[] args)
mainMWorkflow
markImmutable()
mark PO as immutablevoid
reloadNodes()
static ProcessInfo
runDocumentActionWorkflow(PO po, String docAction)
MWFProcess
start(ProcessInfo pi)
Deprecated.MWFProcess
start(ProcessInfo pi, String trxName)
Start Workflow.MWFProcess
startWait(ProcessInfo pi)
Start Workflow and Wait for completion.String
toString()
String RepresentationString
validate()
Validate workflow.-
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, setYield
-
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_AD_Workflow
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
-
MWorkflow
public MWorkflow(Properties ctx, int AD_Workflow_ID, String trxName)
Create/Load Workflow- Parameters:
ctx
- ContextAD_Workflow_ID
- IDtrxName
- transaction
-
MWorkflow
public MWorkflow(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MWorkflow
public MWorkflow(MWorkflow copy)
- Parameters:
copy
-
-
MWorkflow
public MWorkflow(Properties ctx, MWorkflow copy)
- Parameters:
ctx
-copy
-
-
MWorkflow
public MWorkflow(Properties ctx, MWorkflow copy, String trxName)
- Parameters:
ctx
-copy
-trxName
-
-
-
Method Detail
-
get
public static MWorkflow get(int AD_Workflow_ID)
Get Workflow from Cache (immutable)- Parameters:
AD_Workflow_ID
- id- Returns:
- workflow
-
get
public static MWorkflow get(Properties ctx, int AD_Workflow_ID)
Get Workflow from Cache (immutable)- Parameters:
ctx
- contextAD_Workflow_ID
- id- Returns:
- workflow
-
getCopy
public static MWorkflow getCopy(Properties ctx, int AD_Workflow_ID, String trxName)
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 Workflow- Parameters:
ctx
- contextAD_Client_ID
- clientAD_Table_ID
- table- Returns:
- document value workflow array or null
-
getNodeCount
public int getNodeCount()
Get Number of Nodes- Returns:
- number of nodes
-
getNodes
public MWFNode[] getNodes(boolean ordered, int AD_Client_ID)
Get the nodes- Parameters:
ordered
- ordered arrayAD_Client_ID
- for client- Returns:
- array of nodes
-
reloadNodes
public void reloadNodes()
-
getFirstNode
public MWFNode getFirstNode()
Get the first node- Returns:
- array of next nodes
-
getNode
protected MWFNode getNode(int AD_WF_Node_ID)
Get Node with ID in Workflow- Parameters:
AD_WF_Node_ID
- ID- Returns:
- node or null
-
getNextNodes
public MWFNode[] getNextNodes(int AD_WF_Node_ID, int AD_Client_ID)
Get the next nodes- Parameters:
AD_WF_Node_ID
- IDAD_Client_ID
- for client- Returns:
- array of next nodes or null
-
getNodesInOrder
public MWFNode[] getNodesInOrder(int AD_Client_ID)
Get The 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) of ID- Parameters:
AD_WF_Node_ID
- idAD_Client_ID
- for client- Returns:
- next AD_WF_Node_ID or 0
-
getNodeNexts
public MWFNodeNext[] getNodeNexts(int AD_WF_Node_ID, int AD_Client_ID)
Get Transitions (NodeNext) of ID- Parameters:
AD_WF_Node_ID
- idAD_Client_ID
- for client- Returns:
- array of next nodes
-
getPrevious
public int getPrevious(int AD_WF_Node_ID, int AD_Client_ID)
Get (first) Previous Node of ID- Parameters:
AD_WF_Node_ID
- idAD_Client_ID
- for client- Returns:
- next AD_WF_Node_ID or 0
-
getLast
public int getLast(int AD_WF_Node_ID, int AD_Client_ID)
Get very Last Node- Parameters:
AD_WF_Node_ID
- ignoredAD_Client_ID
- for client- Returns:
- next 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
- idAD_Client_ID
- for client- Returns:
- true if 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
- idAD_Client_ID
- for client- Returns:
- true if last node
-
getName
public String getName(boolean translated)
Get Name- Parameters:
translated
- translated- Returns:
- Name
-
getDescription
public String getDescription(boolean translated)
Get Description- Parameters:
translated
- translated- Returns:
- Description
-
getHelp
public String getHelp(boolean translated)
Get Help- Parameters:
translated
- translated- Returns:
- Name
-
toString
public String toString()
String Representation- Overrides:
toString
in classX_AD_Workflow
- Returns:
- info
-
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.
-
start
public MWFProcess start(ProcessInfo pi)
Deprecated.Start Workflow.- Parameters:
pi
- Process Info (Record_ID)- Returns:
- process
-
start
public MWFProcess start(ProcessInfo pi, String trxName)
Start Workflow.- Parameters:
pi
- Process Info (Record_ID)- Returns:
- process
-
startWait
public MWFProcess startWait(ProcessInfo pi)
Start 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 CalendarField- Returns:
- Calendar.MINUTE, etc.
-
validate
public String validate()
Validate workflow. Sets Valid flag- Returns:
- errors or ""
-
main
public static void main(String[] args)
main- Parameters:
args
-
-
getWorkflowSearchKey
public static int getWorkflowSearchKey(MProduct product)
Get AD_Workflow_ID for given M_Product_ID- Parameters:
product
-- Returns:
- AD_Workflow_ID
-
isValidFromTo
public boolean isValidFromTo(Timestamp date)
Check if the workflow is valid for given date- Parameters:
date
-- Returns:
- true if valid
-
markImmutable
public MWorkflow markImmutable()
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
runDocumentActionWorkflow
public static ProcessInfo runDocumentActionWorkflow(PO po, String docAction)
- Parameters:
po
-docAction
-- Returns:
- ProcessInfo
-
-