Package org.dspace.content

Examples of org.dspace.content.WorkspaceItem


     */
    public static void remove(Context context, int wsItemID, int groupID)
        throws SQLException, AuthorizeException
    {
        // get the workspace item and the group from the request values
        WorkspaceItem wsItem = WorkspaceItem.find(context, wsItemID);
        Group group = Group.find(context, groupID);
       
        // remove the link from the supervisory database
        String query = "DELETE FROM epersongroup2workspaceitem " +
                       "WHERE workspace_item_id = ? "+
                       "AND eperson_group_id = ? ";
       
        DatabaseManager.updateQuery(context, query, wsItemID, groupID);
       
        // get the item and have it remove the policies for the group
        Item item = wsItem.getItem();
        item.removeGroupPolicies(group);
    }
View Full Code Here


       
        // If a default policy type has been requested, apply the policies using
        // the DSpace API for doing so
        if (policy != POLICY_NONE)
        {
            WorkspaceItem wsItem = WorkspaceItem.find(context, wsItemID);
            Item item = wsItem.getItem();
            Group group = Group.find(context, groupID);
           
            // "Editor" implies READ, WRITE, ADD permissions
            // "Observer" implies READ permissions
            if (policy == POLICY_EDITOR)
View Full Code Here

    protected DAVResource[] children() throws SQLException
    {
        EPerson ep = this.context.getCurrentUser();
        if (ep != null)
        {
            WorkspaceItem wi[] = WorkspaceItem.findByEPerson(this.context, ep);
            log.debug("children(): Got " + String.valueOf(wi.length)
                    + " Workspace Items.");
            DAVResource result[] = new DAVResource[wi.length];
            for (int i = 0; i < wi.length; ++i)
            {
View Full Code Here

        row.setColumn("item_id", myitem.getID());
        row.setColumn("collection_id", mycollection.getID());
        DatabaseManager.insert(c, row);

        int wsi_id = row.getIntColumn("workspace_item_id");
        WorkspaceItem wi = WorkspaceItem.find(c, wsi_id);
        wi.setMultipleFiles(wfi.hasMultipleFiles());
        wi.setMultipleTitles(wfi.hasMultipleTitles());
        wi.setPublishedBefore(wfi.isPublishedBefore());
        wi.update();

        //myitem.update();
        log.info(LogManager.getHeader(c, "return_to_workspace",
                "workflow_item_id=" + wfi.getID() + "workspace_item_id="
                        + wi.getID()));

        // Now remove the workflow object manually from the database
        DatabaseManager.updateQuery(c,
                "DELETE FROM WorkflowItem WHERE workflow_id=" + wfi.getID());
View Full Code Here

        // Add to item as a DC field
        myitem.addDC("description", "provenance", "en", provDescription);
        myitem.update();

        // convert into personal workspace
        WorkspaceItem wsi = returnToWorkspace(c, wi);

        // notify that it's been rejected
        notifyOfReject(c, wi, e, rejection_message);

        log.info(LogManager.getHeader(c, "reject_workflow", "workflow_item_id="
                + wi.getID() + "item_id=" + wi.getItem().getID()
                + "collection_id=" + wi.getCollection().getID() + "eperson_id="
                + e.getID()));

        logWorkflowEvent(c, wsi.getItem(), wi, e, WFSTATE_SUBMIT, null, wsi.getCollection(), oldState, null);

        return wsi;
    }
View Full Code Here

//            TaskLog tasklog = TaskLog.create(c, wi);
//            tasklog.update();

                // convert into personal workspace
                WorkspaceItem wsi = returnToWorkspace(context, workflowItem);

                log.info(LogManager.getHeader(context, "restart_workflow", "workflow_item_id="
                        + workflowItem.getID() + "item_id=" + workflowItem.getItem().getID()
                        + "collection_id=" + workflowItem.getCollection().getID()));
View Full Code Here

        row.setColumn("item_id", myitem.getID());
        row.setColumn("collection_id", mycollection.getID());
        DatabaseManager.insert(c, row);

        int wsi_id = row.getIntColumn("workspace_item_id");
        WorkspaceItem wi = WorkspaceItem.find(c, wsi_id);
        wi.setMultipleFiles(wfi.hasMultipleFiles());
        wi.setMultipleTitles(wfi.hasMultipleTitles());
        wi.setPublishedBefore(wfi.isPublishedBefore());
        wi.update();

        //myitem.update();
        log.info(LogManager.getHeader(c, "return_to_workspace",
                "workflow_item_id=" + wfi.getID() + "workspace_item_id="
                        + wi.getID()));

        // Now remove the workflow object manually from the database
        DatabaseManager.updateQuery(c,
                "DELETE FROM WorkflowItem WHERE workflow_id=" + wfi.getID());
View Full Code Here

        }

        // First and foremost - if it's a thesis, reject the submission
        if (isThesis)
        {
            WorkspaceItem wi = (WorkspaceItem) subInfo.getSubmissionItem();
            wi.deleteAll();
            subInfo.setSubmissionItem(null);

            // Remember that we've removed a thesis in the session
            request.getSession().setAttribute("removed_thesis",
                    Boolean.TRUE);
View Full Code Here

            return STATUS_INVALID_COLLECTION;
        }
        else
        {
            // create our new Workspace Item
            WorkspaceItem wi = WorkspaceItem.create(context, col, true);

            // update Submission Information with this Workspace Item
            subInfo.setSubmissionItem(wi);

            // commit changes to database
View Full Code Here

               AuthorizeException, SQLException, IOException
    {
        boolean success = false;
        Bundle original = null;
        Bitstream bs = null;
        WorkspaceItem wi = null;

        try
        {
            // Save the PDF in a bitstream first, since the parser
            // has to read it as well, and we cannot "rewind" it after that.
            wi = WorkspaceItem.create(context, (Collection)parent, false);
            Item myitem = wi.getItem();
            original = myitem.createBundle("ORIGINAL");

            InputStream fileStream = null;
            try
            {
                fileStream = new FileInputStream(pkgFile);
                bs = original.createBitstream(fileStream);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.close();
                }
            }

            bs.setName("package.pdf");
            setFormatToMIMEType(context, bs, "application/pdf");
            bs.update();
            if (log.isDebugEnabled())
            {
                log.debug("Created bitstream ID=" + String.valueOf(bs.getID()) + ", parsing...");
            }

            crosswalkPDF(context, myitem, bs.retrieve());

            wi.update();
            context.commit();
            success = true;
            log.info(LogManager.getHeader(context, "ingest",
                "Created new Item, db ID="+String.valueOf(myitem.getID())+
                ", WorkspaceItem ID="+String.valueOf(wi.getID())));

            myitem = PackageUtils.finishCreateItem(context, wi, null, params);
            return myitem;
        }
        finally
        {
            // get rid of bitstream and item if ingest fails
            if (!success)
            {
                if (original != null && bs != null)
                {
                    original.removeBitstream(bs);
                }
                if (wi != null)
                {
                    wi.deleteAll();
                }
            }
            context.commit();
        }
    }
View Full Code Here

TOP

Related Classes of org.dspace.content.WorkspaceItem

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.