Task proxy of quickflow-taskdelegation

Source: Internet
Author: User
Tags eventbus

1) Overview

The latest version of quickflow adds the task proxy function.

The so-called proxy means that you can configure other users in advance to process all the tasks in place of yourself in the specified time period.

The default proxy configuration of quickflow is implemented using a list. The style is as follows:

2) How to enable proxy

By default, the proxy is not enabled. To enable the proxy, first create a list, as shown in. The list name is quickflowdelegation. Field:

Delegateduser, user type, cannot be blank;

Delegateuser, user type, cannot be blank;

Begintime, time type, can be blank;

Endtime, time type, can be blank;

Enabled, bool type, cannot be blank;

For an English site, the quickflow installation package contains a list template file quickflowdelegationlisteng. STP. You can upload this file to the list template library and create a list based on this template.

After creating the list, open the global. config file in the c: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ layouts \ quickflow directory. Uncomment taskdelegationprovider as follows:

<? XML version = "1.0" encoding = "UTF-8"?> <Globalconfiguration xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: XSD = "http://www.w3.org/2001/XMLSchema"> <customroleuserprovider> quickflow. core. sproleuserprovider, quickflow, version = 1.0.0.0, culture = neutral, publickeytoken = ec1e0fe6e1745628 </customroleuserprovider> <taskdelegationprovider> quickflow. core. defaulttaskdelegationprovider, quickflow, version = 1.0.0.0, culture = neutral, public Keytoken = ec1e0fe6e1745628 </taskdelegationprovider> <! -- If delegationlistsiteurl is empty, system will use current site --> <! -- <Delegationlistsiteurl> http: // codeartserver: 81/sites/S1 </delegationlistsiteurl> --> <delegationlisturl> lists/quickflowdelegation </delegationlisturl> <eventreceivers> <receiver er enabled = "false" name = "exception" type = "quickflow. eventbus. predictioneventconfigurer, quickflow, version = 1.0.0.0, culture = neutral, publickeytoken = ec1e0fe6e1745628 "/> <runner enabled =" true "name =" tracing "type =" quickflow. eventbus. tracingeventreceiver, quickflow, version = 1.0.0.0, culture = neutral, publickeytoken = ec1e0fe6e1745628 "/> </eventreceivers> </globalconfiguration>

Then restart IIS and the proxy function is enabled.

If quickflow has been deployed, you must reactivate the quickflow feature after installing the latest WSP version.

After the agent is enabled, tasks sent to the agent are automatically assigned to the agent within the validity period of the agent, but the agent still has the permission to operate the task. On the latest QF default task page, the system's workflowhisboty control also displays proxy information:

3) Extension and customization of proxy configuration

If you want to implement your own proxy configuration logic, you can implement a class, implement the itaskdelegationprovider interface, deploy it to GAC, and then modify the configuration.

Implement proxy logic by yourself. Refer to the default system-implementedCode:

Public class defaulttaskdelegationprovider: itaskdelegationprovider {// public const string listurl = "lists/quickflowdelegation"; static lookupqueryfield fielddelegateduser = new lookupqueryfield ("delegateduser "); static typedqueryfield <datetime> fieldbegintime = new typedqueryfield <datetime> ("begintime"); static typedqueryfield <datetime> fieldendtime = new typedqueryfield <datetime> ("endtime "); static queryfield fieldenabled = new queryfield ("enabled"); datetime getdate (string date) {If (string. isnullorempty (date) return datetime. minvalue; else return convert. todatetime (date) ;}# region itasdelegateprovider members public taskdelegate gettaskdelegate (spworkflowactivationproperties prop, string delegateduser) {var siteurl = globalconfiguration. getinstance (). delegationlistsiteurl; If (siteurl = NULL | string. isnullorempty (siteurl. value) {return this. gettaskdeletate (prop. web, delegateduser);} else {using (spsite site = new spsite (siteurl. value) {using (spweb web2 = site. openweb () {return this. gettaskdeletate (web2, delegateduser) ;}}} public taskdelegate gettaskdeletate (spweb, string delegateduser) {string fullurl = web. site. serverrelativeurl. trimend ('/') + "/" + globalconfiguration. getinstance (). delegationlisturl. value; splist list = NULL; try {list = web. getlist (fullurl);} catch (exception ex) {Throw new exception ("can't find the delegate confit list:" + fullurl);} spuser user = web. allusers [delegateduser]; If (user = NULL) {Throw new exception ("User doen't exist in the Web:" + delegateduser);} var now = datetime. now; var items = listquery. select (1 ). from (list ). where (fielddelegateduser = user. ID & (fieldbegintime. isnull | fieldbegintime <= now) & (fieldendtime. isnull | fieldendtime> now. adddays (-1) & (fieldenabled = 1 )). getitems (); If (items = NULL | items. count = 0) {return NULL;} var item = items [0]; spfielduservalue uservalue = item. fields. getfield ("delegateuser "). getfieldvalue (item ["delegateuser"]. tostring () as spfielduservalue; var del = new taskdelegate (); Del. delegateuser = uservalue. user. loginname; Del. begintime = This. getdate ("" + item ["begintime"]); Del. endtime = This. getdate ("" + item ["endtime"]); Return del ;}# endregion}

Note: quick flow. WSP (build101031) and later versions are supported.

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.