Package org.dspace.xmlworkflow.state

Examples of org.dspace.xmlworkflow.state.Step


                        if(workflowID==null){
                            throw new WorkflowConfigurationException("No mapping is present for collection with handle:" + collection.getHandle());
                        }
                        Node workflowNode = XPathAPI.selectSingleNode(mainNode, "//workflow[@id='"+workflowID+"']");
                        Workflow wf = new Workflow(workflowID, getRoles(workflowNode));
                        Step step = createFirstStep(wf, workflowNode);
                        wf.setFirstStep(step);
                        workflowCache.put("default", wf);
                        workflowCache.put(collection.getHandle(), wf);
                        return wf;
                    }else{
                        return workflowCache.get("default");
                    }

                }else{
                    //We have a workflowID so retrieve it & resolve it to a workflow, also store it in our cache
                    String workflowID = workflowMap.getAttributes().getNamedItem("workflow").getTextContent();

                    Node workflowNode = XPathAPI.selectSingleNode(mainNode, "//workflow[@id='"+workflowID+"']");
                    Workflow wf = new Workflow(workflowID, getRoles(workflowNode));
                    Step step = createFirstStep(wf, workflowNode);
                    wf.setFirstStep(step);
                    workflowCache.put(collection.getHandle(), wf);
                    return wf;
                }
            } catch (Exception e){
View Full Code Here


        Role role = null;
        if(roleNode != null)
            role = workflow.getRoles().get(roleNode.getTextContent());
        String userSelectionActionID = stepNode.getAttributes().getNamedItem("userSelectionMethod").getTextContent();
        UserSelectionActionConfig userSelection = createUserAssignmentActionConfig(userSelectionActionID);
        return new Step(firstStepID, workflow, role, userSelection, getStepActionConfigs(stepNode), getStepOutcomes(stepNode), getNbRequiredUser(stepNode));
    }
View Full Code Here

            Role role = null;
            if(roleNode != null)
                role = workflow.getRoles().get(roleNode.getTextContent());
            String userSelectionActionID = stepNode.getAttributes().getNamedItem("userSelectionMethod").getTextContent();
            UserSelectionActionConfig userSelection = createUserAssignmentActionConfig(userSelectionActionID);
            return new Step(stepID, workflow, role, userSelection, getStepActionConfigs(stepNode), getStepOutcomes(stepNode), getNbRequiredUser(stepNode));

        }catch (Exception e){
            log.error("Error while creating step with :" + stepID, e);
            throw new WorkflowConfigurationException("Step: " + stepID + " does not exist for workflow: "+workflow.getID());
        }
View Full Code Here

        //Then remove the current user from the inProgressUsers
        InProgressUser.findByWorkflowItemAndEPerson(c, wfi.getID(), user.getID()).delete();

        Workflow workflow = WorkflowFactory.getWorkflow(wfi.getCollection());
        Step step = workflow.getStep(stepID);

//        WorkflowManager.deleteOwnedTask(c, user, wfi, step, step.getActionConfig());
        //We had reached our total user, so recreate tasks for the user who don't have one
        if(totalUsers == step.getRequiredUsers()){

            //Create a list of the users we are to ignore
            List<InProgressUser> toIgnore = InProgressUser.findByWorkflowItem(c, wfi.getID());

            //Remove the users to ignore
            RoleMembers roleMembers = step.getRole().getMembers(c, wfi);
            //Create a list out all the users we are to pool a task for
            for (InProgressUser ipu: toIgnore) {
                roleMembers.removeEperson(ipu.getUserID());
            }
            step.getUserSelectionMethod().getProcessingAction().regenerateTasks(c, wfi, roleMembers);

        }else{
            //If the user previously had a personal PoolTask, this must be regenerated. Therefore we call the regeneration method
            //with only one EPerson
            RoleMembers role = step.getRole().getMembers(c, wfi);
            List<EPerson> epersons = role.getEPersons();
            for(EPerson eperson: epersons){
                if(eperson.getID() == user.getID()){
                    RoleMembers memberToRegenerateTasksFor = new RoleMembers();
                    memberToRegenerateTasksFor.addEPerson(user);
                    step.getUserSelectionMethod().getProcessingAction().regenerateTasks(c, wfi, memberToRegenerateTasksFor);
                    break;
                }
            }
        }
        //Update our item
