Package org.drools.task

Examples of org.drools.task.PeopleAssignments


                strategies.add(subTaskStrategy);
            }
            task.setSubTaskStrategies(strategies);
        }

        PeopleAssignments assignments = new PeopleAssignments();
    List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();

        String actorId = (String) workItem.getParameter("ActorId");
    if (actorId != null) {
     
      String[] actorIds = actorId.split(",");
      for (String id: actorIds) {
        User user = new User();
        user.setId(id.trim());
        potentialOwners.add(user);
      }
            //Set the first user as creator ID??? hmmm might be wrong
            if (potentialOwners.size() > 0){
                taskData.setCreatedBy((User)potentialOwners.get(0));
            }
        }
        String groupId = (String) workItem.getParameter("GroupId");
    if (groupId != null) {
     
      String[] groupIds = groupId.split(",");
      for (String id: groupIds) {

        potentialOwners.add(new Group(id));
      }
     
    }

        assignments.setPotentialOwners(potentialOwners);
    List<OrganizationalEntity> businessAdministrators = new ArrayList<OrganizationalEntity>();
    businessAdministrators.add(new User("Administrator"));
    assignments.setBusinessAdministrators(businessAdministrators);
    task.setPeopleAssignments(assignments);
       
    task.setTaskData(taskData);

    ContentData content = null;
View Full Code Here


                strategies.add(subTaskStrategy);
            }
            task.setSubTaskStrategies(strategies);
        }

        PeopleAssignments assignments = new PeopleAssignments();
    List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();

        String actorId = (String) workItem.getParameter("ActorId");
    if (actorId != null) {
     
      String[] actorIds = actorId.split(",");
      for (String id: actorIds) {
        User user = new User();
        user.setId(id.trim());
        potentialOwners.add(user);
      }
            //Set the first user as creator ID??? hmmm might be wrong
            if (potentialOwners.size() > 0){
                taskData.setCreatedBy((User)potentialOwners.get(0));
            }
        }
        String groupId = (String) workItem.getParameter("GroupId");
    if (groupId != null) {
     
      String[] groupIds = groupId.split(",");
      for (String id: groupIds) {

        potentialOwners.add(new Group(id));
      }
     
    }

        assignments.setPotentialOwners(potentialOwners);
    List<OrganizationalEntity> businessAdministrators = new ArrayList<OrganizationalEntity>();
    businessAdministrators.add(new User("Administrator"));
    assignments.setBusinessAdministrators(businessAdministrators);
    task.setPeopleAssignments(assignments);
       
    task.setTaskData(taskData);

    ContentData content = null;
View Full Code Here

    private boolean isAllowed(OperationCommand command,
                              Task task,
                              User user,
                              OrganizationalEntity targetEntity) {
        PeopleAssignments people = task.getPeopleAssignments();
        TaskData taskData = task.getTaskData();

        boolean operationAllowed = false;
        for ( Allowed allowed : command.getAllowed() ) {
            if ( operationAllowed ) {
                break;
            }
            switch ( allowed ) {
                case Owner : {
                    operationAllowed = (taskData.getActualOwner() != null && taskData.getActualOwner().getId() == user.getId());
                    break;
                }
                case Initiator : {
                    operationAllowed = (taskData.getCreatedBy() != null && taskData.getCreatedBy().getId() == user.getId());
                    break;
                }
                case PotentialOwner : {
                    operationAllowed = isAllowed( user,
                                                  people.getPotentialOwners() );
                    break;
                }
                case BusinessAdministrator : {
                    operationAllowed = isAllowed( user,
                                                  people.getBusinessAdministrators() );
                    break;
                }
            }
        }

        if ( operationAllowed && command.isUserIsExplicitPotentialOwner() ) {
            // if user has rights to execute the command, make sure user is explicitely specified (not as a group)
            operationAllowed = people.getPotentialOwners().contains( user );
        }
       
        if ( operationAllowed && command.isSkippable() ) {
          operationAllowed = taskData.isSkipable();
        }
View Full Code Here

                strategies.add(subTaskStrategy);
            }
            task.setSubTaskStrategies(strategies);
        }

        PeopleAssignments assignments = new PeopleAssignments();
    List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();

        String actorId = (String) workItem.getParameter("ActorId");
    if (actorId != null) {
     
      String[] actorIds = actorId.split(",");
      for (String id: actorIds) {
        User user = new User();
        user.setId(id.trim());
        potentialOwners.add(user);
      }
            //Set the first user as creator ID??? hmmm might be wrong
            if (potentialOwners.size() > 0){
                taskData.setCreatedBy((User)potentialOwners.get(0));
            }
        }
        String groupId = (String) workItem.getParameter("GroupId");
    if (groupId != null) {
     
      String[] groupIds = groupId.split(",");
      for (String id: groupIds) {

        potentialOwners.add(new Group(id));
      }
     
    }

        assignments.setPotentialOwners(potentialOwners);
    List<OrganizationalEntity> businessAdministrators = new ArrayList<OrganizationalEntity>();
    businessAdministrators.add(new User("Administrator"));
    assignments.setBusinessAdministrators(businessAdministrators);
    task.setPeopleAssignments(assignments);
       
    task.setTaskData(taskData);

    ContentData content = null;
