public class DataSource implements IToJSON
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.
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map |
inInitState
Holds data sources which are in init state.
|
static java.lang.String |
OP_ADD
Constant specifying the add operation.
|
static java.lang.String |
OP_CLIENT_EXPORT
Constant specifying a clientExport 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.
|
Modifier and Type | Method and Description |
---|---|
long |
add(java.lang.Object values)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "add", calling setValues() on it, and then calling its execute() method.
|
static void |
addDynamicDSGenerator(DynamicDSGenerator ddsg)
Registers the parameter DynamicDSGenerator with the DataSource system.
|
static void |
addDynamicDSGenerator(DynamicDSGenerator ddsg,
java.util.regex.Pattern regex)
Registers the parameter DynamicDSGenerator with the DataSource system.
|
static void |
addDynamicDSGenerator(DynamicDSGenerator ddsg,
java.lang.String prefix)
Registers the parameter DynamicDSGenerator with the DataSource system.
|
static void |
clearDynamicDSGenerators()
Removes all DynamicDSGenerators from the system
|
DSResponse |
execute(DSRequest req)
This method carries out the actual processing of a DataSource request.
|
DSResponse |
executeAdd(DSRequest req)
This method is called by DataSource.execute() for "add" operations.
|
DSResponse |
executeClientExport(DSRequest req)
This method is called by DataSource.execute() for "clientExport" operations.
|
DSResponse |
executeCustom(DSRequest req)
This method is called by DataSource.execute() for "custom" operations.
|
DSResponse |
executeFetch(DSRequest req)
This method is called by DataSource.execute() for "fetch" operations.
|
DSResponse |
executeRemove(DSRequest req)
This method is called by DataSource.execute() for "remove" operations.
|
DSResponse |
executeUpdate(DSRequest req)
This method is called by DataSource.execute() for "update" operations.
|
java.util.List |
fetch(java.lang.Object criteria)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "fetch", calling setCriteria() on it, and then calling its execute() method.
|
java.util.List |
fetch(java.lang.String key,
java.lang.Object value)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "fetch", calling setCriteria() on it, and then calling its execute() method.
|
java.util.Map |
fetchById(java.lang.Object id)
Returns the record whose primary key matches the supplied id, or null if no such record
exists.
|
java.util.Map |
fetchSingle(java.lang.Object criteria)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "fetch", calling setCriteria() on it, calling its execute() method, then
obtaining just the first item of the results.
|
java.util.Map |
fetchSingle(java.lang.String key,
java.lang.Object value)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "fetch", calling setCriteria() on it, calling its execute() method, then
obtaining just the first item of the results.
|
java.util.List |
filter(java.lang.Object criteria)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "filter", calling setCriteria() on it, and then calling its execute() method.
|
java.util.List |
filter(java.lang.String key,
java.lang.Object value)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "filter", calling setCriteria() on it, and then calling its execute() method.
|
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.Document doc,
DSRequest dsRequest)
Instantiates a DataSource from an XML Document, with optional context DSRequest - the
documentElement of the XML 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(org.w3c.dom.Element elem,
DSRequest dsRequest)
Instantiates a DataSource from an XML Element, with optional context DSRequest
|
static DataSource |
fromXML(java.io.Reader reader)
Instantiates a DataSource from XML using a Reader
|
static DataSource |
fromXML(java.io.Reader reader,
DSRequest dsRequest)
Instantiates a DataSource from XML using a Reader, with optional context DSRequest
|
static DataSource |
fromXML(java.lang.String xml)
Instantiates a DataSource from a String of XML
|
static DataSource |
fromXML(java.lang.String xml,
DSRequest dsRequest)
Instantiates a DataSource from a String of XML, with optional context DSRequest
|
java.lang.String |
getAuditRevisionFieldName()
Get the field name for the audit revision field configured for this
DataSource |
java.lang.String |
getAuditTimestampFieldName()
Get the field name for the audit timestamp field configured for this
DataSource |
java.lang.String |
getAuditTypeFieldName()
Get the field name for the audit type field configured for this
DataSource |
java.lang.String |
getAuditUserFieldName()
Get the field name for the audit user field configured for this
DataSource |
java.lang.String |
getEnumConstantProperty()
Returns the name of the property this DataSource uses for constant name when translating
enumerated types.
|
java.lang.String |
getEnumOrdinalProperty()
Returns the name of the property this DataSource uses for ordinal number when translating
enumerated types.
|
java.lang.String |
getEnumTranslateStrategy()
Returns the strategy this DataSource uses for translating Java enumerated types (enums).
|
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.List |
getListProperties(java.util.List list)
Takes a List of beans/Elements/Maps and for all fields on this DataSource that specify a
valueXPath, applies the xpath to each object in the List using the Jakarta JXPath
library.
|
java.util.List |
getListProperties(java.util.List list,
boolean dropExtraFields,
boolean dropIgnoredFields)
Takes a List of beans/Elements/Maps and for all fields on this DataSource that specify a
valueXPath, applies the xpath to each object in the List using the Jakarta JXPath
library.
|
java.lang.String |
getPrimaryKey()
Returns the name of the primary key field.
|
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,
boolean dropIgnoredFields)
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.Class |
getPropertyJavaClass(java.lang.String propertyName,
DSField field,
java.lang.Object value)
Override point to allow subclasses to dynamically determine the Java class to use for a
given property.
|
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.
|
java.lang.Object |
getTransactionObject(DSRequest req)
Returns an object that can be used to manage transactions for this DataSource and other
DataSources of the same type and provider.
|
static java.lang.Object |
getTransactionObject(DSRequest req,
java.lang.String transactionObjectKey)
Helper method retrieves connection/transaction object for specified type of data source implementation
or
null . |
boolean |
hasRecord(java.util.Map criteria)
Returns true if the dataSource contains at least one record that matches the supplied
criteria
|
boolean |
hasRecord(java.lang.String columnName,
java.lang.Object value)
Returns true if the dataSource contains at least one record where the columnName matches
the value.
|
protected void |
initialized()
This method is called after the DataSource has been initialized allowing
further custom initialization.
|
static boolean |
isModificationOperation(java.lang.String operationType)
Convenience method that returns true for operations that modify data and false for those
that do not.
|
long |
remove(java.lang.Object criteria)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "remove", calling setCriteria() on it, and then calling its execute() method.
|
static DynamicDSGenerator |
removeDynamicDSGenerator()
Removes the default DynamicDSGenerator
|
static DynamicDSGenerator |
removeDynamicDSGenerator(java.util.regex.Pattern regex)
Removes the DynamicDSGenerator registered against the parameter regexp Pattern
|
static DynamicDSGenerator |
removeDynamicDSGenerator(java.lang.String prefix)
Removes the DynamicDSGenerator registered against the parameter prefix String
|
void |
setEnumConstantProperty(java.lang.String newValue)
Sets the name of the property this DataSource should use for constant name when translating
enumerated types.
|
void |
setEnumOrdinalProperty(java.lang.String newValue)
Sets the name of the property this DataSource should use for ordinal number when translating
enumerated types.
|
void |
setEnumTranslateStrategy(java.lang.String newValue)
Sets the strategy this DataSource uses to translate enumerated types (objects of type
enum).
|
java.lang.Object |
setProperties(java.util.Map properties,
java.lang.Object target)
Applies all properties in a Map to a target bean by calling setter methods according to
the Java Beans naming convention ("name" -> setName()), including recursive traversal of
sub-beans and JXPath-based setting of properties in nested beans.
|
void |
transformMultipleFields(DSRequest req)
Transforms the values for fields declared multiple:true in the incoming DSRequest.
|
void |
transformMultipleFields(DSResponse res)
Transforms the values for fields declared multiple:true in a DSResponse.
|
long |
update(java.lang.Object criteria,
java.lang.Object values)
This convenience method is the equivalent of creating a DSRequest with an operationType
of "update", calling setValues() and setCriteria() on it, and then calling its execute()
method.
|
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.
|
ErrorReport |
validate(java.util.Map data,
boolean reportMissingRequiredFields,
boolean mergeValidatedValues)
Takes a Map of fieldName -> value (data argument) and validates the data using the
validators specified on this dataSource, optionally merging validated values back into
the data
|
protected static final java.util.Map inInitState
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
public static final java.lang.String OP_CLIENT_EXPORT
public static void addDynamicDSGenerator(DynamicDSGenerator ddsg)
DynamicDSGenerator.getDataSource(String, DSRequest)
method; only if that method returns null
will it proceed to use the normal
system for obtaining DataSource instances.
NOTE:
DataSource.addDynamicDSGenerator(DynamicDSGenerator, String)
and
DataSource.addDynamicDSGenerator(DynamicDSGenerator, Pattern)
for APIs that are
more likely to be suitablenull
for
DataSources that you cannot provide an instance ofddsg
- A DynamicDSGenerator to register as the defaultpublic static void addDynamicDSGenerator(DynamicDSGenerator ddsg, java.lang.String prefix)
You can add multiple DynamicDSGenerators using this API. If two or more are registered with prefixes that match a given DataSource ID, the one added first wins. Eg, if you have prefixes "c" and "cust" registered, then the "customer" DataSource will be provided by whichever of those two DynamicDSGenerators was registered first. Note that this "earliest first" basis also applies to DynamicDSGenerators registered with a regexp; if you had a DataSource ID that matched both a prefix and a regexp, whichever one of the two registrations came first would be used - there is no priority given to one or the other styles of ID matching.
ddsg
- A DynamicDSGenerator to register as the defaultprefix
- A prefix String as described abovepublic static void addDynamicDSGenerator(DynamicDSGenerator ddsg, java.util.regex.Pattern regex)
java.util.regex.Pattern
You can add multiple DynamicDSGenerators using this API. If two or more are registered with regular expressions that match a given DataSource ID, the one added first wins. This also applies to DynamicDSGenerators registered with a simple prefix String.
ddsg
- A DynamicDSGenerator to register as the defaultregex
- A Pattern representing a regular expression to match against incoming
DataSource IDspublic static DynamicDSGenerator removeDynamicDSGenerator()
public static DynamicDSGenerator removeDynamicDSGenerator(java.lang.String prefix)
public static DynamicDSGenerator removeDynamicDSGenerator(java.util.regex.Pattern regex)
public static void clearDynamicDSGenerators()
protected void initialized() throws java.lang.Exception
The default implementation does nothing.
java.lang.Exception
- if an error occurs during initializationpublic 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.Element elem, DSRequest dsRequest) throws java.lang.Exception
elem
- XML Element containing the DataSource definitiondsRequest
- DSRequest to use as a context object if the creation of this DataSource
involves the automatic creation of further, possibly user-generated, DataSources
(eg, if this DataSource inheritsFrom a user-generated one)java.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(org.w3c.dom.Document doc, DSRequest dsRequest) throws java.lang.Exception
doc
- XML Document containing the DataSource definitiondsRequest
- DSRequest to use as a context object if the creation of this DataSource
involves the automatic creation of further, possibly user-generated, DataSources
(eg, if this DataSource inheritsFrom a user-generated one)java.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.lang.String xml, DSRequest dsRequest) throws java.lang.Exception
xml
- XML string containing the DataSource definitiondsRequest
- DSRequest to use as a context object if the creation of this DataSource
involves the automatic creation of further, possibly user-generated, DataSources
(eg, if this DataSource inheritsFrom a user-generated one)java.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 static DataSource fromXML(java.io.Reader reader, DSRequest dsRequest) throws java.lang.Exception
reader
- Reader supplying XML containing the DataSource definitiondsRequest
- DSRequest to use as a context object if the creation of this DataSource
involves the automatic creation of further, possibly user-generated, DataSources
(eg, if this DataSource inheritsFrom a user-generated one)java.lang.Exception
- if an error occurs during DataSource instantiationpublic java.util.List getFieldNames()
public java.lang.String getPrimaryKey()
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 transformMultipleFields(DSRequest req)
See client-side docs for DataSourceField.multipleStorage for possible behaviors. This transformation is performed in DataSource.execute(), before operationType-specific methods like executeFetch or executeUpdate() are called.
req
- the request to be transformed.public void transformMultipleFields(DSResponse res)
See client-side docs for DataSourceField.multipleStorage for possible behaviors. This transformation is performed in DataSource.execute(), after operationType-specific methods like executeFetch or executeUpdate() are called.
res
- the DSResponse to be transformed.public DSResponse execute(DSRequest req) throws java.lang.Exception
com.isomorphic.datasource.DataSource.transformMultipleFields(DSRequest)
and
com.isomorphic.datasource.DataSource.transformMultipleFields(DSResponse)
.req
- The DSRequest object representing this operationjava.lang.Exception
public java.lang.String getAuditTypeFieldName()
DataSource
DataSource
.public java.lang.String getAuditRevisionFieldName()
DataSource
DataSource
.public java.lang.String getAuditTimestampFieldName()
DataSource
DataSource
.public java.lang.String getAuditUserFieldName()
DataSource
DataSource
.public java.lang.Object setProperties(java.util.Map properties, java.lang.Object target)
When DataSourceField.valueXPath is set, the valueXPath is treated as a Jakarta JXPath
expression. If some intervening objects in a JXPath are nulls
, this method
attempts to create missing objects if possible - see
com.isomorphic.util.JXPathContextObjectFactory
documentation for details.
Entries in the "properties" Map where there is no same-named DataSource field are discarded.
This method can be used to recursively populate an object graph of Beans and Collections, using multiple DataSources to define rules for how subobjects are populated. Specifically, if the "properties" Map has entries whose values are Maps, if the corresponding field on the DataSource is declared as being of a DataSource type (ie, the type property is set to the ID of some valid DataSource), these properties will be applied via a recursive call to DataSource.setProperties() using the indicated DataSource. This will also occur for a Collection within the "properties" Map if the target bean has a corresponding property of Collection type.
When the type to use is ambiguous (for example, a property on the target bean is declared as a base type with many sub-types, or is an abstract type like List) the DataSourceField properties javaClass, javaCollectionClass and javaKeyClass can be used to specify a concrete type - see the client-side reference docs for further details.
Ultimately, this method calls DataTools.setProperties(Map, Object, DataSource)
- see the documentation of these method for details of treatment of object vs primitive
type, Java Generics, Enums, and other cases.
properties
- Map of DataSource fieldName -> valuetarget
- Target object to which the values are to be appliedpublic java.util.List getListProperties(java.util.List list)
list
- The List of objects that is mined for values.public java.util.List getListProperties(java.util.List list, boolean dropExtraFields, boolean dropIgnoredFields)
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.list
- The List of objects 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.dropIgnoredFields
- If true, values specified for fieldNames that are declared in
the datasource on which this method is being called with the property ignore: true are
are discarded; otherwise they are keptpublic 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, boolean dropIgnoredFields)
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.dropIgnoredFields
- If true, values specified for fieldNames that are declared in
the datasource on which this method is being called with the property ignore: true are
are discarded; otherwise they are keptpublic 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 validationpublic ErrorReport validate(java.util.Map data, boolean reportMissingRequiredFields, boolean mergeValidatedValues) 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.mergeValidatedValues
- if true, replaces values in the original data with their
validated equivalents. Often the validated value is the same
as the original value, but this is not always the case. For
example if the String "123" is supplied as a value for an
integer field, the validated value will be the numeric value
123 as an instance of Longjava.lang.Exception
- if an exception occurs during validationpublic DSResponse executeFetch(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public DSResponse executeRemove(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public DSResponse executeAdd(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public DSResponse executeUpdate(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public DSResponse executeCustom(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public DSResponse executeClientExport(DSRequest req) throws java.lang.Exception
req
- The DSRequest object representing this operationjava.lang.Exception
public java.util.List fetch(java.lang.Object criteria) throws java.lang.Exception
criteria
- The criteria to use for the fetch operationList
with retrieved data.java.lang.Exception
public java.util.List fetch(java.lang.String key, java.lang.Object value) throws java.lang.Exception
key
- The criterion keyvalue
- The criterion valueList
with retrieved data.java.lang.Exception
public java.util.List filter(java.lang.Object criteria) throws java.lang.Exception
criteria
- The criteria to use for the filter operationList
with retrieved data.java.lang.Exception
public java.util.List filter(java.lang.String key, java.lang.Object value) throws java.lang.Exception
key
- The criterion keyvalue
- The criterion valueList
with retrieved data.java.lang.Exception
public long add(java.lang.Object values) throws java.lang.Exception
values
- The values to use for the add operationlong
number of affected rows.java.lang.Exception
public long update(java.lang.Object criteria, java.lang.Object values) throws java.lang.Exception
criteria
- The criteria to use for the update operationvalues
- The values to use for the update operationlong
number of affected rows.java.lang.Exception
public long remove(java.lang.Object criteria) throws java.lang.Exception
criteria
- The criteria to use for the remove operationlong
number of affected rows.java.lang.Exception
public java.util.Map fetchSingle(java.lang.String key, java.lang.Object value) throws java.lang.Exception
Note that this method expects the specified criterion to result in a single result, and will throw an exception if the multiple records match the request.
key
- The criterion keyvalue
- The criterion valueMap
of retrieved object properties.java.lang.Exception
public java.util.Map fetchSingle(java.lang.Object criteria) throws java.lang.Exception
Note that this method expects the specified criteria to result in a single result, and will throw an exception if the multiple records match the request.
criteria
- The criteria to use for the fetch operationMap
of retrieved object properties.java.lang.Exception
public java.lang.Object getTransactionObject(DSRequest req) throws java.lang.Exception
This method is part of the Automatic Transactions feature, which is effective only in Power edition and above.
java.lang.Exception
public static java.lang.Object getTransactionObject(DSRequest req, java.lang.String transactionObjectKey) throws java.lang.Exception
null
.
SQLDataSource
:
Connection conn = DataSource.getTransactionObject(req, SQLTransaction.CONNECTION_ATTR + dbName);
where dbName
is name of database as configured in server.properties file.
Returned conn
is instance of java.sql.Connection
to specified data base.HibernateDataSource
:
Transaction tx = DataSource.getTransactionObject(req, HibernateTransaction.TRANSACTION_ATTR);
Session session = HibernateTransaction.getTransactionSession(tx);
session
and tx
instances of hibernate session and transaction object
used by HibernateDataSource
.JPADataSource
:
JPAConnectionHolder holder = DataSource.getTransactionObject(req, EMF.TRANSACTION_ATTR);
JPAConnectionHolder
instance contains references to entity manager and transaction object
used by JPADataSource
instances.RPCManager
and will be handled by data source object which started transaction.
This method is part of the Automatic Transactions feature, which is effective only in
Power edition and above.req
- DSRequest
transactionObjectKey
- String
Name of transaction object key.Object
containing connection/transaction. Actual type of instance depends on
passed parameter transactionObjectKey
. null
is returned if specified request
does not contain reference to RPCManager
or specified object is not set.java.lang.Exception
- if provided DSRequest
is null
.public boolean hasRecord(java.lang.String columnName, java.lang.Object value) throws java.lang.Exception
columnName
- The columnName to use in the search criteriavalue
- The value to look for in the search criteriajava.lang.Exception
public boolean hasRecord(java.util.Map criteria) throws java.lang.Exception
criteria
- A Map containing the search criteriajava.lang.Exception
public java.util.Map fetchById(java.lang.Object id) throws java.lang.Exception
id
- The primary key value to match, or a set of primary key values in a Mapjava.lang.Exception
public java.lang.String getEnumTranslateStrategy()
DataSource.setEnumTranslateStrategy(String)
for
details of valid translate strategiespublic void setEnumTranslateStrategy(java.lang.String newValue)
enum.toString()
newValue
- A String containing the new enum translate strategypublic java.lang.String getEnumOrdinalProperty()
public java.lang.String getEnumConstantProperty()
public void setEnumOrdinalProperty(java.lang.String newValue)
newValue
- The new ordinal property namepublic void setEnumConstantProperty(java.lang.String newValue)
newValue
- The new constant value property namepublic java.lang.Class getPropertyJavaClass(java.lang.String propertyName, DSField field, java.lang.Object value) throws java.lang.Exception
Your overriding method is passed the name of the property we are trying to populate, the raw value we are going to use to populate it, and the DSField object associated with the property. It is envisaged that this will be sufficient context to dynamically decide on a Class to use. For example, if the raw Map passed in contains a given property, your code might decide to use Class B rather than the normal Class A.
Note that whatever class you return from this method will be used as the parameter type for the corresponding setter on the bean we are populating. This means that this method (and indeed the declarative "javaClass" property) is only useful if your Javabean property type is a supertype of whatever class you return from this method. Examples of valid use cases would include things like your Javabean property is of an interface or abstract type, or of a general base type like Object.
propertyName
- Name of the property we are trying to populate, for contextfield
- The associated DSField
value
- The raw value we are trying to assign to this property. Note this will
ordinarily be a Map or a List of MapsDataSourceField.javaClass
)java.lang.Exception