com.smartgwt.client.docs.serverds
Class DataSourceField

java.lang.Object
  extended by com.smartgwt.client.docs.serverds.DataSourceField

public class DataSourceField
extends java.lang.Object

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.

Metadata about a DataSourceField, including its type and validators.


Field Summary
 java.lang.Boolean autoGenerated
          Indicates this field value is auto-generated by data base or ORM provider.
 boolean autoQuoteCustomExpressions
          If explicitly set to false, switches off automatic quoting and escaping of values in custom expressions that are derived from Velocity evaluations.
 java.lang.Boolean canEdit
          Controls whether, by default, dataBoundComponents consider this field editable.
 java.lang.Boolean canExport
          Dictates whether the data in this field be exported.
 java.lang.Boolean canFilter
          Should the user be able to filter data by this field? Effects whether this field will show up in dataBoundComponents with UI for filtering data.
 java.lang.Boolean canSave
          Whether values in this field can be updated and saved to the dataSource.
 boolean canSortClientOnly
          When true, this field can only be used for sorting if the data is entirely client-side.
 java.lang.Boolean canView
          If false, this property indicates that this field is considered "server only".
 boolean childrenProperty
          If true, this property indicates that this field will hold an explicit array of child nodes for the current node.
 java.lang.String childTagName
          For a field that is multiple:"true", controls the name of the XML tag used for each subelement during DataSource.xmlSerialize.
 java.lang.Boolean creatorOverrides
          Indicates that normal declarative security rules specified on this field are waived for rows that were created by the current user, as described in the discussion of dataSource.creatorOverrides.
 java.lang.String customCriteriaExpression
          This property indicates that this field should be represented by a custom expression embedded in the WHERE clause of the generated SQL, instead of the generated expression containing this field name that would ordinarily be used.
 java.lang.String customInsertExpression
          This property is similar to customUpdateExpression; its value is used during "add" operations.
 java.lang.String customSelectExpression
          This property indicates that this field represents a custom expression that should be embedded in the generated SQL instead of a reference to this field.
 java.lang.Boolean customSQL
          For a DataSource with serverType "sql" or "hibernate", indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with custom queries.
 java.lang.String customUpdateExpression
          This property specifies the value to use to update this column on "update" operations.
 java.lang.Integer decimalPad
          Applies only to fields of type "float" and enforces a minimum number of digits shown after the decimal point.
 java.lang.Integer decimalPrecision
          Applies only to fields of type "float" and affects how many significant digits are shown.
 boolean detail
          Whether this field should be considered a "detail" field by a DataBoundComponent.
 DateDisplayFormat displayFormat
          The default date formatter to use for displaying this field.
 FormItem editorType
          Sets the default FormItem to be used whenever this field is edited (whether in a grid, form, or other component).
 VelocityExpression editRequires
          Indicates that the specified VelocityExpression must evaluate to true if writes to this field are to be allowed.
 java.lang.Boolean editRequiresAuthentication
          Whether a user must be authenticated in order to write to this field.
 java.lang.String editRequiresRole
          Comma-separated list of user roles that are allowed to write to this field.
 java.lang.Boolean encodeInResponse
          When set for a field with binary data, binary data will be delivered as a Base64 encoded string.
 java.lang.Boolean escapeHTML
          When data values are displayed in DataBound components, by default strings will be interpreted as HTML by the browser in most cases.
 java.lang.String exportTitle
          Optional different field-title used for exports.
 java.lang.String fkColumnCode
          Only applicable to the built-in SQL DataSource
 java.lang.String fkTableCode
          Only applicable to the built-in SQL DataSource
 java.lang.String foreignKey
          Declares that this field holds values that can be matched to values from another DataSource field, to create a relationship between records from different DataSources or even records within the same DataSource.
 java.lang.String group
          For use in ComponentSchema, indicates what group to place the property in when editing in Visual Builder.
 boolean hidden
          Whether this field should be hidden from users by default within a DataBound component.
 boolean ignore
          Whether this field should be completely excluded from this dataSource, as if it had never been defined.
 java.lang.Integer imageHeight
          Height of the image-content of this field.
 java.lang.Integer imageSize
          Width and height of the image-content of this field.
 java.lang.Integer imageWidth
          Width of the image-content of this field.
 java.lang.Boolean inapplicable
          For use in ComponentSchema, a field inherited from another schema can be redeclared with this property set in order to indicate that the property should not be used.
 java.lang.String includeFrom
          Indicates this field should be fetched from another, related DataSource.
 VelocityExpression initRequires
          Indicates that the specified VelocityExpression must evaluate to true if initializations of this field are to be allowed.
 java.lang.Boolean initRequiresAuthentication
          Whether a user must be authenticated in order to initialize to this field.
 java.lang.String initRequiresRole
          Comma-separated list of user roles that are allowed to initialize this field.
 java.lang.String javaClass
          For use with the Smart GWT server when populating Java Beans / POJOs based on data contained in a DSRequest, javaClass specifies the fully qualified Java className to be created and passed to the setter for the Java Bean Property with the same name as this field.
 java.lang.String javaCollectionClass
          See javaClass - when auto-populating of Java Beans / POJOs based on inbound DSRequest data, for a field of type Collection or Map, javaCollectionClass can be used to specify a particular concrete class to use.
 java.lang.String javaKeyClass
          See javaClass - when auto-populating of Java Beans / POJOs based on inbound DSRequest data, for a field of Map type, javaKeyClass can be used to specify a particular concrete class for the map keys.
 JoinType joinType
          This property is only applicable to fields of SQL DataSources that also specify a foreignKey property; it is ignored for all other fields.
 java.lang.Integer length
          Maximum number of characters allowed.
 java.lang.Integer maxFileSize
          For fields of a type that are represented by binary data initially uploaded from a file (currently "binary" and "imageFile", see FieldType), this sets the maximum file size allowed, in bytes.
 java.lang.String mimeType
          For a binary field, sets a fixed mime type for all files stored to this field.
 java.lang.Boolean multiple
          Indicates that this field should always be Array-valued.
 java.lang.String name
          Name for this field.
 java.lang.String nativeName
          Only applicable to "sql" dataSources.
 java.lang.Boolean nillable
          Controls whether an explicit null-valued Record attribute for this field should result in xsi:nil being used to transmit the value when serializing to XML, like so:
 boolean primaryKey
          Indicates either that this field holds a value unique across all records in this DataSource, or that it is one of a number of fields marked as primary keys, and the combination of the values held in all of those fields is unique across all records in the DataSource.
 java.lang.Boolean propertiesOnly
          For use in ComponentSchema for fields that contain other components, this flag suppresses auto-construction for subcomponents that appear under this field.
 FormItem readOnlyEditorType
          Sets the default FormItem to be used if this field is marked as canEdit false and displayed in an editor component such as a DynamicForm.
 java.lang.Boolean required
          Indicates this field must be non-null in order for a record to pass validation.
 java.lang.Object rootValue
          For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node.
 java.lang.String sequenceName
          For a DataSource with serverType:"sql" with a field of type "sequence", the name of the SQL sequence that should be used when inserting new records into this table.
 java.lang.Boolean showFileInline
          For a field of type:"imageFile", indicates whether to stream the image and display it inline or to display the View and Download icons.
 java.lang.String sqlDateFormat
          For fields of type "date" and "datetime" that specify a sqlStorageStrategy of "number" or "text", this property allows you to specify the format Smart GWT should use to map to/from the underlying value stored in the database.
 java.lang.String sqlFalseValue
          For fields of type "boolean" that specify a sqlStorageStrategy of "singleChar", this is the value to persist for false values.
 java.lang.String sqlStorageStrategy
          For certain field types, indicates the strategy to be used to store values to the underlying SQL column.
 java.lang.String sqlTrueValue
          For fields of type "boolean" that specify a sqlStorageStrategy of "singleChar", this is the value to persist for true values.
 HashAlgorithm storeWithHash
          If set, causes the field to be securely hashed before saving on an "add" or "update" operation.
 java.lang.String tableName
          Only applicable to "sql" dataSources, setting tableName indicates that this field will be coming from another table by way of a customized SQL query.
 java.lang.String title
          Default user-visible title for this field.
 FieldType type
          Type of this field.
 VelocityExpression updateRequires
          Indicates that the specified VelocityExpression must evaluate to true if updates to this field are to be allowed.
 java.lang.Boolean updateRequiresAuthentication
          Whether a user must be authenticated in order to update to this field.
 java.lang.String updateRequiresRole
          Comma-separated list of user roles that are allowed to update this field.
 java.lang.String uploadFieldName
          Used by the BatchUploader to map a field in an upload file to this dataSourceField.
 Validator[] validators
          Validators to be applied to this field.
 OperatorId[] validOperators
          List of operators valid on this field.
 java.util.Map valueMap
          A ValueMap is a set of legal values for a field.
 java.lang.String valueMapEnum
          Fully qualified Java className of an Enum that should be used to derive this field's ValueMap.
 XPathExpression valueWriteXPath
          Alternative XPath expression used to set the field's value.
 XPathExpression valueXPath
          XPath expression used to retrieve the field's value.
 VelocityExpression viewRequires
          Indicates that the specified VelocityExpression must evaluate to true if values for the field are to be fetched.
 java.lang.Boolean viewRequiresAuthentication
          Whether a user must be authenticated in order to fetch this field.
 java.lang.String viewRequiresRole
          Comma-separated list of user roles that are allowed to fetch this field.
 java.lang.Boolean xmlAttribute
          Indicates that DataSource.xmlSerialize should serialize this value as an XML attribute.
 
Constructor Summary
DataSourceField()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlFalseValue

public java.lang.String sqlFalseValue
For fields of type "boolean" that specify a sqlStorageStrategy of "singleChar", this is the value to persist for false values. Note that the common use cases of storing booleans as T/F, Y/N and 1/0 are already catered for without the need for this property.
For fields of type "boolean" that specify a sqlStorageStrategy of "string", this is the value to persist for false values that require using the entire value.

Default value is null

See Also:
sqlStorageStrategy, sqlTrueValue

rootValue

public java.lang.Object rootValue
For a field that is a foreignKey establishing a tree relationship, what value indicates a root-level node. Defaults to null.

Note that the rootValue may be overridden on a specific ResultTree instance by setting rootNode, or if the ResultTree is auto-generated by a TreeGrid, by setting treeRootValue. This allows a component to navigate a subtree of the hierarchical data from this dataSource starting at a particular node.

Default value is null

See Also:
DataSourceRelations overview and related methods

inapplicable

public java.lang.Boolean inapplicable
For use in ComponentSchema, a field inherited from another schema can be redeclared with this property set in order to indicate that the property should not be used.

This is primarily used to influence VisualBuilder. For simple type properties, this avoids the property appearing in the Component Editor.

For fields that hold subcomponents, this prevents inappropriate drag and drop. For example, a custom class called MyDialog may automatically create a series of children, and not allow arbitrary other children to be added. In this case, the inherited property children should be marked inapplicable in order to prevent arbitrary components being dropped onto a MyDialog instance.

Default value is null

See Also:
ComponentSchema overview and related methods

canView

public java.lang.Boolean canView
If false, this property indicates that this field is considered "server only". This means: canView:false is not the same thing as hidden. Use canView:false when you want to prevent the client from ever seeing a field's definition or values; use hidden:true if it is fine from a security perspective that a field's definition and values are sent to the browser, but the field should not by default appear in user interface elements (but could do in some cases, like a special screen for advanced users or administrators, for example).

Note that this property must be set explicitly to false to have an effect; a null or undefined setting is treated the same as true.

This property is used to implement field-level view security: failing a viewRequiresAuthentication, viewRequiresRole or viewRequires test is equivalent to setting canView:false on the field (and, indeed, from the client's perspective, the field has had canView:false set).

Default value is null

See Also:
ComponentBinding overview and related methods

javaKeyClass

public java.lang.String javaKeyClass
See javaClass - when auto-populating of Java Beans / POJOs based on inbound DSRequest data, for a field of Map type, javaKeyClass can be used to specify a particular concrete class for the map keys. If not specified, and a concrete type cannot be discovered using Java Reflection, java.lang.Object is used. Note that javaKeyClass take precedence over generics if both are used.

Default value is null


group

public java.lang.String group
For use in ComponentSchema, indicates what group to place the property in when editing in Visual Builder.

Default value is null

See Also:
ComponentSchema overview and related methods

canFilter

public java.lang.Boolean canFilter
Should the user be able to filter data by this field? Effects whether this field will show up in dataBoundComponents with UI for filtering data.

Default value is null

See Also:
SearchForm.getShowFilterFieldsOnly(), SearchForm.getCanEditFieldAttribute()

validators

public Validator[] validators
Validators to be applied to this field.

Validators are applied whenever there is an attempt to save changes to a field.

For the available set of built-in validators, and how to define a custom validator, see the Validator class.

Default value is null

See Also:
Validator, Validation overview and related methods

mimeType

public java.lang.String mimeType
For a binary field, sets a fixed mime type for all files stored to this field. Should be set to a standard mime type string, for example, "text/plain" for a .txt file.

This is useful if a binary field only stored one type of file and you chose not to store filenames, since the extension of the file name is normally used to determine the mime type.

Default value is null


viewRequiresRole

public java.lang.String viewRequiresRole
Comma-separated list of user roles that are allowed to fetch this field. If the current user has any of the roles listed, values for the field will be fetched. Please see requiresRole for further details of Smart GWT's declarative role-based security. Please also see fetchRequiresAuthentication for details of how declarative field-level security settings can be overridden per-request.

Default value is null

See Also:
viewRequiresAuthentication, editRequiresRole, FieldLevelAuth overview and related methods

showFileInline

public java.lang.Boolean showFileInline
For a field of type:"imageFile", indicates whether to stream the image and display it inline or to display the View and Download icons.

Default value is null


escapeHTML

public java.lang.Boolean escapeHTML
When data values are displayed in DataBound components, by default strings will be interpreted as HTML by the browser in most cases.

If set, this property will be picked up by components bound to this dataSource, notifying them that any HTML characters should be escaped when displaying values for this field.

Default value is null

See Also:
ListGridField.getEscapeHTML()

initRequiresAuthentication

public java.lang.Boolean initRequiresAuthentication
Whether a user must be authenticated in order to initialize to this field. If this property is set and the user is not authenticated, the Smart GWT Server will not allow this field to be initialized.

Default value is null

See Also:
editRequiresAuthentication, FieldLevelAuth overview and related methods

valueMapEnum

public java.lang.String valueMapEnum
Fully qualified Java className of an Enum that should be used to derive this field's ValueMap.

This has the same behavior of auto-deriving a valueMap from a Java Enum as autoDeriveSchema except it applies only to one field.

If you enable autoDeriveSchema there is no need to set valueMapEnum for Enum fields unless you want to actually override the behavior to use a different Enum for the field (eg, a superclass Enum that is more restrictive).

Default value is null


detail

public boolean detail
Whether this field should be considered a "detail" field by a DataBoundComponent.

Detail fields won't be shown by default in a DataBoundComponent where showDetailFields is false. This allows for some DataBound components, like a ListGrid, to show a summary view of records which displays only the most commonly viewed fields by default, while other DataBoundComponents, like a DetailViewer, show all fields by default.

In addition, the formItem.showIf property is supported in multiple components for conditional visibility - see for example ListGridField.showIf and FormItem.showIf).

Default value is false

See Also:
ComponentBinding overview and related methods

validOperators

public OperatorId[] validOperators
List of operators valid on this field.

If not specified, all operators that are valid for the field type are allowed.

Default value is null


xmlAttribute

public java.lang.Boolean xmlAttribute
Indicates that DataSource.xmlSerialize should serialize this value as an XML attribute.

Note this does not need to be declared in order for DataSource records to be derived from XML data: a field will be populated with either an attribute or subelement with matching name.

Default value is null

See Also:
ComponentSchema overview and related methods

fkTableCode

public java.lang.String fkTableCode
Only applicable to the built-in SQL DataSource

This read-only attribute is a secure and unique hashed version of the name of the table underlying a dataSource that this dataSourceField is a foreign key to. It is used automatically by client-side framework code to link dataSources together by foreign key, by matching fkTableCodes with tableCodes. This is necessary if we automatically discovered a foreign key relationship by inspecting the database schema, as a result of a DataSource specifying autoDeriveSchema: true. We use a secure hash rather than the table name itself for security reasons - sending the actual table name to the client would be considered an information leakage that could encourage attempts at injection attacks.

Default value is null

See Also:
DataSource.tableCode, fkColumnCode

decimalPrecision

public java.lang.Integer decimalPrecision
Applies only to fields of type "float" and affects how many significant digits are shown.

For example, with decimalPrecision 3, if the field value is 343.672677, 343.673 is shown.

If the value is 125.2, 125.2 is shown - decimalPrecision will not cause extra zeros to be added. Use decimalPad for this.

A number if always shown with its original precision when edited.

Default value is null

See Also:
Appearance overview and related methods

updateRequiresRole

public java.lang.String updateRequiresRole
Comma-separated list of user roles that are allowed to update this field. If the current user does not have any of the roles listed, the system will not allow this field to be updated.

NOTE: This property only prevents a field from being updated; initialization will still be allowed. You should only use this property if you have a special requirement; ordinarily, use editRequiresRole, which applies security for both types of write.

Default value is null

See Also:
editRequiresAuthentication, editRequiresRole, initRequires, FieldLevelAuth overview and related methods

customCriteriaExpression

public java.lang.String customCriteriaExpression
This property indicates that this field should be represented by a custom expression embedded in the WHERE clause of the generated SQL, instead of the generated expression containing this field name that would ordinarily be used. You use this property when you have to accomodate some special way of using a field's value in criteria, other than by directly comparing it to the criteria. For example, if you have a column that contains bit-packed information you will generally need to perform a bitwise AND to filter on that column, rather than an equality check. In this case, you would use a customCriteriaExpression something like this (in Oracle):

   BITAND(myField, $criteria.myField)+0 = $criteria.myField

Or this (in MySQL or SQL Server):

   myField & $criteria.myField = $criteria.myField

As this example shows, a customCriteriaExpression is expected to be a complete logical expression that provides both sides of the comparison. After Velocity processing, this example would result in SQL similar to this (for the MySQL case); the colored part comes entirely from the customCriteriaExpression:

SELECT myField, myOtherField FROM myTable WHERE myField & 32 = 32

customCriteriaExpression can also be used with AdvancedCriteria. Note that the point mentioned above, about a customCriteriaExpression being a complete logical expression that provides both sides of the comparison still applies. This means that when you use customCriteriaExpression in conjunction with AdvancedCriteria, you effectively switch off support for different OperatorIds to be used on that field, unless you use Velocity expressions containing the special $criteriaOperator variable (see below).

When you use customCriteriaExpression with AdvancedCriteria, the way you access criteria values differs slightly. One option is to use the $advancedCriteria Velocity variable, as described in the "Using AdvancedCriteria" section of the custom querying overview. However, this variable only returns the value from the first Criterion that uses the field, as found by depth-first search. If your AdvancedCriteria contains multiple references to this field, this will not be satisfactory. Therefore, specifically for customCriteriaExpression, we provide another Velocity variable, $criteriaValue. This variable means "the value on a Criterion referencing this field". An example may serve to clarify this:

Assume you need to extend the above example to filter records where a certain bit is set OR a certain other bit is set. An AdvancedCriteria like this would be required (note that the choice of "equals" as the operator in these clauses is completely arbitrary - as discussed above, the operator is ignored when we have a customCriteriaExpression, so it would make no difference to the end product if we had used different operators here):

    { _constructor: "AdvancedCriteria", operator: "or", criteria: [
        { fieldName: "myField", operator: "equals", value: 32 },
        { fieldName: "myField", operator: "equals", value: 64 },
      ]
    }       
  
If you used the customCriteriaExpression from above unchanged with this criteria, the following SQL would be generated (in the MySQL case):

SELECT myField, myOtherField FROM myTable WHERE myField & null = null OR myField & null = null

This is because $criteria is a variable that only works correctly with simple criteria. If you changed the $criteria references in the expression to $advancedCriteria, the generated SQL would be:

SELECT myField, myOtherField FROM myTable WHERE myField & 32 = 32 OR myField & 32 = 32

This is because $advancedCriteria always returns the first value it finds for a particular field, as described above. However, if you change the expression so it reads:

   myField & $criteriaValue = $criteriaValue

you will now get the correct SQL generated:

SELECT myField, myOtherField FROM myTable WHERE myField & 32 = 32 OR myField & 64 = 64

Similar to $criteriaValue, we provide a special variable, $criteriaOperator. This is intended for use in Velocity expressions, so that your customCriteriaExpression can process different operators in different ways. How you choose to interpret an operator is entirely up to you; this variable is both advanced and rarely used. This example is contrived and does not show a usage that would be remotely likely in a real application, but it does show how to use the variable in a Velocity expression:

   myField #if ($criteriaOperator == "greaterThan") & #else | #end $criteriaValue = $criteriaValue

For simple criteria, note that $criteriaOperator will vary depending on field type and the textMatchStyle in force, as follows:

You can use Velocity expressions in your customCriteriaExpressions, and the usual context variables are available. Note that the results of Velocity evaluations are automatically quoted and escaped by default; this behavior can be switched off - see autoQuoteCustomExpressions, and particularly note the warnings about its use.

Note that this property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null

See Also:
customSelectExpression, customUpdateExpression, customInsertExpression, autoQuoteCustomExpressions

primaryKey

public boolean primaryKey
Indicates either that this field holds a value unique across all records in this DataSource, or that it is one of a number of fields marked as primary keys, and the combination of the values held in all of those fields is unique across all records in the DataSource. Note that the latter usage - so-called "composite" or "multipart" keys - is intended for support of legacy databases only: if you are able to choose an approach, Isomorphic recommends the use of one primaryKey field per DataSource, and ideally this field should be of type "sequence".

