Java Code Examples for org.apache.nifi.web.api.dto.ConnectionDTO#getDestination()
The following examples show how to use
org.apache.nifi.web.api.dto.ConnectionDTO#getDestination() .
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: StandardConnectionDAO.java From localization_nifi with Apache License 2.0 | 4 votes |
/** * Validates the proposed processor configuration. */ private List<String> validateProposedConfiguration(final String groupId, final ConnectionDTO connectionDTO) { List<String> validationErrors = new ArrayList<>(); if (isNotNull(connectionDTO.getBackPressureObjectThreshold()) && connectionDTO.getBackPressureObjectThreshold() < 0) { validationErrors.add("Max queue size must be a non-negative integer"); } if (isNotNull(connectionDTO.getFlowFileExpiration())) { Matcher expirationMatcher = FormatUtils.TIME_DURATION_PATTERN.matcher(connectionDTO.getFlowFileExpiration()); if (!expirationMatcher.matches()) { validationErrors.add("Flow file expiration is not a valid time duration (ie 30 sec, 5 min)"); } } if (isNotNull(connectionDTO.getLabelIndex())) { if (connectionDTO.getLabelIndex() < 0) { validationErrors.add("The label index must be positive."); } } // validation is required when connecting to a remote process group since each node in a // cluster may or may not be authorized final ConnectableDTO proposedDestination = connectionDTO.getDestination(); if (proposedDestination != null && ConnectableType.REMOTE_INPUT_PORT.name().equals(proposedDestination.getType())) { // the group id must be specified if (proposedDestination.getGroupId() == null) { validationErrors.add("When the destination is a remote input port its group id is required."); return validationErrors; } // attempt to location the proprosed destination final ProcessGroup destinationParentGroup = locateProcessGroup(flowController, groupId); final RemoteProcessGroup remoteProcessGroup = destinationParentGroup.getRemoteProcessGroup(proposedDestination.getGroupId()); if (remoteProcessGroup == null) { validationErrors.add("Unable to find the specified remote process group."); return validationErrors; } // ensure the new destination was found final RemoteGroupPort remoteInputPort = remoteProcessGroup.getInputPort(proposedDestination.getId()); if (remoteInputPort == null) { validationErrors.add("Unable to find the specified destination."); return validationErrors; } } return validationErrors; }
Example 2
Source File: StandardConnectionDAO.java From nifi with Apache License 2.0 | 4 votes |
/** * Validates the proposed processor configuration. */ private List<String> validateProposedConfiguration(final String groupId, final ConnectionDTO connectionDTO) { List<String> validationErrors = new ArrayList<>(); if (isNotNull(connectionDTO.getBackPressureObjectThreshold()) && connectionDTO.getBackPressureObjectThreshold() < 0) { validationErrors.add("Max queue size must be a non-negative integer"); } if (isNotNull(connectionDTO.getFlowFileExpiration())) { Matcher expirationMatcher = FormatUtils.TIME_DURATION_PATTERN.matcher(connectionDTO.getFlowFileExpiration()); if (!expirationMatcher.matches()) { validationErrors.add("Flow file expiration is not a valid time duration (ie 30 sec, 5 min)"); } } if (isNotNull(connectionDTO.getLabelIndex())) { if (connectionDTO.getLabelIndex() < 0) { validationErrors.add("The label index must be positive."); } } // validation is required when connecting to a remote process group since each node in a // cluster may or may not be authorized final ConnectableDTO proposedDestination = connectionDTO.getDestination(); if (proposedDestination != null && ConnectableType.REMOTE_INPUT_PORT.name().equals(proposedDestination.getType())) { // the group id must be specified if (proposedDestination.getGroupId() == null) { validationErrors.add("When the destination is a remote input port its group id is required."); return validationErrors; } // attempt to location the proprosed destination final ProcessGroup destinationParentGroup = locateProcessGroup(flowController, groupId); final RemoteProcessGroup remoteProcessGroup = destinationParentGroup.getRemoteProcessGroup(proposedDestination.getGroupId()); if (remoteProcessGroup == null) { validationErrors.add("Unable to find the specified remote process group."); return validationErrors; } // ensure the new destination was found final RemoteGroupPort remoteInputPort = remoteProcessGroup.getInputPort(proposedDestination.getId()); if (remoteInputPort == null) { validationErrors.add("Unable to find the specified destination."); return validationErrors; } } return validationErrors; }