|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.isomorphic.base.Base | +--com.isomorphic.datasource.DataSource
A DataSource is metadata that provides a high-level, implementation independant description of a set of permanently stored objects that will be manipulated within a SmartClient application.
The server-side DataSource object supports declarative validation, XPath-based mapping of DataSource fields to Java Objects and XML structures, and dynamic instantiation from XML. See the client reference for the client-side capabilities of DataSource objects.
Field Summary | |
static java.lang.String |
OP_ADD
Constant specifying the add operation. |
static java.lang.String |
OP_CUSTOM
Constant specifying a custom operation. |
static java.lang.String |
OP_FETCH
Constant specifying the fetch operation. |
static java.lang.String |
OP_REMOVE
Constant specifying the remove operation. |
static java.lang.String |
OP_UPDATE
Constant specifying the update operation. |
static java.lang.String |
OP_VALIDATE
Constant specifying the validate operation. |
Method Summary | |
static DataSource |
fromXML(org.w3c.dom.Document doc)
Instantiates a DataSource from an XML Document - the documentElement of this document is expected to contain the DataSource definition. |
static DataSource |
fromXML(org.w3c.dom.Element elem)
Instantiates a DataSource from an XML Element |
static DataSource |
fromXML(java.io.Reader reader)
Instantiates a DataSource from XML using a Reader |
static DataSource |
fromXML(java.lang.String xml)
Instantiates a DataSource from a String of XML |
DSField |
getField(java.lang.String fieldName)
Returns the field definition for the specified field. |
java.util.List |
getFieldNames()
Returns the list of field names in the DataSource as a List of strings. |
java.util.Map |
getProperties(java.lang.Object obj)
Takes a bean/Element/Map and for all fields on this DataSource that specify a valueXPath, applies the xpath to the object using the Jakarta JXPath library. |
java.util.Map |
getProperties(java.lang.Object obj,
boolean dropExtraFields)
Takes a bean/Element/Map and for all fields on this DataSource that specify a valueXPath, applies the xpath to the object using the Jakarta JXPath library. |
java.util.Map |
getProperties(java.lang.Object obj,
java.util.Collection propsToKeep)
Takes a bean/Element/Map and for all fields on this DataSource that specify a valueXPath, applies the xpath to the object using the Jakarta JXPath library. |
java.lang.String |
getRecordXPath()
For an XML DataSource, returns the XPath expression used to retrieve the set of XML elements that constitute the records of this DataSource. |
static boolean |
isModificationOperation(java.lang.String operationType)
Convenience method that returns true for operations that modify data and false for those that do not. |
void |
setProperties(java.util.Map properties,
java.lang.Object target)
Takes a Map of fieldName -> value (properties argument) and for all fields that specify a valueXPath, applies the value to the target object via xpath using the Jakarta JXPath library. |
ErrorReport |
validate(java.util.Map data,
boolean reportMissingRequiredFields)
Takes a Map of fieldName -> value (data argument) and validates the data using the validators specified on this dataSource. |
Methods inherited from interface com.isomorphic.js.IToJSON |
toJSON |
Field Detail |
public static final java.lang.String OP_FETCH
public static final java.lang.String OP_ADD
public static final java.lang.String OP_REMOVE
public static final java.lang.String OP_UPDATE
public static final java.lang.String OP_CUSTOM
public static final java.lang.String OP_VALIDATE
Method Detail |
public static DataSource fromXML(org.w3c.dom.Element elem) throws java.lang.Exception
elem
- XML Element containing the DataSource definitionjava.lang.Exception
- if an error occurs during DataSource instantiationpublic static DataSource fromXML(org.w3c.dom.Document doc) throws java.lang.Exception
doc
- XML Document containing the DataSource definitionjava.lang.Exception
- if an error occurs during DataSource instantiationpublic static DataSource fromXML(java.lang.String xml) throws java.lang.Exception
xml
- XML string containing the DataSource definitionjava.lang.Exception
- if an error occurs during DataSource instantiationpublic static DataSource fromXML(java.io.Reader reader) throws java.lang.Exception
reader
- Reader supplying XML containing the DataSource definitionjava.lang.Exception
- if an error occurs during DataSource instantiationpublic java.util.List getFieldNames()
public DSField getField(java.lang.String fieldName)
fieldName
- the name of the field whose definition you wantDSField
public java.lang.String getRecordXPath()
For example, an "ItemSearch" might return metadata along with the set of
<Item>
elements that one might want to display in a grid. The XPath
expression to retrieve just the <Item>
elements in this case might be
"//Item", which would select all <Item>
elements anywhere in
the returned document.
public static boolean isModificationOperation(java.lang.String operationType)
public void setProperties(java.util.Map properties, java.lang.Object target)
properties
- Map of DataSource fieldName -> valuetarget
- Target object to which the values are to be appliedpublic java.util.Map getProperties(java.lang.Object obj)
obj
- The object that is mined for values.public java.util.Map getProperties(java.lang.Object obj, boolean dropExtraFields)
dropExtraFields
parameter controls whether or not values
specified for fieldNames that are not declared in the datasource on which this method is
being called are discarded.obj
- The object that is mined for values.dropExtraFields
- If true, values specified for fieldNames that are not declared in
the datasource on which this method is being called are discarded, otherwise they are kept.public java.util.Map getProperties(java.lang.Object obj, java.util.Collection propsToKeep)
obj
- The object that is mined for values.propsToKeep
- specifies an explicit list of properties to retain
the datasource on which this method is being called are discarded, otherwise they are kept.public ErrorReport validate(java.util.Map data, boolean reportMissingRequiredFields) throws java.lang.Exception
data
- Map of DataSource fieldName -> valuereportMissingRequiredFields
- for operations like update or fetch/filter only
partial fields may be specified by the user. In
those cases you want to ignore missing required
fields.java.lang.Exception
- if an exception occurs during validation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |