Package org.apache.abdera.model

Examples of org.apache.abdera.model.Workspace


            }

            Service service = abderaFactory.newService();
            //service.setText("service");

            Workspace workspace = abderaFactory.newWorkspace();
            if ( title != null ) {
                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);

            //FIXME add prettyPrint support
            try {
                service.getDocument().writeTo(response.getOutputStream());
View Full Code Here


            }

            Service service = abderaFactory.newService();
            //service.setText("service");

            Workspace workspace = abderaFactory.newWorkspace();
            if ( title != null ) {
                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);

            //FIXME add prettyPrint support
            try {
                service.getDocument().writeTo(response.getOutputStream());
View Full Code Here

    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    iri = factory.newUri();
    iri.setValue("http://example.org/foo");
    assertEquals(iri.getValue().toString(), "http://example.org/foo");
    Workspace workspace = factory.newWorkspace();
    assertNotNull(workspace);
    div = factory.newDiv();
    content = factory.newContent(Content.Type.XHTML);
    content.setValueElement(div);
    assertNotNull(content);
View Full Code Here

  // TODO: This method needs changes.
  public JSONObject getRepositoryInfo(Service ecmInfo){
    JSONObject response = new JSONObject();
   
    Workspace ws = ecmInfo.getWorkspace("Main Repository");
      
    List<Element> list = ws.getExtensions();
    Element e;
    List<List<Element>> info = new ArrayList<List<Element>>();
    for (int i=0; i<list.size(); i++) {
      e = list.get(i);
      List<Element> cmisPropsECM = e.getElements();
View Full Code Here

    return list;
  }

  public Workspace getWorkspace(String title) {
    List<Workspace> workspaces = getWorkspaces();
    Workspace workspace = null;
    for (Workspace w : workspaces) {
      if (w.getTitle().equals(title)) {
        workspace = w;
        break;
      }
View Full Code Here

    addChild((OMElement) workspace);
  }
 
  public Workspace addWorkspace(String title) {
    FOMFactory fomfactory = (FOMFactory) factory;
    Workspace workspace = fomfactory.newWorkspace(this);
    workspace.setTitle(title);
    return workspace;
  }
View Full Code Here

    return workspace;
  }

  public Collection getCollection(String workspace, String collection) {
    Collection col = null;
    Workspace w = getWorkspace(workspace);
    if (w != null) {
      col = w.getCollection(collection);
    }
    return col;
  }
View Full Code Here

  private static AppTest INSTANCE = null;
 
  private static Document<Service> init_service_document(String base) {
    try {
      Service service = getFactory().newService();
      Workspace workspace = service.addWorkspace("Test");
      workspace.addCollection("Entries", base + "/collections/entries").setAcceptsEntry();
      workspace.addCollection("Other", base + "/collections/other").setAccept("text/plain");
      Document<Service> doc = service.getDocument();
      return doc;
    } catch (Exception e) {}
    return null;
  }
View Full Code Here

      Document<Service> service_doc = response.getDocument();
      assertNotNull(service_doc);
      assertEquals(1, service_doc.getRoot().getWorkspaces().size());

      Workspace workspace = service_doc.getRoot().getWorkspace("Test");
      assertNotNull(workspace);

      for (Collection c: workspace.getCollections()) {
        assertNotNull(c.getTitle());
        assertNotNull(c.getHref());
      }
   
      col_uri = getBase() + "/collections/entries";
View Full Code Here

 
  public static void testSelectors() throws Exception {
   
    Abdera abdera = new Abdera();
    Service service = abdera.newService();
    Workspace workspace = service.addWorkspace("a");
    Collection collection1 = workspace.addCollection("a1","a1");
    collection1.setAcceptsEntry();
    FeaturesHelper.addFeature(collection1, FeaturesHelper.FEATURE_DRAFTS);
    Collection collection2 = workspace.addCollection("a2","a2");
    collection2.setAccept("image/*");
   
    Selector s1 = new FeatureSelector(FeaturesHelper.FEATURE_DRAFTS);
   
    Collection[] collections = FeaturesHelper.select(service, s1);
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Workspace

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.