Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.rendering.api
Class DefaultDocumentView

java.lang.Object
  extended by org.nuxeo.ecm.platform.rendering.api.DefaultDocumentView
All Implemented Interfaces:
DocumentView

public class DefaultDocumentView
extends Object
implements DocumentView

Base class to build views for Document oriented contexts (contexts that are bound to a document).

Note that this class cannot be used with contexts for which the RenderingContext#getDocument() method is returning null.

This implementation ensure that the context argument is never used so it can be used outside the scope of a rendering context to get a view over the document.

Author:
Bogdan Stefanescu

Nested Class Summary
static interface DefaultDocumentView.Field
           
 
Field Summary
static DefaultDocumentView DEFAULT
          The singleton instance that should be used by clients.
static Object UNKNOWN
           
 
Constructor Summary
DefaultDocumentView()
           
DefaultDocumentView(Map<String,DefaultDocumentView.Field> fields)
           
 
Method Summary
 void addField(DefaultDocumentView.Field field)
           
 void addFields(Collection<DefaultDocumentView.Field> fields)
           
 Object get(DocumentModel doc, String name)
           
 DefaultDocumentView.Field getField(String name)
           
 Map<String,DefaultDocumentView.Field> getFields()
           
 boolean isEmpty()
           
 Collection<String> keys(DocumentModel doc)
           
 void removeField(String name)
           
 int size(DocumentModel doc)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final Object UNKNOWN

DEFAULT

public static final DefaultDocumentView DEFAULT
The singleton instance that should be used by clients. Warn that this static field must be defined at the end of the class after any other field class since it will try to register these fields (otherwise fields will not be defined yet at the time of the initialization of that static member

Constructor Detail

DefaultDocumentView

public DefaultDocumentView()

DefaultDocumentView

public DefaultDocumentView(Map<String,DefaultDocumentView.Field> fields)
Method Detail

addField

public final void addField(DefaultDocumentView.Field field)

addFields

public final void addFields(Collection<DefaultDocumentView.Field> fields)

removeField

public final void removeField(String name)

getField

public DefaultDocumentView.Field getField(String name)

get

public Object get(DocumentModel doc,
                  String name)
           throws Exception
Specified by:
get in interface DocumentView
Throws:
Exception

keys

public Collection<String> keys(DocumentModel doc)
Specified by:
keys in interface DocumentView

getFields

public Map<String,DefaultDocumentView.Field> getFields()

isEmpty

public boolean isEmpty()

size

public int size(DocumentModel doc)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.