new CloudObject(manager, tag)
Creates an instance of a Sync.
Parameters:
| Name | Type | Description |
|---|---|---|
manager |
olympe.dc.Manager | undefined | Data cloud manager instance |
tag |
string | Instance tag |
- Implements:
Members
-
<static> containsRel
-
-
<static> extendedByRel
-
-
<static> extendRel
-
-
<static> instancesRel
-
-
<static> modelRel
-
-
<static> nameProp
-
-
<static> propertyRel
-
-
<protected, non-null> db :olympe.dc.DBView
-
Type:
-
<protected> manager :olympe.dc.Manager
-
Type:
-
<non-null> model :olympe.dc.CloudObject
-
Type:
-
<protected> tag :string
-
Type:
- string
Methods
-
<static> asInstance()
-
Return the class as instance of CloudObject
Returns:
-
<static> createInstance(transaction, model [, name], args)
-
Creates an instance for the specified model.
Parameters:
Name Type Argument Description transactionolympe.dc.Transaction The
Transactionthat will perform the creation.modelolympe.dc.InstanceTag The Model for the instance.
namestring | olympe.df.POString <optional>
The name to give that instance.
args* <repeatable>
Extra arguments passed to the factory method if any. If no factory is specified the default behavior is to treat the first args as the name of the created object.
Returns:
The ID of the created instance.
- Type
- string
-
<static> createWith(properties [, model] [, source])
-
Create an instance of this model class non persisted, in the local datacloud, based on the specified property values. Return the newly create cloud object.
Parameters:
Name Type Argument Description propertiesMap.<!olympe.dc.Tag, *> modelolympe.dc.Tag <optional>
sourcestring <optional>
Returns:
-
<static> get(tag)
-
Return the CloudObject of the instance specified by the tag.
Parameters:
Name Type Description tagolympe.dc.Tag Returns:
-
<static> getInstance(instance)
-
Return the Sync instance of the specified
instanceParameters:
Name Type Description instanceolympe.dc.InstanceTag - Deprecated:
-
- use
olympe.dc.CloudObject#getinstead
- use
Returns:
-
<static> getInstancesOf(tagOrConstructor)
-
Return the listdef of all instances of the specified
tagOrConstructorParameters:
Name Type Description tagOrConstructorolympe.dc.InstanceTag Returns:
- Type
- olympe.dc.ListDef
-
<static> getProperties()
-
Return the list of properties defined on this model class.
Returns:
- Type
- Array.<!olympe.dc.registry.Property>
-
<static> getRelations()
-
Return the list of relations associated to that CloudObject model class, in both directions.
Returns:
- Type
- Array.<!olympe.dc.registry.Relation>
-
<static> instancesOf(model)
-
Returns a query of all instances of the specified model.
Parameters:
Name Type Description modelfunction Returns:
- Type
- olympe.dc.Query
-
detachDelete( [transaction])
-
Remove all relations linked to the current sync and then remove the sync itself.
Parameters:
Name Type Argument Description transactionolympe.dc.Transaction <optional>
-
equals(obj)
-
Checks whether 2 Syncs are equal.
Parameters:
Name Type Description obj* The object to compare with.
Returns:
trueif this Sync is the same as theobj- Type
- boolean
-
follow(relation)
-
Return a query with this instance as root and following the specified relation.
Parameters:
Name Type Description relationolympe.dc.registry.Relation Returns:
- Type
- olympe.dc.Query
-
followSingle(relation)
-
Return a query single which start from this instance and follow the specified relation to a unique other cloud object.
Parameters:
Name Type Description relationolympe.dc.registry.Relation Returns:
-
forEachRelated(relation, callback)
-
Register a callback to be called each time a specific relation is added to this object.
Note: If relations are already established at the time of calling, then the callback will be immediately invoked for each existing relation.
Parameters:
Name Type Description relationolympe.dc.registry.Relation The relation to follow
callbackfunction The function to invoke.
-
get(property)
-
Return the current value of the specified property of this object.
Parameters:
Name Type Description propertyolympe.dc.Tag Returns:
- Type
- *
-
getContainer()
-
Gets the container of this instance.
Returns:
The container.
-
getContents()
-
Get the instances set as content by this instance.
Returns:
The set of instances.
-
getDisplayName()
-
Gets the name of this
Sync, defaulting to a string representation of this object.Returns:
The display name of this
Sync.- Type
- olympe.df.POString
-
getFirstRelated(related [, valueType])
-
Gets the first object related to this one by the specified relation.
Parameters:
Name Type Argument Description relatedolympe.dc.registry.Relation The transformer specifying the type of relation.
valueTypefunction <optional>
Type of the values, must be sub-class of
Sync.Returns:
The first object matching the request.
- Type
- olympe.dc.CloudObject | T | olympe.df.Proxy.<T>
-
getModel()
-
Gets the model of this
CloudObject.Returns:
The model of this
CloudObject. -
getModelTag()
-
Gets the tag of the model of this
Sync.Returns:
The tag of the model.
- Type
- string
-
getName()
-
Gets the name of this
CloudObject.Returns:
The name of this
CloudObject.- Type
- olympe.df.POString
-
getProperty(property)
-
Parameters:
Name Type Description propertyolympe.dc.Tag - Deprecated:
-
- use
olympe.dc.CloudObject#getinstead
- use
Returns:
- Type
- *
-
getPropertyAsBoolean(tag)
-
Gets a property value as an
OBoolean.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
Returns:
The value of the property.
- Type
- olympe.df.POBoolean
-
getPropertyAsColor(tag)
-
Gets a property value as a
Color.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
Returns:
The value of the property.
- Type
- olympe.df.PColor
-
getPropertyAsDateTime(tag)
-
Gets a property value as an
ODateTime.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
Returns:
The value of the property.
- Type
- olympe.df.PODateTime
-
getPropertyAsNumber(tag)
-
Gets a property value as an
ONumber.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
Returns:
The value of the property.
- Type
- olympe.df.PONumber
-
getPropertyAsString(tag)
-
Gets a property value as an
OString.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
Returns:
The value of the property.
- Type
- olympe.df.POString
-
getPropertyAsSync(tag)
-
Gets a property value as a
Sync.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of property.
Returns:
The value of the property.
-
getRawProperty(prop, valueCaster, valueType)
-
Gets a property raw value, optionally processing it with the specified callback.
Parameters:
Name Type Description propolympe.dc.InstanceTag Property.
valueCasterolympe.dc.CloudObject.ValueCaster Optional 'casting' function.
valueTypefunction The Type for the property.
Returns:
The created node.
- Type
- olympe.df.Node.<T>
-
getRelated(relation [, valueType])
-
Gets all the objects related to this one by the specified relation.
Parameters:
Name Type Argument Description relationolympe.dc.registry.Relation The relation to follow.
valueTypefunction <optional>
Type of the values, must be sub-class of
Sync.Returns:
A list of objects matching the request.
- Type
- olympe.dc.ListDef.<T>
-
getSource()
-
Gets the source of this
Sync.Returns:
The source.
- Type
- string
-
getTag()
-
Gets the unique tag of this
CloudObject.- Implements:
Returns:
The tag.
- Type
- string
-
getVersion()
-
Gets the version of this
Sync.Returns:
The version.
- Type
- number
-
isPersisted()
-
Returns true if this instance is persisted in the datacloud and false if it is a local instance only.
Returns:
- Type
- boolean
-
name()
-
Return the name of this
CloudObject.Returns:
- Type
- string
-
observe(context, property)
-
Return an observable to the value of the specified property of this object. Stops listening to updates when the specified context is destroyed.
Parameters:
Name Type Description contextolympe.sc.Context | olympe.df.ExecutionContext propertyolympe.dc.Tag Returns:
- Type
- rxjs.Observable.<?*>
-
observeProperty(property)
-
Parameters:
Name Type Description propertyolympe.dc.Tag - Deprecated:
-
- use
olympe.dc.CloudObject#observeinstead
- use
Returns:
- Type
- rxjs.Observable.<?*>
-
oEquals(otherSync)
-
Checks whether this
olympe.dc.CloudObjectis equal to another CloudObject.Parameters:
Name Type Description otherSync* The object to compare with.
Returns:
true if both syncs have the same tag, false otherwise
- Type
- olympe.df.POBoolean
-
query()
-
Returns a query with this instance as root.
Returns:
- Type
- olympe.dc.Query
-
toJSON()
-
-
toListDef()
-
Returns a ListDef whose query has only the current sync as start point.
Returns:
The created
ListDef.- Type
- olympe.dc.ListDef
-
toOString()
-
Convert current object to a string representation. By default, this function simply returns what getDisplayName() returns, but this simplistic behavior should typically overridden by sibling classes.
Returns:
The string representation.
- Type
- olympe.df.POString
-
toString()
-
-
transform(transformers)
-
Creates a
ListDefrepresenting a query which will apply the provided transformers to thisSync.Parameters:
Name Type Argument Description transformersolympe.dc.Transformer | Array.<olympe.dc.Transformer> <repeatable>
The transformers to apply. Note that an error is thrown if an array is passed as first argument, there is more than one arguments.
Returns:
The created
ListDef.- Type
- olympe.dc.ListDef
Type Definitions
-
ValueCaster(value)
-
A
ValueCasteris a function performing the conversion (or 'casting') of a raw value into a typed value.Parameters:
Name Type Description value* Raw value from database.
Returns:
value Casted value.
- Type
- *
Olympe SDK