A DataSource that can only perform the "fetch" operation does not require a primaryKey. If a DataSource allows modification of DataSource records through add, update and remove DataSource operations, one or more fields must be marked as the primary key.

Smart GWT requires a primary key value to uniquely identify records when communicating updates or deletions to the server. There is no requirement that the primaryKey field be mapped to an actual "primary key" in your object model, web service, or database (though this is the most obvious and natural thing to do, of course). The only requirement is that the combined values of the primaryKey fields be unique for a given browser instance for the lifetime of the page.

If using Smart GWT's SQL engine and generating SQL tables using the Admin Console, the table column generated from a primaryKey field will have a unique constraint applied in the database table and, if the field is of type "sequence", the database column will also be created as an "identity column" in those databases that implement sequence-type handling with identity columns.

Default value is false

See Also:
DataSourceRelations overview and related methods

length

public java.lang.Integer length
Maximum number of characters allowed. Applicable only to fields of text type.

NOTE: For DataSources of type "sql", this property has a bearing on the type of column we use when the underlying table is created by a DataSource import in the Admin Console. Below a certain length (which is database-specific, see below), we use standard VARCHAR columns; above that length, we use an alternate strategy (again, database-specific). For these long fields, we sometimes also generate different SQL for "update" and "add" operations, using JDBC "?" replacement parameters rather than embedding values directly in the generated SQL; whether or not this is done depends entirely on what the underlying database product and/or JDBC driver will allow.


Table of field length limits for supported databases:

Database product VARCHAR limit * Type used above limit
HSQLDBNone-
IBM DB24000CLOB
Firebird32767BLOB with subtype 1
Informix255 / 32739LVARCHAR / TEXT **
Microsoft SQL Server 8000TEXT
MySQL 255 / 65535 / 16M TEXT / MEDIUMTEXT / LONGTEXT ***
Oracle4000CLOB
PostgreSQL4000TEXT

* The "VARCHAR limit" referred to here is a limit used by the Smart GWT Server; it is not necessarily imposed by the database. For example, DB2's VARCHAR limit is not 4000 characters; it actually varies from about 4K to about 32K, depending on how the server has been configured.

** Informix has a limit of just 255 characters for VARCHAR, but has a native LVARCHAR type which supports nearly 32K characters without needing to fall back on long datatypes. Therefore, with that one product, we have two thresholds for a change in storage type.

*** MySQL has a limit of 255 characters for VARCHAR, 65,535 characters for TEXT and 16,777,215 for MEDIUMTEXT; therefore, with that one product, we have three thresholds for a change in storage type.

Default value is null


storeWithHash

public HashAlgorithm storeWithHash
If set, causes the field to be securely hashed before saving on an "add" or "update" operation.

Default value is null


javaCollectionClass

public java.lang.String javaCollectionClass
See javaClass - when auto-populating of Java Beans / POJOs based on inbound DSRequest data, for a field of type Collection or Map, javaCollectionClass can be used to specify a particular concrete class to use. If not specified, and a concrete Collection or Map class cannot be discovered using Java Reflection, the following concrete classes are used: Note that this value is used even if the target Collection or Map is declared as a concrete class. So, for example, if you set javaCollectionClass to java.util.LinkedList but your setter method accepts a java.util.ArrayList, you will get a ClassCastException.

Default value is null


javaClass

public java.lang.String javaClass
For use with the Smart GWT server when populating Java Beans / POJOs based on data contained in a DSRequest, javaClass specifies the fully qualified Java className to be created and passed to the setter for the Java Bean Property with the same name as this field. javaClass is used both when manually calling DataSource.setProperties() and when auto-populating POJO arguments of a DMI method.

The Java class to create does not normally have to be specified: Smart GWT will use Java reflection to inspect the type of argument expected by a setter method and will attempt conversion of inbound data to that type. As described in the documentation for DataTools.setProperties(), this works for almost all typical cases. However field.javaClass is useful for:

NOTE: It is also possible to make Smart GWT Server determine the javaClass to use dynamically at runtime. See the description of DataSource.getPropertyJavaClass() in the server documentation for details.

Default value is null


autoQuoteCustomExpressions

public boolean autoQuoteCustomExpressions
If explicitly set to false, switches off automatic quoting and escaping of values in custom expressions that are derived from Velocity evaluations.

By default, any part of a customSelectExpression, customCriteriaExpression, customUpdateExpression or customInsertExpression that comes ultimately from evaluating a Velocity expression, will be automatically quoted and escaped according to the syntax of the underlying database. We do this because "raw" values are vulnerable to SQL injection attacks.

However, it is possible that the exact SQL logic you desire for a custom expression cannot be expressed without access to the raw, unquoted value. To work around this, you can either use the special $rawValue context variable, or you can set this property to false to switch off auto-quoting completely for all custom expressions on this field.

Warning: Bear in mind that it is dangerous to use raw values. There are some cases where using the raw value is necessary, but even so, all such cases are likely to be vulnerable to injection attacks. Generally, the presence of $rawValue in a custom expression, or any fields with autoQuoteCustomExpressions: false specified, should be viewed as a red flag.

Default value is true

See Also:
customSelectExpression, customUpdateExpression, customInsertExpression, customCriteriaExpression

exportTitle

public java.lang.String exportTitle
Optional different field-title used for exports.

Default value is null


nillable

public java.lang.Boolean nillable
Controls whether an explicit null-valued Record attribute for this field should result in xsi:nil being used to transmit the value when serializing to XML, like so:
  <book>
      <title>Beowulf</title>
      <author xsi:nil="true"/>
  </book>
  
If nillable is not set, no XML element will be generated for the explicit null value.

Default value is null


joinType

public JoinType joinType
This property is only applicable to fields of SQL DataSources that also specify a foreignKey property; it is ignored for all other fields. Indicates the type of join to make between the tables underlying this DataSource and the other DataSource referred to in the foreignKey property, when resolving includeFrom fields. The default value of null is the same as specifying "inner".

Note, outer joins are allowed for all supported database products only if you are using ANSI-style joins (which is the default). If you are using the older strategy of additional join expressions in the WHERE clause, outer joins are only supported for database products that provide a proprietary native syntax for expressing outer joins. Those products are:

Default value is null

See Also:
DataSourceRelations overview and related methods

updateRequires

public VelocityExpression updateRequires
Indicates that the specified VelocityExpression must evaluate to true if updates to this field are to be allowed. If the specified expression does not evaluate to true, the field will be removed from the request as described for editRequiresAuthentication.

NOTE: This property only prevents update of a field; initialization will still be allowed. You should only use this property if you have a special requirement; ordinarily, use editRequires, which applies security for both types of write.

Default value is null

See Also:
editRequiresAuthentication, editRequiresRole, viewRequires, FieldLevelAuth overview and related methods

editRequiresAuthentication

public java.lang.Boolean editRequiresAuthentication
Whether a user must be authenticated in order to write to this field. If this property is set and the user is not authenticated, the Smart GWT Server will not allow this field to be updated or initialized.

This property affects two things. Firstly, the server determines when the DataSource is first loaded if we have an authenticated user; if we don't, the field is marked canEdit: false. Secondly, when an insert or update request is received from the client, the server removes the field from the values clause before the request is processed.

