Java Code Examples for org.apache.nifi.controller.ProcessorNode#getPropertyDescriptor()
The following examples show how to use
org.apache.nifi.controller.ProcessorNode#getPropertyDescriptor() .
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: ParametersIT.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testSensitivePropertyReferenceParameterSupportsEL() { final ProcessorNode usernamePassword = createProcessorNode(UsernamePasswordProcessor.class); final ParameterReferenceManager referenceManager = new StandardParameterReferenceManager(getFlowController().getFlowManager()); final ParameterContext parameterContext = new StandardParameterContext(UUID.randomUUID().toString(), "param-context", referenceManager, null); parameterContext.setParameters(Collections.singletonMap("pass", new Parameter(new ParameterDescriptor.Builder().name("pass").sensitive(true).build(), "secret"))); getRootGroup().setParameterContext(parameterContext); final Map<String, String> properties = new HashMap<>(); properties.put("password", "#{pass}"); usernamePassword.setProperties(properties); final ProcessContext processContext = new StandardProcessContext(usernamePassword, getFlowController().getControllerServiceProvider(), getFlowController().getEncryptor(), getFlowController().getStateManagerProvider().getStateManager(usernamePassword.getIdentifier()), () -> false); final PropertyDescriptor descriptor = usernamePassword.getPropertyDescriptor("password"); final PropertyValue propertyValue = processContext.getProperty(descriptor); final PropertyValue evaluatedPropertyValue = propertyValue.evaluateAttributeExpressions(); final String evaluatedPassword = evaluatedPropertyValue.getValue(); assertEquals("secret", evaluatedPassword); }
Example 2
Source File: StandardNiFiServiceFacade.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public PropertyDescriptorDTO getProcessorPropertyDescriptor(final String id, final String property) { final ProcessorNode processor = processorDAO.getProcessor(id); PropertyDescriptor descriptor = processor.getPropertyDescriptor(property); // return an invalid descriptor if the processor doesn't support this property if (descriptor == null) { descriptor = new PropertyDescriptor.Builder().name(property).addValidator(Validator.INVALID).dynamic(true).build(); } return dtoFactory.createPropertyDescriptorDto(descriptor, processor.getProcessGroup().getIdentifier()); }