Class PropertiesOperations


  • public class PropertiesOperations
    extends Object
    Many resources store properties in form of a sub resource similar to:
     {
         "top-level-attribute" => undefined,
         "property" => {
             "foo" => {"value" => "bar"},
             "baz" => {"value" => "qux"}
         }
     }
     
    where "property" is the properties sub resource (PSR). Each property has its onw resource with the name as key and the "value" string node as value.

    This class mirrors some of the methods from CrudOperations to save these resources together with its properties (if modified):

    1. New properties are added as children of the PSR
    2. Modified properties are modified in the PSRs
    3. Removed properties are removed from the PSR
    • Method Detail

      • saveWithProperties

        public void saveWithProperties​(String type,
                                       String name,
                                       AddressTemplate template,
                                       Map<String,​Object> changedValues,
                                       String psr,
                                       Map<String,​String> properties,
                                       Callback callback)
        Saves the changed values and its properties (if modified) to the specified resource. After the resource has been saved a standard success message is fired and the specified callback is executed.

        This is the properties-extended version of CrudOperations.save(String, String, AddressTemplate, Map, Callback):

        1. New properties are added as children of the PSR
        2. Modified properties are modified in the PSRs
        3. Removed properties are removed from the PSR
        Parameters:
        type - the human readable resource type used in the success message
        name - the resource name
        template - the address template which is resolved against the current statement context and the resource name to get the resource address for the operation
        changedValues - the changed values / payload for the operation
        psr - the name of the properties sub resource (PSR) - most often this is "property"
        properties - the properties to save
        callback - the callback executed after saving the resource
      • saveWithProperties

        public void saveWithProperties​(String type,
                                       String name,
                                       ResourceAddress address,
                                       Map<String,​Object> changedValues,
                                       Metadata metadata,
                                       String psr,
                                       Map<String,​String> properties,
                                       Callback callback)
        Saves the changed values and its properties (if modified) to the specified resource. After the resource has been saved a standard success message is fired and the specified callback is executed.

        This is the properties-extended version of CrudOperations.save(String, String, AddressTemplate, Map, Callback):

        1. New properties are added as children of the PSR
        2. Modified properties are modified in the PSRs
        3. Removed properties are removed from the PSR
        Parameters:
        type - the human readable resource type used in the success message
        name - the resource name
        address - the fq address for the operation
        changedValues - the changed values / payload for the operation
        metadata - the metadata for the of the attributes in the change set
        psr - the name of the properties sub resource (PSR) - most often this is "property"
        properties - the properties to save
        callback - the callback executed after saving the resource
      • saveWithProperties

        public void saveWithProperties​(String type,
                                       String name,
                                       ResourceAddress address,
                                       Composite operations,
                                       String psr,
                                       Map<String,​String> properties,
                                       Callback callback)
        Saves the changed values and its properties (if modified) to the specified resource. After the resource has been saved a standard success message is fired and the specified callback is executed.

        This is the properties-extended version of CrudOperations.save(String, String, Composite, Callback):

        1. New properties are added as children of the PSR
        2. Modified properties are modified in the PSRs
        3. Removed properties are removed from the PSR
        Parameters:
        type - the human readable resource type used in the success message
        name - the resource name
        address - the fq address for the operation
        operations - the composite operation to persist the changed values
        psr - the name of the properties sub resource (PSR) - most often this is "property"
        properties - the properties to save
        callback - the callback executed after saving the resource
      • saveSingletonWithProperties

        public void saveSingletonWithProperties​(String type,
                                                ResourceAddress address,
                                                Map<String,​Object> changedValues,
                                                Metadata metadata,
                                                String psr,
                                                Map<String,​String> properties,
                                                Callback callback)
        Saves the changed values and its properties (if modified) to the specified resource. After the resource has been saved a standard success message is fired and the specified callback is executed.

        This is the properties-extended version of CrudOperations.saveSingleton(String, AddressTemplate, Map, Callback):

        1. New properties are added as children of the PSR
        2. Modified properties are modified in the PSRs
        3. Removed properties are removed from the PSR
        Parameters:
        type - the human readable resource type used in the success message
        address - the fq address for the operation
        changedValues - the changed values / payload for the operation
        metadata - the metadata for the of the attributes in the change set
        psr - the name of the properties sub resource (PSR) - most often this is "property"
        properties - the properties to save
        callback - the callback executed after saving the resource