OFBiz workflow source code learning (2)-wfexecutionobject Interface

Source: Internet
Author: User
Wfexecutionobject interface and implementation

1. Overview

The wfexecutionobject interface is an abstract basic class interface that defines the attributes, statuses, and operations of the wfprocess and wfacti.pdf public. The status returned by the wfexecutionobject operation is different from the Process status. Wfexecutionobject provides a way to get the current state and complete the transition from the current State to another State. However, the state of wfexecutionobject is the state of the execution object, and the state of wfprocess is the state of the process. There is no inevitable relationship between them.

 

2. Attributes and corresponding methods

2.1 name

The name attribute is the descriptive name of the workflow execution object. The acquisition and setting of the name attribute are completed through genericdelegator and workeffortid:

Public string name () throws wfexception {

Return getruntimeobject (). getstring ("workeffortname ");

}

Public void setname (string newvalue) throws wfexception {

Genericvalue dataobject = getruntimeobject ();

Try {

Dataobject. Set ("workeffortname", newvalue );

Dataobject. Store ();

} Catch (genericentityexception e ){

Throw new wfexception (E. getmessage (), e );

}

}

2.2 key

Key is the unique identifier of the workflow execution object. Each process has a unique key in the process set generated by a specific workflow manager. Each activity contains a unique key in the activity set. When a workflow execution object is generated, the workflow manager assigns a specific key to it.

A key is different from an object identifier. It is a reference for a flow or activity in the life cycle of the workflow execution object. It is represented by activityid or processid.

2.3 process_context

Process_context is the process-related data that defines the execution object environment. It is described by a series of name attributes. Process_context is expressed by a series of name-value pairs. The acquisition and setting of process_context are implemented through runtimedataid and genericvalue.

2.4 priority

The valid values of priority are between 0 and 5. One is highest, the other is normal, and the other is other.

2.5 last_state_time

Indicates the time when the last state changes, as shown below:

Public timestamp laststatetime () throws wfexception {

Genericvalue dataobject = getruntimeobject ();

 

If (dataobject = NULL | dataobject. Get ("laststatusupdate") = NULL)

Throw new wfexception ("No runtime object or status has never been set .");

Return dataobject. gettimestamp ("laststatusupdate ");

}

 

3. Status

The overall status is divided into open and closed.

Open is divided into open. Running and open. not_running.

Open. not_running is divided into not_running.not_started and not_running.suincluded.

Closed is divided into closed. Completed, closed. terminated, and closed. aborted.

From not_running.suincluded to open. Running, the resume () method should be used. In addition, the terminate () method, abort () method, or complete () method can be called, and the suspend () method can be in the corresponding state. Of course, the most common way to change the state is to use the changestate (INT state) method.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.