...
Code Block |
---|
|
var automationComposition = participantIntermediaryApi.getAutomationComposition(instanceId);
var compositionId = automationComposition.getCompositionId();
var acElementDefinitionsFrom = participantIntermediaryApi.getAcElementsDefinitions(compositionId);
var acElementDefinitionFrom = acElementsDefinitionsFrom.values().stream()
.filter(el -> el.getAcElementDefinitionId().getName().equals(element.getDefinition().getName())).findFirst().get();
var outPropertiesFrom = acElementDefinitionFrom.getOutProperties();
var acElementDefinitionTo = participantIntermediaryApi.getAcElementDefinition(compositionTargetId, element.getDefinition());
var outPropertiesTo = acElementDefinitionTo.getOutProperties(); |
- Refactor the migrate method.
Create two Document Transfer Object (using record) that contains all data:
Code Block |
---|
|
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 |
---|
|
/**
* 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 {
} |