Package org.purl.sword.base

Examples of org.purl.sword.base.Collection


         {
            TreeNodeWrapper collectionWrapper = (TreeNodeWrapper)o;
            Object data = collectionWrapper.getData();
            if( data instanceof Collection )
            {
               Collection col = (Collection)data;
               String location = col.getLocation();
               if( location != null )
               {
                  locations[i] = location;                   
               }
            }
View Full Code Here


    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();

    org.dspace.content.Collection col = (org.dspace.content.Collection) dso;

    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(col);

    // collection title is just its name
    String title = col.getMetadata("name");

    // the collection policy is the licence to which the collection adheres
    String collectionPolicy = col.getLicense();

    // FIXME: what is the treatment?  Doesn't seem appropriate for DSpace
    // String treatment = " ";

    // abstract is the short description of the collection
    String dcAbstract = col.getMetadata("short_description");

    // we just do support mediation
    boolean mediation = swordConfig.isMediated();

    // load up the sword collection
    scol.setLocation(location);

    // add the title if it exists
    if (title != null && !"".equals(title))
    {
      scol.setTitle(title);
    }

    // add the collection policy if it exists
    if (collectionPolicy != null && !"".equals(collectionPolicy))
    {
      scol.setCollectionPolicy(collectionPolicy);
    }

    // FIXME: leave the treatment out for the time being,
    // as there is no analogue
    // scol.setTreatment(treatment);

    // add the abstract if it exists
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    scol.setMediation(mediation);

        List<String> accepts = swordService.getSwordConfig().getCollectionAccepts();
        for (String accept : accepts)
        {
            scol.addAccepts(accept);
        }

    // add the accept packaging values
    Map<String, Float> aps = swordConfig.getAcceptPackaging(col);
    for (Map.Entry<String, Float> ap : aps.entrySet())
    {
      scol.addAcceptPackaging(ap.getKey(), ap.getValue());
    }

    // should we offer the items in the collection up as deposit
    // targets?
    boolean itemService = ConfigurationManager.getBooleanProperty("sword-server", "expose-items");
    if (itemService)
    {
      String subService = urlManager.constructSubServiceUrl(col);
      scol.setService(subService);
    }

    log.debug("Created ATOM Collection for DSpace Collection");

    return scol;
View Full Code Here

    // get the things we need out of the service
    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();

    Community com = (Community) dso;
    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(com);
    scol.setLocation(location);

    // collection title is just the community name
    String title = com.getMetadata("name");
    if (title != null && !"".equals(title))
    {
      scol.setTitle(title);
    }

    // FIXME: the community has no obvious licence
    // the collection policy is the licence to which the collection adheres
    // String collectionPolicy = col.getLicense();

    // abstract is the short description of the collection
    String dcAbstract = com.getMetadata("short_description");
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    // do we support mediated deposit
    scol.setMediation(swordConfig.isMediated());

    // NOTE: for communities, there are no MIME types that it accepts.
    // the list of mime types that we accept

    // offer up the collections from this item as deposit targets
    String subService = urlManager.constructSubServiceUrl(com);
    scol.setService(subService);

    log.debug("Created ATOM Collection for DSpace Community");

    return scol;
  }
View Full Code Here

    SWORDConfiguration swordConfig = swordService.getSwordConfig();
    SWORDUrlManager urlManager = swordService.getUrlManager();
    Context context = swordService.getContext();

    Item item = (Item) dso;
    Collection scol = new Collection();

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(item);
    scol.setLocation(location);

    // the item title is the sword collection title, or "untitled" otherwise
    String title = "Untitled";
    Metadatum[] dcv = item.getMetadataByMetadataString("dc.title");
    if (dcv.length > 0)
    {
      title = dcv[0].value;
    }
    scol.setTitle(title);

    // FIXME: there is no collection policy for items that is obvious to provide.
    // the collection policy is the licence to which the collection adheres
    // String collectionPolicy = col.getLicense();

    // abstract is the short description of the item, if it exists
    String dcAbstract = "";
    Metadatum[] dcva = item.getMetadataByMetadataString("dc.description.abstract");
    if (dcva.length > 0)
    {
      dcAbstract = dcva[0].value;
    }
    if (dcAbstract != null && !"".equals(dcAbstract))
    {
      scol.setAbstract(dcAbstract);
    }

    // do we suppot mediated deposit
    scol.setMediation(swordConfig.isMediated());

    // the list of mime types that we accept, which we take from the
    // bitstream format registry
    List<String> acceptFormats = swordConfig.getAccepts(context, item);
    for (String acceptFormat : acceptFormats)
    {
      scol.addAccepts(acceptFormat);
    }

    return scol;
  }
View Full Code Here

        // process the collections
        Iterator<Collection> collections = workspace
        .collectionIterator();
        for (; collections.hasNext();)
        {
          Collection collection = collections.next();
          System.out.println("\nCollection location: "
              + collection.getLocation());
          System.out.println("Collection title: "
              + collection.getTitle());
          System.out
          .println("Abstract: " + collection.getAbstract());
          System.out.println("Collection Policy: "
              + collection.getCollectionPolicy());
          System.out.println("Treatment: "
              + collection.getTreatment());
          System.out.println("Mediation: "
              + collection.getMediation());

          String[] accepts = collection.getAccepts();
          if( accepts != null && accepts.length == 0 )
          {
            System.out.println("Accepts: none specified");
          }
          else
          {
            for (String s : accepts)
            {
              System.out.println("Accepts: " + s);
            }
          }
                     List<SwordAcceptPackaging> acceptsPackaging = collection.getAcceptPackaging();

                     StringBuilder acceptPackagingList = new StringBuilder();
                     for(Iterator i = acceptsPackaging.iterator();i.hasNext();)
                     {
                        SwordAcceptPackaging accept = (SwordAcceptPackaging) i.next();
View Full Code Here

        ServiceDocument serviceDoc = (ServiceDocument) request.getAttribute("serviceDoc");
        String location = (String) request.getAttribute("location");
        String[] fileTypes = (String[]) request.getAttribute("fileTypes");
        String[] packageFormats = (String[]) request.getAttribute("packageFormats");

        Collection collection = ServiceDocumentHelper.getCollection(serviceDoc, location);

        Division main = body.addInteractiveDivision("confirm-collection", contextPath + "/swordclient", Division.METHOD_POST, "");
        main.setHead(T_main_head.parameterize(handle));

        List collectionList = main.addList("collectionList", List.TYPE_FORM);

        collectionList.setHead(T_collection_head.parameterize(location));
        collectionList.addItem().addContent(T_collection_title.parameterize(collection.getTitle()));
        collectionList.addItem().addContent(T_collection_policy.parameterize(collection.getCollectionPolicy()));
        collectionList.addItem().addContent(T_collection_mediation.parameterize(Boolean.toString(collection.getMediation())));

        Select fileType = collectionList.addItem().addSelect("fileType");
        for (String ft : fileTypes) {
            fileType.addOption(false, ft, ft);
        }
View Full Code Here

TOP

Related Classes of org.purl.sword.base.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.