Class: OperationList

olympe.dc.transaction. OperationList

Default implementation of the Patch class, used to accumulate operations in a low-structured way.

On the input side, OperationList, being olympe.dc.Writable, can receive Create, Delete or Update commands and translate these commands into operations.

On the output side, OperationList, as an olympe.dc.transaction.Patch, can have its operations applied to another Writable.


new OperationList( [id])

Creates anOperationList.

Parameters:
Name Type Argument Description
id string <optional>

the patch id

Implements:

Members


<static> OPERATIONS :number

Patch operations

Type:
  • number
Properties:
Name Type Default Description
CREATE_INSTANCE number 1
UPDATE_INSTANCE number 2
DELETE_INSTANCE number 3
CREATE_RELATION number 4
DELETE_RELATION number 5

Methods


applyOperationsTo(writable)

Updates the specified object (writable) with the operation accumulated in this patch.

Parameters:
Name Type Description
writable olympe.dc.Writable

the writable on which apply the operations contained in this patch.

Implements:
Returns:

By convention, the writable given as parameter is returned to ease chaining.

Type
olympe.dc.Writable

concat(otherOperationList)

Concat all the operations of the specified other operation list.

Parameters:
Name Type Description
otherOperationList olympe.dc.transaction.OperationList

createInstance(tag [, properties] [, id])

Creates an instance and returns it's tag

Parameters:
Name Type Argument Description
tag string

New instance tag

properties Map.<string, ?*> <optional>

Instance's properties (map of properties names to values)

id number <optional>

operationId

Implements:

createRelation(relationTag, originTag, destinationTag [, id])

Creates a relation between two instances.

Parameters:
Name Type Argument Description
relationTag string

Tag of the relation

originTag string

Origin instance tag

destinationTag string

Destination instance tag

id number <optional>

operationId

Implements:

deleteInstance(tag [, followRule] [, id])

Deletes the specified instance. If specified, apply the follow rules to make a clean delete.

Parameters:
Name Type Argument Description
tag string
followRule olympe.dc.FollowRules <optional>
id number <optional>

operationId

Implements:

deleteRelation(relationTag, originTag, destinationTag [, id])

Removes a relation between two instances

Parameters:
Name Type Argument Description
relationTag string

Tag of the relation

originTag string

Origin instance tag

destinationTag string

Destination instance tag

id number <optional>

operationId

Implements:

getId()

Return the patch id

Implements:
Returns:
Type
string

getSize()

Return the number of primitive operation this patch is made from

Implements:
Returns:
Type
number

updateInstance(tag [, properties] [, forceUpdate] [, id])

Updates an instance.

  • If the instance does not exist, it will be automatically created
  • Depending on the implementation, updates will be rejected if the provided "new" version is lower than the stored one
Parameters:
Name Type Argument Default Description
tag string

Instance tag

properties Map.<string, ?*> <optional>

Instance properties

forceUpdate boolean <optional>
false

If true, do not do any version check and accepts any update (used by rollbacks)

id number <optional>

operationId

Implements: