StoreObjectMutable interface

A JavaScript object implementing the StoreObjectMutable interface is an object in the Object Store which can be modified, then saved back to the store.

StoreObjectMutable objects also implement the StoreObject interface.

Construction

Use O.object() or mutableCopy() on StoreObject objects.

Interface

acts as StoreObject

All properties and functions in the StoreObject interface are implemented.

function save(labelChanges)

Creates or updates the object in the store.

labelChanges is optional, and if present, is used to add or remove labels from the defaults, or those specified when calling O.object().

function append(value, desc, qual)

Append a value to the object, with the specified desc from the schema ATTR constants. qual can be omitted, or use QUAL["std:qualifier:null"] to specify no qualifier.

The value can be:

Type Notes
Ref Link to another object
StoreObject ref property used for linking to the object
Text Any text object created with O.text()
String Automatically converted into a Text
DateTime Variable precision date and time
Date Automatically converted into a DateTime with Day precision

function appendType(value, qual)

Shortcut for append(value, ATTR["dc:attribute:type"], qual)

function appendTitle(value, qual)

Shortcut for append(value, ATTR["dc:attribute:title"], qual)

function appendParent(value, qual)

Shortcut for append(value, ATTR["std:attribute:parent"], qual)

function remove(desc, qual, iterator)

Remove zero or more values from the object. desc is required, qual can be omitted to specify any qualifier (If QUAL["std:qualifier:null"] is used for qual, it will only remove values without a qualifier).

If an iterator is passed as the last argument, it will be called with (value, desc, qual) arguments. If it returns true, the value will be deleted.

function preallocateRef()

Preallocate the ref for a new object before save() is called.

preallocateRef() will throw an exception if it is called when the ref has already been allocated, either by calling this function or save().

Returns the new ref.