com.webmethods.caf.faces.data.object
Class BoundPropertiesContentProvider

java.lang.Object
  extended by com.webmethods.caf.faces.data.object.BoundPropertiesContentProvider
All Implemented Interfaces:
IContentProvider, IUpdateableContentProvider
Direct Known Subclasses:
AtomFeedExportProvider, BoundPropertiesTableContentProvider

public class BoundPropertiesContentProvider
extends Object
implements IContentProvider, IUpdateableContentProvider

Provider which limits a wrapped provider to exposing a specified set of properties; the properties are specified via binding expressions.


Field Summary
protected  Map m_keys
           
protected  IContentProvider m_provider
           
protected  String m_var
           
 
Constructor Summary
BoundPropertiesContentProvider()
          Blank provider.
BoundPropertiesContentProvider(IContentProvider provider, Map keys, String var)
          Provider limiting specified provider to specified keys.
 
Method Summary
static Map createDefaultKeys(IContentProvider provider, String var)
          Creates the default key mapping for the specified provider and provider variable.
 Map getKeys()
          Maps property names to value-binding expressions.
 Object[] getPropertyKeys()
          Returns list of properties supported by this content provider.
 IContentProvider getProvider()
          Source provider that this provider limits.
 Class getType(Object propertyKey)
          Returns java type of the given property
 Object getValue(Object propertyKey)
          Returns value of the given property
 String getVar()
          Variable representing the source provider to use in key value bindings.
 boolean hasProperty(Object propertyKey)
          Checks if the given property is supported by this content provider
 boolean isReadOnly(Object propertyKey)
          Returns true if the given property is readonly.
 void setKeys(Map keys)
          Maps property names to value-binding expressions.
 void setProvider(IContentProvider provider)
          Source provider that this provider limits.
 void setValue(Object propertyKey, Object value)
          Sets new value of the given property
 void setVar(String var)
          Variable representing the source provider to use in key value bindings.
 String toString()
          Returns string representation of content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_provider

protected IContentProvider m_provider

m_keys

protected Map m_keys

m_var

protected String m_var
Constructor Detail

BoundPropertiesContentProvider

public BoundPropertiesContentProvider()
Blank provider. Must be initialized with BoundPropertiesContentProvider.setProvider(com.webmethods.caf.faces.data.IContentProvider), BoundPropertiesContentProvider.setKeys(java.util.Map), and BoundPropertiesContentProvider.setVar(java.lang.String).


BoundPropertiesContentProvider

public BoundPropertiesContentProvider(IContentProvider provider,
                                      Map keys,
                                      String var)
Provider limiting specified provider to specified keys.

Method Detail

createDefaultKeys

public static Map createDefaultKeys(IContentProvider provider,
                                    String var)
Creates the default key mapping for the specified provider and provider variable. For example, if the provider has three keys ["foo", "bar", "baz"], the default key mapping would be (with var "p") {"foo":"#{p.foo}", "bar":"#{p.bar}", "baz":"#{p.baz}"}.


toString

public String toString()
Description copied from interface: IContentProvider
Returns string representation of content.

Specified by:
toString in interface IContentProvider
Overrides:
toString in class Object
Returns:
String representation of the wrapped content

getPropertyKeys

public Object[] getPropertyKeys()
Description copied from interface: IContentProvider
Returns list of properties supported by this content provider. Can return Object[0], never null.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
array of property keys which is typically of type String or Integer

getType

public Class getType(Object propertyKey)
              throws PropertyNotFoundException
Description copied from interface: IContentProvider
Returns java type of the given property

Specified by:
getType in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
property java Class
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyKey)
                throws EvaluationException,
                       PropertyNotFoundException
Description copied from interface: IContentProvider
Returns value of the given property

Specified by:
getValue in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
value of the property, can be null
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

hasProperty

public boolean hasProperty(Object propertyKey)
Description copied from interface: IContentProvider
Checks if the given property is supported by this content provider

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if property is supported

isReadOnly

public boolean isReadOnly(Object propertyKey)
                   throws EvaluationException,
                          PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Returns true if the given property is readonly. If it is readonly, IUpdateableContentProvider.setValue(Object, Object) will definitely fail.

Specified by:
isReadOnly in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if the property is readonly
Throws:
EvaluationException
PropertyNotFoundException

setValue

public void setValue(Object propertyKey,
                     Object value)
              throws EvaluationException,
                     PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Sets new value of the given property

Specified by:
setValue in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
value - new property value
Throws:
EvaluationException - if error happens during property assigment
PropertyNotFoundException - if property is not found

getProvider

public IContentProvider getProvider()
Source provider that this provider limits.


setProvider

public void setProvider(IContentProvider provider)
Source provider that this provider limits.


getKeys

public Map getKeys()
Maps property names to value-binding expressions.


setKeys

public void setKeys(Map keys)
Maps property names to value-binding expressions.


getVar

public String getVar()
Variable representing the source provider to use in key value bindings.


setVar

public void setVar(String var)
Variable representing the source provider to use in key value bindings.