Table
The Table class represents a possible source or target for a Link. It is analogous to a database table or Salesforce object.
Hint
Keep in mind that a Table doesn’t have to correspond to an actual database table. You can create Table instances as logical constructs, perhaps to represent different parts of the same API.
A Table can be specified in a Link as either the source or target of records. However, this is not required for a Link to function, and in fact it’s perfectly fine for an Adapter to be “schema-less”. Creating Table instances goes hand-in-hand with the SchemaAdapter interface.
Tables are constructed using a builder pattern that uses a fluent interface to make it simple to construct Table instances with varying degrees of complexity.
You get a TableBuilder by calling Table.create() and passing the API name of the Table you are constructing. This is the only required property, but it’s an important one. This string value is used when asking your Adapter for the Fields that be found for a given table. You will also likely use this table name value when your Adapter is figuring out which table the user wants to get records from, or send records to.
Simple Table Example
valence.Table companiesTable = valence.Table.create('company').withLabel('Companies').build();
Properties
Data Type |
Class Property |
Builder Method |
Description |
---|---|---|---|
String |
name |
Required. Used to retrieve lists of Fields. |
|
String |
label |
withLabel |
User-friendly label for this table. |
String |
description |
withDescription |
Description of the table’s use. |
String |
tableDetails |
withTableDetails |
Additional details you might need later. See Additional Table Details. |
Boolean |
isCreateable |
setCreateable |
True if new records can be created in this table (default: false). |
Boolean |
isReadable |
setReadable |
True if records can be read from this table (default: true). |
Boolean |
isUpdateable |
setUpdateable |
True if existing records can be updated in this table (default: false). |
Boolean |
isDeletable |
setDeletable |
True if records can be deleted from this table (default: false). |
Boolean |
isEditable |
setEditable |
True if either isCreateable or isUpdateable have been set. Can also be set independently (default: false). |