Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupContentsDTO#getOutputPorts()
The following examples show how to use
org.apache.nifi.web.api.dto.RemoteProcessGroupContentsDTO#getOutputPorts() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteProcessGroupEntityMerger.java From localization_nifi with Apache License 2.0 | 4 votes |
private static void mergeDtos(final RemoteProcessGroupDTO clientDto, final Map<NodeIdentifier, RemoteProcessGroupDTO> dtoMap) { // if unauthorized for the client dto, simple return if (clientDto == null) { return; } final RemoteProcessGroupContentsDTO remoteProcessGroupContents = clientDto.getContents(); final Map<String, Set<NodeIdentifier>> authorizationErrorMap = new HashMap<>(); final Map<String, Set<NodeIdentifier>> validationErrorMap = new HashMap<>(); Boolean mergedIsTargetSecure = null; final Set<RemoteProcessGroupPortDTO> mergedInputPorts = new HashSet<>(); final Set<RemoteProcessGroupPortDTO> mergedOutputPorts = new HashSet<>(); for (final Map.Entry<NodeIdentifier, RemoteProcessGroupDTO> nodeEntry : dtoMap.entrySet()) { final RemoteProcessGroupDTO nodeRemoteProcessGroup = nodeEntry.getValue(); // consider the node remote process group when authorized if (nodeRemoteProcessGroup != null) { final NodeIdentifier nodeId = nodeEntry.getKey(); // merge the authorization errors ErrorMerger.mergeErrors(authorizationErrorMap, nodeId, nodeRemoteProcessGroup.getAuthorizationIssues()); ErrorMerger.mergeErrors(validationErrorMap, nodeId, nodeRemoteProcessGroup.getValidationErrors()); // use the first target secure flag since they will all be the same final Boolean nodeIsTargetSecure = nodeRemoteProcessGroup.isTargetSecure(); if (mergedIsTargetSecure == null) { mergedIsTargetSecure = nodeIsTargetSecure; } // merge the ports in the contents final RemoteProcessGroupContentsDTO nodeRemoteProcessGroupContentsDto = nodeRemoteProcessGroup.getContents(); if (remoteProcessGroupContents != null && nodeRemoteProcessGroupContentsDto != null) { if (nodeRemoteProcessGroupContentsDto.getInputPorts() != null) { mergedInputPorts.addAll(nodeRemoteProcessGroupContentsDto.getInputPorts()); } if (nodeRemoteProcessGroupContentsDto.getOutputPorts() != null) { mergedOutputPorts.addAll(nodeRemoteProcessGroupContentsDto.getOutputPorts()); } } } } if (remoteProcessGroupContents != null) { if (!mergedInputPorts.isEmpty()) { remoteProcessGroupContents.setInputPorts(mergedInputPorts); } if (!mergedOutputPorts.isEmpty()) { remoteProcessGroupContents.setOutputPorts(mergedOutputPorts); } } if (mergedIsTargetSecure != null) { clientDto.setTargetSecure(mergedIsTargetSecure); } // set the merged the validation errors clientDto.setAuthorizationIssues(ErrorMerger.normalizedMergedErrors(authorizationErrorMap, dtoMap.size())); clientDto.setValidationErrors(ErrorMerger.normalizedMergedErrors(validationErrorMap, dtoMap.size())); }
Example 2
Source File: RemoteProcessGroupSchemaFunction.java From nifi-minifi with Apache License 2.0 | 4 votes |
@Override public RemoteProcessGroupSchema apply(RemoteProcessGroupDTO remoteProcessGroupDTO) { Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.ID_KEY, remoteProcessGroupDTO.getId()); map.put(CommonPropertyKeys.NAME_KEY, remoteProcessGroupDTO.getName()); // Prefer the targetUris if populated, otherwise, default to using the singular targetUri final String targetUris = remoteProcessGroupDTO.getTargetUris(); map.put(RemoteProcessGroupSchema.URL_KEY, StringUtils.isNotBlank(targetUris) ? targetUris : remoteProcessGroupDTO.getTargetUri()); RemoteProcessGroupContentsDTO contents = remoteProcessGroupDTO.getContents(); if (contents != null) { Set<RemoteProcessGroupPortDTO> inputPorts = contents.getInputPorts(); if (inputPorts != null) { map.put(CommonPropertyKeys.INPUT_PORTS_KEY, inputPorts.stream() .map(remotePortSchemaFunction) .map(RemotePortSchema::toMap) .collect(Collectors.toList())); } Set<RemoteProcessGroupPortDTO> outputPorts = contents.getOutputPorts(); if (outputPorts != null) { map.put(CommonPropertyKeys.OUTPUT_PORTS_KEY, outputPorts.stream() .map(remotePortSchemaFunction) .map(RemotePortSchema::toMap) .collect(Collectors.toList())); } } map.put(CommonPropertyKeys.COMMENT_KEY, remoteProcessGroupDTO.getComments()); map.put(RemoteProcessGroupSchema.TIMEOUT_KEY, remoteProcessGroupDTO.getCommunicationsTimeout()); map.put(CommonPropertyKeys.YIELD_PERIOD_KEY, remoteProcessGroupDTO.getYieldDuration()); map.put(RemoteProcessGroupSchema.TRANSPORT_PROTOCOL_KEY, remoteProcessGroupDTO.getTransportProtocol()); map.put(RemoteProcessGroupSchema.PROXY_HOST_KEY, remoteProcessGroupDTO.getProxyHost()); map.put(RemoteProcessGroupSchema.PROXY_PORT_KEY, remoteProcessGroupDTO.getProxyPort()); map.put(RemoteProcessGroupSchema.PROXY_USER_KEY, remoteProcessGroupDTO.getProxyUser()); map.put(RemoteProcessGroupSchema.PROXY_PASSWORD_KEY, remoteProcessGroupDTO.getProxyPassword()); map.put(RemoteProcessGroupSchema.LOCAL_NETWORK_INTERFACE_KEY, remoteProcessGroupDTO.getLocalNetworkInterface()); return new RemoteProcessGroupSchema(map); }
Example 3
Source File: RemoteProcessGroupEntityMerger.java From nifi with Apache License 2.0 | 4 votes |
private static void mergeDtos(final RemoteProcessGroupDTO clientDto, final Map<NodeIdentifier, RemoteProcessGroupDTO> dtoMap) { // if unauthorized for the client dto, simple return if (clientDto == null) { return; } final RemoteProcessGroupContentsDTO remoteProcessGroupContents = clientDto.getContents(); final Map<String, Set<NodeIdentifier>> authorizationErrorMap = new HashMap<>(); final Map<String, Set<NodeIdentifier>> validationErrorMap = new HashMap<>(); Boolean mergedIsTargetSecure = null; Set<RemoteProcessGroupPortDTO> mergedInputPorts = null; Set<RemoteProcessGroupPortDTO> mergedOutputPorts = null; for (final Map.Entry<NodeIdentifier, RemoteProcessGroupDTO> nodeEntry : dtoMap.entrySet()) { final RemoteProcessGroupDTO nodeRemoteProcessGroup = nodeEntry.getValue(); // consider the node remote process group when authorized if (nodeRemoteProcessGroup != null) { final NodeIdentifier nodeId = nodeEntry.getKey(); // merge the authorization errors ErrorMerger.mergeErrors(authorizationErrorMap, nodeId, nodeRemoteProcessGroup.getAuthorizationIssues()); ErrorMerger.mergeErrors(validationErrorMap, nodeId, nodeRemoteProcessGroup.getValidationErrors()); // use the first target secure flag since they will all be the same final Boolean nodeIsTargetSecure = nodeRemoteProcessGroup.isTargetSecure(); if (mergedIsTargetSecure == null) { mergedIsTargetSecure = nodeIsTargetSecure; } // merge the ports in the contents final RemoteProcessGroupContentsDTO nodeRemoteProcessGroupContentsDto = nodeRemoteProcessGroup.getContents(); if (remoteProcessGroupContents != null && nodeRemoteProcessGroupContentsDto != null) { final Set<RemoteProcessGroupPortDTO> nodeInputPorts = nodeRemoteProcessGroupContentsDto.getInputPorts(); if (nodeInputPorts != null) { if (mergedInputPorts == null) { mergedInputPorts = new HashSet<>(nodeInputPorts); } else { mergedInputPorts.retainAll(nodeInputPorts); } } final Set<RemoteProcessGroupPortDTO> nodeOutputPorts = nodeRemoteProcessGroupContentsDto.getOutputPorts(); if (nodeOutputPorts != null) { if (mergedOutputPorts == null) { mergedOutputPorts = new HashSet<>(nodeOutputPorts); } else { mergedOutputPorts.retainAll(nodeOutputPorts); } } } } } if (remoteProcessGroupContents != null) { if (mergedInputPorts == null) { remoteProcessGroupContents.setInputPorts(Collections.emptySet()); clientDto.setInputPortCount(0); } else { remoteProcessGroupContents.setInputPorts(mergedInputPorts); clientDto.setInputPortCount(mergedInputPorts.size()); } if (mergedOutputPorts == null) { remoteProcessGroupContents.setOutputPorts(Collections.emptySet()); clientDto.setOutputPortCount(0); } else { remoteProcessGroupContents.setOutputPorts(mergedOutputPorts); clientDto.setOutputPortCount(mergedOutputPorts.size()); } } if (mergedIsTargetSecure != null) { clientDto.setTargetSecure(mergedIsTargetSecure); } // set the merged the validation errors clientDto.setAuthorizationIssues(ErrorMerger.normalizedMergedErrors(authorizationErrorMap, dtoMap.size())); clientDto.setValidationErrors(ErrorMerger.normalizedMergedErrors(validationErrorMap, dtoMap.size())); }