Note that you can override this behavior. The canEdit setting can be overridden on the the client-side DataSource like any other client-side property. The value-removing behavior can be overridden on a per-request basis by providing a DMI that re-adds values for the fields you want for that particular request to the values object (the values originally sent up by the client are available on the DSRequest). See the server-side Javadocs for DSRequest.getValues() and DSRequest.getClientSuppliedValues().

Default value is null

See Also:
viewRequiresAuthentication, FieldLevelAuth overview and related methods

childTagName

public java.lang.String childTagName
For a field that is multiple:"true", controls the name of the XML tag used for each subelement during DataSource.xmlSerialize.

If unset, the default tag name is "value" for a field of simple type, and for a field of DataSource type, is the tagName or ID of the DataSource (as though xmlSerialize() were called on the child DataSource).

Default value is null

See Also:
ComponentSchema overview and related methods

uploadFieldName

public java.lang.String uploadFieldName
Used by the BatchUploader to map a field in an upload file to this dataSourceField. This is only necessary if the dataSourceField's name and title differ from the name of the field in the upload file (Smart GWT will automatically map upload fields using the dataSourceField's title, if possible, if it does not get a direct match on field name).

Default value is null


customSQL

public java.lang.Boolean customSQL
For a DataSource with serverType "sql" or "hibernate", indicates that this field should be omitted by default from all SQL or Hibernate operations, and will only be used with custom queries.

Having marked a field as customSQL you can refer to it via $criteria.fieldName or $values.fieldName in customized queries.

The following are situations where you would not use customSQL:

Use customSQL in situations like:

Default value is null


title

public java.lang.String title
Default user-visible title for this field.

This will be picked up by DataBound components and other views over this DataSource.

Note this property frequently does not need to be set since autoDeriveTitles (on by default) usually picks an appropriate user-visible title if you have a reasonable naming convention for your field names.

Note that if this field is being displayed in a ListGrid bound to this dataSource, the headerTitle attribute may be used to specify a different string for display in the listGrid column header.

Default value is null

See Also:
ComponentBinding overview and related methods

customInsertExpression

public java.lang.String customInsertExpression
This property is similar to customUpdateExpression; its value is used during "add" operations. If you do not specify this property, but do specify a customUpdateExpression, the customUpdateExpression is used instead.

Everything that applies to customUpdateExpression also applies to this property, including the observation that fields which specify a customSelectExpression but no corresponding customUpdateExpression or customInsertExpression, will be ignored when adding new records.

Note that this property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null

See Also:
customUpdateExpression, customSelectExpression, customCriteriaExpression, autoQuoteCustomExpressions

editRequires

public VelocityExpression editRequires
Indicates that the specified VelocityExpression must evaluate to true if writes to this field are to be allowed. If the specified expression does not evaluate to true, the field will be removed from the request as described for editRequiresAuthentication.

NOTE: This property prevents both initialization and updates for a field. If you have a need to prevent just initialization or just updates, you can use initRequires or updateRequires.

Default value is null

See Also:
editRequiresAuthentication, editRequiresRole, viewRequires, FieldLevelAuth overview and related methods

encodeInResponse

public java.lang.Boolean encodeInResponse
When set for a field with binary data, binary data will be delivered as a Base64 encoded string.

When encodeInResponse is not set normal responses will not contain values for binary fields at all. Instead, UI components, such as TileGrid issue a second binary fetch for binary data when appropriate, and APIs such as downloadFile and viewFile can be used to programmatically trigger downloads.

Only applicable to fields of a type that are represented by binary data (currently "binary" and "imageFile", see FieldType).

Default value is null


sqlStorageStrategy

public java.lang.String sqlStorageStrategy
For certain field types, indicates the strategy to be used to store values to the underlying SQL column.

Fields of type "boolean"
The default strategy for boolean fields is to assume the underlying type of the field is text and store boolean true and false values as the character strings "true" and "false". The following additional strategies are available:

Fields of type "date" and "datetime"
The default strategy for both these types is to use a native type that supports date and time values to the nearest second; the actual type used varies by database. The following additional strategies are available:

The "number" and "text" strategies for date/datetime fields are provided to allow transparent two-way mapping of legacy date values; you would not ordinarily use them in the absence of a legacy database. In both cases, the actual format of the number or text string is determined by specifying a sqlDateFormat on the field; if no format is specified, the framework defaults to "yyyyMMdd".

Fields of type "text"

NOTE: This section is only applicable for users of Microsoft SQL Server. The "ntext" strategy is ignored for all other databases.

If you are integrating with Microsoft SQL Server, you may run into an issue with that database and double-byte character sets. Although the documentation indicates that string values are sent to the database as Unicode by default, they may undergo conversion at the database end, depending on the collation settings of the database. This Microsoft support article describes the situation, which is that Unicode is converted to the code page of the database before being used, in order to "provide backward compatibility with existing applications".

To work around this, we provide an sqlStorageStrategy of "ntext". Fields that declare this strategy are inserted into queries using the "N syntax", like so:
   UPDATE MyTable SET MyTextColumn = N'some text' WHERE MyPK = N'some key'

This syntax overrides defaults and forces the database to treat strings as Unicode.

Note that declaring a field to be of type "ntext" is exactly equivalent to specifying type "text" and an sqlStorageStrategy of "ntext". If you declare a field of type "ntext" when the back-end database is something other than SQL Server, it will be treated as a normal field of type "text".

This property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null


initRequires

public VelocityExpression initRequires
Indicates that the specified VelocityExpression must evaluate to true if initializations of this field are to be allowed. If the specified expression does not evaluate to true, the field will be removed from the request as described for editRequiresAuthentication.

NOTE: This property only prevents initialization of a field; updates will still be allowed. You should only use this property if you have a special requirement; ordinarily, use editRequires, which applies security for both types of write.

Default value is null

See Also:
editRequiresAuthentication, editRequiresRole, viewRequires, FieldLevelAuth overview and related methods

viewRequiresAuthentication

public java.lang.Boolean viewRequiresAuthentication
Whether a user must be authenticated in order to fetch this field. If this property is set and the user is not authenticated, Smart GWT Server will not return values for this field to the client.

The way this behavior works is to remove the field from the expressed or implied list of fields to return. A list of fields can be expressed using outputs or outputs; in the absence of those, the entire set of fields defined in the DataSource is implied. You can override this behavior on a per-request basis by providing a DMI that just re-adds the names of the fields you want for that particular request to the "consolidated outputs". See the server-side Javadoc for DSRequest.getConsolidatedOutputs().

In addition to this behavior of trimming off values in fetched records, a field that fails a field-level security check (either this one or one of the two more specific checks, viewRequiresRole and viewRequires) will be altered in the version of the dataSource returned to the client by the <loadDS> JSP tag or DataSourceLoader servlet.

By default, view constraints automatically imply edit constraints - almost all of the time, if a user is not allowed to view a field, he should not be allowed to update it either. If you specify a view constraint, the system behaves as if you had also specified the corresponding edit constraint - so viewRequiresAuthentication on a field implies editRequiresAuthentication. You override this behavior simply by specifying some kind of edit constraint for the field, either a different one (eg, "users" can view a field, but only "managers" can update it) or a blank one (if you have some unusual requirement whereby users are not allowed to view a field, but they can update it).

Default value is null

See Also:
editRequiresAuthentication, FieldLevelAuth overview and related methods

imageWidth

