fix newly introduced bug where nifi doesnt connect feeds to reusable templates
@@ -102,7 +102,7 @@ public class NiFiObjectCache {
public ProcessGroupDTO getReusableTemplateCategoryProcessGroup() {
if (reusableTemplateCategory == null) {
if(reusableTemplateProcessGroupId != null) {
- reusableTemplateCategory = restClient.getNiFiRestClient().processGroups().findById("root", false, false).orElse(null);
+ reusableTemplateCategory = restClient.getNiFiRestClient().processGroups().findById(reusableTemplateProcessGroupId, false, false).orElse(null);
}
if(reusableTemplateCategory == null) {
reusableTemplateCategory = restClient.getProcessGroupByName("root", reusableTemplateCategoryName);
@@ -146,7 +146,8 @@ public class NiFiObjectCache {
ProcessGroupDTO reusableTemplateCategoryGroupId = getReusableTemplateCategoryProcessGroup();
Set<PortDTO> inputPortsEntity = restClient.getNiFiRestClient().processGroups().getInputPorts(reusableTemplateCategoryGroupId.getId());
if (inputPortsEntity != null) {
- inputPortsEntity.stream().forEach(inputPort -> reusableTemplateCategoryInputPortsByName.putIfAbsent(inputPort.getName(), inputPort));
+ inputPortsEntity.stream().forEach(inputPort -> reusableTemplateCategoryInputPortsByName.put(inputPort.getName(),inputPort)
+ );
PortDTO inputPort = NifiConnectionUtil.findPortMatchingName(inputPortsEntity, inputPortName);
return inputPort;
}
@@ -169,7 +170,7 @@ public class NiFiObjectCache {
if (outputPort == null) {
Set<PortDTO> outputPorts = restClient.getNiFiRestClient().processGroups().getOutputPorts(categoryProcessGroupId);
if (outputPorts != null) {
- outputPorts.stream().forEach(port -> categoryProcessGroupIdToOutputPortByName.get(categoryProcessGroupId).putIfAbsent(port.getName(), port));
+ outputPorts.stream().forEach(port -> categoryProcessGroupIdToOutputPortByName.get(categoryProcessGroupId).put(port.getName(), port));
outputPort =
NifiConnectionUtil.findPortMatchingName(outputPorts, outputPortName);
}
@@ -178,7 +179,10 @@ public class NiFiObjectCache {
}
public void addCategoryOutputPort(String categoryProcessGroupId, PortDTO portDTO) {
- categoryProcessGroupIdToOutputPortByName.putIfAbsent(categoryProcessGroupId, new ConcurrentHashMap<>()).put(portDTO.getName(), portDTO);
+ if(!categoryProcessGroupIdToOutputPortByName.containsKey(categoryProcessGroupId)) {
+ categoryProcessGroupIdToOutputPortByName.put(categoryProcessGroupId, new ConcurrentHashMap<>());
+ }
+ categoryProcessGroupIdToOutputPortByName.get(categoryProcessGroupId).put(portDTO.getName(), portDTO);
}
public Set<ConnectionDTO> getConnections(String processGroupId){