View Full Code Here

    private void commands(OperationCommand command,
                          Task task,
                          User user,
                          OrganizationalEntity targetEntity) {
        PeopleAssignments people = task.getPeopleAssignments();
        TaskData taskData = task.getTaskData();

        if ( command.getNewStatus() != null ) {
            taskData.setStatus( command.getNewStatus() );
        } else if ( command.isSetToPreviousStatus() ) {
            taskData.setStatus( taskData.getPreviousStatus() );
        }

        if ( command.isAddTargetEntityToPotentialOwners() && !people.getPotentialOwners().contains( targetEntity ) ) {
            people.getPotentialOwners().add( targetEntity );
        }

        if ( command.isRemoveUserFromPotentialOwners() ) {
            people.getPotentialOwners().remove( user );
        }

        if ( command.isSetNewOwnerToUser() ) {
            taskData.setActualOwner( (User) user );
        }
View Full Code Here

    private boolean isAllowed(OperationCommand command,
                              Task task,
                              User user,
                              OrganizationalEntity targetEntity) {
        PeopleAssignments people = task.getPeopleAssignments();
        TaskData taskData = task.getTaskData();

        boolean operationAllowed = false;
        for ( Allowed allowed : command.getAllowed() ) {
            if ( operationAllowed ) {
                break;
            }
            switch ( allowed ) {
                case Owner : {
                    operationAllowed = (taskData.getActualOwner() != null && taskData.getActualOwner().getId() == user.getId());
                    break;
                }
                case Initiator : {
                    operationAllowed = (taskData.getCreatedBy() != null && taskData.getCreatedBy().getId() == user.getId());
                    break;
                }
                case PotentialOwner : {
                    operationAllowed = isAllowed( user,
                                                  people.getPotentialOwners() );
                    break;
                }
                case BusinessAdministrator : {
                    operationAllowed = isAllowed( user,
                                                  people.getBusinessAdministrators() );
                    break;
                }
            }
        }

        if ( operationAllowed && command.isUserIsExplicitPotentialOwner() ) {
            // if user has rights to execute the command, make sure user is explicitely specified (not as a group)
            operationAllowed = people.getPotentialOwners().contains( user );
        }
       
        if ( operationAllowed && command.isSkippable() ) {
          operationAllowed = taskData.isSkipable();
        }
View Full Code Here

    private void commands(OperationCommand command,
                          Task task,
                          User user,
                          OrganizationalEntity targetEntity) {
        PeopleAssignments people = task.getPeopleAssignments();
        TaskData taskData = task.getTaskData();

        if ( command.getNewStatus() != null ) {
            taskData.setStatus( command.getNewStatus() );
        } else if ( command.isSetToPreviousStatus() ) {
            taskData.setStatus( taskData.getPreviousStatus() );
        }

        if ( command.isAddTargetEntityToPotentialOwners() && !people.getPotentialOwners().contains( targetEntity ) ) {
            people.getPotentialOwners().add( targetEntity );
        }

        if ( command.isRemoveUserFromPotentialOwners() ) {
            people.getPotentialOwners().remove( user );
        }

        if ( command.isSetNewOwnerToUser() ) {
            taskData.setActualOwner( (User) user );
        }
View Full Code Here

    taskData.setWorkItemId(workItem.getId());
    taskData.setSkipable(!"false".equals(workItem.getParameter("Skippable")));
    task.setTaskData(taskData);
    String actorId = (String) workItem.getParameter("ActorId");
    if (actorId != null) {
      PeopleAssignments assignments = new PeopleAssignments();
      List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>();
      String[] actorIds = actorId.split(",");
      for (String id: actorIds) {
        User user = new User();
        user.setId(id.trim());
        potentialOwners.add(user);
      }
      assignments.setPotentialOwners(potentialOwners);
      List<OrganizationalEntity> businessAdministrators = new ArrayList<OrganizationalEntity>();
      businessAdministrators.add(new User("Administrator"));
      assignments.setBusinessAdministrators(businessAdministrators);
      task.setPeopleAssignments(assignments);
    }
   
    ContentData content = null;
    Object contentObject = workItem.getParameter("Content");
View Full Code Here

TOP

Related Classes of org.drools.task.PeopleAssignments

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.