Constructor
new Metadata(entity, type)
Parameters:
Name | Type | Description |
---|---|---|
entity |
binding.Entity | |
type |
metamodel.ManagedType |
- Source:
Extends
Members
(static) Type :number
Type:
- number
Properties:
Name | Type | Description |
---|---|---|
UNAVAILABLE |
number | |
PERSISTENT |
number | |
DIRTY |
number |
- Source:
acl :Acl
Type:
- Source:
(readonly) bucket :string
Type:
- string
- Source:
db :EntityManager
Type:
- Source:
db
- Source:
id :string
Type:
- string
- Source:
(readonly) isAttached :boolean
Indicates if this object already belongs to an dbtrue
if this object belongs already to an db otherwise false
Type:
- boolean
- Source:
(readonly) isAvailable :boolean
Indicates if this object is represents a db object, but was not loaded up to now
Type:
- boolean
- Source:
(readonly) isDirty :boolean
Indicates that this object was modified and the object was not written back to the db
Type:
- boolean
- Source:
(readonly) isPersistent :boolean
Indicates if this object represents the state of the db and was not modified in any manner
Type:
- boolean
- Source:
isReady :boolean
Indicates if there is currently no exclusive operation executedtrue
If no exclusive lock is hold
Type:
- boolean
- Inherited From:
- Source:
key
- Source:
(readonly) key :string
Type:
- string
- Source:
type :metamodel.ManagedType
Type:
- Source:
version :number
Type:
- number
- Source:
Methods
(static) create(type, object) → {*}
Creates a metadata instance for the given type and object instance
Parameters:
Name | Type | Description |
---|---|---|
type |
metamodel.ManagedType | The type of the object |
object |
* | The object instance of the type |
- Source:
Returns:
The created metadata for the object
- Type
- *
(static) get(managed) → {util.Metadata}
Returns the metadata of the managed object
Parameters:
Name | Type | Description |
---|---|---|
managed |
binding.Managed |
- Source:
Returns:
- Type
- util.Metadata
enable(newStateTrackingState) → {void}
Enable/Disable state change tracking of this object
Parameters:
Name | Type | Description |
---|---|---|
newStateTrackingState |
boolean | The new change tracking state |
- Source:
Returns:
- Type
- void
getJson(optionsopt) → {json}
Converts the object to an JSON-Object
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | boolean |
<optional> |
false | to json options by default excludes the metadata |
|||||||||||||||||||
Properties
|
- Deprecated:
- Yes
- Source:
Returns:
JSON-Object
- Type
- json
readAccess() → {void}
Signals that the object will be accessed by a read
Ensures that the object was loaded already.
- Source:
Returns:
- Type
- void
ready(doneCallbackopt, failCallbackopt) → {Promise.<this>}
Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doneCallback |
util.Lockable~doneCallback |
<optional> |
The callback which will be invoked when the previously |
failCallback |
util.Lockable~failCallback |
<optional> |
When the lock can't be released caused by a none |
- Inherited From:
- Source:
Returns:
A promise which completes successfully, when the previously requested
operation completes
- Type
- Promise.<this>
setDirty() → {void}
Indicates the the object is modified by the user
- Source:
Returns:
- Type
- void
setJson(json, optionsopt) → {void}
Sets the object content from json
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
json |
json | The updated json content |
||||||||||||||||
options |
Object |
<optional> |
The options used to apply the json |
|||||||||||||||
Properties
|
||||||||||||||||||
{options.updateMetadataOnly |
boolean | false} | Indicates if only the metadata should be updated |
- Deprecated:
- Yes
- Source:
Returns:
- Type
- void
setPersistent() → {void}
Indicates that the associated object is not stale
An object is stale if it correlates the database state and is not modified by the user.
- Source:
Returns:
- Type
- void
setRemoved() → {void}
Indicates the the object is removed
- Source:
Returns:
- Type
- void
setUnavailable() → {void}
Indicates that the associated object isn't available
- Source:
Returns:
- Type
- void
(protected) withLock(callback, criticalopt) → {Promise.<T>}
Try to aquire an exclusive lock and executes the given callback.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
util.Lockable~callback | The exclusive operation to execute |
||
critical |
boolean |
<optional> |
false | Indicates if the operation is critical. If the operation is critical and the |
- Inherited From:
- util.Lockable#withLock<T>
- Source:
Throws:
-
If the lock can't be aquired
- Type
- Error
Returns:
A promise
- Type
- Promise.<T>
writeAccess() → {void}
Signals that the object will be accessed by a write
Ensures that the object was loaded already and marks the object as dirty.
- Source:
Returns:
- Type
- void