Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

  • 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:

Code Block
languagejava
public record CompositionElementDto(UUID compositionId, ToscaConceptIdentifier elementDefinitionId,
     Map<String, Object> inProperties, Map<String, Object> outProperties) {
}
 
public record InstanceElementDto(UUID instanceId, UUID elementId, ToscaServiceTemplate toscaServiceTemplateFragment,
     Map<String, Object> inProperties, Map<String, Object> outProperties) {
}



Code Block
languagejava
/**
 * Migrate a automation composition element.
 *
 * @param compositionElement the old composition element, if new element elementDefinitionId will be null
 * @param compositionElementTarget the composition element target, if removed element elementDefinitionId will be null
 * @param instanceElement the old instance element, if new element elementId will be null
 * @param  instanceElementMigrate the instance element with  removed properties, if new element elementId will be null
 */
@Override void migrate(CompositionElementDto compositionElement, CompositionElementDto compositionElementTarget,
    InstanceElementDto instanceElement, InstanceElementDto instanceElementMigrate) throws PfModelException {
}

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