Package org.dspace.xmlworkflow.storedcomponents

Examples of org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem


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

    @Override
    public void addPageMeta(PageMeta pageMeta) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
        Request request = ObjectModelHelper.getRequest(objectModel);
        Context context = ContextUtil.obtainContext(objectModel);

        XmlWorkflowItem xmlWorkflowItem = retrieveWorkflowItem(request, context);

        pageMeta.addMetadata("title").addContent(T_workflow_title.parameterize(xmlWorkflowItem.getItem().getName()));

        pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
        pageMeta.addTrail().addContent(T_trail);

    }
View Full Code Here

      String[] workflowIDs = request.getParameterValues("workflowandstepID");
      if (workflowIDs != null)
      {
        for (String workflowID : workflowIDs)
        {
                XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, Integer.valueOf(workflowID.split(":")[0]));

                ClaimedTask pooledTask = ClaimedTask.findByWorkflowIdAndEPerson(context, workflowItem.getID(), context.getCurrentUser().getID());
                XmlWorkflowManager.deleteClaimedTask(context, workflowItem, pooledTask);

                WorkflowRequirementsManager.removeClaimedUser(context, workflowItem, context.getCurrentUser(), workflowID.split(":")[1]);
                log.info(LogManager.getHeader(context, "unclaim_workflow", "workflow_id=" + workflowItem.getID()));

            }
        }
        return null;
    }
View Full Code Here

        Context context = ContextUtil.obtainContext(request);
        if(!AuthorizeManager.isAdmin(context)){
            throw new AuthorizeException();
        }

        XmlWorkflowItem xmlWorkflowItem = retrieveWorkflowItem(request, context);
        String actionURL = contextPath + "/admin/display-workflowItem";

        Division div = body.addInteractiveDivision("perform-task", actionURL, Division.METHOD_POST, "primary workflow");
//        div.setHead(T_workflow_head);

        div.addHidden("wfiId").setValue(xmlWorkflowItem.getID());

        String showfull = request.getParameter("submit_full_item_info");

        // if the user selected showsimple, remove showfull.
        if (showfull != null && request.getParameter("submit_simple_item_info") != null)
            showfull = null;

        if (showfull == null)
        {
          ReferenceSet referenceSet = div.addReferenceSet("narf",ReferenceSet.TYPE_SUMMARY_VIEW);
            referenceSet.addReference(xmlWorkflowItem.getItem());
          div.addPara().addButton("submit_full_item_info").setValue(T_showfull);
        }
        else
        {
            ReferenceSet referenceSet = div.addReferenceSet("narf", ReferenceSet.TYPE_DETAIL_VIEW);
            referenceSet.addReference(xmlWorkflowItem.getItem());
            div.addPara().addButton("submit_simple_item_info").setValue(T_showsimple);

            div.addHidden("submit_full_item_info").setValue("true");
        }
View Full Code Here

        authorized = true;
        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);
View Full Code Here

        }

        int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
        if(workflowIdentifiers != null){
            for (int workflowIdentifier : workflowIdentifiers) {
                XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
                if (workflowItem != null) {
                    XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
                }
            }
        }
