Package org.dspace.content

Examples of org.dspace.content.Collection


 
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int collectionID = parameters.getParameterAsInteger("collectionID", -1);
    Collection thisCollection = Collection.find(context, collectionID);
   
    String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();

            //Check that all HTML input fields contain valid XHTML
            String short_description_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("short_description"));
      String introductory_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("introductory_text"));
      String copyright_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("copyright_text"));
      String side_bar_text_error = FlowContainerUtils.checkXMLFragment(thisCollection.getMetadata("side_bar_text"));
     
    // DIVISION: main
      Division main = body.addInteractiveDivision("collection-metadata-edit",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
      main.setHead(T_main_head.parameterize(thisCollection.getMetadata("name")));
  
      List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
      options.addItem().addHighlight("bold").addXref(baseURL+"&submit_metadata",T_options_metadata);
      options.addItem().addXref(baseURL+"&submit_roles",T_options_roles);
      options.addItem().addXref(baseURL+"&submit_harvesting",T_options_harvest);
     
     
      // The grand list of metadata options
      List metadataList = main.addList("metadataList", "form");
     
      // collection name
      metadataList.addLabel(T_label_name);
      Text name = metadataList.addItem().addText("name");
      name.setSize(40);
      name.setValue(thisCollection.getMetadata("name"));
     
      // short description
      metadataList.addLabel(T_label_short_description);
      Text short_description = metadataList.addItem().addText("short_description");
      short_description.setValue(thisCollection.getMetadata("short_description"));
      short_description.setSize(40);
      if (short_description_error != null)
        short_description.addError(short_description_error);
     
      // introductory text
      metadataList.addLabel(T_label_introductory_text);
      TextArea introductory_text = metadataList.addItem().addTextArea("introductory_text");
      introductory_text.setValue(thisCollection.getMetadata("introductory_text"));
      introductory_text.setSize(6, 40);
      if (introductory_text_error != null)
        introductory_text.addError(introductory_text_error);
     
      // copyright text
      metadataList.addLabel(T_label_copyright_text);
      TextArea copyright_text = metadataList.addItem().addTextArea("copyright_text");
      copyright_text.setValue(thisCollection.getMetadata("copyright_text"));
      copyright_text.setSize(6, 40);
      if (copyright_text_error != null)
        copyright_text.addError(copyright_text_error);
     
      // legacy sidebar text; may or may not be used for news
      metadataList.addLabel(T_label_side_bar_text);
      TextArea side_bar_text = metadataList.addItem().addTextArea("side_bar_text");
      side_bar_text.setValue(thisCollection.getMetadata("side_bar_text"));
      side_bar_text.setSize(6, 40);
      if (side_bar_text_error != null)
        side_bar_text.addError(side_bar_text_error);
     
      // license text
      metadataList.addLabel(T_label_license);
      TextArea license = metadataList.addItem().addTextArea("license");
      license.setValue(thisCollection.getMetadata("license"));
      license.setSize(6, 40);
     
      // provenance description
      metadataList.addLabel(T_label_provenance_description);
      TextArea provenance_description = metadataList.addItem().addTextArea("provenance_description");
      provenance_description.setValue(thisCollection.getMetadata("provenance_description"));
      provenance_description.setSize(6, 40);
           
      // the row to upload a new logo
      metadataList.addLabel(T_label_logo);
      metadataList.addItem().addFile("logo");

      // the row displaying an existing logo
      Item item;
      if (thisCollection.getLogo() != null) {
        metadataList.addLabel(T_label_existing_logo);
        item = metadataList.addItem();
        item.addFigure(contextPath + "/bitstream/id/" + thisCollection.getLogo().getID() + "/bob.jpg", null, null);
        item.addButton("submit_delete_logo").setValue(T_submit_delete_logo);
      }
     
      // item template creation and removal
      metadataList.addLabel(T_label_item_template);
      item = metadataList.addItem();
     
      if (thisCollection.getTemplateItem() == null)
        item.addButton("submit_create_template").setValue(T_submit_create_template);
      else
      {
        item.addButton("submit_edit_template").setValue(T_submit_edit_template);
        item.addButton("submit_delete_template").setValue(T_submit_delete_template);
View Full Code Here


 
  public void addBody(Body body) throws SAXException, WingException, SQLException, IOException
  {
    // Get our parameters and state;
    int collectionID = parameters.getParameterAsInteger("collectionID",-1);
    Collection collection = Collection.find(context,collectionID)
   
    String query = URLDecode(parameters.getParameter("query",null));
    ArrayList<Item> items = preformSearch(collection,query);
   
   
   
    // DIVISION: manage-mapper
    Division div = body.addInteractiveDivision("search-items",contextPath + "/admin/mapper", Division.METHOD_GET,"primary administrative mapper");
    div.setHead(T_head1.parameterize(query));
   
    Para actions = div.addPara();
    actions.addButton("submit_map").setValue(T_submit_map);
    actions.addButton("submit_cancel").setValue(T_submit_cancel);
   
    Table table = div.addTable("search-items-table",1,1);
   
    Row header = table.addRow(Row.ROLE_HEADER);
    header.addCellContent(T_column1);
    header.addCellContent(T_column2);
    header.addCellContent(T_column3);
    header.addCellContent(T_column4);
   
    for (Item item : items)
    {
      String itemID = String.valueOf(item.getID());
      Collection owningCollection = item.getOwningCollection();
      String owning = owningCollection.getMetadata("name");
      String author = "unkown";
      DCValue[] dcAuthors = item.getDC("contributor",Item.ANY,Item.ANY);
      if (dcAuthors != null && dcAuthors.length >= 1)
        author = dcAuthors[0].value;
     
View Full Code Here

        String myIDString = null;
        int seqStart = -1;
        int myType = -1;

        Item myItem = null;
        Collection mycollection = null;

        if (line.hasOption('h'))
        {
            HelpFormatter myhelp = new HelpFormatter();
            myhelp.printHelp("ItemExport\n", options);
            System.out
                    .println("\nfull collection: ItemExport -t COLLECTION -i ID -d dest -n number");
            System.out
                    .println("singleitem:       ItemExport -t ITEM -i ID -d dest -n number");

            System.exit(0);
        }

        if (line.hasOption('t')) // type
        {
            typeString = line.getOptionValue('t');

            if (typeString.equals("ITEM"))
            {
                myType = Constants.ITEM;
            }
            else if (typeString.equals("COLLECTION"))
            {
                myType = Constants.COLLECTION;
            }
        }

        if (line.hasOption('i')) // id
        {
            myIDString = line.getOptionValue('i');
        }

        if (line.hasOption('d')) // dest
        {
            destDirName = line.getOptionValue('d');
        }

        if (line.hasOption('n')) // number
        {
            seqStart = Integer.parseInt(line.getOptionValue('n'));
        }

        boolean migrate = false;
        if (line.hasOption('m')) // number
        {
            migrate = true;
        }

        boolean zip = false;
        String zipFileName = "";
        if (line.hasOption('z'))
        {
            zip = true;
            zipFileName = line.getOptionValue('z');
        }

        // now validate the args
        if (myType == -1)
        {
            System.out
                    .println("type must be either COLLECTION or ITEM (-h for help)");
            System.exit(1);
        }

        if (destDirName == null)
        {
            System.out
                    .println("destination directory must be set (-h for help)");
            System.exit(1);
        }

        if (seqStart == -1)
        {
            System.out
                    .println("sequence start number must be set (-h for help)");
            System.exit(1);
        }

        if (myIDString == null)
        {
            System.out
                    .println("ID must be set to either a database ID or a handle (-h for help)");
            System.exit(1);
        }

        Context c = new Context();
        c.setIgnoreAuthorization(true);

        if (myType == Constants.ITEM)
        {
            // first, is myIDString a handle?
            if (myIDString.indexOf('/') != -1)
            {
                myItem = (Item) HandleManager.resolveToObject(c, myIDString);

                if ((myItem == null) || (myItem.getType() != Constants.ITEM))
                {
                    myItem = null;
                }
            }
            else
            {
                myItem = Item.find(c, Integer.parseInt(myIDString));
            }

            if (myItem == null)
            {
                System.out
                        .println("Error, item cannot be found: " + myIDString);
            }
        }
        else
        {
            if (myIDString.indexOf('/') != -1)
            {
                // has a / must be a handle
                mycollection = (Collection) HandleManager.resolveToObject(c,
                        myIDString);

                // ensure it's a collection
                if ((mycollection == null)
                        || (mycollection.getType() != Constants.COLLECTION))
                {
                    mycollection = null;
                }
            }
            else if (myIDString != null)
            {
                mycollection = Collection.find(c, Integer.parseInt(myIDString));
            }

            if (mycollection == null)
            {
                System.out.println("Error, collection cannot be found: "
                        + myIDString);
                System.exit(1);
            }
        }

        if (zip)
        {
            ItemIterator items;
            if (myItem != null)
            {
                items = new ItemIterator(c, new ArrayList(myItem.getID()));
            }
            else
            {
                System.out.println("Exporting from collection: " + myIDString);
                items = mycollection.getItems();
            }
            exportAsZip(c, items, destDirName, zipFileName, seqStart, migrate);
        }
        else
        {
            if (myItem != null)
            {
                // it's only a single item
                exportItem(c, myItem, destDirName, seqStart, migrate);
            }
            else
            {
                System.out.println("Exporting from collection: " + myIDString);

                // it's a collection, so do a bunch of items
                ItemIterator i = mycollection.getItems();
                try
                {
                    exportItem(c, i, destDirName, seqStart, migrate);
                }
                finally
View Full Code Here

                    }
                }
            }
            else if (dso.getType() == Constants.COLLECTION)
            {
                Collection collection = (Collection) dso;
                // get all the items in the collection
                ItemIterator iitems = collection.getItems();
                try
                {
                    while (iitems.hasNext())
                    {
                        Item item = iitems.next();
View Full Code Here

 
  public void addBody(Body body) throws SAXException, WingException, SQLException
  {
    // Get our parameters and state;
    int collectionID = parameters.getParameterAsInteger("collectionID",-1);
    Collection collection = Collection.find(context,collectionID);
   
    int[] counts = getNumberOfMappedAndUnmappedItems(collection);
    int count_native = counts[0];
    int count_import = counts[1];
   
   
   
   
    // DIVISION: manage-mapper
    Division div = body.addInteractiveDivision("manage-mapper",contextPath + "/admin/mapper", Division.METHOD_GET,"primary administrative mapper");
    div.setHead(T_head1);
   
    div.addPara(T_para1.parameterize(collection.getMetadata("name")));
   
    div.addPara(T_para2);
   
   
    // LIST: Author search form
View Full Code Here

        StringBuffer emailText = new StringBuffer();
        boolean isFirst = true;

        for (int i = 0; i < collections.size(); i++)
        {
            Collection c = (Collection) collections.get(i);

            try {
                boolean includeAll = ConfigurationManager.getBooleanProperty("harvest.includerestricted.subscription", true);
               
                // we harvest all the changed item from yesterday until now
                List itemInfos = Harvest.harvest(context, c, startDate, null, 0, // Limit
                                                                                    // and
                                                                                    // offset
                                                                                    // zero,
                                                                                    // get
                                                                                    // everything
                        0, true, // Need item objects
                        false, // But not containers
                        false, // Or withdrawals
                        includeAll);
   
                if (ConfigurationManager.getBooleanProperty("eperson.subscription.onlynew", false))
                {
                    // get only the items archived yesterday
                    itemInfos = filterOutModified(itemInfos);
                }
                else
                {
                    // strip out the item archived today or
                    // not archived yesterday and modified today
                    itemInfos = filterOutToday(itemInfos);
                }

                // Only add to buffer if there are new items
                if (itemInfos.size() > 0)
                {
                    if (!isFirst)
                    {
                        emailText
                                .append("\n---------------------------------------\n");
                    }
                    else
                    {
                        isFirst = false;
                    }
   
                    emailText.append(labels.getString("org.dspace.eperson.Subscribe.new-items")).append(" ").append(
                            c.getMetadata("name")).append(": ").append(
                            itemInfos.size()).append("\n\n");
   
                    for (int j = 0; j < itemInfos.size(); j++)
                    {
                        HarvestedItemInfo hii = (HarvestedItemInfo) itemInfos
View Full Code Here

    public void addBody(Body body) throws SAXException, WingException,
            UIException, SQLException, IOException, AuthorizeException
    {
      // Get any metadata that may be removed by unselecting one of these options.
      Item item = submission.getItem();
    Collection collection = submission.getCollection();
    String actionURL = contextPath + "/handle/"+collection.getHandle() + "/workflow";
    int state = ((WorkflowItem) submission).getState();
     
      Request request = ObjectModelHelper.getRequest(objectModel);
    String showfull = request.getParameter("showfull");
   
View Full Code Here

 
    public void addBody(Body body) throws SAXException, WingException,
            UIException, SQLException, IOException, AuthorizeException
    {
      Item item = submission.getItem();
    Collection collection = submission.getCollection();
    String actionURL = contextPath + "/handle/"+collection.getHandle() + "/workflow";
     
      Request request = ObjectModelHelper.getRequest(objectModel);
    String showfull = request.getParameter("showfull");
   
    // if the user selected showsimple, remove showfull.
View Full Code Here

  public void addBody(Body body) throws SAXException, WingException,
  UIException, SQLException, IOException, AuthorizeException
  {
    // Build the url to and from creative commons
    Item item = submission.getItem();
    Collection collection = submission.getCollection();
    String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";

    Request request = ObjectModelHelper.getRequest(objectModel);
    boolean https = request.isSecure();
    String server = request.getServerName();
    int port = request.getServerPort();
View Full Code Here

     * @param collectionID
     * @return
     */
    private Collection checkCollection(String collectionID)
    {
      Collection collection = resolveCollection(collectionID);
      try {
        HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
          if (!hc.isHarvestable()) {
            System.out.println("Collection '"+ collection.getName() +"' is not set up for harvesting");
              System.exit(1);
          }
      } catch (SQLException se) {
        se.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of org.dspace.content.Collection

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.