Java Code Examples for org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#isTransmitting()

The following examples show how to use org.apache.nifi.web.api.dto.RemoteProcessGroupDTO#isTransmitting() . 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: StandardRemoteProcessGroupDAO.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies the specified remote group can be updated, if necessary.
 */
private void verifyUpdate(RemoteProcessGroup remoteProcessGroup, RemoteProcessGroupDTO remoteProcessGroupDto) {
    // see if the remote process group can start/stop transmitting
    if (isNotNull(remoteProcessGroupDto.isTransmitting())) {
        if (!remoteProcessGroup.isTransmitting() && remoteProcessGroupDto.isTransmitting()) {
            remoteProcessGroup.verifyCanStartTransmitting();
        } else if (remoteProcessGroup.isTransmitting() && !remoteProcessGroupDto.isTransmitting()) {
            remoteProcessGroup.verifyCanStopTransmitting();
        }
    }

    // validate the proposed configuration
    final List<String> requestValidation = validateProposedRemoteProcessGroupConfiguration(remoteProcessGroupDto);
    // ensure there was no validation errors
    if (!requestValidation.isEmpty()) {
        throw new ValidationException(requestValidation);
    }

    // if any remote group properties are changing, verify update
    if (isAnyNotNull(remoteProcessGroupDto.getYieldDuration(),
            remoteProcessGroupDto.getLocalNetworkInterface(),
            remoteProcessGroupDto.getCommunicationsTimeout(),
            remoteProcessGroupDto.getProxyHost(),
            remoteProcessGroupDto.getProxyPort(),
            remoteProcessGroupDto.getProxyUser(),
            remoteProcessGroupDto.getProxyPassword())) {
        remoteProcessGroup.verifyCanUpdate();
    }
}
 
Example 2
Source File: StandardRemoteProcessGroupDAO.java    From nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies the specified remote group can be updated, if necessary.
 */
@SuppressWarnings("unchecked")
private void verifyUpdate(RemoteProcessGroup remoteProcessGroup, RemoteProcessGroupDTO remoteProcessGroupDto) {
    // see if the remote process group can start/stop transmitting
    if (isNotNull(remoteProcessGroupDto.isTransmitting())) {
        if (!remoteProcessGroup.isTransmitting() && remoteProcessGroupDto.isTransmitting()) {
            remoteProcessGroup.verifyCanStartTransmitting();
        } else if (remoteProcessGroup.isTransmitting() && !remoteProcessGroupDto.isTransmitting()) {
            remoteProcessGroup.verifyCanStopTransmitting();
        }
    }

    // validate the proposed configuration
    final List<String> requestValidation = validateProposedRemoteProcessGroupConfiguration(remoteProcessGroupDto);
    // ensure there was no validation errors
    if (!requestValidation.isEmpty()) {
        throw new ValidationException(requestValidation);
    }

    // if any remote group properties are changing, verify update
    if (isAnyNotNull(remoteProcessGroupDto.getYieldDuration(),
            remoteProcessGroupDto.getLocalNetworkInterface(),
            remoteProcessGroupDto.getCommunicationsTimeout(),
            remoteProcessGroupDto.getProxyHost(),
            remoteProcessGroupDto.getProxyPort(),
            remoteProcessGroupDto.getProxyUser(),
            remoteProcessGroupDto.getProxyPassword())) {
        remoteProcessGroup.verifyCanUpdate();
    }
}
 
Example 3
Source File: StandardRemoteProcessGroupDAO.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroup updateRemoteProcessGroup(RemoteProcessGroup remoteProcessGroup, RemoteProcessGroupDTO remoteProcessGroupDTO) {
    // verify the update request
    verifyUpdate(remoteProcessGroup, remoteProcessGroupDTO);

    // configure the remote process group
    final String name = remoteProcessGroupDTO.getName();
    final String comments = remoteProcessGroupDTO.getComments();
    final String communicationsTimeout = remoteProcessGroupDTO.getCommunicationsTimeout();
    final String yieldDuration = remoteProcessGroupDTO.getYieldDuration();
    final String proxyHost = remoteProcessGroupDTO.getProxyHost();
    final Integer proxyPort = remoteProcessGroupDTO.getProxyPort();
    final String proxyUser = remoteProcessGroupDTO.getProxyUser();
    final String proxyPassword = remoteProcessGroupDTO.getProxyPassword();

    final String transportProtocol = remoteProcessGroupDTO.getTransportProtocol();
    final String localNetworkInterface = remoteProcessGroupDTO.getLocalNetworkInterface();

    if (isNotNull(name)) {
        remoteProcessGroup.setName(name);
    }
    if (isNotNull(comments)) {
        remoteProcessGroup.setComments(comments);
    }
    if (isNotNull(communicationsTimeout)) {
        remoteProcessGroup.setCommunicationsTimeout(communicationsTimeout);
    }
    if (isNotNull(yieldDuration)) {
        remoteProcessGroup.setYieldDuration(yieldDuration);
    }
    if (isNotNull(remoteProcessGroupDTO.getPosition())) {
        remoteProcessGroup.setPosition(new Position(remoteProcessGroupDTO.getPosition().getX(), remoteProcessGroupDTO.getPosition().getY()));
    }
    if (isNotNull(transportProtocol)) {
        remoteProcessGroup.setTransportProtocol(SiteToSiteTransportProtocol.valueOf(transportProtocol.toUpperCase()));
        // No null check because these proxy settings have to be clear if not specified.
        // But when user Enable/Disable transmission, only isTransmitting is sent.
        // To prevent clearing these values in that case, set these only if transportProtocol is sent,
        // assuming UI sends transportProtocol always for update.
        remoteProcessGroup.setProxyHost(proxyHost);
        remoteProcessGroup.setProxyPort(proxyPort);
        remoteProcessGroup.setProxyUser(proxyUser);
        // Keep using current password when null or "********" was sent.
        // Passing other values updates the password,
        // specify empty String to clear password.
        if (isNotNull(proxyPassword) && !DtoFactory.SENSITIVE_VALUE_MASK.equals(proxyPassword)) {
            remoteProcessGroup.setProxyPassword(proxyPassword);
        }
    }
    if (localNetworkInterface != null) {
        if (StringUtils.isBlank(localNetworkInterface)) {
            remoteProcessGroup.setNetworkInterface(null);
        } else {
            remoteProcessGroup.setNetworkInterface(localNetworkInterface);
        }
    }

    final Boolean isTransmitting = remoteProcessGroupDTO.isTransmitting();
    if (isNotNull(isTransmitting)) {
        // start or stop as necessary
        if (!remoteProcessGroup.isTransmitting() && isTransmitting) {
            remoteProcessGroup.startTransmitting();
        } else if (remoteProcessGroup.isTransmitting() && !isTransmitting) {
            remoteProcessGroup.stopTransmitting();
        }
    }

    return remoteProcessGroup;
}
 