public java.lang.Integer imageWidth
Width of the image-content of this field. If set as a string, represents the name of another field in the record that holds the imageWidth. Applicable only to fields of image type or fields that use a ViewFileItem as an editor.

Default value is null


canExport

public java.lang.Boolean canExport
Dictates whether the data in this field be exported. Explicitly setting canExport to false overrides the setting on any component-fields, such as ListGrid fields.

Default value is null


foreignKey

public java.lang.String foreignKey
Declares that this field holds values that can be matched to values from another DataSource field, to create a relationship between records from different DataSources or even records within the same DataSource.

The format of foreignKey is <dataSourceId>.<fieldName>.
For a foreignKey within the same dataSource, you can omit the dataSourceId and just specify <fieldName>.
For example, to create a tree relationship within a DataSource:

    DataSource.create({
      ID:"supplyItem",
      fields : [
        {name:"itemId", type:"sequence", primaryKey:true},
        {name:"parentId", type:"integer", foreignKey:"itemId"},
        ...
      ]
    });
  

foreignKey declarations also allow other automatic behaviors by DataBoundComponents, such as ListGrid.fetchRelatedData.

For SQLDataSources foreign keys can be automatically discovered from SQL tables if autoDeriveSchema is set.

Default value is false

See Also:
joinType, DataSourceRelations overview and related methods

multiple

public java.lang.Boolean multiple
Indicates that this field should always be Array-valued. If the value derived from XML or JSON data is singular, it will be wrapped in an Array.

Specifically for XML serialization and deserialization, multiple:true behaves similarly to the SOAP array idiom, that is, there will be a "wrapper element" named after the field name, whose contents will be several elements of the specified field.type.

For example, members is declared with type:"Canvas", multiple:true. The correct XML format is thus:

  <VLayout>
      <members>
          <Canvas ID="myCanvas" ... />
          <ListGrid ID="myGrid" .../>
          <Toolstrip ID="myToolStrip" ... />
      </members>
  </VLayout>
  

See childTagName for customizing the tagName used for subelements.

Default value is null

See Also:
ComponentSchema overview and related methods

sqlDateFormat

public java.lang.String sqlDateFormat
For fields of type "date" and "datetime" that specify a sqlStorageStrategy of "number" or "text", this property allows you to specify the format Smart GWT should use to map to/from the underlying value stored in the database. The string provided must be a valid SimpleDateFormat pattern string.

This property and the "number" and "text" strategies for date/datetime fields are provided to allow transparent two-way mapping of legacy date values that are stored in numeric or text columns respectively rather than a true "date" column. You would not ordinarily use them in the absence of a legacy database.

Note that this property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null


creatorOverrides

public java.lang.Boolean creatorOverrides
Indicates that normal declarative security rules specified on this field are waived for rows that were created by the current user, as described in the discussion of dataSource.creatorOverrides. This setting overrides dataSource.creatorOverrides, for this field only.

Note that field-level creatorOverrides is conceptually slightly different to the setting at DataSource and OperationBinding levels. To give the example of a fetch operation, at the other two levels, it results in a limited set of rows being returned, rather than a security exception being thrown. At the field-level, it results in values for individual fields being present in those rows, rather than them being stripped out on the server.

Default value is null

See Also:
editRequires, viewRequires, DataSource.creatorOverrides, FieldLevelAuth overview and related methods

editRequiresRole

public java.lang.String editRequiresRole
Comma-separated list of user roles that are allowed to write to this field. If the current user does not have any of the roles listed, the system will not allow this field to be initialized or updated. Please see requiresRole for further details of Smart GWT's declarative role-based security. Please also see editRequiresAuthentication for details of how declarative field-level security settings can be overridden per-request.

NOTE: This property prevents both initialization and updates for a field. If you have a need to prevent just initialization or just updates, you can use initRequiresRole or updateRequiresRole.

Default value is null

See Also:
editRequiresAuthentication, viewRequiresRole, initRequiresRole, updateRequiresRole, FieldLevelAuth overview and related methods

canEdit

public java.lang.Boolean canEdit
Controls whether, by default, dataBoundComponents consider this field editable.

Set to false to draw this field read-only.

This attribute may not effect all dataBoundComponents - the canEditFieldAttribute may be set at the component level to look for a different attribute on the dataSourceField, and components allow developers to explicitly override this default (see canEdit. canEdit for example).

Note that this setting only prevents the user from modifying the field's value through the UI; the value can still be modified programmatically, and it will still be saved in the normal way. If you wish to prevent a field from being saved, use canSave:false instead (or in addition).

Default value is null

See Also:
canFilter, canSave, ComponentBinding overview and related methods

sequenceName

public java.lang.String sequenceName
For a DataSource with serverType:"sql" with a field of type "sequence", the name of the SQL sequence that should be used when inserting new records into this table.

Note that this is never required for SQL tables that are generated from Smart GWT DataSources (a default sequence name of tableName + "_" + columnName is chosen), and is never required for databases where inserting null into a sequence column is sufficient (MySQL, SQL Server, DB2 and others).

You would only need to set sequenceName if you are integrating with a pre-existing table stored in a database where the sequence must be named for insertion to work (Oracle, Postgres, Firebird) OR you are trying to use the same sequence across multiple DataSources.

Default value is null

See Also:
SqlDataSource overview and related methods

displayFormat

public DateDisplayFormat displayFormat
The default date formatter to use for displaying this field. Only applicable to fields of type "date" and "datetime". Note that this property is honored when exporting directly to Excel spreadsheets (ie, when using XLS or XLSX/OOXML form, not CSV); "date" and "datetime" fields with this property set will deliver real dates and formatting information to Excel, rather than formatted strings or unformatted dates.

Default value is null


customSelectExpression

public java.lang.String customSelectExpression
This property indicates that this field represents a custom expression that should be embedded in the generated SQL instead of a reference to this field. For example, if you have a field partialName where this value is set to SUBSTR(surname, 2), the generated SQL would look similar to this:
    SELECT ... SUBSTR(surname, 2) AS partialName ...
  
Fields with this property set can be used for sorting and filtering in the normal way, but they are only applicable to update-type operations if you also provide a corresponding customUpdateExpression and/or customInsertExpression. See the documentation for those methods for the rules of how they are applied.

You can use Velocity expressions in your customSelectExpressions, and the usual context variables are available. Note that the results of Velocity evaluations are automatically quoted and escaped by default; this behavior can be switched off - see autoQuoteCustomExpressions, and particularly note the warnings about its use.

Note that this property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null

See Also:
customUpdateExpression, customInsertExpression, customCriteriaExpression, autoQuoteCustomExpressions

readOnlyEditorType

public FormItem readOnlyEditorType
Sets the default FormItem to be used if this field is marked as canEdit false and displayed in an editor component such as a DynamicForm.

This property may also be specified at the type level by specifying readOnlyEditorType.

Default value is null

See Also:
ComponentBinding overview and related methods

imageSize

public java.lang.Integer imageSize
Width and height of the image-content of this field. If set as a string, represents the name of another field in the record that holds the imageSize. Applicable only to fields of image type or fields that use a ViewFileItem as an editor.

Default value is null


decimalPad

public java.lang.Integer decimalPad
Applies only to fields of type "float" and enforces a minimum number of digits shown after the decimal point.

For example, a field value of 343.1, 343.104 and 343.09872677 would all be shown as 343.10 if decimalPad is 2.

