Class ecm.model._ModelStore

Represents a data store that is used for lists within the ecm.model package. This class provides a read-only implementation of the Dojo data store. Dojo data stores are useful for providing data to Dojo dijit widgets.

The _ModelStore class makes assumptions about methods on the objects for which the data store is provided. In particular, if the following methods are not defined on the object, the data store returns null for the corresponding function:


Defined in: <ecm\model\_ModelStore.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Method Summary

Method Attributes Method Name and Description
<static>  
ecm.model._ModelStore._ModelStore.booleanComparator(a, b)
Compares boolean values.
<static>  
ecm.model._ModelStore._ModelStore.caseInsensitiveComparator(a, b)
Compares two values in a case-insensitive way.
<static>  
ecm.model._ModelStore._ModelStore.dateComparator(a, b)
Compares date strings.
<static>  
ecm.model._ModelStore._ModelStore.longComparator(a, b)
Compares long (64bit) numeric strings.
<static>  
ecm.model._ModelStore._ModelStore.numericComparator(a, b)
Compares numeric strings.
 
close(request)
The close() method is intended for instructing the store to 'close' out any information associated with a particular request.
 
constructor(parentModelObject, getListFunction, newItemFunction, deleteItemFunction, getMappedAttributeNameFunction)
Constructs the store.
 
containsValue(item, attribute, value)
Returns true if the item contains the given value for the specified attribute.
 
deleteItem(item)
Deletes an item from the store.
 
fetch(request)
See dojo.data.util.simpleFetch.fetch() for a description of this method.
 
fetchItemByIdentity(keywordArgs)
This method is not implemented and will throw an error if used.
 
Returns an array of all of the attributes of this item.
 
Returns the features supported by this store.
 
Returns a unique identifier for an item.
 
Returns an array of attributes that are used to generate the identity.
 
getLabel(item)
Invokes the model object's getName function to return a user-readable label for the item.
 
Method to inspect the item and return an array of what attributes of the item were used to generate its label, if any.
 
getValue(item, attribute, defaultValue)
Returns a single attribute value for an item.
 
getValues(item, attribute)
Returns the array of values for an attribute.
 
hasAttribute(item, attribute)
Returns true if the item has the specified attribute.
 
isItem(something)
Always returns true, although for a perfect implementation of a dojo.data store this should return true if the provided object is an item from this store instance.
 
isItemLoaded(something)
Always returns true.
 
loadItem(keywordArgs)
Performs nothing.
 
newItem(item)
Adds a new item to the store.
 
onDelete(deletedItem)
This event function is called any time an item is deleted from the store.
 
onNew(newItem, parentInfo)
This event function is called any time a new item is created in the store.
 
onSet(item, attribute, oldValue, newValue)
This event function is called any time an item is modified via this store.
 
save(obj)
Calls obj.onComplete.
 
setValue(item, attribute, value)
Set the attribute value in the item.

Constructor Detail

ecm.model._ModelStore()

Method Detail

<static> {number} ecm.model._ModelStore._ModelStore.booleanComparator(a, b)

Compares boolean values.
Parameters:
a
The first value to compare.
b
The second value to compare.
Returns:
{number} 0 if equal, 1 if a == null, -1 if b == null, 1 if a not null.

<static> ecm.model._ModelStore._ModelStore.caseInsensitiveComparator(a, b)

Compares two values in a case-insensitive way. Returns the following:
Parameters:
a
The first value to compare.
b
The second value to compare.

<static> {number} ecm.model._ModelStore._ModelStore.dateComparator(a, b)

Compares date strings.
Parameters:
a
The first value to compare.
b
The second value to compare.
Returns:
{number} 0 if equal, 1 if a > b, -1 if a < b.

<static> {number} ecm.model._ModelStore._ModelStore.longComparator(a, b)

Compares long (64bit) numeric strings.
Parameters:
a
The first value to compare.
b
The second value to compare.
Returns:
{number} 0 if equal, 1 if a > b, -1 if a < b.

<static> {number} ecm.model._ModelStore._ModelStore.numericComparator(a, b)

Compares numeric strings.
Parameters:
a
The first value to compare.
b
The second value to compare.
Returns:
{number} 0 if equal, 1 if a > b, -1 if a < b.

close(request)

The close() method is intended for instructing the store to 'close' out any information associated with a particular request. This method does nothing for this implementation.
Parameters:
request

constructor(parentModelObject, getListFunction, newItemFunction, deleteItemFunction, getMappedAttributeNameFunction)