View Full Code Here

      if (workflowIDs != null)
      {
            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

          for (ClaimedTask owned : ownedItems)
          {
                int workflowItemID = owned.getWorkflowItemID();
                String stepID = owned.getStepID();
                String actionID = owned.getActionID();
                XmlWorkflowItem item = null;
                try {
                    item = XmlWorkflowItem.find(context, workflowItemID);
                    Workflow wf = WorkflowFactory.getWorkflow(item.getCollection());
                    Step step = wf.getStep(stepID);
                    WorkflowActionConfig action = step.getActionConfig(actionID);
                    String url = contextPath+"/handle/"+item.getCollection().getHandle()+"/xmlworkflow?workflowID="+workflowItemID+"&stepID="+stepID+"&actionID="+actionID;
                    Metadatum[] titles = item.getItem().getDC("title", null, Item.ANY);
                    String collectionName = item.getCollection().getMetadata("name");
                    EPerson submitter = item.getSubmitter();
                    String submitterName = submitter.getFullName();
                    String submitterEmail = submitter.getEmail();

    //            Message state = getWorkflowStateMessage(owned);

                    boolean taskHasPool = step.getUserSelectionMethod().getProcessingAction().usesTaskPool();
                    if(taskHasPool){
                        //We have a workflow item that uses a pool, ensure we see the return to pool button
                        showReturnToPoolButton = true;
                    }

                    Row row = table.addRow();

                    Cell firstCell = row.addCell();
                    if(taskHasPool){
                        CheckBox remove = firstCell.addCheckBox("workflowandstepID");
                        remove.setLabel("selected");
                        remove.addOption(workflowItemID + ":" + step.getId());
                    }

                    // The task description
                    row.addCell().addXref(url,message("xmlui.XMLWorkflow." + wf.getID() + "." + stepID + "." + actionID));

                    // The item description
                    if (titles != null && titles.length > 0)
                    {
                        String displayTitle = titles[0].value;
                        if (displayTitle.length() > 50)
                            displayTitle = displayTitle.substring(0,50)+ " ...";
                        row.addCell().addXref(url,displayTitle);
                    }
                    else
                        row.addCell().addXref(url,T_untitled);

                    // Submitted too
                    row.addCell().addXref(url,collectionName);

                    // Submitted by
                    Cell cell = row.addCell();
                    cell.addContent(T_email);
                    cell.addXref("mailto:"+submitterEmail,submitterName);
                } catch (WorkflowConfigurationException e) {
                    Row row = table.addRow();
                    row.addCell().addContent("Error: Configuration error in workflow.");
                    log.error(LogManager.getHeader(context, "Error while adding owned tasks on the submissions page", ""), e);

                } catch (Exception e) {
                    log.error(LogManager.getHeader(context, "Error while adding owned tasks on the submissions page", ""), e);
                }
            }

          if(showReturnToPoolButton){
                Row row = table.addRow();
                row.addCell(0,5).addButton("submit_return_tasks").setValue(T_w_submit_return);
            }

        }
        else
        {
          Row row = table.addRow();
          row.addCell(0,5).addHighlight("italic").addContent(T_w_info2);
        }




        // Tasks in the pool
        table = workflow.addTable("workflow-tasks",pooledItems.size()+2,5);
        table.setHead(T_w_head3);

        header = table.addRow(Row.ROLE_HEADER);
        header.addCellContent(T_w_column1);
        header.addCellContent(T_w_column2);
        header.addCellContent(T_w_column3);
        header.addCellContent(T_w_column4);
        header.addCellContent(T_w_column5);

        if (pooledItems.size() > 0)
        {

          for (PoolTask pooled : pooledItems)
          {
                String stepID = pooled.getStepID();
                int workflowItemID = pooled.getWorkflowItemID();
                String actionID = pooled.getActionID();
                    XmlWorkflowItem item;
                try {
                    item = XmlWorkflowItem.find(context, workflowItemID);
                    Workflow wf = WorkflowFactory.getWorkflow(item.getCollection());
                    String url = contextPath+"/handle/"+item.getCollection().getHandle()+"/xmlworkflow?workflowID="+workflowItemID+"&stepID="+stepID+"&actionID="+actionID;
                    Metadatum[] titles = item.getItem().getDC("title", null, Item.ANY);
                    String collectionName = item.getCollection().getMetadata("name");
                    EPerson submitter = item.getSubmitter();
                    String submitterName = submitter.getFullName();
                    String submitterEmail = submitter.getEmail();

    //            Message state = getWorkflowStateMessage(pooled);
View Full Code Here

        }

        int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
        if(workflowIdentifiers != null){
            for (int workflowIdentifier : workflowIdentifiers) {
                XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
                if (workflowItem != null) {
                    WorkspaceItem workspaceItem = XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
                    //Delete the workspaceItem
                    workspaceItem.deleteAll();
                }
View Full Code Here

TOP

Related Classes of org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem

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.