The original unpadded value is always shown when the value is edited.

Default value is null

See Also:
Appearance overview and related methods

autoGenerated

public java.lang.Boolean autoGenerated
Indicates this field value is auto-generated by data base or ORM provider.

Default value is null


editorType

public FormItem editorType
Sets the default FormItem to be used whenever this field is edited (whether in a grid, form, or other component).

If unset, a FormItem will be automatically chosen based on the type of the field, by the rules explained here.

Default value is null

See Also:
ComponentBinding overview and related methods

maxFileSize

public java.lang.Integer maxFileSize
For fields of a type that are represented by binary data initially uploaded from a file (currently "binary" and "imageFile", see FieldType), this sets the maximum file size allowed, in bytes.

Default value is null


viewRequires

public VelocityExpression viewRequires
Indicates that the specified VelocityExpression must evaluate to true if values for the field are to be fetched. If the specified expression does not evaluate to true, the field will be dropped as described for viewRequiresAuthentication.

Default value is null

See Also:
viewRequiresAuthentication, viewRequiresRole, editRequires, FieldLevelAuth overview and related methods

tableName

public java.lang.String tableName
Only applicable to "sql" dataSources, setting tableName indicates that this field will be coming from another table by way of a customized SQL query.

By default, the SQL generator will not include this field in generated SQL for "add" or "update" operations. It will include the field in the SELECT clause and WHERE clause of customized "fetch" operations, where it is expected that you will make the table available via a custom <tableClause> as shown in this sample.

The table name will also be used to qualifying the column name unless qualifyColumnNames or qualifyColumnNames has been disabled.

Note: This property is only required when including fields from tables other than the default table specified by tableName.

Default value is null

See Also:
nativeName

hidden

public boolean hidden
Whether this field should be hidden from users by default within a DataBound component. This is generally used for internal IDs and other fields not meaningful to users.

See detail for fields that should be hidden in a summary view such as a ListGrid, but still available to the user.

NOTE: This property is not a security setting - data for hidden fields is still delivered to the client, it just isn't shown to the user. If you wish to make sure that only appropriate data reaches the client, use outputs, canView:false on the field, or a field-level declarative security setting like viewRequiresRole.

Default value is false

See Also:
ComponentBinding overview and related methods

propertiesOnly

public java.lang.Boolean propertiesOnly
For use in ComponentSchema for fields that contain other components, this flag suppresses auto-construction for subcomponents that appear under this field.

For example, the VLayout schema sets this for its members property, so that when a VLayout is constructed via XML as follows:

  <VLayout>
      <members>
          <ListGrid ID="myGrid" .../>
          <Toolstrip ID="myToolStrip" ... />
      </members>
  </VLayout>
  
The ListGrid and ToolStrip do not construct themselves automatically. Instead, the VLayout receives the properties of the ListGrid and ToolStrip as ordinary JavaScript Objects, with the special property _constructor set to the name of the class that should be constructed.

Default value is null

See Also:
ComponentSchema overview and related methods

includeFrom

public java.lang.String includeFrom
Indicates this field should be fetched from another, related DataSource.

A foreignKey declaration must exist between the two DataSources, establishing either a 1-to-1 relationship or a many-to-1 relationship from this DataSource to the related DataSource.

The incluedFrom attribute should be of the form "dataSourceId.fieldName", for example:

     <field includeFrom="supplyItem.itemName"/>
  

name will default to the name of the included field, or you can specify a different name.

If both DataSources are SQLDataSources, HibernateDataSources or JPADataSources (with Hibernate as the provider) the related data will be retrieved via a SQL join and criteria and sort directions applied to the field work normally (they become part of the generated SQL query).

Otherwise, the related data will be retrieved via performing a DSRequest against the related DataSource once the data from the primary DataSource has been retrieved. In this case, criteria or sorting directions applied to the included field are only allowed if data paging is not in use (for example dataFetchMode:"basic"); otherwise, criteria and sort direction are ignored for the included field and a warning is logged on the server.

An included field is canEdit:false by default. Note that included fields are not updatable, even if you set canEdit:true; the server will simply drop values for included fields if client code sends them.

Default value is null

See Also:
DataSourceRelations overview and related methods

imageHeight

public java.lang.Integer imageHeight
Height of the image-content of this field. If set as a string, represents the name of another field in the record that holds the imageHeight. Applicable only to fields of image type or fields that use a ViewFileItem as an editor.

Default value is null


name

public java.lang.String name
Name for this field.

The field name is also the property in each DataSource record which holds the value for this field.

Must be unique across all fields within the DataSource as well as a valid JavaScript identifier, as specified by ECMA-262 Section 7.6.

NOTE: The StringUtil.isValidID() function can be used to test whether a name is a valid JavaScript identifier.

Default value is null

See Also:
Basics overview and related methods

type

public FieldType type
Type of this field. Required for all DataSource fields.

Field type may imply automatic validators (for example, an integer field cannot accept the value "foo"). Field type also affects the default behaviors of DataBound components, for example, if a field is declared as type "date", components that edit that field will automatically choose a date-editing interface with pop-up date picker.

Default value is null

See Also:
Basics overview and related methods

required

public java.lang.Boolean required
Indicates this field must be non-null in order for a record to pass validation.

Note that required should not be set for a server-generated field, such as a sequence, or validation will fail on the client.

Default value is null


canSave

public java.lang.Boolean canSave
Whether values in this field can be updated and saved to the dataSource.

