"Go" Silverlight All-open source Workflow Designer

Source: Internet
Author: User
Tags silverlight

Statement

This workflow is a workflow of passive data-triggering patterns that authors have conceived and designed themselves. There is no compliance with various existing workflow design criteria (such as WFMC or WSFL) and no interface specification with other working flow. More of this is the author's idea of the use of workflow, and the usefulness of the workflow in the daily office. So, if you are a person who follows a variety of standards and norms, please consult the following as appropriate. If you are more focused on reality and practicality, then follow the footsteps of the author to understand the implementation of this workflow.

Introduced

The SV workflow is divided into two main components: Workflow Designer and Workflow engine. have been developed based on visual Studio + FramWork4.5. The Workflow Designer is a fully visualized operation mode based on SILVERLIGHT5 development. The workflow engine is a standalone engine class library that is developed based on the C # language. Combined with the ASP. NET MVC4 framework, the design and use of the entire workflow is better done. The working principle and usage of the Workflow designer and engine are described in detail below.

Overview

There are already many formed and powerful workflow designers on the market, many of which are based on scripts or plug-ins to complete the corresponding design operations. The author himself has tried some workflow designers, almost all of the operating environment has a very harsh requirements, this for the user, is undoubtedly a nightmare, because different browsers or different PCs, the environment will vary, just to display the full designer page, it is necessary to do a lot of setup or install some non-certified plug-ins. So the author chose Microsoft's Silverlight. Similar to flash, you can install the Silverlight runtime only once. And almost all browsers are operational, greatly simplifying the user's usage requirements.

Principle

The entire workflow is made up of active nodes and routing settings. The flow of nodes is based on the routing settings to achieve the logical flow, and the data of the nodes and routes are defined by the variables of the workflow.

It is also possible to understand this by first creating a workflow, then defining the variables used in the workflow, and controlling the available variables for each node through the settings of the active node. When the engine is advancing the node, the next active node is selected according to the value of the variable that determines the routing setting. We'll show you an example of this later, and here's how it works.

The active node of the workflow is based on the system role. The author abandons the former bound to the person's view, because each enterprise or the unit, the basic job is basically fixed, the change is only the person, but we speak the system role, may also contain many functions, so no matter how personnel's position changes, will not affect the circulation logic. This can greatly reduce the maintenance work of the workflow. What we have to do here is to make the relationship between the system role and the job well done, of course, this is the need for us to pay some cautious and workload, for our workflow, this must have, but we do not say this here, because this involves the whole system of the foundation, and there are a lot of implementation methods, and different, The following diagrams provide only a diagram of the roles, titles, people, and permissions that the author implements for reference.

Use

We open the Workflow designer and see the following interface:

Includes six function buttons, and an empty design interface. We can load the contents of a workflow by clicking New Workflow or open workflow. Here, suppose we want to set up a process of leave, which involves two active nodes, one is a leave of absence of the single data node, one is to audit the absence of the node. We click on "New Workflow" and the following interface will appear:

A green and Red node appears in the Settings page, we call the Green node as the start node, the Red node as the end node, and all the workflows contain the two nodes, all starting from the start node and ending with the end node. The gray dots in the start node are drag-and-drop to create the routing settings.

A workflow with no active node has been created, the next thing we want to do is to define the variables involved in the workflow, we want to create a process of leave, the data involved should be: leave person, leave reason, leave start date, leave end date and audit status. Move the mouse to the blank space inside the designer, click the right mouse button, the Settings page will pop up the workflow as follows:

Here we can set the name and description of this workflow, as well as define the variables involved in the workflow, the types of variables include: single-line character type, multi-line character type, HTML format character type, integer type, numeric type, date type, date time type, selection type.

For our leave list, we create the following variables: Leave person (single-line character type), leave reason (multiline character type), leave start date (date type), leave end date (date type), allow (select), Audit description (multiline character type). In addition to the audit note, the other variables are not allowed to empty, when the variable type is selected, we also have to click the "..." button in the back, to choose the content of the settings, whether to allow variables, we set two options, one is allowed, one is not allowed. The order of variables in the variable list can be arbitrarily adjusted, and the order of the variables will affect the ordering of the fields when the user fills out the form. Such as:

