Package org.apache.abdera.model

Examples of org.apache.abdera.model.Collection


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


        abderaClient.addCredentials(start, null, null, new UsernamePasswordCredentials("username", "password"));

        // Get the service document and look up the collection uri
        Document<Service> service_doc = abderaClient.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 = abderaClient.post(uri, entry);

        // Check the result
View Full Code Here

        abderaClient.addCredentials(start, null, null, new UsernamePasswordCredentials("username", "password"));

        // Get the service doc and locate the href of the collection
        Document<Service> service_doc = abderaClient.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 = abderaClient.getDefaultRequestOptions();
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++;
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++;
View Full Code Here

    }

    @Test
    public void testFeatures() throws Exception {
        Abdera abdera = Abdera.getInstance();
        Collection coll = abdera.getFactory().newCollection();
        Features features = FeaturesHelper.addFeaturesElement(coll);
        features.addFeature("http://example.com/features/foo", null, "foo & here");
        features.addFeature("http://example.com/features/bar", null, null);

        assertEquals(Status.SPECIFIED, FeaturesHelper.getFeatureStatus(coll, "http://example.com/features/foo"));
View Full Code Here

    public void testSelectors() throws Exception {

        Abdera abdera = Abdera.getInstance();
        Service service = abdera.newService();
        Workspace workspace = service.addWorkspace("a");
        Collection collection1 = workspace.addCollection("a1", "a1");
        collection1.setAcceptsEntry();
        Features features = FeaturesHelper.addFeaturesElement(collection1);
        features.addFeature(FeaturesHelper.FEATURE_SUPPORTS_DRAFTS);
        Collection collection2 = workspace.addCollection("a2", "a2");
        collection2.setAccept("image/*");

        Selector s1 = new FeatureSelector(FeaturesHelper.FEATURE_SUPPORTS_DRAFTS);

        Collection[] collections = FeaturesHelper.select(service, s1);

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

                workspace.setTitle(title);
            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;type=feed");
              collection.addAccepts("application/json;type=feed");
              collection.addAccepts("application/atom+xml;type=entry");
              collection.addAccepts("application/json;type=entry");
              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;type=feed");
              collection.addAccepts("application/atom+xml; type=entry");
              collection.addAccepts("application/json;type=entry");
              collection.addCategories().setFixed(false);           
            }
          workspace.addCollection(collection);

            service.addWorkspace(workspace);
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.