@Override public void delegate(String userId) { setDelegationState(DelegationState.PENDING); if (getOwner() == null) { setOwner(getAssignee()); } setAssignee(userId); }
@Override public void delegate(String userId) { setDelegationState(DelegationState.PENDING); if (getOwner() == null) { setOwner(getAssignee()); } setAssignee(userId); }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); ensureNotNull("Cannot find task with id " + taskId, "task", task); checkDeleteIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(null); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(null); } else { task.deleteIdentityLink(userId, groupId, type); } return null; }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); ensureNotNull("Cannot find task with id " + taskId, "task", task); checkDeleteIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(null); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(null); } else { task.deleteIdentityLink(userId, groupId, type); } return null; }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); EnsureUtil.ensureNotNull("Cannot find task with id " + taskId, "task", task); checkAddIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(userId); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(userId); } else { task.addIdentityLink(userId, groupId, type); } return null; }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); EnsureUtil.ensureNotNull("Cannot find task with id " + taskId, "task", task); checkAddIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(userId); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(userId); } else { task.addIdentityLink(userId, groupId, type); } return null; }
public void testRemoveChangeWhenSetBackToTheOrgValue() { TaskEntity entity = new TaskEntity(); // set an owner (default is null) entity.setOwner("icke"); // should track this change assertFalse(entity.getPropertyChanges().isEmpty()); // reset the owner entity.setOwner(null); // the change is removed assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testNotTrackChangeToTheSameValue() { TaskEntity entity = new TaskEntity(); // get and set a properties entity.setPriority(entity.getPriority()); entity.setOwner(entity.getOwner()); entity.setFollowUpDate(entity.getFollowUpDate()); // should not track this change assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testAllTrackedProperties() { Date yesterday = new Date(new Date().getTime() - 86400000); Date tomorrow = new Date(new Date().getTime() + 86400000); TaskEntity entity = new TaskEntity(); // call all tracked setter methods entity.setAssignee("er"); entity.setDelegationState(DelegationState.PENDING); entity.setDeleted(true); entity.setDescription("a description"); entity.setDueDate(tomorrow); entity.setFollowUpDate(yesterday); entity.setName("to do"); entity.setOwner("icke"); entity.setParentTaskId("parent"); entity.setPriority(73); // and validate the change list Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue()); assertTrue((Boolean) changes.get(DELETE).getNewValue()); assertEquals("a description", changes.get(DESCRIPTION).getNewValue()); assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue()); assertEquals(yesterday, changes.get(FOLLOW_UP_DATE).getNewValue()); assertEquals("to do", changes.get(NAME).getNewValue()); assertEquals("icke", changes.get(OWNER).getNewValue()); assertEquals("parent", changes.get(PARENT_TASK).getNewValue()); assertEquals(73, changes.get(PRIORITY).getNewValue()); }
@Override public void delegate(String userId) { setDelegationState(DelegationState.PENDING); if (getOwner() == null) { setOwner(getAssignee()); } setAssignee(userId); }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); EnsureUtil.ensureNotNull("Cannot find task with id " + taskId, "task", task); checkAddIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(userId); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(userId); } else { task.addIdentityLink(userId, groupId, type); } return null; }
public Void execute(CommandContext commandContext) { ensureNotNull("taskId", taskId); TaskManager taskManager = commandContext.getTaskManager(); task = taskManager.findTaskById(taskId); ensureNotNull("Cannot find task with id " + taskId, "task", task); checkDeleteIdentityLink(task, commandContext); if (IdentityLinkType.ASSIGNEE.equals(type)) { task.setAssignee(null); } else if (IdentityLinkType.OWNER.equals(type)) { task.setOwner(null); } else { task.deleteIdentityLink(userId, groupId, type); } return null; }
public void testRemoveChangeWhenSetBackToTheOrgValue() { TaskEntity entity = new TaskEntity(); // set an owner (default is null) entity.setOwner("icke"); // should track this change assertFalse(entity.getPropertyChanges().isEmpty()); // reset the owner entity.setOwner(null); // the change is removed assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testNotTrackChangeToTheSameValue() { TaskEntity entity = new TaskEntity(); // get and set a properties entity.setPriority(entity.getPriority()); entity.setOwner(entity.getOwner()); entity.setFollowUpDate(entity.getFollowUpDate()); // should not track this change assertTrue(entity.getPropertyChanges().isEmpty()); }
public void testAllTrackedProperties() { Date yesterday = new Date(new Date().getTime() - 86400000); Date tomorrow = new Date(new Date().getTime() + 86400000); TaskEntity entity = new TaskEntity(); // call all tracked setter methods entity.setAssignee("er"); entity.setDelegationState(DelegationState.PENDING); entity.setDeleted(true); entity.setDescription("a description"); entity.setDueDate(tomorrow); entity.setFollowUpDate(yesterday); entity.setName("to do"); entity.setOwner("icke"); entity.setParentTaskId("parent"); entity.setPriority(73); // and validate the change list Map<String, PropertyChange> changes = entity.getPropertyChanges(); assertEquals("er", changes.get(ASSIGNEE).getNewValue()); assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue()); assertTrue((Boolean) changes.get(DELETE).getNewValue()); assertEquals("a description", changes.get(DESCRIPTION).getNewValue()); assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue()); assertEquals(yesterday, changes.get(FOLLOW_UP_DATE).getNewValue()); assertEquals("to do", changes.get(NAME).getNewValue()); assertEquals("icke", changes.get(OWNER).getNewValue()); assertEquals("parent", changes.get(PARENT_TASK).getNewValue()); assertEquals(73, changes.get(PRIORITY).getNewValue()); }