Examples of UserRoles


Examples of org.intalio.tempo.workflow.auth.UserRoles

            Task previous = dao.fetchTaskIfExists(id);
            if (previous != null && (previous instanceof PATask)) {
                PATask paPrevious = (PATask) previous;

                // security ?
                UserRoles credentials = _authProvider.authenticate(participantToken);
                // checkIsAvailable(id, previous, credentials);

                try {
                    paPrevious.setPriority(task.getPriority());
                } catch (Exception e) {
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

    }

    public Document initProcess(ITaskDAOConnection dao,String taskID, String user, String formUrl, Document input, String participantToken)
            throws AuthException, UnavailableTaskException, AccessDeniedException, AxisFault {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof PIPATask) {
            PIPATask pipaTask = (PIPATask) task;
            Document document = sendInitMessage(pipaTask, user, formUrl, participantToken, input);
            if (_logger.isDebugEnabled())
                _logger.debug(credentials.getUserID() + " has initialized process " + pipaTask.getProcessEndpoint()
                        + " with Workflow PIPA Task " + task);
            return document;
        } else {
            throw new UnavailableTaskException("Task (" + taskID
                    + ") is not a PIPA task cannot be used to initiate a process");
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        }
    }

    public Attachment[] getAttachments(ITaskDAOConnection dao,String taskID, String participantToken) throws AuthException,
            UnavailableTaskException, AccessDeniedException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof ITaskWithAttachments) {
            ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
            return taskWithAttachments.getAttachments().toArray(new Attachment[] {});
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        }
    }

    public void addAttachment(ITaskDAOConnection dao,String taskID, Attachment attachment, String participantToken) throws AuthException,
            UnavailableTaskException, AccessDeniedException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof ITaskWithAttachments == false) {
            throw new UnavailableTaskException("Task does not support attachments");
        }
        ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
        taskWithAttachments.addAttachment(attachment);
        dao.updateTask(task);
        dao.commit();
        if (_logger.isDebugEnabled())
            _logger.debug(credentials.getUserID() + " has added attachment " + attachment + "to Workflow Task " + task);
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        Task task = null;
        boolean availableTask = false;
        boolean availableAttachment = false;

        UserRoles credentials = _authProvider.authenticate(participantToken);
        try {
            task = dao.fetchTaskIfExists(taskID);
            availableTask = task instanceof ITaskWithAttachments && task.isAvailableTo(credentials);
            if (availableTask) {
                ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
                Attachment removedAttachment = taskWithAttachments.removeAttachment(attachmentURL);
                availableAttachment = (removedAttachment != null);
                if (availableAttachment) {
                    dao.updateTask(task);
                    dao.commit();
                    if (_logger.isDebugEnabled())
                        _logger.debug(credentials.getUserID() + " has removed attachment " + attachmentURL
                                + " for Workflow Task " + task);
                }
            }
        } catch (Exception e) {
            _logger.error("Error while delete attachment " + attachmentURL + " for Workflow Task " + taskID, e);
        }
        if (!availableTask || !availableAttachment) {
            throw new UnavailableTaskException(credentials.getUserID() + " cannot remove attachment for Workflow Task "
                    + task + ", is problem with task? - " + availableTask + ", is problem with attachment? - "
                    + availableAttachment);
        }
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        // DOTO due to all the service from wds is 'x'
        if (participantToken.equalsIgnoreCase("x")) {
            dao.deletePipaTask(formUrl);
            dao.commit();
        } else {
            UserRoles credentials = _authProvider.authenticate(participantToken);
            String userID = credentials.getUserID();
            try {
                Task task = dao.fetchPipa(formUrl);
                if (_permissions.isAuthorized(TaskPermissions.ACTION_DELETE, task, credentials)) {
                    dao.deletePipaTask(formUrl);
                    dao.commit();
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        map.put(TaskFetcher.FETCH_SUB_QUERY, subQuery);
        return this.getAvailableTasks(dao,participantToken, map);
    }

    public Long countAvailableTasks(ITaskDAOConnection dao,String participantToken, HashMap parameters) throws AuthException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        try {
            parameters.put(TaskFetcher.FETCH_USER, credentials);
            String klass = (String) parameters.get(TaskFetcher.FETCH_CLASS_NAME);
            if (klass != null)
                parameters.put(TaskFetcher.FETCH_CLASS, TaskTypeMapper.getTaskClassFromStringName(klass));
            return dao.countAvailableTasks(parameters);
        } catch (Exception e) {
            _logger.error("Error while tasks list retrieval for user " + credentials.getUserID(), e);
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

            throw new RuntimeException(e);
        }
    }

    public Task[] getAvailableTasks(ITaskDAOConnection dao,String participantToken, HashMap parameters) throws AuthException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        try {
            parameters.put(TaskFetcher.FETCH_USER, credentials);
            String klass = (String) parameters.get(TaskFetcher.FETCH_CLASS_NAME);
            if (klass != null)
                parameters.put(TaskFetcher.FETCH_CLASS, TaskTypeMapper.getTaskClassFromStringName(klass));
            return dao.fetchAvailableTasks(parameters);
        } catch (Exception e) {
            _logger.error("Error while tasks list retrieval for user " + credentials.getUserID(), e);
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

        }
    }

    public void skip(ITaskDAOConnection dao,String taskID, String participantToken) throws AuthException, UnavailableTaskException,
            InvalidTaskStateException, AccessDeniedException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof ITaskWithState) {
            ITaskWithState taskWithState = (ITaskWithState) task;
            taskWithState.setState(TaskState.OBSOLETE);
            dao.updateTask(task);
            dao.commit();
            if (_logger.isDebugEnabled())
                _logger.debug(credentials.getUserID() + " has skiped the Workflow Task " + task);
        } else {
            throw new UnavailableTaskException(credentials.getUserID() + " cannot skip Workflow Task " + task);
        }
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.auth.UserRoles

    return (Long) q.getSingleResult();
  }

  private Query buildQuery(Map parameters) {
    // _entityManager.clear();
    UserRoles user = (UserRoles) parameters.get(FETCH_USER);
    Class taskClass = (Class) parameters.get(FETCH_CLASS);
    String subQuery = MapUtils.getString(parameters, FETCH_SUB_QUERY, "");

    ArrayList userIdList = new ArrayList();
    userIdList.add(user.getUserID());
    String baseQuery = parameters.containsKey(FETCH_COUNT) ? QUERY_GENERIC_COUNT
        : QUERY_GENERIC1;
    Query q;
    if (StringUtils.isEmpty(subQuery)) {
      q = _entityManager.createQuery(
          baseQuery + taskClass.getSimpleName() + QUERY_GENERIC2)
          .setParameter(1, userIdList).setParameter(2,
              user.getAssignedRoles());
    } else {
      StringBuffer buffer = new StringBuffer();
      buffer.append(baseQuery).append(taskClass.getSimpleName()).append(
          QUERY_GENERIC2);

      String trim = subQuery.toLowerCase().trim();
      int orderIndex = trim.indexOf("order");
      if (orderIndex == -1) {
        buffer.append(" and ").append(" ( ").append(subQuery).append(
            " ) ");
      } else {
        if (!trim.startsWith("order"))
          buffer.append(" and (").append(
              subQuery.substring(0, orderIndex)).append(") ")
              .append(subQuery.substring(orderIndex));
        else {
          buffer.append(subQuery);
        }
      }
      if (_logger.isDebugEnabled()){
        _logger.debug(buffer.toString());
        _logger.debug("Parameter 1:" + userIdList);
        _logger.debug("Parameter 2:" + user.getAssignedRoles());
      }
      q = _entityManager.createQuery(buffer.toString()).setParameter(1,
          userIdList).setParameter(2, user.getAssignedRoles());
    }
    return q;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.