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 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)


Code Block
languagejava
/**
 * 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.