NIFI-13088 Populate missing parameter context ids in MiNiFi flows.json.raw

Signed-off-by: Ferenc Erdei <erdei.ferenc90@gmail.com>
This closes #8692.
This commit is contained in:
Ferenc Kis 2024-04-23 12:57:34 +02:00 committed by Ferenc Erdei
parent 49862d5342
commit 4b5b7ac2bb
No known key found for this signature in database
GPG Key ID: 023D856C60E92F96
1 changed files with 11 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import static java.util.Objects.isNull;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;
import static java.util.UUID.randomUUID;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
import static org.apache.commons.lang3.StringUtils.EMPTY;
@ -95,6 +96,16 @@ public class StandardFlowEnrichService implements FlowEnrichService {
versionedDataflow.setReportingTasks(ofNullable(versionedDataflow.getReportingTasks()).orElseGet(ArrayList::new));
versionedDataflow.setRegistries(ofNullable(versionedDataflow.getRegistries()).orElseGet(ArrayList::new));
versionedDataflow.setControllerServices(ofNullable(versionedDataflow.getControllerServices()).orElseGet(ArrayList::new));
versionedDataflow.setParameterContexts(
ofNullable(versionedDataflow.getParameterContexts()).orElseGet(ArrayList::new)
.stream()
.map(versionedParameterContext -> {
versionedParameterContext.setIdentifier(ofNullable(versionedParameterContext.getIdentifier()).orElseGet(randomUUID()::toString));
versionedParameterContext.setInstanceIdentifier(ofNullable(versionedParameterContext.getInstanceIdentifier()).orElseGet(randomUUID()::toString));
return versionedParameterContext;
})
.collect(toList())
);
Optional<Integer> maxConcurrentThreads = ofNullable(minifiProperties.getProperty(MiNiFiProperties.NIFI_MINIFI_FLOW_MAX_CONCURRENT_THREADS.getKey()))
.map(Integer::parseInt);