Package org.apache.abdera.model

Examples of org.apache.abdera.model.Collection


      "username", "password"));
   
    // Get the service document and look up the collection uri
    Document<Service> service_doc = client.get(start).getDocument();
    Service service = service_doc.getRoot();
    Collection collection = service.getWorkspaces().get(0).getCollections().get(0);
    String uri = collection.getHref().toString();
     
    // Post the entry to the collection
    Response response = client.post(uri, entry);
   
    // Check the result
View Full Code Here


      "username", "password"));
   
    // Get the service doc and locate the href of the collection
    Document<Service> service_doc = client.get(start).getDocument();
    Service service = service_doc.getRoot();
    Collection collection = service.getWorkspaces().get(0).getCollections().get(1);
    String uri = collection.getHref().toString();
     
    // Set the filename.  Note: the Title header was used by older drafts
    // of the Atom Publishing Protocol and should no longer be used.  The
    // current Roller APP implementation still currently requires it.
    RequestOptions options = client.getDefaultRequestOptions();
View Full Code Here

    Document<Service> introspection =
      client.get(
        args[0]).getDocument();
    Service service =
      introspection.getRoot();
    Collection collection =
      service.getCollection(
        args[1],
        args[2]);
    report("The Collection Element", collection.toString());
   
    // Create the entry to post to the collection
    Entry entry = factory.newEntry();
    entry.setId("tag:example.org,2006:foo");
    entry.setTitle("This is the title");
    entry.setUpdated(new Date());
    entry.addAuthor("James");
    entry.setContent("This is the content");
    report("The Entry to Post", entry.toString());
   
    // Post the entry. Be sure to grab the resolved HREF of the collection
    Document<Entry> doc = client.post(
      collection.getResolvedHref().toString(),
      entry).getDocument();
   
    // In some implementations (such as Google's GData API, the entry URI is
    // distinct from it's edit URI.  To be safe, we should assume it may be
    // different
View Full Code Here

  private Document<Service> init_service_doc(Abdera abdera) {
    Factory factory = abdera.getFactory();
    Service service = factory.newService();
    Workspace workspace = service.addWorkspace("Simple");
    try {
      Collection collection = workspace.addCollection("Simple", "atom/feed");
      collection.setAccept("entry");
      collection.addCategories().setFixed(false);
    } catch (Exception e) {}
    return service.getDocument();
  }
View Full Code Here

        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());
        System.out.println(indent + "self link=" + feed.getSelfLink());
        Collection collection = feed.getCollection();
        if (collection == null) {
            System.out.println(indent + "collection=null");
        } else {
            System.out.println(indent + "collection=" + collection);
        }
View Full Code Here

        Document<Service> doc = resp.getDocument();
        Service service = doc.getRoot();
        assertEquals(1, service.getWorkspaces().size());
        Workspace workspace = service.getWorkspace("Abdera");
        assertEquals(2, workspace.getCollections().size());
        Collection collection = workspace.getCollection("Filesystem Feed");
        assertNotNull(collection);
        assertTrue(collection.acceptsEntry());
        assertEquals("http://localhost:9002/fs", collection.getResolvedHref().toString());
    }
View Full Code Here

            } else if (element instanceof Collection) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
                if (!isSameAsParentBase(element))
                    jstream.writeField("xml:base", element.getResolvedBaseUri());
                Collection collection = (Collection)element;
                jstream.writeField("href", collection.getResolvedHref());
                writeElement("title", collection.getTitleElement(), jstream);
                String[] accepts = collection.getAccept();
                if (accepts != null && accepts.length > 0) {
                    jstream.writeField("accept");
                    jstream.startArray();
                    for (int n = 0; n < accepts.length; n++) {
                        jstream.writeQuoted(accepts[n]);
                        if (n < accepts.length - 1)
                            jstream.writeSeparator();
                    }
                    jstream.endArray();
                }
                List<Categories> cats = collection.getCategories();
                if (cats.size() > 0)
                    writeList("categories", collection.getCategories(), jstream);
                writeExtensions((ExtensibleElement)element, jstream);
                jstream.endObject();
            } else if (element instanceof Control) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
View Full Code Here

    public static void main(String... args) throws Exception {

        Abdera abdera = new Abdera();
        Service service = abdera.newService();
        Workspace workspace = service.addWorkspace("My workspace");
        Collection collection = workspace.addCollection("My collection", "foo");

        // Specify which features are supported by the collection
        org.apache.abdera.ext.features.Features features = FeaturesHelper.addFeaturesElement(collection);
        features.addFeature(FeaturesHelper.FEATURE_SUPPORTS_DRAFTS);
        features.addFeature(FeaturesHelper.FEATURE_REQUIRES_TEXT_TEXT);
View Full Code Here

        category.setLabel("c");
        assertNotNull(category);
        assertEquals("a", category.getScheme().toString());
        assertEquals("b", category.getTerm());
        assertEquals("c", category.getLabel());
        Collection collection = factory.newCollection();
        assertNotNull(collection);
        Content content = factory.newContent(Content.Type.TEXT);
        assertNotNull(content);
        assertEquals(Content.Type.TEXT, content.getContentType());
        content = factory.newContent(Content.Type.HTML);
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

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.