@Override public User newUser( String id ) { return new UserImpl(id); }
@Override public User newUser() { return new UserImpl(); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { id = in.readLong(); text = in.readUTF(); addedBy = new UserImpl(); addedBy.readExternal( in ); addedAt = new Date( in.readLong() ); }
static UserImpl convertToUserImpl(User user) { if( user == null ) { return null; } if( user instanceof UserImpl ) { return (UserImpl) user; } else { return new UserImpl(user.getId()); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { id = in.readLong(); name = in.readUTF(); accessType = AccessType.valueOf( in.readUTF() ); contentType = in.readUTF(); attachedBy = new UserImpl(); attachedBy.readExternal( in ); attachedAt = new Date( in.readLong() ); size = in.readInt( ); attachmentContentId = in.readLong(); }
public TaskFluent setAdminUser(String userId) { if(assignments.getBusinessAdministrators().isEmpty()){ List<OrganizationalEntity> businessAdmins = new ArrayList<OrganizationalEntity>(); assignments.setBusinessAdministrators(businessAdmins); } assignments.getBusinessAdministrators().add(new UserImpl(userId)); return this; }
public TaskFluent addPotentialUser(String userId) { if(assignments.getPotentialOwners().isEmpty()){ List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>(); assignments.setPotentialOwners(potentialOwners); } assignments.getPotentialOwners().add(new UserImpl(userId)); return this; }
static List<OrganizationalEntity> convertToPersistentOrganizationalEntity(List<OrganizationalEntity> orgEntList) { List<OrganizationalEntity> persistentOrgEnts = orgEntList; if( persistentOrgEnts != null && ! persistentOrgEnts.isEmpty() ) { persistentOrgEnts = new ArrayList<OrganizationalEntity>(orgEntList.size()); for( OrganizationalEntity orgEnt : orgEntList ) { if( orgEnt instanceof UserImpl || orgEnt instanceof GroupImpl ) { persistentOrgEnts.add(orgEnt); } else if( orgEnt instanceof User ) { persistentOrgEnts.add(new UserImpl(orgEnt.getId())); } else if( orgEnt instanceof Group ) { persistentOrgEnts.add(new GroupImpl(orgEnt.getId())); } else { throw new IllegalStateException("Unknown user or group object: " + orgEnt.getClass().getName() ); } } } return persistentOrgEnts; } }
public TaskFluent setCreatedBy(String userId){ ((TaskDataImpl)task.getTaskData()).setCreatedBy(new UserImpl(userId)); return this; }
public static List<OrganizationalEntity> readOrganizationalEntityList(ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); List<OrganizationalEntity> list = new ArrayList<OrganizationalEntity>(size); for ( int i = 0; i < size; i++ ) { short type = in.readShort(); if ( type == 0 ) { User user = new UserImpl(); user.readExternal( in ); list.add( user ); } else { Group group = new GroupImpl(); group.readExternal( in ); list.add( group ); } } return list; } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { if ( in.readBoolean() ) { taskInitiator = new UserImpl(); taskInitiator.readExternal( in ); } potentialOwners = CollectionUtils.readOrganizationalEntityList( in ); excludedOwners = CollectionUtils.readOrganizationalEntityList( in ); taskStakeholders = CollectionUtils.readOrganizationalEntityList( in ); businessAdministrators = CollectionUtils.readOrganizationalEntityList( in ); recipients = CollectionUtils.readOrganizationalEntityList( in ); }
public void testClaimIsAllowedExcludedOwner() { User testUser = new UserImpl("BB8");
public void testDelegateIsAllowedExcludedOwnerBusinessAdministrator() { User testUser = new UserImpl("BB8");
@Test public void testGetUserTaskLoad() { // Prepare and claim 6 tasks by The Emperor for (int x = 0; x < 6; x++) { TaskFluent task = new TaskFluent() .setName("CalculatorTask1") .addPotentialUser(DARTH_VADER) .setDeploymentID(DEPLOYMENT_ID) .setProcessId(PROCESS_ID) .setAdminUser(ADMIN); createTaskWithoutAssert(task); } User userVader = new UserImpl(DARTH_VADER); TaskContext ctx = new TaskContext(); EntityManager em = emf.createEntityManager(); ctx.setPersistenceContext(new JPATaskPersistenceContext(em)); LoadCalculator calculator = new TotalCompletionTimeLoadCalculator(); Double userTaskLoad = calculator.getUserTaskLoad(userVader, ctx).getCalculatedLoad(); Double userTaskLoads = calculator.getUserTaskLoads(Collections.singletonList(userVader), ctx).iterator().next().getCalculatedLoad(); Assertions.assertThat(userTaskLoad).isGreaterThanOrEqualTo(840.0); Assertions.assertThat(userTaskLoads).isEqualTo(userTaskLoad); em.close(); }
@Test public void jaxbCommentTest() throws Exception { Assume.assumeFalse(getType().equals(TestType.YAML)); CommentImpl comment = new CommentImpl(); comment.setAddedAt(new Date()); comment.setAddedBy(new UserImpl("user")); comment.setId(23l); comment.setText("ILLUMINATI!"); JaxbComment jaxbComment = new JaxbComment(comment); assertEquals("added at", comment.getAddedAt(), jaxbComment.getAddedAt()); assertEquals("added by", comment.getAddedBy().getId(), jaxbComment.getAddedById()); assertEquals("added by", comment.getAddedBy().getId(), jaxbComment.getAddedBy().getId()); assertEquals("id", comment.getId(), jaxbComment.getId()); assertEquals("text", comment.getText(), jaxbComment.getText()); JaxbComment copyJaxbComment = testRoundTrip(jaxbComment); Assertions.assertThat(jaxbComment).isEqualToComparingFieldByFieldRecursively(copyJaxbComment); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { id = in.readLong(); text = in.readUTF(); addedBy = new UserImpl(); addedBy.readExternal( in ); addedAt = new Date( in.readLong() ); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { if ( in.readBoolean() ) { taskInitiator = new UserImpl(); taskInitiator.readExternal( in ); } potentialOwners = CollectionUtils.readOrganizationalEntityList( in ); excludedOwners = CollectionUtils.readOrganizationalEntityList( in ); taskStakeholders = CollectionUtils.readOrganizationalEntityList( in ); businessAdministrators = CollectionUtils.readOrganizationalEntityList( in ); recipients = CollectionUtils.readOrganizationalEntityList( in ); }
@Test public void testAllowDelegateUserInPotentialOwner() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setPotentialOwners(Collections.<OrganizationalEntity>singletonList(new UserImpl(userId))); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }
@Test public void testAllowDelegateInitiator() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setTaskInitiator(new UserImpl(userId)); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }