You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

At the moment, the update of the properties in the cache at migrate time happens as soon as the participant receives the call. The participant may need to be aware of both the old properties and the new while it is carrying out checks and other processes.

    

@Override
public void migrate(UUID instanceId, AcElementDeploy element, UUID compositionTargetId, Map<String, Object> properties) throws PfModelException {

Current implementation

  • properties parameter contains the properties from migration POST
  • element.properties contains the properties from migration POST
  • The properties into elements that could be fetched by getAutomationComposition() method are the merge of old properties and properties from migration

Solution 1

Just using element.properties to hold the old properties.

  • properties contains the properties from migration POST
  • element.properties contains the old properties
  • The elements that could be fetched in cache are the merge of old properties and properties from migration

Solution 2

Hold the old properties in cache, and participant has to send an update methods for the merge with the new properties.

  • properties contains the properties from migration POST
  • element.properties contains the properties from migration POST
  • The properties into elements that could be fetched by getAutomationComposition() method are the old properties
  • participant calls a method to merge migrate properties

Solution 3

Refactor the migrate method.

Create two Document Transfer Object (using record) that contains all data:

public record CompositionDto(UUID compositionId, ToscaConceptIdentifier elementDefinitionId, Map<String, Object> inProperties, Map<String, Object> outProperties)

public record InstanceElementDto(UUID instanceId, UUID elementId, Map<String, Object> inProperties, Map<String, Object> outProperties)


/**
 * Migrate a automation composition element.
 *
 * @param compositionDto the old composition, if new element elementDefinitionId will be null
 * @param instanceElementDto the old instance element, if new element elementId will be null
 * @param compositiontargetDto the composition target, if removed element elementDefinitionId will be null 
 * @param  instanceElementMigrateDto the instance element with  removed properties, if new element elementId will be null
 */
@Override
public void migrate(CompositionDto compositionDto, InstanceElementDto instanceElementDto, CompositionDto compositiontargetDto, InstanceElementDto instanceElementMigrateDto) throws PfModelException {
}

Note:
The solution 3 will help the backward compatibility of the future versions.


  • No labels