IMPORTANT: The CDF Store is designed to work with Tibco GI, and references Tibco's JSX3 JavaScript library and will not work without it.
The CDF Store implements dojo.data.Read, Write, and Identity api's. It is a local (in memory) store that handles XML documents formatted according to the Common Data Format (CDF) spec: http://www.tibco.com/devnet/resources/gi/3_1/tips_and_techniques/CommonDataFormatCDF.pdf
The purpose of this store is to provide a glue between a jsx3 CDF file and a Dijit.
While a CDF document is an XML file, other than the initial input, all data returned from and written to this store should be in object format.
Parameter | Type | Description |
---|---|---|
args | Object |
See the dojox/data/CdfStore reference documentation for more information.
A object that will be converted into the xmlStr property, and then parsed into a CDF.
The unique identifier for each item. Defaults to "jsxid" which is standard for a CDF document. Should not be changed.
A string that can be parsed into an XML document and should be formatted according to the CDF spec.
Internal method. Requests the items from jsx3.xml.Entity with an xpath query.
Parameter | Type | Description |
---|---|---|
cdfDoc | jsx3.xml.Entity | |
request | Object |
Internal method. If a cdfDoc exists, return it. Otherwise, get one from JSX3, load the data or url, and return the doc or a deferred.
Internal method. Marks items as modified, deleted or new.
Parameter | Type | Description |
---|---|---|
item | undefined |
Internal method. Converts an object into an XML string.
Parameter | Type | Description |
---|---|---|
obj | undefined |
See dojo/data/api/Read.close()
Parameter | Type | Description |
---|---|---|
request | dojo/data/api/Request | Object |
Optional
|
Check whether an item contains a value
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String | |
value | anything |
Delete an jsx3.xml.Entity (wrapper to a XML element).
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
Returns an Array of items based on the request arguments.
Returns an Array of items based on the request arguments. If the store is in ASYNC mode, the items should be expected in an onComplete method passed in the request object. If store is in SYNC mode, the items will be return directly as well as within the onComplete method.
note: The mode can be set on store initialization or during a fetch as one of the parameters.
See:
See dojo.data.Read.fetch():
Parameter | Type | Description |
---|---|---|
request | String |
Optional The items in the store are treated as objects, but this is reading an XML document. Further, the actual querying of the items takes place in Tibco GI's jsx3.xml.Entity. Therefore, we are using their syntax which is xpath. Note: As conforming to a CDF document, most, if not all nodes are considered "records" and their tagNames are as such. The root node is named "data". |
All items:
store.fetch({query:"*"});
Item with a jsxid attribute equal to "1" (note you could use byId for this)
store.fetch({query:"//record[@jsxid='1']"});
All items with any jsxid attribute:
"//record[@jsxid='*']"
The items with a jsxid of '1' or '4':
"//record[@jsxid='4' or @jsxid='1']"
All children within a "group" node (could be multiple group nodes): "//group/record"
All children within a specific group node: "//group[@name='mySecondGroup']/record"
Any record, anywhere in the document:
"//record"
Only the records beneath the root (data) node:
"//data/record"
See dojo/data/api/Identity.fetchItemByIdentity(keywordArgs).
Note: This method can be synchronous if mode is set. Also, there is a more finger friendly alias of this method, byId();
Parameter | Type | Description |
---|---|---|
args | Object | String |
Return an array of property names
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
Returns the identifier for an item.
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
Returns the property used for the identity.
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
See dojo/data/api/Read.getLabel()
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
returns an array of what properties of the item that were used to generate its label See dojo/data/api/Read.getLabelAttributes()
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
Return an property value of an item
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String | |
defaultValue | value |
Optional
|
Return an array of values
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String |
Check whether an item has a property
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String |
Alias for hasAttribute
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String |
Check whether an item is new, modified or deleted. If no item is passed, checks if anything in the store has changed.
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity |
Optional
|
Check whether the object is an item (jsx3.xml.Entity)
Parameter | Type | Description |
---|---|---|
something | anything |
Check whether the object is a jsx3.xml.Entity object and loaded
Parameter | Type | Description |
---|---|---|
something | anything |
Load an item
The store always loads all items, so if it's an item, then it's loaded.
Parameter | Type | Description |
---|---|---|
keywordArgs | object |
Creates a jsx3.xml.Entity item and inserts it either inside the parent or appends it to the root
Parameter | Type | Description |
---|---|---|
keywordArgs | object |
Optional
|
parentInfo | Object | String |
Optional
|
Invalidate changes (new and/or modified elements) Resets data by simply deleting the reference to the cdfDoc. Subsequent fetches will load the new data.
Note: Any items outside the store will no longer be valid and may cause errors.
Set an property value
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String | |
value | almost anything |
Set property values.
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String | |
values | array |
Remove an property
Parameter | Type | Description |
---|---|---|
item | jsx3.xml.Entity | |
property | String |