use of com.liferay.ide.kaleo.core.model.RoleType in project liferay-ide by liferay.
the class KaleoModelUtil method changeTaskAssignments.
public static void changeTaskAssignments(Task task, AssignableOp op) {
if ((task == null) || (op == null)) {
return;
}
ElementHandle<User> user = task.getUser();
user.clear();
ElementHandle<Scriptable> scripteAssignment = task.getScriptedAssignment();
scripteAssignment.clear();
ElementList<ResourceAction> resourceAction = task.getResourceActions();
resourceAction.clear();
ElementList<Role> taskRole = task.getRoles();
taskRole.clear();
switch(op.getAssignmentType().content(true)) {
case CREATOR:
user.content(true);
break;
case USER:
User content = user.content(true);
content.copy(op.getImpliedUser());
break;
case ROLE:
final Role newRole = taskRole.insert();
newRole.copy(op.getImpliedRole());
break;
case ROLE_TYPE:
for (Role role : op.getRoles()) {
Role newRoleType = taskRole.insert();
newRoleType.copy(role);
Value<RoleType> roleType = role.getRoleType();
newRoleType.setRoleType(roleType.content(true));
Value<Boolean> autoCreate = role.getAutoCreate();
if (autoCreate.content() != null) {
newRoleType.setAutoCreate(autoCreate.content());
}
}
break;
case SCRIPTED_ASSIGNMENT:
Scriptable scriptable = scripteAssignment.content(true);
Scriptable impliedScriptable = op.getImpliedScriptable();
Value<ScriptLanguageType> scriptLanguageType = impliedScriptable.getScriptLanguage();
scriptable.setScriptLanguage(scriptLanguageType.content(true));
scriptable.setScript("/*specify script assignment */");
break;
case RESOURCE_ACTIONS:
for (ResourceAction ra : op.getResourceActions()) {
ResourceAction newResourceAction = resourceAction.insert();
newResourceAction.copy(ra);
}
break;
}
}
Aggregations