Home Manual Reference Source
public class | source

CrudOperations

Contains generic CRUD methods to add, read, update and remove (singleton) resources. Some methods just execute the underlying DMR operations, other methods also interact with the user by showing (confirmation) dialogs.

Method Summary

Public Methods
public

add(type: string, name: string, address: AddressTemplate | ResourceAddress | string, payload: ModelNode, callback: function(name: string, address: ResourceAddress))

Executes an add operation using the specified name and payload.

public

addDialog(type: string, address: AddressTemplate | ResourceAddress | string, attributes: string[], callback: function(name: string, address: ResourceAddress))

Opens an add-resource dialog for the given resource type.

public

addSingleton(type: string, address: AddressTemplate | ResourceAddress | string, payload: ModelNode, callback: function(address: ResourceAddress))

Executes an add operation using the specified payload.

public

addSingletonDialog(type: string, address: Object, attributes: string[], callback: function(address: ResourceAddress))

Opens an add-resource dialog for the given singleton resource type.

public

read(address: AddressTemplate | ResourceAddress | string, callback: function(result: ModelNode))

Executes a read-resource operation on the specified address and passes the result to the callback.

public

readChildren(address: AddressTemplate | ResourceAddress | string, childType: string, callback: function(children: Property[]))

Executes a read-children-resources operation on the specified address and passes the result as Property array to the callback.

public

Executes a recursive read-resource operation on the specified address and passes the result to the callback.

public

remove(type: string, name: string, address: AddressTemplate | ResourceAddress | string, callback: function())

Shows a confirmation dialog and removes the resource if confirmed by the user.

public

Shows a confirmation dialog and removes the singleton resource if confirmed by the user.

public

save(type: string, name: string, address: AddressTemplate | ResourceAddress | string, changeSet: {key: string, value: object}, callback: function())

Writes the changed values to the specified resource.

public

saveSingleton(type: string, address: AddressTemplate | ResourceAddress | string, changeSet: {key: string, value: object}, callback: function())

Writes the changed values to the specified singleton resource.

Public Methods

public add(type: string, name: string, address: AddressTemplate | ResourceAddress | string, payload: ModelNode, callback: function(name: string, address: ResourceAddress)) source

Executes an add operation using the specified name and payload. After the resource has been added a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the dialog header and success message.

name string

The resource name which is part of the add operation.

address AddressTemplate | ResourceAddress | string

The address for the add operation. Must end in <resource type>=*.

payload ModelNode

The optional payload of the add operation (may be null or undefined).

callback function(name: string, address: ResourceAddress)

The callback executed after the resource has been added.

public addDialog(type: string, address: AddressTemplate | ResourceAddress | string, attributes: string[], callback: function(name: string, address: ResourceAddress)) source

Opens an add-resource dialog for the given resource type. The dialog contains fields for all required request properties. When clicking "Add", a new resource is added using the specified address. After the resource has been added a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the dialog header and success message.

address AddressTemplate | ResourceAddress | string

The address for the add operation. Must end in <resource type>=*.

attributes string[]

Additional attributes (besides the required attributes) which should be part of the add-resource dialog. May be null or empty.

callback function(name: string, address: ResourceAddress)

The callback executed after the resource has been added.

public addSingleton(type: string, address: AddressTemplate | ResourceAddress | string, payload: ModelNode, callback: function(address: ResourceAddress)) source

Executes an add operation using the specified payload. After the resource has been added a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the dialog header and success message.

address AddressTemplate | ResourceAddress | string

The address for the add operation. Must end in <resource type>=<resource name>.

payload ModelNode

The optional payload of the add operation (may be null or undefined).

callback function(address: ResourceAddress)

The callback executed after the singleton resource has been added.

public addSingletonDialog(type: string, address: Object, attributes: string[], callback: function(address: ResourceAddress)) source

Opens an add-resource dialog for the given singleton resource type. The dialog contains fields for all required request properties. When clicking "Add", a new singleton resource is added using the specified address template. After the singleton resource has been added a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the dialog header and success message.

address Object

The address for the add operation. Must end in <resource type>=<resource name>.

attributes string[]

Additional attributes (besides the required attributes) which should be part of the add-resource dialog. May be null or empty.

callback function(address: ResourceAddress)

The callback executed after the singleton resource has been added.

public read(address: AddressTemplate | ResourceAddress | string, callback: function(result: ModelNode)) source

Executes a read-resource operation on the specified address and passes the result to the callback.

Params:

NameTypeAttributeDescription
address AddressTemplate | ResourceAddress | string

The address for the read-resource operation operation.

callback function(result: ModelNode)

The callback which gets the result of the read-resource operation.

public readChildren(address: AddressTemplate | ResourceAddress | string, childType: string, callback: function(children: Property[])) source

Executes a read-children-resources operation on the specified address and passes the result as Property array to the callback.

Params:

NameTypeAttributeDescription
address AddressTemplate | ResourceAddress | string

The address for the read-children-resources operation.

childType string

The child resource type.

callback function(children: Property[])

The callback which gets the result of the read-children-resources operation.

public readRecursive(address: AddressTemplate | ResourceAddress | string, callback: function(result: ModelNode)) source

Executes a recursive read-resource operation on the specified address and passes the result to the callback.

Params:

NameTypeAttributeDescription
address AddressTemplate | ResourceAddress | string

The address for the read-resource operation operation.

callback function(result: ModelNode)

The callback which gets the result of the read-resource operation.

public remove(type: string, name: string, address: AddressTemplate | ResourceAddress | string, callback: function()) source

Shows a confirmation dialog and removes the resource if confirmed by the user. After the resource has been removed a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the success message.

name string

The resource name.

address AddressTemplate | ResourceAddress | string

The address for the operation.

callback function()

The callback executed after the resource has been removed.

public removeSingleton(type: string, address: AddressTemplate | ResourceAddress | string, callback: function()) source

Shows a confirmation dialog and removes the singleton resource if confirmed by the user. After the resource has been removed a success message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the success message.

address AddressTemplate | ResourceAddress | string

The address for the operation.

callback function()

The callback executed after the resource has been removed.

public save(type: string, name: string, address: AddressTemplate | ResourceAddress | string, changeSet: {key: string, value: object}, callback: function()) source

Writes the changed values to the specified resource. After the resource has been saved a standard success message is displayed and the callback is executed. If the change set is empty, a warning message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the success message.

name string

The resource name.

address AddressTemplate | ResourceAddress | string

The address for the operation.

changeSet {key: string, value: object}

A key-value map containing the changes to the resource.

callback function()

The callback executed after the resource has been saved.

public saveSingleton(type: string, address: AddressTemplate | ResourceAddress | string, changeSet: {key: string, value: object}, callback: function()) source

Writes the changed values to the specified singleton resource. After the resource has been saved a standard success message is displayed and the callback is executed. If the change set is empty, a warning message is displayed and the callback is executed.

Params:

NameTypeAttributeDescription
type string

The human readable resource type used in the success message.

address AddressTemplate | ResourceAddress | string

The address for the operation.

changeSet {key: string, value: object}

A key-value map containing the changes to the resource.

callback function()

The callback executed after the singleton resource has been saved.