public KaleoTaskInstanceToken completeKaleoTaskInstanceToken( long kaleoTaskInstanceTokenId, ServiceContext serviceContext) throws PortalException, SystemException { // Kaleo task instance token KaleoTaskInstanceToken kaleoTaskInstanceToken = kaleoTaskInstanceTokenPersistence.findByPrimaryKey(kaleoTaskInstanceTokenId); kaleoTaskInstanceToken.setCompletionUserId(serviceContext.getUserId()); kaleoTaskInstanceToken.setCompleted(true); kaleoTaskInstanceToken.setCompletionDate(new Date()); kaleoTaskInstanceTokenPersistence.update(kaleoTaskInstanceToken, false); // Kaleo task assignment instance kaleoTaskAssignmentInstanceLocalService.completeKaleoTaskInstanceToken( kaleoTaskInstanceTokenId, serviceContext); // Kaleo timers kaleoTimerInstanceTokenLocalService.completeKaleoTimerInstanceTokens( kaleoTaskInstanceToken.getKaleoInstanceTokenId(), serviceContext); return kaleoTaskInstanceToken; }
protected KaleoTaskInstanceToken addKaleoTaskInstanceToken() throws Exception { long pk = RandomTestUtil.nextLong(); KaleoTaskInstanceToken kaleoTaskInstanceToken = _persistence.create(pk); kaleoTaskInstanceToken.setGroupId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setCompanyId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setUserId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setUserName(RandomTestUtil.randomString()); kaleoTaskInstanceToken.setCreateDate(RandomTestUtil.nextDate()); kaleoTaskInstanceToken.setModifiedDate(RandomTestUtil.nextDate()); kaleoTaskInstanceToken.setKaleoDefinitionId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setKaleoInstanceId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setKaleoInstanceTokenId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setKaleoTaskId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setKaleoTaskName(RandomTestUtil.randomString()); kaleoTaskInstanceToken.setClassName(RandomTestUtil.randomString()); kaleoTaskInstanceToken.setClassPK(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setCompletionUserId(RandomTestUtil.nextLong()); kaleoTaskInstanceToken.setCompleted(RandomTestUtil.randomBoolean()); kaleoTaskInstanceToken.setCompletionDate(RandomTestUtil.nextDate()); kaleoTaskInstanceToken.setDueDate(RandomTestUtil.nextDate()); kaleoTaskInstanceToken.setWorkflowContext(RandomTestUtil.randomString()); _kaleoTaskInstanceTokens.add(_persistence.update(kaleoTaskInstanceToken)); return kaleoTaskInstanceToken; }
@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()); }