-
<constant> AUTO_NUMBER :String
-
Numbers are automatically generated by the server.
Type:
- Inherited From:
- Default Value:
- Source:
-
<constant> AUTO_OVERRIDE_NUMBER :Number
-
Numbers are automatically generated, but can be over-ridden by the user.
Type:
- Inherited From:
- Default Value:
- Source:
-
checkConflicts
-
Check for conflicts on an already used document key when the key changes
and on save.
- Inherited From:
- Source:
-
conversionMap
-
Used when converting from an account to the subclass. No need to include
the document key which is automatically accounted for.
- Inherited From:
- Source:
-
documentKey :String
-
The unique property for the document, typically a number, code or name.
This property will be checked when a user edits it to ensure it has not already
been used by another record of the same type.
Type:
- Inherited From:
- Default Value:
- Source:
-
enforceUpperKey :Boolean
-
Forces the document key to always be uppercase.
Type:
- Inherited From:
- Default Value:
- Source:
-
keyIsString :Boolean
-
Converts auto numbered keys to strings.
Type:
- Inherited From:
- Default Value:
- Source:
-
<constant> MANUAL_NUMBER :String
-
Numbers are manually generated.
Type:
- Inherited From:
- Default Value:
- Source:
-
numberPolicy :String
-
Number generation method for the document key that can be one of three constants:
XM.Document.MANUAL_NUMBER
XM.Document.AUTO_NUMBER
XM.Document.AUTO_OVERRIDE_NUMBER
Can be inferred from the setting that controls this for a given record type
if it is set.
Type:
- Inherited From:
- Default Value:
- Source:
-
numberPolicySetting :String
-
If set, the number Policy property will be set based on the number
generation policy on this setting.
Type:
- Inherited From:
- Source:
-
_fetchHelper()
-
Prepare fetch.
TODO sync() alone should handle all of this stuff. fetch() is not a
Backbone customization point by design.
- Inherited From:
- Source:
-
bindEvents()
-
A function that binds events to functions. It can and should only be called
once by initialize. Any attempt to call it a second time will throw an error.
- Inherited From:
- Source:
-
build()
-
Overload: assume that anything calling this function is doing so because it
is building a model for a relation. In that case set the `isFetching` option
is true which will set it in a `BUSY_FETCHING` state when it is created.
- Inherited From:
- Source:
-
destroy() → {Object|Boolean}
-
Reimplemented to handle state change and parent child relationships. Calling
`destroy` on a parent will cause the model to commit to the server
immediately. Calling destroy on a child relation will simply mark it for
deletion on the next save of the parent.
- Inherited From:
- Source:
Returns:
-
Type
-
Object
|
Boolean
-
fetch(Options) → {Object}
-
Parameters:
Name |
Type |
Description |
Options |
Object
|
|
- Inherited From:
- Source:
Returns:
Request
-
Type
-
Object
-
fetchId() → {Object}
-
Set the id on this record an id from the server. Including the `cascade`
option will call ids to be fetched recursively for `HasMany` relations.
- Inherited From:
- Source:
Returns:
Request
-
Type
-
Object
-
fetchNumber() → {Object}
-
A utility function to sets the next sequential number on a record.
The function will send the class name property of itself to the server
which will cross reference the ORM 'orderSequence' property for the class
to determine which sequence to use.
- Inherited From:
- Source:
Returns:
Receiver
-
Type
-
Object
-
-
Retrieve related objects.
Parameters:
Name |
Type |
Description |
key |
String
|
The relation key to fetch models for. |
options |
Object
|
Options for 'Backbone.Model.fetch' and 'Backbone.sync'. |
update |
Boolean
|
Whether to force a fetch from the server (updating existing models). |
- Inherited From:
- Source:
Returns:
An array of request objects.
-
Type
-
Array
-
findOrCreate()
-
Overload: Need to handle status here
- Inherited From:
- Source:
-
-
Returns the current model prototype class.
- Inherited From:
- Source:
Returns:
-
Type
-
XM.Model
-
getParent(Get) → {XM.Model}
-
Return the parent model if one exists. If the `getRoot` parameter is
passed, it will return the top level parent of the model hierarchy.
Parameters:
Name |
Type |
Description |
Get |
Boolean
|
Root |
- Inherited From:
- Source:
Returns:
-
Type
-
XM.Model
-
initialize()
-
Called when model is instantiated.
- Inherited From:
- Source:
-
isReadOnly(attribute) → {Boolean}
-
Return whether the model is in a read-only state. If an attribute name
is passed, returns whether that attribute is read-only. It is also
capable of checking the read only status of child objects via a search path string.
// Inquire on the whole model
var readOnly = this.isReadOnly();
// Inquire on a single attribute
var readOnly = this.isReadOnly("name");
// Inquire using a search path
var readOnly = this.isReadOnly("contact.firstName");
Parameters:
Name |
Type |
Description |
attribute |
String
|
|
- Inherited From:
- Source:
Returns:
-
Type
-
Boolean
-
obtainLock()
-
Attempt to obtain lock.
- Inherited From:
- Source:
Fires:
-
parse(Response)
-
Recursively checks the object against the schema and converts date strings to
date objects.
Parameters:
Name |
Type |
Description |
Response |
Object
|
|
- Inherited From:
- Source:
-
releaseLock()
-
Release lock.
- Inherited From:
- Source:
Fires:
-
releaseNumber() → {Object}
-
Releases a number back into the number pool for the record type. Usually
would happen when user cancels without saving a new record.
The function will send the class name property of itself to the server
which will cross reference the ORM 'orderSequence' property for the class
to determine which sequence to use.
- Inherited From:
- Source:
Returns:
Receiver
-
Type
-
Object
-
renewLock()
-
Attempt to renew lock.
- Inherited From:
- Source:
Fires:
-
revert()
-
Revert a model back to its original state the last time it was fetched.
- Inherited From:
- Source:
-
revertStatus()
-
Revert the model to the previous status. Useful for reseting status
after a failed validation.
param {Boolean} - cascade
- Inherited From:
- Source:
-
save()
-
This version of `save` first checks to see if the document key already
exists before committing.
- Inherited From:
- Source:
-
set(Key, Value, Options)
-
Overload: Don't allow setting when model is in error or destroyed status, or
updating a `READY_CLEAN` record without update privileges.
Parameters:
Name |
Type |
Description |
Key |
String
|
Object
|
|
Value |
String
|
Object
|
or Options |
Options |
Objecw
|
|
- Inherited From:
- Source:
-
setStatus(Status)
-
Set the status on the model. Triggers `statusChange` event. Option set to
`cascade` will propagate status recursively to all HasMany children.
Parameters:
Name |
Type |
Description |
Status |
Number
|
|
- Inherited From:
- Source:
-
setValue()
-
Set a value(s) on attributes if key(s) is/are in schema, otherwise set on
`meta`. If `meta` is null then behaves the same as `setIfExists`.
Supports path strings.
- Inherited From:
- Source:
-
toJSON()
-
Overload: Delete objects marked as destroyed from arrays and
convert dates to strings.
Add support for 'includeNested' option that will
output JSON with nested toOne objects when specified.
- Inherited From:
- Source:
-
validate(Attributes, Options)
-
Default validation checks `attributes` for:
* Data type integrity.
* Required fields.
Returns `undefined` if the validation succeeded, or some value, usually
an error message, if it fails.
Parameters:
Name |
Type |
Description |
Attributes |
Object
|
|
Options |
Object
|
|
- Inherited From:
- Source: