Examples of SwordCollection


Examples of org.swordapp.server.SwordCollection

    // get the things we need out of the service
    SwordUrlManager urlManager = swordConfig.getUrlManager(context, swordConfig);

    Collection col = (Collection) dso;
    SwordCollection scol = new SwordCollection();

    // 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 = swordConfig.getCollectionAccepts();
        for (String accept : accepts)
        {
            scol.addAccepts(accept);
      scol.addMultipartAccepts(accept);
        }

    // add the accept packaging values
    List<String> aps = swordConfig.getAcceptPackaging(col);
    for (String ap : aps)
    {
      scol.addAcceptPackaging(ap);
    }

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

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

    return scol;
View Full Code Here

Examples of org.swordapp.server.SwordCollection

    // get the things we need out of the service
    SwordUrlManager urlManager = swordConfig.getUrlManager(context, swordConfig);

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

    // prepare the parameters to be put in the sword collection
    String location = urlManager.getDepositLocation(com);
    if (location == null)
    {
      location = HandleManager.getCanonicalForm(com.getHandle());
    }
    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.addSubService(new IRI(subService));

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

    return scol;
  }
View Full Code Here

Examples of org.swordapp.server.SwordCollection

      if (swordCommunities)
      {
        List<Community> comms = swordAuth.getAllowedCommunities(context);
        for (Community comm : comms)
        {
          SwordCollection scol = comGen.buildCollection(context.getContext(), comm, swordConfig);
          workspace.addCollection(scol);
        }
      }
      else
      {
        List<Collection> cols = swordAuth.getAllowedCollections(context);
        for (Collection col : cols)
        {
            SwordCollection scol = colGen.buildCollection(context.getContext(), col, swordConfig);
          workspace.addCollection(scol);
        }
      }

          service.addWorkspace(workspace);
    }
    else
    {
      // we are dealing with a partial or sub-service document
      DSpaceObject dso = urlManager.extractDSpaceObject(url);
            if (dso == null)
            {
                throw new SwordError(404);
            }

      if (dso instanceof Community)
      {
        Community community = (Community) dso;
        SwordWorkspace workspace = new SwordWorkspace();
        workspace.setTitle(community.getMetadata("name"));

        List<Collection> collections = swordAuth.getAllowedCollections(context, community);
        for (Collection collection : collections)
        {
          SwordCollection scol = colGen.buildCollection(context.getContext(), collection, swordConfig);
          workspace.addCollection(scol);
        }

        List<Community> communities = swordAuth.getCommunities(context, community);
        for (Community comm : communities)
        {
          SwordCollection scol = comGen.buildCollection(context.getContext(), comm, swordConfig);
          workspace.addCollection(scol);
        }

        service.addWorkspace(workspace);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.