Example 4
Source File: StandardRemoteProcessGroupDAO.java    From nifi with Apache License 2.0 4 votes vote down vote up
private RemoteProcessGroup updateRemoteProcessGroup(RemoteProcessGroup remoteProcessGroup, RemoteProcessGroupDTO remoteProcessGroupDTO) {
    // verify the update request
    verifyUpdate(remoteProcessGroup, remoteProcessGroupDTO);

    // configure the remote process group
    final String targetUris = remoteProcessGroupDTO.getTargetUris();
    final String name = remoteProcessGroupDTO.getName();
    final String comments = remoteProcessGroupDTO.getComments();
    final String communicationsTimeout = remoteProcessGroupDTO.getCommunicationsTimeout();
    final String yieldDuration = remoteProcessGroupDTO.getYieldDuration();
    final String proxyHost = remoteProcessGroupDTO.getProxyHost();
    final Integer proxyPort = remoteProcessGroupDTO.getProxyPort();
    final String proxyUser = remoteProcessGroupDTO.getProxyUser();
    final String proxyPassword = remoteProcessGroupDTO.getProxyPassword();

    final String transportProtocol = remoteProcessGroupDTO.getTransportProtocol();
    final String localNetworkInterface = remoteProcessGroupDTO.getLocalNetworkInterface();

    if (isNotNull(targetUris)) {
        remoteProcessGroup.setTargetUris(targetUris);
    }
    if (isNotNull(name)) {
        remoteProcessGroup.setName(name);
    }
    if (isNotNull(comments)) {
        remoteProcessGroup.setComments(comments);
    }
    if (isNotNull(communicationsTimeout)) {
        remoteProcessGroup.setCommunicationsTimeout(communicationsTimeout);
    }
    if (isNotNull(yieldDuration)) {
        remoteProcessGroup.setYieldDuration(yieldDuration);
    }
    if (isNotNull(remoteProcessGroupDTO.getPosition())) {
        remoteProcessGroup.setPosition(new Position(remoteProcessGroupDTO.getPosition().getX(), remoteProcessGroupDTO.getPosition().getY()));
    }
    if (isNotNull(transportProtocol)) {
        remoteProcessGroup.setTransportProtocol(SiteToSiteTransportProtocol.valueOf(transportProtocol.toUpperCase()));
        // No null check because these proxy settings have to be clear if not specified.
        // But when user Enable/Disable transmission, only isTransmitting is sent.
        // To prevent clearing these values in that case, set these only if transportProtocol is sent,
        // assuming UI sends transportProtocol always for update.
        remoteProcessGroup.setProxyHost(proxyHost);
        remoteProcessGroup.setProxyPort(proxyPort);
        remoteProcessGroup.setProxyUser(proxyUser);
        // Keep using current password when null or "********" was sent.
        // Passing other values updates the password,
        // specify empty String to clear password.
        if (isNotNull(proxyPassword) && !DtoFactory.SENSITIVE_VALUE_MASK.equals(proxyPassword)) {
            remoteProcessGroup.setProxyPassword(proxyPassword);
        }
    }
    if (localNetworkInterface != null) {
        if (StringUtils.isBlank(localNetworkInterface)) {
            remoteProcessGroup.setNetworkInterface(null);
        } else {
            remoteProcessGroup.setNetworkInterface(localNetworkInterface);
        }
    }

    final Boolean isTransmitting = remoteProcessGroupDTO.isTransmitting();
    if (isNotNull(isTransmitting)) {
        // start or stop as necessary
        if (!remoteProcessGroup.isTransmitting() && isTransmitting) {
            remoteProcessGroup.startTransmitting();
        } else if (remoteProcessGroup.isTransmitting() && !isTransmitting) {
            remoteProcessGroup.stopTransmitting();
        }
    }

    final ProcessGroup group = remoteProcessGroup.getProcessGroup();
    if (group != null) {
        group.onComponentModified();
    }
    return remoteProcessGroup;
}