If set to false, this field will default to being non-editable in standard editing components (DynamicForm, editable ListGrid), but will be editable when displayed for filtering purposes only (in a SearchForm or ListGrid filter editor. If canEdit is explicitly specified it will take precedence over this client-side behavior, but the server will still enforce the no-save policy (described below).

NOTE: If you are using Smart GWT Server and have specified canSave: false for a field in a DataSource definition (.ds.xml file), this is enforced on the server. This means that we will strip out any attempt to set the value of such a field before trying to process any update or add request, similar to what happens when a field-level declarative security check fails.

Default value is null

See Also:
ComponentBinding overview and related methods

valueXPath

public XPathExpression valueXPath
XPath expression used to retrieve the field's value.

This XPath expression will be evaluated in the scope of the record objects selected by the recordXPath. For XML data (dataFormat:"xml") this means a call to XMLTools.selectString passing the selected XML element. For JSON data (dataFormat:"json"), this means a call to XMLTools.selectObjects passing the selected JSON object.

In the absence of a valueXPath, for JSON data the value for the field will be the value of the same-named property in the record object selected by recordXPath.

For XML data, the value will be the attribute or subelement named after the field name. For example, for a field "author" on a record element <book>, the following structures require no valueXPath:

     <book author="Mark Jones"/>
 
     <book>
         <author>Mark Jones</author>
     </book>
  

If valueXPath is not required for your field because of the default handling described above, don't specify it, as it's slightly slower.

To learn about XPath, try the following search: http://www.google.com/search?q=xpath+tutorial

Using valueXPath with the Smart GWT server

If you're using the Smart GWT server to return data via the DSResponse object (or indirectly doing so using DataSource DMI), the valueXPath you specify on the DataSource fields will be applied to the data you return via the JXPath library.

If you are returning Java Beans as your DSResponse data, normally each dataSource field receives the value of the same-named Java Bean property, that is, a field "zipCode" is populated by looking for "getZipCode()" on the objects passed as DSResponse data. You can use valueXPath to retrieve properties from subobjects, so long as a chain of getter methods exists that corresponds to the valueXPath. For example, a valueXPath of "address/zipCode" expects to call "getAddress()" on the bean(s) passed to DSResponse.setData(), followed by "getZipCode()" on whatever object "getAddress()" returns.

When you are saving data, the inbound DSRequest values, available as a Java Map, will use just dataSource field names as Map keys, not the valueXPath used to derive them. However, to achieve bidirectional valueXPath binding, you can use the server-side method dataSource.setProperties() to use the valueXPath when setting properties on your server object model. When applied as a setter, an XPath like "address/zipCode" attempts "getAddress()" followed by "setZipCode()" on the returned object. JXPath also has some ability to auto-create intervening objects if they are missing, such as auto-creating an "address" subobject when applying "address/zipCode" as a valueXPath.

See the JXPath library documentation for complete details, including other types of server object models supported, such as server-side XML.

Default value is null

See Also:
ClientDataIntegration overview and related methods

updateRequiresAuthentication

public java.lang.Boolean updateRequiresAuthentication
Whether a user must be authenticated in order to update to this field. If this property is set and the user is not authenticated, the Smart GWT Server will not allow this field to be updated.

Default value is null

See Also:
editRequiresAuthentication, FieldLevelAuth overview and related methods

canSortClientOnly

public boolean canSortClientOnly
When true, this field can only be used for sorting if the data is entirely client-side.

Default value is false


sqlTrueValue

public java.lang.String sqlTrueValue
For fields of type "boolean" that specify a sqlStorageStrategy of "singleChar", this is the value to persist for true values. Note that the common use cases of storing booleans as T/F, Y/N and 1/0 are already catered for without the need for this property.
For fields of type "boolean" that specify a sqlStorageStrategy of "string", this is the value to persist for true values that require using the entire value.

Default value is null

See Also:
sqlStorageStrategy, sqlFalseValue

nativeName

public java.lang.String nativeName
Only applicable to "sql" dataSources. If set, this property indicates that the field is bound to the column named in the property. It is used to bind a DataSourceField to a database column with a different name.

nativeName is useful for disambiguating in cases where you have customized SQL. For example, assume you are joining two tables - call them product and supplier - that both contain a column called "name". Only one field in the DataSource can be called "name"; to disambiguate, we need to specify both tableName and nativeName. A field declaration like this would be needed:

    <field name="supplierName" type="text" tableName="supplier" nativeName="name"
 />

You may also wish to use this property to map legacy column names to more meaningful field names in the DataSource. For example:

    <field name="productName" type="text" nativeName="PRDNM" />

Default value is null

See Also:
tableName

valueMap

public java.util.Map valueMap
A ValueMap is a set of legal values for a field.

The valueMap can be specified as either an Array of legal values, or as an Object where each property maps a stored value to a user-displayable value.

To enforce that a field should be constrained to only the values in the valueMap, either declare field.type as "enum", or use a ValidatorType of "isOneOf" with explicitly listed values. Otherwise, although a normal SelectItem control will only allow values from the valueMap to be entered, other controls such as a ComboBox will allow other values to be entered.

In XML, a valueMap that specifies only a list of legal values is specified as follows:

    <valueMap>
     <value>Pens & Pencils</value>
     <value>Stationery</value>
     <value>Computer Products</value>
     <value>Furniture</value>
     <value>Misc</value>
    </valueMap>
  
A ValueMap that specifies stored values mapped to user-visible values is specified as follows:
    <valueMap>
     <value ID="1">Pens & Pencils</value>
     <value ID="2">Stationery</value>
     <value ID="3">Computer Products</value>
     <value ID="4">Furniture</value>
     <value ID="5">Misc</value>
    </valueMap>
  

Default value is null


valueWriteXPath

public XPathExpression valueWriteXPath
Alternative XPath expression used to set the field's value.

If is not set, then dataSourceField.valueXPath is used, see its description for details.

Default value is null

See Also:
ClientDataIntegration overview and related methods

customUpdateExpression

public java.lang.String customUpdateExpression
This property specifies the value to use to update this column on "update" operations. The value of this property will be passed through Velocity evaluation and then embedded directly in the SQL generated to perform the update. It can be used in conjunction with customSelectExpression to provide bi-directional mapping between application data formats and persisted data formats. Or, it can be used unilaterally as a means of silently enforcing data rules - for example, ensuring that all values for a given field are in upper case.

You can use Velocity expressions in your customUpdateExpressions, and the usual context variables are available. Note that the results of Velocity evaluations are automatically quoted and escaped by default; this behavior can be switched off - see autoQuoteCustomExpressions, and particularly note the warnings about its use.

The value must be a string that will end up as a valid SQL snippet after Velocity evaluation. The following examples are valid:

The first example is a literal and so it must be enclosed in quotes to render valid SQL. The second example is also a literal, but as it is the result of a Velocity evaluation, it will be automatically quoted as appropriate. The third example is an actual SQL snippet and does not need to be enclosed in quotes (indeed, would fail if it were). The fourth example shows an SQL snippet containing a literal - again, because the literal is the result of a Velocity evaluation, it will be automatically quoted. The remaining two examples both yield literals, but as they are numeric literals they must not be quoted.

When an "update" operation runs, any fields that specify customSelectExpression but do not specify customUpdateExpression will be ignored. When an "add" operation runs, this property acts as a default for any fields that do not specify a customInsertExpression; similar to update, any fields that specify a customSelectExpression but do not specify either a customUpdateExpression or customInsertExpression, will be ignored when "add" operations run.

Note that this property only applies to users of the Smart GWT server using dataSources of type "sql".

Default value is null

See Also:
customSelectExpression, customInsertExpression, customCriteriaExpression, autoQuoteCustomExpressions

ignore

public boolean ignore
Whether this field should be completely excluded from this dataSource, as if it had never been defined.

Default value is false

See Also:
ComponentBinding overview and related methods

initRequiresRole

public java.lang.String initRequiresRole
Comma-separated list of user roles that are allowed to initialize this field. If the current user does not have any of the roles listed, the system will not allow this field to be initialized.

NOTE: This property only prevents initialization of a field; updates will still be allowed. You should only use this property if you have a special requirement; ordinarily, use editRequiresRole, which applies security for both types of write.

Default value is null

See Also:
editRequiresAuthentication, editRequiresRole, updateRequiresRole, initRequires, FieldLevelAuth overview and related methods

fkColumnCode

public java.lang.String fkColumnCode
Only applicable to the built-in SQL DataSource

This read-only attribute is a secure and unique hashed version of the name of the matching column in the table underlying a dataSource that this dataSourceField is a foreign key to. It is used automatically by client-side framework code to link dataSources together by foreign key. This is necessary if we automatically discovered a foreign key relationship by inspecting the database schema, as a result of a DataSource specifying autoDeriveSchema: true. We use a secure hash rather than the column name itself for security reasons - sending the actual column name to the client would be considered an information leakage that could encourage attempts at injection attacks.

Default value is null

See Also:
DataSource.tableCode, fkTableCode

childrenProperty

public boolean childrenProperty
If true, this property indicates that this field will hold an explicit array of child nodes for the current node. This has the same effect as specifying childrenField to this field's name.

Default value is false

See Also:
DataSource.childrenField, DataSourceRelations overview and related methods
Constructor Detail

DataSourceField

public DataSourceField()