Click the OK button, and a workflow framework with a workflow name and variable is already complete. The next step is to create the relevant nodes and make routing between the nodes.

We continue to click the "Add Activity" button, at this time, the Setup interface will be more than a rectangular node, this rectangular node, is our active node, can be moved by the mouse to the active node, the mouse moved to the rectangular border and drag points between the white space, hold down the left mouse button to move the active node. The start and end nodes can also be moved. We add two active nodes and move those nodes, such as:

According to our process design, the first activity node should be the leave to fill out the data, the second node is the manager of the absence of the audit action, we start from the start node, by dragging points, the relationship between these nodes to create, the mouse hold the drag point, drag to the next node above, loosen, To establish the routing relationship between nodes, we need to establish a routing relationship as follows, from the start node to fill out the absence form to the audit form to the end of the process. Such as:

At this point we have the approximate flow of the workflow is set, and then, the active node and the route to the setup, to achieve our flow logic. Let's first set up the active node, move the mouse to the first node, right-click the first node, and the popup setting box is as follows:

The settings for the active node have 4 large items: properties, execution roles, variables, reminders.

Properties: Sets the name of the active node and the way the node is submitted, in two ways, one is "post-processing by any one of the roles", and the other is "everyone in the role commits after processing."

Any person in the role commits after processing: in all roles specified in the execution role item, any one of them commits the commit operation.

Everyone in the role commits after processing: in all roles specified in the execution role item, all people are processed before committing.

In this option, we set the active node name to: Fill out the leave slip; the commit node is: any one in the role is processed and submitted.

Select the execution role entry, and the Settings page appears as follows:

On the Specify Execution role page, we can set the type of role to operate on this active node.

This activity is handled by the initiator: Once this is selected, the following list of roles will not be allowed to be selected, meaning that this node will only be manipulated by the workflow's initiator.

This activity is processed by a dynamically assigned person in the previous activity: Once this option is selected, the role list will not be allowed to be selected, meaning that in the process of workflow, the handler of this node is dynamically specified by the performer of the previous node, and after selecting this option, you can also make a setting that is specified once. This means that if the node has an opportunity to execute more than once throughout the workflow, the performer of the previous node is dynamically specified each time it executes, or only once, and then the first assigned person is executed.

System role Selection list: Select the role that can execute the node, and then click the ">" button to add to the right of the current node execution role. In the current node execution role list, you can also set up the current role and the initiator's institutional or departmental relationship, there are three items, no designation, same agency, same department. No designation means no judgment, as long as the person in this list of roles can be processed; the same organization means that the handler in this execution role list must be in the same organization as the initiator to process The same department means that the handler in this execution role list must be in the same organization and within the same department as the initiator to process. This relationship setting can greatly improve the scope of our workflow.

In this option, we select: This activity is handled by the initiator.

The settings page for selecting the variable entry appears as follows:

Here, we can see all the variables set in the workflow and add the variables that the active node needs to handle to the list of currently active variables on the right. When a variable is added to the list of currently active variables, it is also possible to make a read-only setting on the variable, and if the variable is read-only in the Read-only check box, the property of the active node is only read-only and allowed to be modified.

This option, we add the leave person, leave of absence, leave start date, leave end date to the current active variable, and are all variables that can be edited.

Select the reminder option and the following interface appears:

The purpose of this tab is to set up some informational reminders for the handler of this node when the workflow flows to this active node.

Reminder type: Includes never remind, immediate reminder, delay reminder. Never remind you that you do not need to remind the handler of this node; Immediately reminds, that is, once the process is executed to the node, the handler of this node is alerted immediately; time delay reminder, when this option is selected, the following delay value is required, meaning that when executing to the node, if within the specified delay time, has not yet been processed, the handler for the node has been alerted.

