Package org.dspace.xmlworkflow.state

Examples of org.dspace.xmlworkflow.state.Workflow


                        String workflowID = XPathAPI.selectSingleNode(mainNode, "//workflow-map/name-map[@collection='default']").getAttributes().getNamedItem("workflow").getTextContent();
                        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){
                log.error("Error while retrieving workflow for collection: " + collection.getHandle(), e);
View Full Code Here


        int totalUsers = InProgressUser.getNumberOfInProgressUsers(c, wfi.getID()) + InProgressUser.getNumberOfFinishedUsers(c, wfi.getID());

        //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()){
View Full Code Here

    }
    /*
     * Deletes a role group linked to a given role and a collection
     */
    public static void deleteRoleGroup(Context context, Collection collection, String roleID) throws SQLException, IOException, WorkflowConfigurationException {
        Workflow workflow = WorkflowFactory.getWorkflow(collection);
        Role role = workflow.getRoles().get(roleID);
        if(role.getScope() == Role.Scope.COLLECTION){
            CollectionRole ass = CollectionRole.find(context, collection.getID(), roleID);
            ass.delete();
        }
    }
View Full Code Here

        }
    }


    public static HashMap<String, Role> getCollectionRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException {
        Workflow workflow = WorkflowFactory.getWorkflow(thisCollection);
        LinkedHashMap<String, Role> result = new LinkedHashMap<String, Role>();
        if(workflow != null){
            //Make sure we find one
            HashMap<String, Role> allRoles = workflow.getRoles();
            //We have retrieved all our roles, not get the ones which can be configured by the collection
            for(String roleId : allRoles.keySet()){
                Role role = allRoles.get(roleId);
                // We just require the roles which have a scope of collection
                if(role.getScope() == Role.Scope.COLLECTION && !role.isInternal()){
View Full Code Here

        return result;
    }


    public static HashMap<String, Role> getCollectionAndRepositoryRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException {
        Workflow workflow = WorkflowFactory.getWorkflow(thisCollection);
        LinkedHashMap<String, Role> result = new LinkedHashMap<String, Role>();
        if(workflow != null){
            //Make sure we find one
            HashMap<String, Role> allRoles = workflow.getRoles();
            //We have retrieved all our roles, not get the ones which can be configured by the collection
            for(String roleId : allRoles.keySet()){
                Role role = allRoles.get(roleId);
                // We just require the roles which have a scope of collection
                if((role.getScope() == Role.Scope.COLLECTION || role.getScope() == Role.Scope.REPOSITORY) && !role.isInternal()){
View Full Code Here

        return result;
    }


    public static HashMap<String, Role> getAllExternalRoles(Collection thisCollection) throws IOException, WorkflowConfigurationException {
        Workflow workflow = WorkflowFactory.getWorkflow(thisCollection);
        LinkedHashMap<String, Role> result = new LinkedHashMap<String, Role>();
        if(workflow != null){
            //Make sure we find one
            HashMap<String, Role> allRoles = workflow.getRoles();
            //We have retrieved all our roles, not get the ones which can be configured by the collection
            for(String roleId : allRoles.keySet()){
                Role role = allRoles.get(roleId);
                // We just require the roles which have a scope of collection
                if(!role.isInternal()){
View Full Code Here


    public static XmlWorkflowItem start(Context context, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException, WorkflowConfigurationException, MessagingException, WorkflowException {
        Item myitem = wsi.getItem();
        Collection collection = wsi.getCollection();
        Workflow wf = WorkflowFactory.getWorkflow(collection);

        XmlWorkflowItem wfi = XmlWorkflowItem.create(context);
        wfi.setItem(myitem);
        wfi.setCollection(wsi.getCollection());
        wfi.setMultipleFiles(wsi.hasMultipleFiles());
        wfi.setMultipleTitles(wsi.hasMultipleTitles());
        wfi.setPublishedBefore(wsi.isPublishedBefore());
        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){
                archive(context, wfi);
            }else{
                activateFirstStep(context, wf, firstStep, wfi);
            }
View Full Code Here

        try {
            String stepID = parameters.getParameter("stepID");
            String actionID = parameters.getParameter("actionID");
            int workflowID = parameters.getParameterAsInteger("workflowID");
            XmlWorkflowItem wfi = XmlWorkflowItem.find(context, workflowID);
            Workflow wf = WorkflowFactory.getWorkflow(wfi.getCollection());

            Step step = wf.getStep(stepID);
            xmluiActionUI = (AbstractXMLUIAction) WorkflowXMLUIFactory.getActionInterface(actionID);
            authorized = step.getActionConfig(actionID).getProcessingAction().isAuthorized(context, ObjectModelHelper.getRequest(objectModel), wfi);

            if(xmluiActionUI != null)
                xmluiActionUI.setup(resolver, objectModel, src, parameters);
View Full Code Here

                    java.util.List<PoolTask> pooltasks = PoolTask.find(context,wfi);
                    java.util.List<ClaimedTask> claimedtasks = ClaimedTask.find(context, wfi);

                    Message state = message("xmlui.XMLWorkflow.step.unknown");
                    for(PoolTask task: pooltasks){
                        Workflow wf = WorkflowFactory.getWorkflow(wfi.getCollection());
                        Step step = wf.getStep(task.getStepID());
                        state = message("xmlui.XMLWorkflow." + wf.getID() + "." + step.getId());
                    }
                    for(ClaimedTask task: claimedtasks){
                        Workflow wf = WorkflowFactory.getWorkflow(wfi.getCollection());
                        Step step = wf.getStep(task.getStepID());
                        state = message("xmlui.XMLWorkflow." + wf.getID() + "." + step.getId());
                    }


                    //Column 0 task Checkbox to delete
                    itemRow.addCell().addCheckBox("workflow_id").addOption(wfi.getID());
View Full Code Here

      {
            for (int workflowID : workflowIDs)
            {
                PoolTask poolTask = PoolTask.findByWorkflowIdAndEPerson(context, workflowID, context.getCurrentUser().getID());
                XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowID);
                Workflow workflow = WorkflowFactory.getWorkflow(workflowItem.getCollection());

                WorkflowActionConfig currentAction = workflow.getStep(poolTask.getStepID()).getActionConfig(poolTask.getActionID());
                XmlWorkflowManager.doState(context, context.getCurrentUser(), request, workflowID, workflow, currentAction);
            }
            context.commit();
        }
View Full Code Here

TOP

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

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.