我有下一个工作流程:
用户填写动态数据列表中配置的某些字段,然后点击提交。
具有请愿分析器角色的用户可以将请愿分配给自己。然后他可以做下面三件事:解决它 - 通知创建者关于此,询问详细信息 - 请愿书返回给创建者,将其转发给组织。
反过来,组织可以解决请愿或要求提供详细信息。 我创建了两个用户,user1和user2属于该组织,并具有安全角色的角色。
除了请愿分析员决定将请愿书转发给组织的时候,一切都很有效。该任务未出现在"我的工作流程任务"属于该组织的任何用户的菜单。 如果我将"转发给组织"任务到请愿分析器,请愿分析器接收任务,所以,我相信,工作流程是正确创建的。或者不是......这是你的决定。
我担心的角色,用户,组织创建。我创建了一个角色"安全角色"类型"组织",一个名为"组织A"并且用户:user1,user2被添加到组织A并分配角色"安全角色"。当我以user1身份登录时,我希望找到该任务并收到有关它的通知。
我在等你的sugesstions。谢谢。
这是我的工作流程:
<workflow-definition
xmlns="urn:liferay.com:liferay-workflow_6.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0.xsd">
<name>Petition workflow</name>
<description>Petition Workflow</description>
<version>1</version>
<state>
<name>created</name>
<metadata>
<![CDATA[{"xy":[36,51]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>sent it to be analyzed</name>
<target>sent it to be analyzed</target>
</transition>
</transitions>
</state>
<task>
<name>asking for details</name>
<metadata>
<![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[328,199]}]]>
</metadata>
<actions>
<action>
<name>reject</name>
<script>
<![CDATA[
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);
]]>
</script>
<script-language>javascript</script-language>
<execution-type>onAssignment</execution-type>
</action>
<notification>
<name>Notification creator that the petition was modified</name>
<template>Petition was modified by ${userName}. Please make the needed changes and resubmit.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<user />
</assignments>
<transitions>
<transition>
<name>Resubmit</name>
<target>sent it to be analyzed</target>
</transition>
</transitions>
</task>
<task>
<name>sent it to be analyzed</name>
<metadata>
<![CDATA[{"xy":[168,36]}]]>
</metadata>
<actions>
<notification>
<name>Notification petition analyzer that he needs to analyze a petition</name>
<template>${userName} sent you a ${entryType}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<notification>
<name>Notification creator, through email, that the analysis is complete</name>
<template>
The petition has been analyzed and has the following commentaries: ${taskComments}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onExit</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>Petition analyzer</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Resolve petition</name>
<target>approved</target>
</transition>
<transition>
<name>Ask for details</name>
<target>asking for details</target>
<default>false</default>
</transition>
<transition>
<name>Forward to an organization</name>
<target>forwarded to an organization</target>
</transition>
</transitions>
</task>
<task>
<name>forwarded to an organization</name>
<metadata>
<![CDATA[{"xy":[168,36]}]]>
</metadata>
<actions>
<notification>
<name>Notification user belonging to an organization that he received a task</name>
<template>${userName} sent you a ${entryType}.</template>
<template-language>freemarker</template-language>
<notification-type>email</notification-type>
<notification-type>user-notification</notification-type>
<execution-type>onAssignment</execution-type>
</notification>
<notification>
<name>Notification creator, through email, when the analysis is completed</name>
<template>
The petition has been sent to be analyzed and has the following commentaries: ${taskComments}.</template>
<template-language>freemarker</template-language>
<notification-type>user-notification</notification-type>
<notification-type>email</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onAssignment</execution-type>
</notification>
</actions>
<assignments>
<roles>
<role>
<role-type>organization</role-type>
<name>Security role</name>
</role>
</roles>
</assignments>
<transitions>
<transition>
<name>Resolve petition</name>
<target>approved</target>
</transition>
<transition>
<name>Ask for details</name>
<target>asking for details</target>
<default>false</default>
</transition>
</transitions>
</task>
<state>
<name>approved</name>
<metadata>
<![CDATA[
{"xy":[380,51]}
]]>
</metadata>
<actions>
<action>
<name>approve</name>
<script>
<![CDATA[
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus("approved"), workflowContext);
]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
<notification>
<name>Notification creator that petition has been approved</name>
<template>
The petition has been approved with the following comentaries: ${taskComments}.</template>
<template-language>freemarker</template-language>
<notification-type>user-notification</notification-type>
<recipients>
<user />
</recipients>
<execution-type>onEntry</execution-type>
</notification>
</actions>
</state>
</workflow-definition>
答案 0 :(得分:1)
我花了一些时间来寻找您的工作流程定义并在我的本地环境中进行一些测试。我设法重现相同的效果。即使所有任务都分配给了正确的用户,组织角色的通知似乎根本不起作用。
这是我在深入研究后设法看到的:
在与其他组织(或其他网站)内编辑的网络内容,而不是与角色安全角色相关联的网页内容,使得通知不适用于组织角色。
另一方面,如果你这样做:
所有通知似乎都有效!
这很奇怪,因为整个工作流似乎都在工作,无论它使用什么组织,但通知似乎与组织和处理任务密切相关。这可能是错误或功能。
<强>更新强>
查看代码 WorkflowTaskManagerImpl 类:
if ((role.getType() == RoleConstants.TYPE_SITE) ||
(role.getType() == RoleConstants.TYPE_ORGANIZATION)) {
List<UserGroupRole> userGroupRoles =
UserGroupRoleLocalServiceUtil.
getUserGroupRolesByGroupAndRole(
kaleoTaskInstanceToken.getGroupId(),
kaleoTaskAssignment.getAssigneeClassPK());
for (UserGroupRole userGroupRole : userGroupRoles) {
pooledActors.add(userGroupRole.getUserId());
}
kaleoTaskInstanceToken.getGroupId()基于保存在 kaleotaskinstancetoken 条目中的groupId。这意味着,正如我上面提到的那样:
如果您在与分配给组织角色的组织不同的组织中创建Web内容,则此部分代码将无法找到此类角色。因此,对于此任务,不会发送任何单个通知。
这可能是错误,应该由Liferay修复,或者某种功能允许将组织角色传递给与组织无直接关联的工作流定义。