if (task.getPeopleAssignments() != null && task.getPeopleAssignments().getPotentialOwners() != null && task.getPeopleAssignments().getPotentialOwners().size() == 1) { OrganizationalEntity potentialOwner = task.getPeopleAssignments().getPotentialOwners().get(0); } else if (task.getPeopleAssignments() != null && task.getPeopleAssignments().getPotentialOwners() != null && task.getPeopleAssignments().getPotentialOwners().size() > 1) { if (task.getPeopleAssignments() != null && task.getPeopleAssignments().getBusinessAdministrators() != null) { List<OrganizationalEntity> businessAdmins = new ArrayList<OrganizationalEntity>(); businessAdmins.add(new User("Administrator")); businessAdmins.addAll(task.getPeopleAssignments().getBusinessAdministrators()); task.getPeopleAssignments().setBusinessAdministrators(businessAdmins);
public void nominate(long taskId, String userId, List<OrganizationalEntity> potentialOwners) { final Task task = em.find(Task.class, taskId); final User user = em.find(User.class, userId); if (isAllowed(user, null, task.getPeopleAssignments().getBusinessAdministrators())) { task.getTaskData().assignOwnerAndStatus(potentialOwners); if (task.getTaskData().getStatus() == Status.Ready) { task.getPeopleAssignments().setPotentialOwners(potentialOwners); } } else { throw new PermissionDeniedException("User " + userId + " is not allowed to perform Nominate on Task " + taskId); } } }
public long addTask(Task task, ContentData contentData) { doCallbackOperationForPeopleAssignments(task.getPeopleAssignments()); doCallbackOperationForTaskData(task.getTaskData()); doCallbackOperationForTaskDeadlines(task.getDeadlines()); em.persist(task); if (contentData != null) { Content content = new Content(contentData.getContent()); em.persist(content); task.getTaskData().setDocument(content.getId(), contentData); } return task.getId(); }
public long addTask(Task task, Map<String, Object> params) { doCallbackOperationForPeopleAssignments(task.getPeopleAssignments()); doCallbackOperationForTaskData(task.getTaskData()); doCallbackOperationForTaskDeadlines(task.getDeadlines()); if (params != null) { ContentData contentData = ContentMarshallerHelper.marshal(params, null); Content content = new Content(contentData.getContent()); em.persist(content); task.getTaskData().setDocument(content.getId(), contentData); } em.persist(task); return task.getId(); }
task.getPeopleAssignments().setPotentialOwners(potentialOwners); task.getTaskData().setActualOwner(null);
context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskForwardedEvent>() { }).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); if (task.getTaskData().getStatus().equals(Status.Ready)) { task.getTaskData().setStatus(Status.Ready); if ( !task.getPeopleAssignments().getPotentialOwners().contains(targetEntity)) { task.getPeopleAssignments().getPotentialOwners().add(targetEntity); task.getPeopleAssignments().getPotentialOwners().remove(user); noOp = false; || task.getTaskData().getStatus().equals(Status.InProgress)) { task.getTaskData().setStatus(Status.Ready); if ( !task.getPeopleAssignments().getPotentialOwners().contains(targetEntity)) { task.getPeopleAssignments().getPotentialOwners().add(targetEntity); task.getPeopleAssignments().getPotentialOwners().remove(user); noOp = false;
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskNominatedEvent>() { }).fire(task); if (CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators())) { task.getTaskData().assignOwnerAndStatus(potentialOwners); if (task.getTaskData().getStatus() == Status.Ready) { task.getPeopleAssignments().setPotentialOwners(potentialOwners); } } else { throw new PermissionDeniedException("User " + userId + " is not allowed to perform Nominate on Task " + taskId); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskNominatedEvent>() { }).fire(task); return null; }
}).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); if (!adminAllowed && !potOwnerAllowed && !ownerAllowed) { if ( !task.getPeopleAssignments().getPotentialOwners().contains(targetEntity)) { task.getPeopleAssignments().getPotentialOwners().add(targetEntity); || task.getTaskData().getStatus().equals(Status.InProgress)) { task.getTaskData().setStatus(Status.Ready); if ( !task.getPeopleAssignments().getPotentialOwners().contains(targetEntity)) { task.getPeopleAssignments().getPotentialOwners().add(targetEntity);
operationAllowed = isAllowed(user, groupIds, task.getPeopleAssignments().getPotentialOwners()); break; operationAllowed = isAllowed(user, groupIds, task.getPeopleAssignments().getBusinessAdministrators()); break; operationAllowed = task.getPeopleAssignments().getPotentialOwners().contains(user);
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskClaimedEvent>() {}).fire(task); // CHeck for potential Owner allowed (decorator?) boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); if (!potOwnerAllowed && !adminAllowed) { String errorMessage = "The user" + user + "is not allowed to Start the task "+task.getId(); throw new PermissionDeniedException(errorMessage); } if (task.getTaskData().getStatus().equals(Status.Ready)) { task.getTaskData().setStatus(Status.Reserved); task.getTaskData().setActualOwner(user); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskClaimedEvent>() {}).fire(task); return null; }
final PeopleAssignments people = task.getPeopleAssignments(); final TaskData taskData = task.getTaskData();
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskStoppedEvent>() {}).fire(task); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); if (!ownerAllowed && !adminAllowed) { String errorMessage = "The user" + user + "is not allowed to Start the task "+task.getId(); throw new PermissionDeniedException(errorMessage); } if (task.getTaskData().getStatus().equals(Status.InProgress)) { task.getTaskData().setStatus(Status.Reserved); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskStoppedEvent>() {}).fire(task); return null; }
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskActivatedEvent>() { }).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); if (!adminAllowed && !ownerAllowed) { String errorMessage = "The user" + user + "is not allowed to Start the task " + task.getId(); throw new PermissionDeniedException(errorMessage); } if (task.getTaskData().getStatus().equals(Status.Created)) { task.getTaskData().setStatus(Status.Ready); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskActivatedEvent>() { }).fire(task); return null; } }
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskStartedEvent>() {}).fire(task); // CHeck for potential Owner allowed (decorator?) boolean operationAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); if (!operationAllowed) { String errorMessage = "The user" + user + "is not allowed to Start the task "+task.getId(); throw new PermissionDeniedException(errorMessage); } if (task.getTaskData().getStatus().equals(Status.Ready)) { task.getTaskData().setStatus(Status.InProgress); task.getTaskData().setActualOwner(user); } if (task.getTaskData().getStatus().equals(Status.Reserved)) { task.getTaskData().setStatus(Status.InProgress); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskStartedEvent>() {}).fire(task); return null; }
public <T> T executeTaskCommand(TaskCommand<T> command) { if (command instanceof AddTaskCommand) { Task task = ((AddTaskCommand) command).getTask(); doCallbackOperationForPeopleAssignments(task.getPeopleAssignments()); doCallbackOperationForTaskData(task.getTaskData()); doCallbackOperationForTaskDeadlines(task.getDeadlines()); } if(command instanceof NominateTaskCommand){ List<OrganizationalEntity> potentialOwners = ((NominateTaskCommand)command).getPotentialOwners(); doCallbackOperationForPotentialOwners(potentialOwners); } command.setGroupsIds(doUserGroupCallbackOperation(command.getUserId(), command.getGroupsIds())); doCallbackUserOperation(command.getTargetEntityId()); return executor.executeTaskCommand(command); }
public Void execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Task task = context.getTaskQueryService().getTaskInstanceById(taskId); User user = context.getTaskIdentityService().getUserById(userId); context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskReleasedEvent>() {}).fire(task); // CHeck for potential Owner allowed (decorator?) boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); boolean adminAllowed = isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); if (!ownerAllowed && !adminAllowed) { String errorMessage = "The user" + user + "is not allowed to Start the task "+task.getId(); throw new PermissionDeniedException(errorMessage); } if (task.getTaskData().getStatus().equals(Status.Reserved) || task.getTaskData().getStatus().equals(Status.InProgress)) { task.getTaskData().setStatus(Status.Ready); task.getTaskData().setActualOwner(null); } context.getTaskEvents().select(new AnnotationLiteral<AfterTaskReleasedEvent>() {}).fire(task); return null; }
}).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); if (!adminAllowed && !potOwnerAllowed && !ownerAllowed) {
}).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); boolean noOp = true;
context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskExitedEvent>() { }).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators());
context.getTaskEvents().select(new AnnotationLiteral<BeforeTaskSkippedEvent>() { }).fire(task); boolean adminAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getBusinessAdministrators()); boolean initiatorAllowed = (task.getTaskData().getCreatedBy() != null && (task.getTaskData().getCreatedBy().equals(user))); boolean potOwnerAllowed = CommandsUtil.isAllowed(user, getGroupsIds(), task.getPeopleAssignments().getPotentialOwners()); boolean ownerAllowed = (task.getTaskData().getActualOwner() != null && task.getTaskData().getActualOwner().equals(user)); if (!adminAllowed && !potOwnerAllowed && !initiatorAllowed && !ownerAllowed) {