com.google.gdata.model.atompub
Class Workspace

java.lang.Object
  extended by com.google.gdata.model.Element
      extended by com.google.gdata.model.atompub.Workspace
All Implemented Interfaces:
IWorkspace

public class Workspace
extends Element
implements IWorkspace

Server-defined groups of Collections. This is hand-written because it needs versioning support that allows us to hide the title attribute by default.


Field Summary
static ElementKey<java.lang.Void,Workspace> KEY
          The key for this element.
static AttributeKey<java.lang.String> TITLE
          The title attribute.
 
Constructor Summary
  Workspace()
          Default mutable constructor.
protected Workspace(ElementKey<?,? extends Workspace> key)
          Lets subclasses create an instance using custom key.
protected Workspace(ElementKey<?,? extends Workspace> key, Element source)
          Constructs a new instance by doing a shallow copy of data from an existing Element instance.
  Workspace(TextContent title)
          Constructor with the title element.
 
Method Summary
 void addCollection(Collection collection)
          Adds a new collection.
 Collection addCollection(java.lang.String collectionUri, java.lang.String title, java.lang.String... acceptedTypes)
          Add a new collection with the given title and accept types.
 java.util.List<Collection> getCollections()
          Returns the collections.
 TextContent getTitle()
          Returns the title.
 boolean hasCollections()
          Returns whether it has the collections.
 boolean hasTitle()
          Returns whether it has the title.
static void registerMetadata(MetadataRegistry registry)
          Registers the metadata for this element.
 boolean removeCollection(Collection collection)
          Removes an existing collection.
 Element resolve(ElementMetadata<?,?> meta, ValidationContext vc)
          Resolve this element's state against the metadata.
 void setTitle(TextContent title)
          Sets the title.
 java.lang.String toString()
           
 
Methods inherited from class com.google.gdata.model.Element
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, equals, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hashCode, hasTextValue, isLocked, lock, narrow, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, validate, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY

public static final ElementKey<java.lang.Void,Workspace> KEY
The key for this element.


TITLE

public static final AttributeKey<java.lang.String> TITLE
The title attribute.

Constructor Detail

Workspace

public Workspace()
Default mutable constructor.


Workspace

protected Workspace(ElementKey<?,? extends Workspace> key)
Lets subclasses create an instance using custom key.


Workspace

protected Workspace(ElementKey<?,? extends Workspace> key,
                    Element source)
Constructs a new instance by doing a shallow copy of data from an existing Element instance. Will use the given ElementKey as the key for the element.

Parameters:
key - the element key to use for this element.
source - source element

Workspace

public Workspace(TextContent title)
Constructor with the title element.

Method Detail

registerMetadata

public static void registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.


getCollections

public java.util.List<Collection> getCollections()
Returns the collections.

Specified by:
getCollections in interface IWorkspace
Returns:
collections

addCollection

public void addCollection(Collection collection)
Adds a new collection.

Parameters:
collection - collection

addCollection

public Collection addCollection(java.lang.String collectionUri,
                                java.lang.String title,
                                java.lang.String... acceptedTypes)
Add a new collection with the given title and accept types.

Specified by:
addCollection in interface IWorkspace

removeCollection

public boolean removeCollection(Collection collection)
Removes an existing collection.

Parameters:
collection - collection
Returns:
true if the collection was removed

hasCollections

public boolean hasCollections()
Returns whether it has the collections.

Returns:
whether it has the collections

getTitle

public TextContent getTitle()
Returns the title.

Returns:
title

setTitle

public void setTitle(TextContent title)
Sets the title.

Parameters:
title - title or null to reset

hasTitle

public boolean hasTitle()
Returns whether it has the title.

Returns:
whether it has the title

resolve

public Element resolve(ElementMetadata<?,?> meta,
                       ValidationContext vc)
Description copied from class: Element
Resolve this element's state against the metadata. Accumulates errors in caller's validation context.

Overrides:
resolve in class Element
vc - validation context
Returns:
the narrowed element if narrowing took place.

toString

public java.lang.String toString()
Overrides:
toString in class Element