Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#setAuthorizationIssues()
The following examples show how to use
org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#setAuthorizationIssues() .
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: TemplateUtils.java From localization_nifi with Apache License 2.0 | 6 votes |
/** * Remove unnecessary fields in remote groups prior to saving. * * @param remoteGroups groups */ private static void scrubRemoteProcessGroups(final Set<RemoteProcessGroupDTO> remoteGroups) { // go through each remote process group for (final RemoteProcessGroupDTO remoteProcessGroupDTO : remoteGroups) { remoteProcessGroupDTO.setFlowRefreshed(null); remoteProcessGroupDTO.setInputPortCount(null); remoteProcessGroupDTO.setOutputPortCount(null); remoteProcessGroupDTO.setTransmitting(null); remoteProcessGroupDTO.setProxyPassword(null); remoteProcessGroupDTO.setActiveRemoteInputPortCount(null); remoteProcessGroupDTO.setInactiveRemoteInputPortCount(null); remoteProcessGroupDTO.setActiveRemoteOutputPortCount(null); remoteProcessGroupDTO.setInactiveRemoteOutputPortCount(null); remoteProcessGroupDTO.setAuthorizationIssues(null); remoteProcessGroupDTO.setFlowRefreshed(null); remoteProcessGroupDTO.setName(null); remoteProcessGroupDTO.setTargetSecure(null); remoteProcessGroupDTO.setTransmitting(null); } }
Example 2
Source File: TemplateUtils.java From nifi with Apache License 2.0 | 6 votes |
/** * Remove unnecessary fields in remote groups prior to saving. * * @param remoteGroups groups */ private static void scrubRemoteProcessGroups(final Set<RemoteProcessGroupDTO> remoteGroups) { // go through each remote process group for (final RemoteProcessGroupDTO remoteProcessGroupDTO : remoteGroups) { remoteProcessGroupDTO.setFlowRefreshed(null); remoteProcessGroupDTO.setInputPortCount(null); remoteProcessGroupDTO.setOutputPortCount(null); remoteProcessGroupDTO.setTransmitting(null); remoteProcessGroupDTO.setProxyPassword(null); remoteProcessGroupDTO.setActiveRemoteInputPortCount(null); remoteProcessGroupDTO.setInactiveRemoteInputPortCount(null); remoteProcessGroupDTO.setActiveRemoteOutputPortCount(null); remoteProcessGroupDTO.setInactiveRemoteOutputPortCount(null); remoteProcessGroupDTO.setAuthorizationIssues(null); remoteProcessGroupDTO.setFlowRefreshed(null); remoteProcessGroupDTO.setName(null); remoteProcessGroupDTO.setTargetSecure(null); remoteProcessGroupDTO.setTransmitting(null); } }
Example 3
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 4
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())); }