org.rometools.propono.atom.client
Class ClientCollection

java.lang.Object
  extended by org.rometools.propono.atom.common.Collection
      extended by org.rometools.propono.atom.client.ClientCollection

public class ClientCollection
extends Collection

Models an Atom collection, extends Collection and adds methods for adding, retrieving, updateing and deleting entries.


Field Summary
 
Fields inherited from class org.rometools.propono.atom.common.Collection
ENTRY_TYPE
 
Method Summary
 void addEntry(ClientEntry entry)
          Save to collection a new entry that was created by a createEntry() or createMediaEntry() and save it to the server.
 ClientEntry createEntry()
          Create new entry associated with collection, but do not save to server.
 ClientMediaEntry createMediaEntry(String title, String slug, String contentType, byte[] bytes)
          Create new media entry assocaited with collection, but do not save.
 ClientMediaEntry createMediaEntry(String title, String slug, String contentType, InputStream is)
          Create new media entry assocaited with collection, but do not save.
 Iterator getEntries()
          Get iterator over entries in this collection.
 ClientEntry getEntry(String uri)
          Get full entry specified by entry edit URI.
 Workspace getWorkspace()
          Get workspace or null if collection is not associated with a workspace.
 boolean isWritable()
          Determines if collection is writable.
protected  void parseCollectionElement(org.jdom.Element element)
           
 
Methods inherited from class org.rometools.propono.atom.common.Collection
accepts, addAccept, addCategories, collectionToElement, elementToCollection, getAccepts, getCategories, getHref, getHrefResolved, getHrefResolved, getTitle, getTitleType, setAccepts, setHref, setTitle, setTitleType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEntries

public Iterator getEntries()
                    throws ProponoException
Get iterator over entries in this collection. Entries returned are considered to be partial entries cannot be saved/updated.

Throws:
ProponoException

getEntry

public ClientEntry getEntry(String uri)
                     throws ProponoException
Get full entry specified by entry edit URI. Note that entry may or may not be associated with this collection.

Returns:
ClientEntry or ClientMediaEntry specified by URI.
Throws:
ProponoException

getWorkspace

public Workspace getWorkspace()
Get workspace or null if collection is not associated with a workspace.


isWritable

public boolean isWritable()
Determines if collection is writable.


createEntry

public ClientEntry createEntry()
                        throws ProponoException
Create new entry associated with collection, but do not save to server.

Throws:
ProponoException - if collecton is not writable.

createMediaEntry

public ClientMediaEntry createMediaEntry(String title,
                                         String slug,
                                         String contentType,
                                         byte[] bytes)
                                  throws ProponoException
Create new media entry assocaited with collection, but do not save. server. Depending on the Atom server, you may or may not be able to persist the properties of the entry that is returned.

Parameters:
title - Title to used for uploaded file.
slug - String to be used in file-name of stored file
contentType - MIME content-type of file.
bytes - Data to be uploaded as byte array.
Throws:
ProponoException - if collecton is not writable

createMediaEntry

public ClientMediaEntry createMediaEntry(String title,
                                         String slug,
                                         String contentType,
                                         InputStream is)
                                  throws ProponoException
Create new media entry assocaited with collection, but do not save. server. Depending on the Atom server, you may or may not be able to. persist the properties of the entry that is returned.

Parameters:
title - Title to used for uploaded file.
slug - String to be used in file-name of stored file
contentType - MIME content-type of file.
is - Data to be uploaded as InputStream.
Throws:
ProponoException - if collecton is not writable

addEntry

public void addEntry(ClientEntry entry)
              throws ProponoException
Save to collection a new entry that was created by a createEntry() or createMediaEntry() and save it to the server.

Parameters:
entry - Entry to be saved.
Throws:
ProponoException - on error, if collection is not writable or if entry is partial.

parseCollectionElement

protected void parseCollectionElement(org.jdom.Element element)
                               throws ProponoException
Overrides:
parseCollectionElement in class Collection
Throws:
ProponoException


Copyright © 2007-2013 ROME Project. All Rights Reserved.