|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.smartgwt.client.docs.serverds.DataSource
public class DataSource
This class is not meant to be created and used, it is actually documentation of settings
allowed in a DataSource descriptor (.ds.xml file). See
com.smartgwt.client.docs.serverds for how to use this documentation.
A DataSource is data-provider-independent description of a set of objects that will be loaded, edited and saved within the user interface of your application.
Each DataSource consists of a list of fields that make up a DataSource record, along with
field types, validation rules, relationships to other DataSources, and other metadata.
The abstract object description provided by a DataSource is easily mapped to a variety of backend object models and storage schemes. The following table shows analogous terminology across systems.
| Isomorphic Smart GWT | Relational Database | Enterprise Java Beans (EJB) | Entity/Relationship Modeling | OO/UML | XML Schema/WSDL | LDAP |
| DataSource | Table | EJB class | Entity | Class | Element Schema (ComplexType) | Objectclass |
| Record | Row | EJB instance | Entity instance | Class instance/Object | Element instance (ComplexType) | Entry |
| Field | Column | Property | Attribute | Property/Attribute | Attribute or Element (SimpleType) | Attribute |
DataSources can be declared in either JavaScript or XML format, and can also be imported from existing metadata formats, including XML Schema.
Data Binding is the process by
which Data Binding-capable UI components can automatically
configure themselves for viewing, editing and saving data described by DataSources. DataBinding is covered in the
${isc.DocUtils.linkForDocNode('QuickStartGuide', 'QuickStart Guide')}, Chapter 6, Data Binding.
Data Integration is the process by which a DataSource can be connected
to server systems such as SQL DataBases, Java Object models, WSDL web services and other data providers. Data
Integration comes in two variants: client-side and server-side. Server-side integration uses the Smart GWT Java-based server to connect to data represented by Java Objects or
JDBC-accessible databases. Client-side integration connects
Smart GWT DataSources to XML, JSON or other formats accessible via HTTP.
DataSources have a concept of 4 core operations ("fetch", "add", "update" and "remove") that can be
performed on the set of objects represented by a DataSource. Once a DataSource has been integrated with your data
store, databinding-capable UI components can leverage the 4 core DataSource operations to provide many complete user
interactions without the need to configure how each individual component loads and saves data.
These interactions
include grid views, tree views, detail views, form-based editing and saving, grid-based editing and saving, and custom interactions provided by Pattern Reuse
Example custom databinding-capable components.
DataBoundComponent| Field Summary | |
|---|---|
java.lang.Boolean |
autoDeriveSchema
This property allows you to specify that your DataSource's schema (field definitions) should be automatically derived from some kind of metadata. |
boolean |
autoDeriveTitles
If set, titles are automatically derived from field.name
for any field that does not have a field.title and is
not marked hidden:true, by calling the method DataSource.getAutoTitle. |
java.lang.Boolean |
autoJoinTransactions
If true, causes all add, update and remove operations on this DataSource to automatically start or join a transaction; this means that multiple operations sent to the server in a request queue will be committed in a single transaction. |
java.lang.String |
beanClassName
This property has different meanings depending on the serverType: |
java.lang.String |
callbackParam
Applies only to dataFormat: "json" and dataTransport:"scriptInclude". |
boolean |
canMultiSort
When true, indicates that this DataSource supports multi-level sorting. |
java.lang.String |
childrenField
fieldName for a field in the dataSource expected to contain an explicit array of child nodes. |
boolean |
clientOnly
Whether to act as a "client-only" DataSource, which has no permanent storage and never contacts the server, instead using a set of test data to respond to requests in the same manner as a server-based DataSource might. |
java.lang.String |
configBean
For DataSources of serverType "hibernate", the name of a
Spring bean to query to obtain Hibernate Configuration for this particular DataSource. |
java.lang.Boolean |
creatorOverrides
Indicates that declarative security rules are waived for rows that were created by the current user. |
CriteriaPolicy |
criteriaPolicy
Decides under what conditions the ResultSet cache should be dropped when the criteria changes. |
java.lang.String |
dataField
Name of the field that has the most pertinent numeric, date, or enum value, for use when a DataBoundComponent needs to show a short summary of a record. |
DSDataFormat |
dataFormat
Indicates the format to be used for HTTP requests and responses when fulfilling DSRequests (eg, when DataSource.fetchData is called). |
RPCTransport |
dataTransport
Transport to use for all operations on this DataSource. |
java.lang.String |
dataURL
Default URL to contact to fulfill all DSRequests. |
java.lang.String |
dbName
For DataSources using the Smart GWT SQL engine for persistence, which
database configuration to use. |
java.lang.String |
descriptionField
Name of the field that has a long description of the record, or has the primary text data value for a record that represents an email message, SMS, log or similar. |
java.lang.Boolean |
dropExtraFields
Indicates that for server responses, for any data being interpreted as DataSource records, only data that corresponds to declared fields should be retained; any extra fields should be discarded. |
java.lang.String |
enumConstantProperty
The name of the property this DataSource uses for constant name when translating Java enumerated types to and from Javascript, if the EnumTranslateStrategy is set to "bean". |
java.lang.String |
enumOrdinalProperty
The name of the property this DataSource uses for ordinal number when translating Java enumerated types to and from Javascript, if the EnumTranslateStrategy is set to "bean". |
EnumTranslateStrategy |
enumTranslateStrategy
Sets the strategy this DataSource uses to translate Java enumerated types (objects of type enum) to and from Javascript. |
DataSourceField[] |
fields
The list of fields that compose records from this DataSource. |
java.lang.Object |
globalNamespaces
Namespaces definitions to add to the root element of outbound XML messages sent to a web service, as a mapping from namespace prefix to namespace URI. |
java.lang.String |
iconField
Designates a field of type:"image" as the field to use when rendering a
record as an image, for example, in a TileGrid. |
java.lang.String |
ID
Unique identifier for this DataSource. |
java.lang.String |
infoField
Name of the field that has the second most pertinent piece of textual information in the record, for use when a DataBoundComponent needs to show a short summary of a record. |
java.lang.String |
inheritsFrom
ID of another DataSource this DataSource inherits its fields
from. |
java.lang.String |
jsonPrefix
Allows you to specify an arbitrary prefix string to apply to all json format responses sent from the server to this application. |
java.lang.String |
jsonSuffix
Allows you to specify an arbitrary suffix string to apply to all json format responses sent from the server to this application. |
boolean |
noNullUpdates
When true, indicates that fields in this DataSource will never be positively updated to the null value; they may arrive at null values by being omitted, but we will not send actual null values in update requests. |
boolean |
nullBooleanValue
If noNullUpdates is set, the value to use for any
boolean field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. |
java.util.Date |
nullDateValue
If noNullUpdates is set, the value to use for any
date or time field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. |
float |
nullFloatValue
If noNullUpdates is set, the value to use for any
float field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. |
int |
nullIntegerValue
If noNullUpdates is set, the value to use for any
integer field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. |
java.lang.String |
nullStringValue
If noNullUpdates is set, the value to use for any
text field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. |
boolean |
omitNullDefaultsOnAdd
When true, and noNullUpdates is also true, indicates
that "add" requests on this DataSource will have null-valued fields removed from the request entirely before it is
sent to the server, as opposed to the default behavior of replacing such null values with defaults. |
OperationBinding[] |
operationBindings
Optional array of OperationBindings, which provide instructions to the DataSource about how each DSOperation is to be performed. |
java.lang.String |
pluralTitle
User-visible plural name for this DataSource. |
boolean |
preventHTTPCaching
If set, the DataSource will ensure that it never uses a cached HTTP response, even if the server marks the response as cacheable. |
boolean |
qualifyColumnNames
For dataSources of serverType "sql", determines whether
we qualify column names with table names in any SQL we generate. |
java.lang.Boolean |
quoteColumnNames
If set, tells the SQL engine to quote column names in all generated DML and DDL statements for this dataSource. |
java.lang.String |
recordXPath
See recordXPath. |
DSRequest |
requestProperties
Additional properties to pass through to the DSRequests made by this DataSource. |
java.lang.String |
requires
Indicates that the specified String must evaluate to true for a user to access this DataSource. |
java.lang.Boolean |
requiresAuthentication
Whether a user must be authenticated in order to access this DataSource. |
java.lang.String |
requiresRole
Similar to requiresRole, but controls access to
the DataSource as a whole. |
int |
resultBatchSize
Very advanced: for servers that do not support paging, and must return large numbers of XML records in one HTTP response, Smart GWT breaks up the processing of the response in order to avoid the "script running slowly" dialog appearing for an end user. |
java.lang.Object |
resultSetClass
Class for ResultSets used by this datasource. |
java.lang.String |
schemaBean
For DataSources that specify autoDeriveSchema,
this property indicates the name of the Spring bean, Hibernate mapping or fully-qualified Java class to use as parent
schema. |
java.lang.String |
schemaNamespace
For a DataSource derived from WSDL or XML schema, the XML namespace this schema belongs to. |
boolean |
sendExtraFields
Analogous to dropExtraFields, for data sent to the
server. |
java.lang.String |
serverConstructor
This property allows you to write and use custom DataSource subclasses on the server, by specifying either the fully-qualified name of the DataSource subclass that should be instantiated server-side for this dataSource, or the token "spring:" followed by a valid Spring bean ID, if you wish to instantiate your custom dataSource object using Spring dependency injection. |
ServerObject |
serverObject
For Direct Method Invocation (DMI) binding, declares the ServerObject to use as the default target for all operationBindings. |
DSServerType |
serverType
For a DataSource stored in .xml format on the ISC server, indicates what server-side connector to use to execute requests, that is, what happens if you call dsRequest.execute() in server code. |
java.lang.String |
serviceNamespace
For an XML DataSource, URN of the WebService to use to invoke operations. |
java.lang.Boolean |
showLocalFieldsOnly
For a DataSource that inherits fields from another
DataSource (via inheritsFrom), indicates that only
the fields listed in this DataSource should be shown. |
boolean |
showPrompt
Whether RPCRequests sent by this DataSource should enable showPrompt if it's unset. |
boolean |
sparseUpdates
When true, indicates that any updates for this DataSource include only those fields that have actually changed (and primaryKey fields); when false (the default), all field values are included in updates, whether they have changed or not |
SQLPagingStrategy |
sqlPaging
The paging strategy to use for this DataSource. |
boolean |
strictSQLFiltering
If set to true, both client and server-side advanced filtering used by Smart GWT will follow SQL99 behavior for dealing with NULL values, which is often counter-intuitive to users. |
java.lang.String |
tableName
For DataSources using the Smart GWT SQL engine for persistence, what
database table name to use. |
java.lang.String |
tagName
Tag name to use when serializing to XML. |
java.lang.Object[] |
testData
For a client-only DataSource, a set of records to use as a dataset, specified as an Array of JavaScript Objects. |
java.lang.String |
title
User-visible name for this DataSource. |
java.lang.String |
titleField
Best field to use for a user-visible title for an individual record from this dataSource. |
java.lang.Boolean |
useFlatFields
Like useFlatFields, but applies to all DataBound
components that bind to this DataSource. |
java.lang.Boolean |
useLocalValidators
Whether to attempt validation on the client at all for this DataSource. |
java.lang.Boolean |
useOfflineStorage
Whether we store server responses for this DataSource into browser-based
offline storage, and then use those stored responses at a later time if we are offline (ie, the application cannot
connect to the server). |
java.lang.Boolean |
useParentFieldOrder
For a DataSource that inherits fields from another
DataSource (via inheritsFrom), indicates that the
parent's field order should be used instead of the order of the fields as declared in this DataSource. |
| Constructor Summary | |
|---|---|
DataSource()
|
|
| Method Summary |
|---|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String inheritsFrom
fields
from. Local fields (fields defined in this DataSource) are added to inherited fields to form the full set of
fields. Fields with the same name are merged in the same way that databound component fields are merged with DataSource fields.
The default order of the combined fields is new local fields first (including any fields present in the parent
DataSource which the local DataSource re-declares), then parent fields. You can set useParentFieldOrder to instead use the parent's field
order, with new local fields appearing last. You can set showLocalFieldsOnly to have all non-local fields
hidden.
Note that only fields are inherited - other properties such as dataURL and dataFormat are not. You
can use ordinary inheritance, that is, creating a subclass of DataSource, in order to share properties such as dataURL
across a series of DataSources that also inherit fields from each other via inheritsFrom.
This feature can be used for:
databound components. XML Schema
or other metadata formats databound components to "customizedEmployee". Customizations of fields
(including appearance changes, field order, new fields, hiding of fields, and custom validation rules) can be added to
"customizedEmployee", so that they are kept separately from the original field data and have the best possible chance of
working with future versions of the "employee" dataSource. Default value is null
public java.lang.Object[] testData
See
this discussion for ways to populate a client-only DataSource
with test data.
Default value is null
clientOnly,
ClientOnlyDataSources overview and related methodspublic RPCTransport dataTransport
defaultTransport. This would typically only be set to enable
"scriptInclude" transport for contacting JSON web
services hosted on servers other than the origin server. When using the "scriptInclude" transport, be sure to set
callbackParam or callbackParam to match the name of the query parameter
name expected by your JSON service provider.
Default value is RPCManager.defaultTransport
RPCTransport,
callbackParam,
ClientDataIntegration overview and related methodspublic java.lang.Object resultSetClass
ResultSet.
This can be set to a custom subclass of ResultSet that, for example, hangs onto to extra information necessary for integration with web services.
Default value is null
public java.lang.String title
For example, for the supplyItem DataSource, "Supply Item".
Defaults to
dataSource.ID.
Default value is dataSource.ID
public java.lang.String jsonSuffix
The inclusion of such a suffix ensures your code is not directly executable outside of your application, as a preventative measure against javascript hijacking.
Only applies to responses formatted as json objects. Does not apply to responses returned via scriptInclude type transport.
Default value is null
OperationBinding.getDataFormat(),
OperationBinding.getDataTransport()public java.lang.String beanClassName
serverType: For DataSources with serverType "hibernate"
The name of the Java bean or POJO class that is
mapped in Hibernate. This will typically be the fully-qualified class name - eg com.foo.MyClass - but it
may be the simple class name - just MyClass - or it may be some other value. It all depends on how your
classes have been mapped in Hibernate.
Note: If you are intending to use Hibernate as a data-access layer only, you do not need to create Hibernate mappings or Java objects: Smart GWT will generate everything it needs on the fly.
For DataSources with serverType "sql"
If set, results from the database will be used to create one
instance of the indicated Java bean per database row. Otherwise a Map is used to represent each row retrieved from SQL.
With this feature active, a DSResponse from this DataSource will contain a Collection of instances of the indicated
beanClassName, available via DSResponse.getData(). This creates a couple of possibilities:
DMI method that calls DSRequest.execute() to retrieve a DSResponse,
you have an opportunity to call business logic methods on the beans representing each row affected by the DSRequest.
For example, notify a related BPEL process of changes to certain fields. By using
beanClassName on a specific OperationBinding, you can:
Note that setting beanClassName has no effect on the DSRequest.
However, DMI has a built-in facility for populating a bean
with the inbound data - just declare the bean as a method argument.
For DataSources with serverType "generic"
Visual Builder
sets this property when it creates a generic DataSource using the Javabean Wizard. It has no built-in server-side
effects.
Default value is null
public DataSourceField[] fields
Each DataSource field can have type, user-visible title, validators, and other metadata attached.
Default value is null
DataSourceFieldpublic java.lang.Boolean useParentFieldOrder
fields from another
DataSource (via inheritsFrom), indicates that the
parent's field order should be used instead of the order of the fields as declared in this DataSource. New fields, if
any, are placed at the end.
Default value is null
public boolean sparseUpdates
Default value is false
public java.lang.Boolean creatorOverrides
In order for this to work, we require two things:
this pageDefault value is null
OperationBinding.creatorOverrides,
DataSourceField.creatorOverrides,
FieldLevelAuth overview and related methodspublic java.lang.String jsonPrefix
The inclusion of such a prefix ensures your code is not directly executable outside of your application, as a preventative measure against javascript hijacking.
Only applies to responses formatted as json objects. Does not apply to responses returned via scriptInclude type
transport.
Note: If the prefix / suffix served by your backend is not a constant, you can use dataFormat:"custom" instead and explicitly parse the prefix out
as part of transformResponse().
Default value is null
OperationBinding.getDataFormat(),
OperationBinding.getDataTransport()public OperationBinding[] operationBindings
When using the Smart GWT Server, OperationBindings are specified in your DataSource
descriptor (.ds.xml file) and control server-side behavior such as what Java object to route
DSRequest to (serverObject) or customizations to
SQL / HQL queries
(customSQL and customHQL). See the
For DataSources bound to WSDL-described web services using {@link com.smartgwt.client.docs.serverds.DataSource#serviceNamespace serviceNamespace}, OperationBindings are used to bind each DataSource {@link com.smartgwt.client.docs.serverds.OperationBinding#operationType operationType} to an {@link com.smartgwt.client.data.OperationBinding#getWsOperation operation} of a WSDL-described {@link com.smartgwt.client.data.WebService web service}, so that a DataSource can both fetch and save data to a web service.
For example, this code accomplishes part of the binding to the SalesForce partner web services
isc.DataSource.create({
serviceNamespace : "urn:partner.soap.sforce.com",
operationBindings : [
{ operationType:"fetch", wsOperation:"query", recordName: "sObject" },
{ operationType:"update", wsOperation:"update", recordName: "SaveResult" },
{ operationType:"add", wsOperation:"create", recordName: "SaveResult" },
{ operationType:"remove", wsOperation:"delete", recordName: "DeleteResult" }
],
...
});
NOTE: additional code is required to handle authentication and other details, see the
complete code in smartclientSDK/examples/databinding/SalesForce.
For DataSources that contact non-WSDL-described XML or JSON services, OperationBindings can be used to separately configure the URL, HTTP method, input and output processing for each operationType. This makes it possible to fetch JSON data from one URL for the "fetch" operationType and save to a web service for the "update" operationType, while appearing as a single integrated DataSource to a {@link com.smartgwt.client.widgets.DataBoundComponent} such as an {@link com.smartgwt.client.widgets.grid.ListGrid#getCanEdit editable ListGrid}.
If no operationBinding is defined for a given DataSource operation, all of the properties which are valid on the operationBinding are checked for on the DataSource itself.
This also means that for a read-only DataSource, that is, a DataSource only capable of fetch operations, operationBindings need not be specified, and instead all operationBinding properties can be set on the DataSource itself. An example of using OperationBinding properties directly on the DataSource in order to read an RSS feed can be found here:
${isc.DocUtils.linkForStandaloneExample('/examples/databinding/rss_databinding.html', '/examples/databinding/rss_databinding.html')}
Default value is null,
OperationBinding
public java.lang.Boolean requiresAuthentication
operationBindings within
the DataSource may still override this setting by explicitly setting requiresAuthentication. Whether the user
is authenticated is determined by calling httpServletRequest.getRemoteUser(), hence works with both simple
J2EE security (realms and form-based authentication) and JAAS (Java Authentication & Authorization Service).
If you
wish to use an authentication scheme that does not make use of the servlet API's standards, Smart GWT Server also
implements the setAuthenticated method on RPCManager. You can use this API to tell Smart GWT
that all the requests in the queue currently being processed are associated with an authenticated user; in this case,
Smart GWT will not attempt to authenticate the user via httpServletRequest.getRemoteUser()
You can set the default value for this property via setting "authentication.defaultRequired" in server.properties. This allows you to, for example, cause all DataSources to require authentication for all operations by default.
Note that setting
this property does not automatically cause an authentication mechanism to appear - you still need to separately
configure an authentication system. Likewise, setting requiresAuthentication="false" does not automatically allow users
to bypass your authentication mechanism - you need to set up a URL that will accept DSRequests and process them similar
to the default "IDACall" servlet, and which is not protected by the authentication system. See Deploying Smart GWT for details on the IDACall servlet.
Default value is null
public boolean sendExtraFields
dropExtraFields, for data sent to the
server. Setting this attribute to false ensures that for any records in the data object, only fields that correspond to
declared dataSource fields will be present on the dsRequest data object passed to DataSource.transformRequest and ultimately sent to the server.
Default value is true
ClientDataIntegration overview and related methodspublic java.lang.String dataURL
dataURL. NOTE: Best practice is to use the same
dataURL for all DataSources which fulfill DSRequests via the server-side RPCManager API. Otherwise,
cross-DataSource operation queuing will not be possible.
Default value is null
ClientDataIntegration overview and related methodspublic java.lang.String configBean
serverType "hibernate", the name of a
Spring bean to query to obtain Hibernate Configuration for this particular DataSource. Note that this is intended for
DataSource-specific configuration overrides for unusual circumstances, such as a DataSource whose physical data store
is a completely different database to that used by other DataSources. See the Integration with Hibernate article for more information
Default value is null
ServerDataIntegration overview and related methodspublic java.lang.Boolean useLocalValidators
Disabling client-side validation entirely is a good way to test server-side validation.
Default value is null
Validation overview and related methodspublic boolean autoDeriveTitles
field.name
for any field that does not have a field.title and is
not marked hidden:true, by calling the method DataSource.getAutoTitle.
Default value is true
public java.lang.String titleField
For example, for a DataSource of employees, a "full name" field would probably most clearly label an employee record.
If not explicitly set, titleField looks for fields named "title", "label", "name", and "id" in that order. If a field exists with one of those names, it becomes the titleField. If not, then the first field is designated as the titleField.
Default value is see below
DsSpecialFields overview and related methodspublic ServerObject serverObject
operationBindings. Specifying this attribute in an XML
DataSource stored on the server enables DMI for this DataSource.
Default value is null
ServerDataIntegration overview and related methodspublic boolean qualifyColumnNames
serverType "sql", determines whether
we qualify column names with table names in any SQL we generate. This property can be overridden on specific
operationBindings.
Default value is true
OperationBinding.qualifyColumnNamespublic CriteriaPolicy criteriaPolicy
ResultSet cache should be dropped when the criteria changes.
Default value is "dropOnShortening"
com.smartgwt.client.data.DataSource#compareCriteriapublic java.lang.String recordXPath
recordXPath. recordXPath can be
specified directly on the DataSource for a simple read-only DataSource only capable of "fetch" operations.
Default value is null
ClientDataIntegration overview and related methodspublic java.lang.String schemaBean
autoDeriveSchema,
this property indicates the name of the Spring bean, Hibernate mapping or fully-qualified Java class to use as parent
schema.
Default value is null
autoDeriveSchemapublic java.lang.String childrenField
childrenProperty directly on
the childrenField object.
By default the children field will be assumed to be multiple,
for XML databinding. This implies that child data should be delivered in the format:
<childrenFieldName>
<item name="firstChild" ...>
<item name="secondChild" ...>
</childrenFieldName>
However data may also be delivered as a direct list of childrenFieldName
elements:
<childrenFieldName name="firstChild" ...>
<childrenFieldName name="secondChild" ...>
If you want to return your data in this format, you will need to explicitly set
multiple to false in the appropriate dataSource field definition.
Default value is null
DataSourceField.childrenProperty,
DataSourceRelations overview and related methodspublic java.lang.Boolean useFlatFields
useFlatFields, but applies to all DataBound
components that bind to this DataSource.
Default value is null
public boolean preventHTTPCaching
Note that this does not disable caching at higher levels in the framework, for example, the caching
performed by ResultSet.
Default value is true
public java.lang.Boolean quoteColumnNames
In general we recommend that you allow the database to use its natural naming scheme
when creating tables (put more simply, just do not quote column names in the CREATE TABLE statement); if
you do this, you will not need to worry about quoting column names when querying. However, if you are dealing with
pre-existing tables, or do not have control over the database naming conventions used, this property may become
necessary. This property may also be necessary if you are using field/column names that clash with reserved words in
the underlying database (these vary by database, but a field called "date" or "timestamp" would have problems with most
database products)
Note: Only applicable to dataSources of serverType "sql".
Default value is null
public java.lang.Boolean autoJoinTransactions
request queue will be committed in a single transaction. If false, causes all operations on this DataSource to be
committed individually. In either case, you can override the setting for individual operations - see autoJoinTransactions. If this property if
null or not defined, we fall back to the default setting for this type of DataSource. These are defined in
server.properties as follows:
hibernate.autoJoinTransactionsdbName). For example, the setting for the default MySQL connection
is sql.Mysql.autoJoinTransactionsserver.properties as
autoJoinTransactions. At the dbName and global system levels, you can set the autoJoinTransactions
attribute to a valid Transaction Policy, rather than a simple true or false (although these values work too - true is
the same as ALL, false is the same as NONE). For valid TransactionPolicy values and their meanings, see the
server-side Javadoc for RPCManager.setTransactionPolicy()
Note that the configuration settings
discussed here can be overridden for a particular queue of requests by setting the server-side RPCManager's transaction
policy. Look in the server-side Javadoc for RPCManager.getTransactionPolicy().
NOTE: Setting this property to true does not cause a transactional persistence mechanism to automatically appear - you have to ensure that your DataSource supports transactions. The Smart GWT SQL and Hibernate DataSources support transactions, but note that they do so at the provider level. This means that you can combine updates to, say, an Oracle database and a MySQL database in the same queue, but they will be committed in two transactions - one per database. The Smart GWT server will commit or rollback these two transactions as if they were one, so a failure in some Oracle update would cause all the updates to both databases to be rolled back. However, this is not a true atomic transaction; it is possible for one transaction to be committed whilst the other is not - in the case of hardware failure, for example.
NOTE: Not all the supported SQL databases are supported for transactions. Databases supported in this release are:
Default value is null
OperationBinding.autoJoinTransactionspublic java.lang.String tagName
dataSource.ID will be used.
Default value is null
ClientDataIntegration overview and related methodspublic java.lang.String nullStringValue
noNullUpdates is set, the value to use for any
text field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue.
Default value is ""
noNullUpdates,
com.smartgwt.client.docs.serverds.DataSourceField#nullReplacementValuepublic java.lang.String descriptionField
For example, for a DataSource representing employees, a field containing the employee's "bio" might be a good choice, or for an email message, the message body.
If descriptionField is unset, it defaults to any field named "description" or "desc" in the record, or the first long text field (greater than 255 characters) in the record, or null if no such field exists.
Default value is null
DsSpecialFields overview and related methodspublic java.lang.Boolean showLocalFieldsOnly
fields from another
DataSource (via inheritsFrom), indicates that only
the fields listed in this DataSource should be shown. All other inherited parent fields will be marked "hidden:true".
Default value is null
public EnumTranslateStrategy enumTranslateStrategy
Default value is null
public java.lang.String infoField
DataBoundComponent needs to show a short summary of a record. For example, for a DataSource of employees, a "job title" field would probably be the second most pertinent text field aside from the employee's "full name".
Unlike titleField, infoField
is not automatically determined in the absence of an explicit setting.
Default value is null
DsSpecialFields overview and related methodspublic java.lang.String requiresRole
requiresRole, but controls access to
the DataSource as a whole.
Default value is null
public DSDataFormat dataFormat
DataSource.fetchData is called).
Default value is "iscServer"
ClientDataIntegration overview and related methodspublic boolean nullBooleanValue
noNullUpdates is set, the value to use for any
boolean field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue.
Default value is false
noNullUpdates,
com.smartgwt.client.docs.serverds.DataSourceField#nullReplacementValuepublic java.lang.String requires
See also requires.
Default value is null
public boolean omitNullDefaultsOnAdd
noNullUpdates is also true, indicates
that "add" requests on this DataSource will have null-valued fields removed from the request entirely before it is
sent to the server, as opposed to the default behavior of replacing such null values with defaults.
Default value is false
noNullUpdatespublic java.lang.String iconField
type:"image" as the field to use when rendering a
record as an image, for example, in a TileGrid. For example, for a DataSource of employees, a "photo" field of type "image" should be designated as the iconField.
If not explicitly set, iconField looks for fields named "picture", "thumbnail", "icon", "image" and "img", in that order, and will use any of these fields as the iconField if it exists and has type "image".
To avoid any field being used as the iconField,
set iconField to null.
Default value is see below
DsSpecialFields overview and related methodspublic boolean showPrompt
showPrompt if it's unset.
Default value is true
public boolean clientOnly
Note that a
client-only DataSource is an entirely client-side variant of a cacheAllData DataSource, where all operations are performed on
client-side data, not just fetches.
See this discussion for
ways to populate a client-only DataSource with test data.
Default value is false
ClientOnlyDataSources overview and related methodspublic int resultBatchSize
If you have a relatively small number of records with a great deal of properties or
subobjects on each record, and you have not set dropExtraFields to eliminate unused data, and you see the "script running slowly" dialog, you may need to set this
number lower.
Default value is 150
public SQLPagingStrategy sqlPaging
server.properties setting sql.defaultPaging, is used. This setting can be
overridden with the sqlPaging property.
NOTE: Operations that involve a customSQL
clause ignore this property, because customSQL operations usually need to be treated as special cases. For these
operations, the paging strategy comes from the server.properties setting
sql.defaultCustomSQLPaging, unless it is overridden by a sqlPaging setting on the
OperationBinding.
Default value is null
OperationBinding.sqlPagingpublic java.lang.String enumConstantProperty
EnumTranslateStrategy is set to "bean". Defaults to "_constant" if
not set. This property is only applicable if you are using the Smart GWT server
Default value is null
public java.lang.String enumOrdinalProperty
EnumTranslateStrategy is set to "bean". Defaults to "_ordinal" if
not set. This property is only applicable if you are using the Smart GWT server
Default value is null
public float nullFloatValue
noNullUpdates is set, the value to use for any
float field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue.
Default value is 0.0
noNullUpdates,
com.smartgwt.client.docs.serverds.DataSourceField#nullReplacementValuepublic java.lang.String pluralTitle
For example, for the supplyItem DataSource, "Supply Items".
Defaults to (dataSource.title or dataSource.ID) + "s".
Default value is dataSource.ID
public java.lang.String ID
addGlobalId is set.
Default value is null
public java.lang.String tableName
Smart GWT SQL engine for persistence, what
database table name to use. The default is to use the DataSource ID as the table name.
Default value is null
ServerDataIntegration overview and related methodspublic java.lang.Object globalNamespaces
The default value is:
globalNamespaces : {
xsi: "http://www.w3.org/2001/XMLSchema-instance",
xsd: "http://www.w3.org/2001/XMLSchema"
},
This default value allows the use of the xsi:type and xsi:nil attributes without further
declarations.
Note that some web services will only accept specific revisions of the XML Schema URI. If xsi-namespaced attributes seem to be ignored by an older webservice, try the URI "http://www.w3.org/1999/XMLSchema-instance" instead.
Default value is ...
public java.lang.Boolean useOfflineStorage
browser-based
offline storage, and then use those stored responses at a later time if we are offline (ie, the application cannot
connect to the server). Note that by default we do NOT use offline storage for a dataSource.
Default value is null
public int nullIntegerValue
noNullUpdates is set, the value to use for any
integer field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue.
Default value is 0
noNullUpdates,
com.smartgwt.client.docs.serverds.DataSourceField#nullReplacementValuepublic java.lang.String dbName
Smart GWT SQL engine for persistence, which
database configuration to use. Database configurations can be created using the Admin Console. If unset, the default database configuration is used (which is
also settable using the "Databases" tab).
Default value is null
ServerDataIntegration overview and related methodspublic DSServerType serverType
Default value is "generic"
ServerDataIntegration overview and related methodspublic DSRequest requestProperties
DSRequests made by this DataSource.
These properties are applied before DataSource.transformRequest is called.
Default value is null
DSRequest,
OperationBinding.requestProperties,
ClientDataIntegration overview and related methodspublic java.lang.String callbackParam
dataTransport:"scriptInclude". Specifies the name of the query parameter that tells your JSON service what function to
call as part of the response.
Default value is "callback"
dataFormat,
operationBindings,
OperationBinding.callbackParam,
ClientDataIntegration overview and related methodspublic java.lang.Boolean autoDeriveSchema
inherit from the special super-DataSource. This
allows you to auto-derive schema from existing metadata, whilst still being able to override any or all of it as
required.This property has a different implementation depending upon the type of DataSource:
tableName.schemaBean property. If this property is not specified, or the
mapping does not exist, derive the dataSource's schema from the SQL table specified in tableName.schemaBean property. A DataSource with following properties
will be generated: ID - your DataSource
name with the suffix "_inheritsFrom"serverConstructor - JPA implementation class
com.isomorphic.jpa.JPADataSource for JPA 1.0com.isomorphic.jpa.GAEJPADataSource for Google App Engine (JPA 1.0)com.isomorphic.jpa.JPA2DataSource for JPA 2.0beanClassName - class name you are inheriting
fromdropExtraFields -
"true"willHandleAdvancedCriteria - "true" for standard JPA implementations; "false" for GAE implementationname - property name according to java naming conventionstype - type of the property: | Java type | type |
|---|---|
| boolean, Boolean | boolean |
| byte, short, int, long, Byte, Short, Integer, Long, BigInteger | integer |
| float, double, Float, Double, BigDecimal | float |
| char, Character, String | text |
| java.util.Date(with Temporal set to TIMESTAMP), java.util.Calendar, java.sql.TimeStamp | datetime |
| java.util.Date(with Temporal set to DATE), java.sql.Date | date |
| java.util.Date(with Temporal set to TIME), java.sql.Time | time |
| Enum (with Enumerated set to STRING) | enum |
| Enum (with Enumerated set to ORDINAL) | intEnum |
| property with Lob annotation | binary |
| field with GeneratedValue annotation | sequence |
valueMap - generated for enum and intEnum
properiesrequired - "true"
when Basic annotation has "optional" value set to "false" or Column annotation has "nullable" value set to "true";
"false" - otherwisecanEdit -
set to "false" when Column annotation "insertable" or "updatable" value set to "false"; "true" - otherwiselength - set to Column annotation
"length" valueprimaryKey -
set to "true" if property has Id annotationhidden - set to true for fields with type
'sequence'valueXPath -
generated for properties with Embedded annotationschemaBean property. If no such bean is found (or Spring is
not present), attempt to instantiate an object whose fully-qualified class name is the value in the
schemaBean property. If one of these approaches succeeds, we derive the schema from the discovered object
(by treating it as a Javabean and assuming that each one of its getters corresponds to a like-named field in the
DataSource).schemaBean implies autoDeriveSchema, because it has no
other purpose. Thus, if you specify schemaBean you do not need to specify autoDeriveSchema
as well (though it does no harm to do so). However, tableName can be validly specified without implying
autoDeriveSchema, so in that case you must explicitly specify autoDeriveSchema.
NOTE: The underlying super-DataSource is cached in server memory, so that it does not have to be derived and
created each time you need it. However, the cache manager will automatically refresh the cached copy if it detects
that the deriving DataSource has changed. Thus, if you change the metadata your DataSource is deriving (if, for
example, you add a column to a table), all you need to do is touch the .ds.xml file (ie, update its last
changed timestamp - you don't actually have to change it) and the cached copy will be refreshed next time it is needed.
Default value is null
public java.lang.String serverConstructor
"spring:MyDataSourceBean"One reason you might wish to do this would be to override the validate() method to provide some arbitrary custom validation (such as complex database lookups, validation embedded in legacy applications, etc). It is also possible - though obviously a more substantial task - to override the execute() method in your custom DataSource. This is one way of creating a completely customized DataSource implementation.
Note: If you use this property, you are responsible for
making sure that it refers to a valid server-side class that extends
com.isomorphic.datasource.BasicDataSource, or to a Spring bean of the same description. If your
implementation relies on methods or state only present in certain specialized subclasses of DataSource (for example,
you want the normal behavior and features of a HibernateDataSource, but with a specialized validate() method), then you
should extend the subclass rather than the base class.
NOTE: Please take note of the points made in this discussion of caching and thread-safety issues in
server-side DataSources.
Default value is null
public java.util.Date nullDateValue
noNullUpdates is set, the value to use for any
date or time field that has a null value assigned on an update operation, and does not specify an explicit nullReplacementValue. Unlike strings and numbers, there is no "natural" choice for a null replacement value for dates. The default value we have chosen is midnight on January 1st 1970, simply because this is "the epoch" - the value that is returned by calling "new Date(0)"
Default value is See below
noNullUpdates,
com.smartgwt.client.docs.serverds.DataSourceField#nullReplacementValuepublic java.lang.String schemaNamespace
WebService.getSchema.
Default value is null
WsdlBinding overview and related methodspublic java.lang.String dataField
DataBoundComponent needs to show a short summary of a record. For example, for a DataSource of employees, good choices might be the "salary" field, "hire date" or "status" (active, vacation, on leave, etc).
Unlike titleField, dataField is not
automatically determined in the absence of an explicit setting.
Default value is null
DsSpecialFields overview and related methodspublic java.lang.Boolean dropExtraFields
For JSON data, this means extra properties in selected objects are
dropped.
By default, for DMI DSResponses, DSResponse.data is filtered on the server to just the set of fields
defined on the DataSource. This type of filtering can also be enabled for non-DMI DSResponses (see the overview in
DMI). Setting this property to false disables
this filtering for this DataSource only. This setting overrides the configuration in server.properties.
This setting can be overridden by dropExtraFields.
Default value is null
ClientDataIntegration overview and related methodspublic boolean strictSQLFiltering
field == "someValue" (normally false)
field != "someValue" (normally true)
not (field == "someValue") (normally true)
not (field != "someValue") (normally false)
This property can be overridden per-query by specifying strictSQLFiltering
directly as a property on the AdvancedCriteria.
NOTE: On the server side, this property is only applicable if you are using one of the built-in DataSource types (SQL, Hibernate or JPA/JPA2)
Default value is false
public boolean noNullUpdates
Setting this value causes null-assigned fields to be replaced with the
field's nullReplacementValue, if one is
declared. If no nullReplacementValue is declared for the field, the null assignment is replaced with the
DataSource's nullStringValue, nullIntegerValue, nullFloatValue or nullDateValue, depending on the field type.
For "add"
operations, setting omitNullDefaultsOnAdd
causes null-valued fields to be removed from the request entirely, rather than replaced with default values as described
above.
Default value is false
public java.lang.String serviceNamespace
Having loaded a WebService using XMLTools.loadWSDL, setting serviceNamespace combined with
specifying operationBindings that set wsOperation will cause a DataSource to invoke web service
operations to fulfill DataSource requests (DSRequests).
Setting
serviceNamespace also defaults dataURL to the
service's location, dataFormat to "xml" and dataProtocol to "soap".
Default value is null
WsdlBinding overview and related methodspublic boolean canMultiSort
Default value is true
| Constructor Detail |
|---|
public DataSource()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||