Package org.apache.abdera.model

Examples of org.apache.abdera.model.Workspace


    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

    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

            }

            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");
                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
            try {
                service.getDocument().writeTo(response.getOutputStream());
View Full Code Here

    } else if (!title.equals(other.title)) return false;
    return true;
  }
 
  public Workspace asWorkspaceElement(RequestContext request) {
    Workspace workspace = request.getAbdera().getFactory().newWorkspace();
    workspace.setTitle(title);
    for (CollectionInfo collection : this.collections)
      workspace.addCollection(collection.asCollectionElement(request));
    return workspace;
  }
View Full Code Here

  public void setTitle(String title) {
    this.title = title;
  }
 
  public Workspace asWorkspaceElement(RequestContext request) {
    Workspace workspace = request.getAbdera().getFactory().newWorkspace();
    workspace.setTitle(getTitle(null));
    for (CollectionInfo collection : getCollections(request))
      workspace.addCollection(collection.asCollectionElement(request));
    return workspace;
  }
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

    }

    public Workspace addWorkspace(String title) {
        complete();
        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

            }

            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

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.