Repeat reminder type: This item can be set to not repeat and repeat when the reminder type is in addition to the never-reminder option, and you need to set the recurrence interval after the repeat reminder is selected.

We choose never to remind.

After setting up the related items for this activity node, we click OK to complete the settings for that node.

At this point, the first active node in the designer has a "fill out a list of leave" subscript

Next, we use the same method to set the second active node, we set its name as "Audit Absence form", the active node submission method, we also select "any one in the role of processing after the submission."

When you choose to perform a role, we select the manager role and set the current role with the initiator's institutional or departmental relationship as "same as the department", such as:

This means that only the person who is the same department as the originator of the leave list and the manager role can handle this node.

Variable tab, we add all of the variables to the current list of active variables, but

Leave, leave, leave start date, leave end date These four variables are set to read-only, such as:

In other words, when the manager reviews the four read-only variables, he only has the right to view, no modification, and he can only set the two variables to allow and audit instructions.

Reminders tab, we still choose never to remind. Click OK to complete the settings for the second active node, such as:

So far, we've set up the workflow and workflow's active node, which is already a workflow that can be executed, but this workflow is not logical analysis ability, we also need to set up the route, in order to let the process in accordance with our intention to flow.

We look at the current workflow, a total of three routes, an arrow represents a route, we probably to analyze the first route, very clear, from the beginning of the process, directly to the first node, is to be the initiator to fill out the absence of single data, completed the absence of data, directly submitted to the audit of the absence of the node, Process has been here, there is no problem, we look at the last route, the audit of the absence of a single processing completed, directly to the completion of the process node. The whole process seems to be missing something. Yes, the lack of the initiator and auditor interaction links, if it is directly through the audit, directly to the process is complete, there is no objection. But what if the audit didn't pass? Need to give feedback on the review to the person where the leave, how to do?

Well, we need to add a route to the process at this point, which is to return from the audit leave single node to the route that fills out the leave single node. We hold the mouse down the review of the drop-off list, drag to fill out the absence of a single node after the drop, at this time our flowchart has become the following,

Between the two active nodes, there are two routes, it can be seen that the basic can achieve the exchange of information between two nodes.

Here need to explain: the route can be set or not set, if it involves the logical flow between nodes, you need to set the route, if it is a simple line of the process, you can not set the path, the process will follow the steps, a node of a node execution down.

For our process, we also only need to audit the absence of a node two nodes out of the routing settings, we first set out from the audit of the absence of a single node to the end of the process node route. Move the mouse over the route, right-click, bounce out by setting box as follows:

Route Name: We fill in the "Audit pass and end process".

Routing rules are formed by contrasting the values of the variables in the workflow, where multiple variable comparison rules can be added to form a routing rule. The relationship between the rules of multiple variables is a && (and) relationship, meaning that all the variable comparison rules are met before the route is executed. When setting up a route, we need to have a thorough understanding of this workflow in order to set the routing rules exactly.

For our leave process, we only set here whether the Allow variable equals allowed, this rule. This means that if the variable is allowed, the workflow will end directly once it is approved. Such as:

Click the OK button, and then look at our process design diagram, where the route name is displayed on this route.

Similarly, we set the route from the review of leave orders to filling out the leave order as follows:

This means that when the audit is not allowed, the data will be returned to fill out the absence of the node, so that the person who fills out the leave list can see the results of the audit, if you still need to commit, continue to submit, if you do not need to submit, you can end the process.

Once set, click the OK button and we'll look at the final process diagram:

We'll follow this flowchart to understand the whole process again.

By the process sponsor to fill out the leave list, submitted to the manager for review, if the manager to allow leave, the direct end of the process, if the manager does not allow the absence of leave, the audit information feedback to the hands of the leave, leave the person can modify the leave information and then submit the review process, and then go through the manager audit;

In this way, we have completed the production of a leave process. Click the "Save Work" button to complete the save of this workflow, can be recalled at any time to modify or delete this workflow.

"Go" Silverlight All-open source Workflow Designer

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.