public WorkflowTaskAdapter( KaleoTaskInstanceToken kaleoTaskInstanceToken, Map<String, Serializable> workflowContext) throws PortalException, SystemException { setCreateDate(kaleoTaskInstanceToken.getCreateDate()); setCompletionDate(kaleoTaskInstanceToken.getCompletionDate()); setDescription(kaleoTaskInstanceToken.getKaleoTask().getDescription()); setDueDate(kaleoTaskInstanceToken.getDueDate()); setName(kaleoTaskInstanceToken.getKaleoTask().getName()); if (workflowContext != null) { setOptionalAttributes(workflowContext); } else { setOptionalAttributes( WorkflowContextUtil.convert(kaleoTaskInstanceToken.getWorkflowContext())); } KaleoInstanceToken kaleoInstanceToken = kaleoTaskInstanceToken.getKaleoInstanceToken(); KaleoInstance kaleoInstance = kaleoInstanceToken.getKaleoInstance(); setWorkflowDefinitionId(kaleoInstance.getKaleoDefinitionId()); setWorkflowDefinitionName(kaleoInstance.getKaleoDefinitionName()); setWorkflowDefinitionVersion(kaleoInstance.getKaleoDefinitionVersion()); setWorkflowInstanceId(kaleoInstance.getKaleoInstanceId()); List<WorkflowTaskAssignee> workflowTaskAssignees = KaleoTaskAssignmentInstanceUtil.getWorkflowTaskAssignees(kaleoTaskInstanceToken); setWorkflowTaskAssignees(workflowTaskAssignees); setWorkflowTaskId(kaleoTaskInstanceToken.getKaleoTaskInstanceTokenId()); }
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); KaleoTaskInstanceToken newKaleoTaskInstanceToken = _persistence.create(pk); newKaleoTaskInstanceToken.setGroupId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setCompanyId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setUserId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setUserName(RandomTestUtil.randomString()); newKaleoTaskInstanceToken.setCreateDate(RandomTestUtil.nextDate()); newKaleoTaskInstanceToken.setModifiedDate(RandomTestUtil.nextDate()); newKaleoTaskInstanceToken.setKaleoDefinitionId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setKaleoInstanceId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setKaleoInstanceTokenId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setKaleoTaskId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setKaleoTaskName(RandomTestUtil.randomString()); newKaleoTaskInstanceToken.setClassName(RandomTestUtil.randomString()); newKaleoTaskInstanceToken.setClassPK(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setCompletionUserId(RandomTestUtil.nextLong()); newKaleoTaskInstanceToken.setCompleted(RandomTestUtil.randomBoolean()); newKaleoTaskInstanceToken.setCompletionDate(RandomTestUtil.nextDate()); newKaleoTaskInstanceToken.setDueDate(RandomTestUtil.nextDate()); newKaleoTaskInstanceToken.setWorkflowContext(RandomTestUtil.randomString()); _kaleoTaskInstanceTokens.add(_persistence.update(newKaleoTaskInstanceToken)); KaleoTaskInstanceToken existingKaleoTaskInstanceToken = _persistence.findByPrimaryKey(newKaleoTaskInstanceToken.getPrimaryKey()); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoTaskInstanceTokenId(), newKaleoTaskInstanceToken.getKaleoTaskInstanceTokenId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getGroupId(), newKaleoTaskInstanceToken.getGroupId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getCompanyId(), newKaleoTaskInstanceToken.getCompanyId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getUserId(), newKaleoTaskInstanceToken.getUserId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getUserName(), newKaleoTaskInstanceToken.getUserName()); Assert.assertEquals( Time.getShortTimestamp(existingKaleoTaskInstanceToken.getCreateDate()), Time.getShortTimestamp(newKaleoTaskInstanceToken.getCreateDate())); Assert.assertEquals( Time.getShortTimestamp(existingKaleoTaskInstanceToken.getModifiedDate()), Time.getShortTimestamp(newKaleoTaskInstanceToken.getModifiedDate())); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoDefinitionId(), newKaleoTaskInstanceToken.getKaleoDefinitionId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoInstanceId(), newKaleoTaskInstanceToken.getKaleoInstanceId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoInstanceTokenId(), newKaleoTaskInstanceToken.getKaleoInstanceTokenId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoTaskId(), newKaleoTaskInstanceToken.getKaleoTaskId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getKaleoTaskName(), newKaleoTaskInstanceToken.getKaleoTaskName()); Assert.assertEquals( existingKaleoTaskInstanceToken.getClassName(), newKaleoTaskInstanceToken.getClassName()); Assert.assertEquals( existingKaleoTaskInstanceToken.getClassPK(), newKaleoTaskInstanceToken.getClassPK()); Assert.assertEquals( existingKaleoTaskInstanceToken.getCompletionUserId(), newKaleoTaskInstanceToken.getCompletionUserId()); Assert.assertEquals( existingKaleoTaskInstanceToken.getCompleted(), newKaleoTaskInstanceToken.getCompleted()); Assert.assertEquals( Time.getShortTimestamp(existingKaleoTaskInstanceToken.getCompletionDate()), Time.getShortTimestamp(newKaleoTaskInstanceToken.getCompletionDate())); Assert.assertEquals( Time.getShortTimestamp(existingKaleoTaskInstanceToken.getDueDate()), Time.getShortTimestamp(newKaleoTaskInstanceToken.getDueDate())); Assert.assertEquals( existingKaleoTaskInstanceToken.getWorkflowContext(), newKaleoTaskInstanceToken.getWorkflowContext()); }