Package org.apache.abdera.model

Examples of org.apache.abdera.model.Collection


            } else {
                workspace.setTitle("workspace");
            }
            workspace.setBaseUri( new IRI( workspaceURL ));

            Collection collection = workspace.addCollection("collection", href );
            Feed feed = getFeed( request );
            if ( feed != null ) {
                String title = feed.getTitle();
                if ( title != null ) {
                    collection.setTitle(title);
                } else {
                    collection.setTitle("entries");
                }
                collection.addAccepts("application/atom+xml");
                collection.addAccepts("application/json");
                List<Category> categories = feed.getCategories();
                if ( categories != null ) {
                    collection.addCategories(categories, false, null);
                } else {
                    collection.addCategories().setFixed(false);
                }

            } else {
                collection.setTitle("entries");

                collection.addAccepts("application/atom+xml");
                collection.addAccepts("application/json");
                collection.addCategories().setFixed(false);
            }
            workspace.addCollection(collection);
            service.addWorkspace(workspace);

            //FIXME add prettyPrint support
View Full Code Here


        System.out.println( title );
        System.out.println( indent + "id=" + feed.getId() );
        System.out.println( indent + "title=" + feed.getTitle() );
        System.out.println( indent + "updated=" + feed.getUpdated() );
        System.out.println( indent + "author=" + feed.getAuthor() );
        Collection collection = feed.getCollection();
        if ( collection == null ) {
            System.out.println( indent + "collection=null" );
        } else {
            System.out.println( indent + "collection=" + collection );
        }
View Full Code Here

            workspace.setTitle("resource");

            String href = request.getRequestURL().toString();
            href = href.substring(0, href.length() - "/atomsvc".length());
           
            Collection collection = workspace.addCollection("collection", "atom/feed");
            collection.setTitle("entries");
            collection.setAttributeValue("href", href);
            collection.setAccept("entry");
            collection.addCategories().setFixed(false);
           
            workspace.addCollection(collection);

            service.addWorkspace(workspace);
View Full Code Here

    Service service = doc.getRoot();
    prettyPrint(service);
    assertEquals(service.getWorkspaces().size(), 1);
    Workspace workspace = service.getWorkspaces().get(0);
    assertEquals(workspace.getCollections().size(), 1);
    Collection collection = workspace.getCollections().get(0);
    assertEquals(collection.getResolvedHref().toString(), BASE + "/feed");
    assertEquals(collection.getTitle().toString(), "A simple feed");
    resp.release();
  }
View Full Code Here

    return list;
  }

  public Collection getCollection(String title) {
    List<Collection> cols = getCollections();
    Collection col = null;
    for (Collection c : cols) {
      if (c.getTitle().equals(title)) {
        col = c;
        break;
      }
View Full Code Here

  }

  public Collection addCollection(String title, String href) {
    complete();
    FOMFactory fomfactory = (FOMFactory) factory;
    Collection collection = fomfactory.newCollection(this);
    collection.setTitle(title);
    collection.setHref(href);
    return collection;
  }
View Full Code Here

  }
 
  public Collection addMultipartCollection(String title, String href) {
      complete();
      FOMFactory fomfactory = (FOMFactory) factory;
      Collection collection = fomfactory.newMultipartCollection(this);
      collection.setTitle(title);
      collection.setHref(href);
      return collection;
    }
View Full Code Here

      collection.setHref(href);
      return collection;
    }
 
  public Collection getCollectionThatAccepts(MimeType... types) {
    Collection collection = null;
    for (Collection coll : getCollections()) {
      int matches = 0;
      for (MimeType type : types) if (coll.accepts(type)) matches++;
      if (matches == types.length) {
        collection = coll;
View Full Code Here

    }
    return collection;
  }

  public Collection getCollectionThatAccepts(String... types) {
    Collection collection = null;
    for (Collection coll : getCollections()) {
      int matches = 0;
      for (String type : types) if (coll.accepts(type)) matches++;
      if (matches == types.length) {
        collection = coll;
View Full Code Here

    category.setLabel("c");
    assertNotNull(category);
    assertEquals(category.getScheme().toString(), "a");
    assertEquals(category.getTerm(), "b");
    assertEquals(category.getLabel(), "c");
    Collection collection = factory.newCollection();
    assertNotNull(collection);
    Content content = factory.newContent(Content.Type.TEXT);
    assertNotNull(content);
    assertEquals(content.getContentType(), Content.Type.TEXT);
    content = factory.newContent(Content.Type.HTML);
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.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.