Package org.dspace.content

Examples of org.dspace.content.Item


        // for now, forget about any targets but item.
        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkInternalException("Wrong target object type, QDCCrosswalk can only crosswalk to an Item.");

        Item item = (Item)dso;

        Iterator mi = ml.iterator();
        while (mi.hasNext())
        {
            Element me = (Element)mi.next();
            String key = makeQualifiedTagName(me);

            // if the root element gets passed here, recurse:
            if (me.getName().equals("qualifieddc"))
                ingest(context, dso, me.getChildren());

            else if (element2qdc.containsKey(key))
            {
                String qdc[] = ((String)element2qdc.get(key)).split("\\.");

                // get language - prefer xml:lang, accept lang.
                String lang = me.getAttributeValue("lang", Namespace.XML_NAMESPACE);
                if (lang == null)
                    lang = me.getAttributeValue("lang");

                if (qdc.length == 3)
                    item.addMetadata(qdc[0], qdc[1], qdc[2], lang, me.getText());
                else if (qdc.length == 2)
                    item.addMetadata(qdc[0], qdc[1], null,   lang, me.getText());
                else
                    throw new CrosswalkInternalException("Unrecognized format in QDC element identifier for key=\""+key+"\", qdc=\""+(String)element2qdc.get(key)+"\"");
            }
            else
                log.warn("WARNING: "+myName+": No mapping for Element=\"" + key+"\" to qdc.");
View Full Code Here


        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, false);
            Item myitem = wi.getItem();
            original = myitem.createBundle("ORIGINAL");
            bs = original.createBitstream(pkg);
            pkg.close();
            bs.setName("package.pdf");
            setFormatToMIMEType(context, bs, "application/pdf");
            bs.update();
            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())));
            return wi;
        }
        finally
        {
View Full Code Here

               AuthorizeException, SQLException, IOException
    {
        if (dso.getType() != Constants.ITEM)
            throw new PackageValidationException("This disseminator can only handle objects of type ITEM.");

        Item item = (Item)dso;
        try
        {
            BitstreamFormat pdff = BitstreamFormat.findByShortDescription(context,
                                    BITSTREAM_FORMAT_NAME);
            if (pdff == null)
View Full Code Here

   
    public Element disseminateElement(DSpaceObject dsothrows CrosswalkException, IOException, SQLException, AuthorizeException
  {
      if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("DIMDisseminationCrosswalk can only crosswalk an Item.");
        Item item = (Item)dso;
       
      DCValue[] dc = item.getMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);
        Element dim = new Element("dim", DIM_NS);
        for (int i = 0; i < dc.length; i++)
        {
            Element field = new Element("field", DIM_NS);
            field.setAttribute("mdschema", dc[i].schema);
View Full Code Here

        throws CrosswalkException,
               IOException, SQLException, AuthorizeException
    {
        if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("METSDisseminationCrosswalk can only crosswalk an Item.");
        Item item = (Item)dso;

        PackageDisseminator dip = (PackageDisseminator)
          PluginManager.getNamedPlugin(PackageDisseminator.class, METS_PACKAGER_PLUGIN);
        if (dip == null)
            throw new CrosswalkInternalException("Cannot find a disseminate plugin for package="+METS_PACKAGER_PLUGIN);
View Full Code Here

        int itemID = parameters.getParameterAsInteger("itemID",-1);
        int highlightID = parameters.getParameterAsInteger("highlightID",-1);
        String baseURL = contextPath+"/admin/epeople?administrative-continue="+knot.getId();

    /* First, set up our various data structures */
    Item item = Item.find(context, itemID);
    Bundle[] bundles = item.getBundles();
    Bitstream[] bitstreams;
   
    ArrayList<ResourcePolicy> itemPolicies = (ArrayList<ResourcePolicy>)AuthorizeManager.getPolicies(context, item);
   
    ArrayList<ResourcePolicy> bundlePolicies = new ArrayList<ResourcePolicy>();
    ArrayList<ResourcePolicy> bitstreamPolicies = new ArrayList<ResourcePolicy>();

    // DIVISION: main
    Division main = body.addInteractiveDivision("edit-item-policies",contextPath+"/admin/authorize",Division.METHOD_POST,"primary administrative authorization");
    main.setHead(T_main_head.parameterize(item.getHandle(),item.getID()));
    main.addPara().addHighlight("italic").addContent(T_main_para1);
    main.addPara().addHighlight("italic").addContent(T_main_para2);
   
      Table table = main.addTable("policies-confirm-delete",itemPolicies.size() + 3, 5);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell();
        header.addCell().addContent(T_head_id);
        header.addCell().addContent(T_head_action);
        header.addCell().addContent(T_head_group);
        header.addCell();

       
        // First, the item's policies are listed
        Row subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
        subheader.addCell(1, 4).addHighlight("bold").addContent(T_subhead_item);
        subheader.addCell().addHighlight("bold").addXref(baseURL + "&submit_add_item", T_add_itemPolicy_link);
       
        this.rowBuilder(baseURL, table, itemPolicies, item.getID(), Constants.ITEM, highlightID);
     
      // Next, one by one, we get the bundles
      for (Bundle bundle : bundles) {
        subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
        subheader.addCell(null, null, 1, 4, "indent").addHighlight("bold").addContent(T_subhead_bundle.parameterize(bundle.getName(),bundle.getID()));
View Full Code Here

  public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException {
   
    if (dso.getType() != Constants.ITEM)
            throw new CrosswalkObjectNotSupported("DIMIngestionCrosswalk can only crosswalk an Item.");
        Item item = (Item)dso;
       
        if (root == null) {
          System.err.println("The element received by ingest was null");
          return;
        }
       
        List<Element> metadata = root.getChildren("field",DIM_NS);
        for (Element field : metadata) {
          item.addMetadata(field.getAttributeValue("mdschema"), field.getAttributeValue("element"), field.getAttributeValue("qualifier"),
              field.getAttributeValue("lang"), field.getText());
        }
       
  }
View Full Code Here

     */
    public static WorkflowItem start(Context c, WorkspaceItem wsi)
            throws SQLException, AuthorizeException, IOException
    {
        // FIXME Check auth
        Item myitem = wsi.getItem();
        Collection collection = wsi.getCollection();

        log.info(LogManager.getHeader(c, "start_workflow", "workspace_item_id="
                + wsi.getID() + "item_id=" + myitem.getID() + "collection_id="
                + collection.getID()));

        // record the start of the workflow w/provenance message
        recordStart(c, myitem);

        // create the WorkflowItem
        TableRow row = DatabaseManager.create(c, "workflowitem");
        row.setColumn("item_id", myitem.getID());
        row.setColumn("collection_id", wsi.getCollection().getID());

        WorkflowItem wfi = new WorkflowItem(c, row);

        wfi.setMultipleFiles(wsi.hasMultipleFiles());
View Full Code Here

                // remove workflow tasks
                deleteTasks(c, wi);

                mycollection = wi.getCollection();

                Item myitem = archive(c, wi);

                // now email notification
                notifyOfArchive(c, myitem, mycollection);
                archived = true;
            }
View Full Code Here

     */
    private static Item archive(Context c, WorkflowItem wfi)
            throws SQLException, IOException, AuthorizeException
    {
        // FIXME: Check auth
        Item item = wfi.getItem();
        Collection collection = wfi.getCollection();

        log.info(LogManager.getHeader(c, "archive_item", "workflow_item_id="
                + wfi.getID() + "item_id=" + item.getID() + "collection_id="
                + collection.getID()));

        InstallItem.installItem(c, wfi);

        // Log the event
        log.info(LogManager.getHeader(c, "install_item", "workflow_id="
                + wfi.getID() + ", item_id=" + item.getID() + "handle=FIXME"));

        return item;
    }
View Full Code Here

TOP

Related Classes of org.dspace.content.Item

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.