Java Code Examples for org.apache.nifi.web.api.dto.ControllerServiceDTO#getProperties()
The following examples show how to use
org.apache.nifi.web.api.dto.ControllerServiceDTO#getProperties() .
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 |
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: StandardSnippetDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
private void lookupSensitiveControllerServiceProperties(final Set<ControllerServiceDTO> controllerServices) { // go through each service for (final ControllerServiceDTO serviceDTO : controllerServices) { // ensure that some property configuration have been specified final Map<String, String> serviceProperties = serviceDTO.getProperties(); if (serviceProperties != null) { // find the corresponding controller service final ControllerServiceNode serviceNode = flowController.getControllerServiceNode(serviceDTO.getId()); if (serviceNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Controller Service '%s' could not be found", serviceDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : serviceNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { serviceProperties.put(descriptor.getName(), entry.getValue()); } } } } }
Example 3
Source File: TemplateUtils.java From localization_nifi with Apache License 2.0 | 6 votes |
private static void scrubControllerServices(final Set<ControllerServiceDTO> controllerServices) { for (final ControllerServiceDTO serviceDTO : controllerServices) { final Map<String, String> properties = serviceDTO.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = serviceDTO.getDescriptors(); if (properties != null && descriptors != null) { for (final PropertyDescriptorDTO descriptor : descriptors.values()) { if (Boolean.TRUE.equals(descriptor.isSensitive())) { properties.put(descriptor.getName(), null); } scrubPropertyDescriptor(descriptor); } } serviceDTO.setCustomUiUrl(null); serviceDTO.setValidationErrors(null); } }
Example 4
Source File: StandardControllerServiceDAO.java From nifi with Apache License 2.0 | 6 votes |
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 5
Source File: StandardSnippetDAO.java From nifi with Apache License 2.0 | 6 votes |
private void lookupSensitiveControllerServiceProperties(final Set<ControllerServiceDTO> controllerServices) { // go through each service for (final ControllerServiceDTO serviceDTO : controllerServices) { // ensure that some property configuration have been specified final Map<String, String> serviceProperties = serviceDTO.getProperties(); if (serviceProperties != null) { // find the corresponding controller service final ControllerServiceNode serviceNode = flowController.getFlowManager().getControllerServiceNode(serviceDTO.getId()); if (serviceNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Controller Service '%s' could not be found", serviceDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : serviceNode.getRawPropertyValues().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { serviceProperties.put(descriptor.getName(), entry.getValue()); } } } } }
Example 6
Source File: TemplateUtils.java From nifi with Apache License 2.0 | 6 votes |
private static void scrubControllerServices(final Set<ControllerServiceDTO> controllerServices) { for (final ControllerServiceDTO serviceDTO : controllerServices) { final Map<String, String> properties = serviceDTO.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = serviceDTO.getDescriptors(); if (properties != null && descriptors != null) { for (final PropertyDescriptorDTO descriptor : descriptors.values()) { if (Boolean.TRUE.equals(descriptor.isSensitive())) { properties.put(descriptor.getName(), null); } scrubPropertyDescriptor(descriptor); } } serviceDTO.setControllerServiceApis(null); serviceDTO.setExtensionMissing(null); serviceDTO.setMultipleVersionsAvailable(null); serviceDTO.setCustomUiUrl(null); serviceDTO.setValidationErrors(null); serviceDTO.setValidationStatus(null); } }
Example 7
Source File: ControllerServiceAuditor.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * 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 8
Source File: StandardControllerServiceDAO.java From nifi with Apache License 2.0 | 5 votes |
private List<String> validateProposedConfiguration(final ControllerServiceNode controllerService, final ControllerServiceDTO controllerServiceDTO) { final List<String> validationErrors = new ArrayList<>(); final Map<String, String> properties = controllerServiceDTO.getProperties(); if (isNotNull(properties)) { try { controllerService.verifyCanUpdateProperties(properties); } catch (final IllegalArgumentException | IllegalStateException iae) { validationErrors.add(iae.getMessage()); } } return validationErrors; }
Example 9
Source File: ControllerServiceAuditor.java From nifi with Apache License 2.0 | 5 votes |
/** * 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; }