Java Code Examples for org.apache.nifi.web.api.dto.ControllerServiceDTO#getName()

The following examples show how to use org.apache.nifi.web.api.dto.ControllerServiceDTO#getName() . 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: StandardControllerServiceDAO.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
private void configureControllerService(final ControllerServiceNode controllerService, final ControllerServiceDTO controllerServiceDTO) {
    final String name = controllerServiceDTO.getName();
    final String annotationData = controllerServiceDTO.getAnnotationData();
    final String comments = controllerServiceDTO.getComments();
    final Map<String, String> properties = controllerServiceDTO.getProperties();

    if (isNotNull(name)) {
        controllerService.setName(name);
    }
    if (isNotNull(annotationData)) {
        controllerService.setAnnotationData(annotationData);
    }
    if (isNotNull(comments)) {
        controllerService.setComments(comments);
    }
    if (isNotNull(properties)) {
        controllerService.setProperties(properties);
    }
}
 
Example 2
Source File: StandardControllerServiceDAO.java    From nifi with Apache License 2.0 6 votes vote down vote up
private void configureControllerService(final ControllerServiceNode controllerService, final ControllerServiceDTO controllerServiceDTO) {
    final String name = controllerServiceDTO.getName();
    final String annotationData = controllerServiceDTO.getAnnotationData();
    final String comments = controllerServiceDTO.getComments();
    final Map<String, String> properties = controllerServiceDTO.getProperties();

    controllerService.pauseValidationTrigger(); // avoid causing validation to be triggered multiple times
    try {
        if (isNotNull(name)) {
            controllerService.setName(name);
        }
        if (isNotNull(annotationData)) {
            controllerService.setAnnotationData(annotationData);
        }
        if (isNotNull(comments)) {
            controllerService.setComments(comments);
        }
        if (isNotNull(properties)) {
            controllerService.setProperties(properties);
        }
    } finally {
        controllerService.resumeValidationTrigger();
    }
}
 
Example 3
Source File: ControllerServiceAuditor.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Extracts the values for the configured properties from the specified ControllerService.
 *
 * @param controllerService service
 * @param controllerServiceDTO dto
 * @return properties
 */
private Map<String, String> extractConfiguredPropertyValues(ControllerServiceNode controllerService, ControllerServiceDTO controllerServiceDTO) {
    Map<String, String> values = new HashMap<>();

    if (controllerServiceDTO.getName() != null) {
        values.put(NAME, controllerService.getName());
    }
    if (controllerServiceDTO.getAnnotationData() != null) {
        values.put(ANNOTATION_DATA, controllerService.getAnnotationData());
    }
    if (controllerServiceDTO.getProperties() != null) {
        // for each property specified, extract its configured value
        Map<String, String> properties = controllerServiceDTO.getProperties();
        Map<PropertyDescriptor, String> configuredProperties = controllerService.getProperties();
        for (String propertyName : properties.keySet()) {
            // build a descriptor for getting the configured value
            PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build();
            String configuredPropertyValue = configuredProperties.get(propertyDescriptor);

            // if the configured value couldn't be found, use the default value from the actual descriptor
            if (configuredPropertyValue == null) {
                propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor);
                configuredPropertyValue = propertyDescriptor.getDefaultValue();
            }
            values.put(propertyName, configuredPropertyValue);
        }
    }
    if (controllerServiceDTO.getComments() != null) {
        values.put(COMMENTS, controllerService.getComments());
    }

    return values;
}
 
Example 4
Source File: ControllerServiceAuditor.java    From nifi with Apache License 2.0 5 votes vote down vote up
/**
 * Extracts the values for the configured properties from the specified ControllerService.
 *
 * @param controllerService service
 * @param controllerServiceDTO dto
 * @return properties
 */
private Map<String, String> extractConfiguredPropertyValues(ControllerServiceNode controllerService, ControllerServiceDTO controllerServiceDTO) {
    Map<String, String> values = new HashMap<>();

    if (controllerServiceDTO.getName() != null) {
        values.put(NAME, controllerService.getName());
    }
    if (controllerServiceDTO.getAnnotationData() != null) {
        values.put(ANNOTATION_DATA, controllerService.getAnnotationData());
    }
    if (controllerServiceDTO.getBundle() != null) {
        final BundleCoordinate bundle = controllerService.getBundleCoordinate();
        values.put(EXTENSION_VERSION, formatExtensionVersion(controllerService.getComponentType(), bundle));
    }
    if (controllerServiceDTO.getProperties() != null) {
        // for each property specified, extract its configured value
        final Map<String, String> properties = controllerServiceDTO.getProperties();
        final Map<PropertyDescriptor, String> configuredProperties = controllerService.getRawPropertyValues();

        for (String propertyName : properties.keySet()) {
            // build a descriptor for getting the configured value
            PropertyDescriptor propertyDescriptor = new PropertyDescriptor.Builder().name(propertyName).build();
            String configuredPropertyValue = configuredProperties.get(propertyDescriptor);

            // if the configured value couldn't be found, use the default value from the actual descriptor
            if (configuredPropertyValue == null) {
                propertyDescriptor = locatePropertyDescriptor(configuredProperties.keySet(), propertyDescriptor);
                configuredPropertyValue = propertyDescriptor.getDefaultValue();
            }
            values.put(propertyName, configuredPropertyValue);
        }
    }
    if (controllerServiceDTO.getComments() != null) {
        values.put(COMMENTS, controllerService.getComments());
    }

    return values;
}