Fórum
Regarding Workflow process definition file
vasudha karri, modificado 11 Anos atrás.
Regarding Workflow process definition file
New Member Postagens: 17 Data de Entrada: 03/05/12 Postagens Recentes
Hi
I wrote a two level scripted work flow,when a user logs in i got the role assigned to him,based on his role i assigned to another role.
here in my case
first level role is->Departmental user
second level role is->Department head
My problem is if a department is added then again i need to add one more if condition to the workflow and upload it again.
Can i read a property file in a workflow process definition file?So that in the property i can add the all the department user roles to one value and all the departmetal head role to other value(example: keys=dept_role_1,dept_role_2 values=dept_head-1,dept_head_2) so that even when a new department is added i can just modify the property file instead of process definition file. Any suggestion is really appreciated
A part of my process definition file looks like below
<assignments>
<scripted-assignment>
<script>
<![CDATA[
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import java.util.List;
long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
long userId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
System.out.println(userId);
List<Role> uroles=RoleLocalServiceUtil.getUserRoles(userId);
roles = new ArrayList<Role>();
String roleName=null;
for(Role urole:uroles)
{
roleName=urole.getName();
System.out.println(roleName);
if(roleName.equals("dept_role_1"))
{
System.out.println("in admin");
Role role = RoleLocalServiceUtil.getRole(companyId, "dept_head_1");
roles.add(role);
break;
}
if(roleName.equals("dept_role_2 "))
{
System.out.println("in gad");
Role role = RoleLocalServiceUtil.getRole(companyId, "dept_head_2");
roles.add(role);
break;
}
}
user = null;
]]>
</script>
<script-language>groovy</script-language>
</scripted-assignment>
</assignments>
Thanks & Regards
K.Vasudha
I wrote a two level scripted work flow,when a user logs in i got the role assigned to him,based on his role i assigned to another role.
here in my case
first level role is->Departmental user
second level role is->Department head
My problem is if a department is added then again i need to add one more if condition to the workflow and upload it again.
Can i read a property file in a workflow process definition file?So that in the property i can add the all the department user roles to one value and all the departmetal head role to other value(example: keys=dept_role_1,dept_role_2 values=dept_head-1,dept_head_2) so that even when a new department is added i can just modify the property file instead of process definition file. Any suggestion is really appreciated
A part of my process definition file looks like below
<assignments>
<scripted-assignment>
<script>
<![CDATA[
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.RoleLocalServiceUtil;
import java.util.List;
long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
long userId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
System.out.println(userId);
List<Role> uroles=RoleLocalServiceUtil.getUserRoles(userId);
roles = new ArrayList<Role>();
String roleName=null;
for(Role urole:uroles)
{
roleName=urole.getName();
System.out.println(roleName);
if(roleName.equals("dept_role_1"))
{
System.out.println("in admin");
Role role = RoleLocalServiceUtil.getRole(companyId, "dept_head_1");
roles.add(role);
break;
}
if(roleName.equals("dept_role_2 "))
{
System.out.println("in gad");
Role role = RoleLocalServiceUtil.getRole(companyId, "dept_head_2");
roles.add(role);
break;
}
}
user = null;
]]>
</script>
<script-language>groovy</script-language>
</scripted-assignment>
</assignments>
Thanks & Regards
K.Vasudha
Gail Hernandez, modificado 11 Anos atrás.
RE: Regarding Workflow process definition file
Hitoshi Ozawa, modificado 11 Anos atrás.
RE: Regarding Workflow process definition file
Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
As Gail replied, you'll probably get better response to your question if you create a new thread in the Developer forum:
http://www.liferay.com/community/forums/-/message_boards/category/239390
http://www.liferay.com/community/forums/-/message_boards/category/239390