View Full Code Here

* @author Mark Diggory (markd at atmire dot com)
*/
public class ClaimAction extends UserSelectionAction {
    @Override
    public void activate(Context context, XmlWorkflowItem wfItem) throws SQLException, IOException, AuthorizeException {
        Step owningStep = getParent().getStep();

        RoleMembers allroleMembers = getParent().getStep().getRole().getMembers(context, wfItem);
        // Create pooled tasks for each member of our group
        if(allroleMembers != null && (allroleMembers.getGroups().size() > 0 || allroleMembers.getEPersons().size() > 0)){
            XmlWorkflowManager.createPoolTasks(context, wfItem, allroleMembers, owningStep, getParent());
View Full Code Here

    }

    public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI) throws WorkflowConfigurationException, SQLException {
        //A user claim action always needs to have a UI, since somebody needs to be able to claim it
        if(hasUI){
            Step step = getParent().getStep();
            //First of all check if our step has a role
            Role role = step.getRole();
            if(role != null){
                //We have a role, check if we have a group to with that role
                RoleMembers roleMembers = role.getMembers(context, wfi);

                ArrayList<EPerson> epersons = roleMembers.getAllUniqueMembers(context);
                return !(epersons.size() == 0 || step.getRequiredUsers() > epersons.size());
            } else {
                // We don't have a role and do have a UI so throw a workflow exception
                throw new WorkflowConfigurationException("The next step is invalid, since it doesn't have a valid role");
            }
        }else
View Full Code Here

        wfi.update();
        removeUserItemPolicies(context, myitem, myitem.getSubmitter());
        grantSubmitterReadPolicies(context, myitem);

        context.turnOffAuthorisationSystem();
        Step firstStep = wf.getFirstStep();
        if(firstStep.isValidStep(context, wfi)){
             activateFirstStep(context, wf, firstStep, wfi);
        } else {
            //Get our next step, if none is found, archive our item
            firstStep = wf.getNextStep(context, wfi, firstStep, ActionResult.OUTCOME_COMPLETE);
            if(firstStep == null){
View Full Code Here

     * Executes an action and returns the next.
     */
    public static WorkflowActionConfig doState(Context c, EPerson user, HttpServletRequest request, int workflowItemId, Workflow workflow, WorkflowActionConfig currentActionConfig) throws SQLException, AuthorizeException, IOException, MessagingException, WorkflowConfigurationException, WorkflowException {
        try {
            XmlWorkflowItem wi = XmlWorkflowItem.find(c, workflowItemId);
            Step currentStep = currentActionConfig.getStep();
            if(currentActionConfig.getProcessingAction().isAuthorized(c, request, wi)){
                ActionResult outcome = currentActionConfig.getProcessingAction().execute(c, wi, currentStep, request);
                return processOutcome(c, user, workflow, currentStep, currentActionConfig, outcome, wi, false);
            }else{
                throw new AuthorizeException("You are not allowed to to perform this task.");
View Full Code Here

            //By not returning an action we ensure ourselfs that we go back to the submission page
            c.restoreAuthSystemState();
            return null;
        }else
        if (currentOutcome.getType() == ActionResult.TYPE.TYPE_OUTCOME) {
            Step nextStep = null;
            WorkflowActionConfig nextActionConfig = null;
            try {
                //We have completed our action search & retrieve the next action
                if(currentOutcome.getResult() == ActionResult.OUTCOME_COMPLETE){
                    nextActionConfig = currentStep.getNextAction(currentActionConfig);
View Full Code Here


    @Override
    public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) throws SQLException, AuthorizeException, IOException, WorkflowException {
        EPerson submitter = wfi.getSubmitter();
        Step currentStep = getParent().getStep();
        WorkflowActionConfig nextAction = getParent().getStep().getNextAction(this.getParent());
        //Retrieve the action which has a user interface
        while(nextAction != null && !nextAction.requiresUI()){
            nextAction = nextAction.getStep().getNextAction(nextAction);
        }
View Full Code Here

TOP

Related Classes of org.dspace.xmlworkflow.state.Step

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.