Constructs the store.
Parameters:
parentModelObject
The object that contains the collection of model objects to which this store is to access.
getListFunction
The function on the parentModelObject that will obtain the list of model objects. This function is itself passed a function as a parameter which is called when the list is obtained, being passed the list of objects. (This is the typical pattern for most of the retrieve methods in the model.)
newItemFunction
The function on the parentModelObject that can be called to add a new item.
deleteItemFunction
The function on the parentModelObject that can be invoked to delete an item.
getMappedAttributeNameFunction
The function on the parentModelObject that can be invoked to get a mapped attribute.

containsValue(item, attribute, value)

Returns true if the item contains the given value for the specified attribute.
Parameters:
item
An ecm.model object.
attribute
The identifier of the attribute.
value
The value to test.

deleteItem(item)

Deletes an item from the store.
Parameters:
item
The item to delete.

fetch(request)

See dojo.data.util.simpleFetch.fetch() for a description of this method.
Parameters:
request

fetchItemByIdentity(keywordArgs)

This method is not implemented and will throw an error if used.
Parameters:
keywordArgs

getAttributes(item)

Returns an array of all of the attributes of this item.
Parameters:
item
An ecm.model object.

getFeatures()

Returns the features supported by this store. The particular interfaces supported are dojo.data.api.Notification, dojo.data.api.Read, and dojo.data.api.Identity. See Dojo documentation dojo.data.api.Read.getFeatures() for more information.

getIdentity(item)

Returns a unique identifier for an item. For ecm.model objects, this is the identifier returned using item.id.
Parameters:
item
An ecm.model object.

getIdentityAttributes(item)

Returns an array of attributes that are used to generate the identity. For ecm.model objects, this returns an empty array.
Parameters:
item
An ecm.model object.

getLabel(item)

Invokes the model object's getName function to return a user-readable label for the item.
Parameters:
item
An ecm.model object.

getLabelAttributes(item)

Method to inspect the item and return an array of what attributes of the item were used to generate its label, if any. Returns an empty array for this implementation.
Parameters:
item
An ecm.model object.

getValue(item, attribute, defaultValue)

Returns a single attribute value for an item.
Parameters:
item
An ecm.model object.
attribute
The identifier of the attribute.
defaultValue
The value to return if the item does not contain this attribute.

getValues(item, attribute)

Returns the array of values for an attribute. If the attribute does not exist, an empty array is returned.
Parameters:
item
An ecm.model object.
attribute
The identifier of the attribute.

hasAttribute(item, attribute)

Returns true if the item has the specified attribute.
Parameters:
item
An ecm.model object.
attribute
The identifier of the attribute.

isItem(something)

Always returns true, although for a perfect implementation of a dojo.data store this should return true if the provided object is an item from this store instance.
Parameters:
something
Any object or value.

isItemLoaded(something)

Always returns true. For some implementations of dojo.data store this would return true if the provided object has not yet been loaded into local memory. However, for ecm.model objects, they are assumed to be loaded into memory after being fetched.
Parameters:
something
Any object or value.

loadItem(keywordArgs)

Performs nothing. For some implementations of dojo.data store, this would load an item that was not yet loaded into local memory so that a subsequent call to store.isItemLoaded(item) will return true. Since isItemLoaded always returns true for this implementation, no logic is needed here.
Parameters:
keywordArgs

newItem(item)

Adds a new item to the store.
Parameters:
item
The item to add.

onDelete(deletedItem)

This event function is called any time an item is deleted from the store. Since this implementation doesn't support writing, the event is never called. However, since it is part of the dojo.data.Notification interface it is implemented. See dojo.data.api.Notification.onDelete() documentation for more information.
Parameters:
deletedItem

onNew(newItem, parentInfo)

This event function is called any time a new item is created in the store. Since this implementation doesn't support writing, the event is never called. However, since it is part of the dojo.data.Notification interface it is implemented. See dojo.data.api.Notification.onNew() documentation for more information.
Parameters:
newItem
parentInfo

onSet(item, attribute, oldValue, newValue)

This event function is called any time an item is modified via this store. Since this implementation doesn't support writing, the event is never called. However, since it is part of the dojo.data.Notification interface it is implemented. See dojo.data.api.Notification.onSet() documentation for more information.
Parameters:
item
attribute
oldValue
newValue

save(obj)

Calls obj.onComplete.
Parameters:
obj

setValue(item, attribute, value)

Set the attribute value in the item.
Parameters:
item
The item.
attribute
The attribute name.
value
The value to set.