Java Code Examples for org.apache.nifi.components.PropertyDescriptor#getAllowableValues()
The following examples show how to use
org.apache.nifi.components.PropertyDescriptor#getAllowableValues() .
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: TestCreateHadoopSequenceFile.java From localization_nifi with Apache License 2.0 | 5 votes |
@Test public void validateAllowableValuesForCompressionType() { PropertyDescriptor pd = CreateHadoopSequenceFile.COMPRESSION_TYPE; List<AllowableValue> allowableValues = pd.getAllowableValues(); assertEquals("NONE", allowableValues.get(0).getValue()); assertEquals("RECORD", allowableValues.get(1).getValue()); assertEquals("BLOCK", allowableValues.get(2).getValue()); }
Example 2
Source File: HtmlDocumentationWriter.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Interrogates a PropertyDescriptor to get a list of AllowableValues, if * there are none, nothing is written to the stream. * * @param xmlStreamWriter the stream writer to use * @param property the property to describe * @throws XMLStreamException thrown if there was a problem writing to the * XML Stream */ protected void writeValidValues(XMLStreamWriter xmlStreamWriter, PropertyDescriptor property) throws XMLStreamException { if (property.getAllowableValues() != null && property.getAllowableValues().size() > 0) { xmlStreamWriter.writeStartElement("ul"); for (AllowableValue value : property.getAllowableValues()) { xmlStreamWriter.writeStartElement("li"); xmlStreamWriter.writeCharacters(value.getDisplayName()); if (value.getDescription() != null) { writeValidValueDescription(xmlStreamWriter, value.getDescription()); } xmlStreamWriter.writeEndElement(); } xmlStreamWriter.writeEndElement(); } else if (property.getControllerServiceDefinition() != null) { Class<? extends ControllerService> controllerServiceClass = property.getControllerServiceDefinition(); writeSimpleElement(xmlStreamWriter, "strong", "Controller Service API: "); xmlStreamWriter.writeEmptyElement("br"); xmlStreamWriter.writeCharacters(controllerServiceClass.getSimpleName()); final List<Class<? extends ControllerService>> implementations = lookupControllerServiceImpls(controllerServiceClass); xmlStreamWriter.writeEmptyElement("br"); if (implementations.size() > 0) { final String title = implementations.size() > 1 ? "Implementations: " : "Implementation:"; writeSimpleElement(xmlStreamWriter, "strong", title); for (int i = 0; i < implementations.size(); i++) { xmlStreamWriter.writeEmptyElement("br"); writeLinkForComponent(xmlStreamWriter, implementations.get(i)); } } else { xmlStreamWriter.writeCharacters("No implementations found."); } } }
Example 3
Source File: TestCreateHadoopSequenceFile.java From nifi with Apache License 2.0 | 5 votes |
@Test public void validateAllowableValuesForCompressionType() { PropertyDescriptor pd = CreateHadoopSequenceFile.COMPRESSION_TYPE; List<AllowableValue> allowableValues = pd.getAllowableValues(); assertEquals("NONE", allowableValues.get(0).getValue()); assertEquals("RECORD", allowableValues.get(1).getValue()); assertEquals("BLOCK", allowableValues.get(2).getValue()); }
Example 4
Source File: HtmlDocumentationWriter.java From nifi with Apache License 2.0 | 5 votes |
/** * Interrogates a PropertyDescriptor to get a list of AllowableValues, if * there are none, nothing is written to the stream. * * @param xmlStreamWriter the stream writer to use * @param property the property to describe * @throws XMLStreamException thrown if there was a problem writing to the * XML Stream */ protected void writeValidValues(XMLStreamWriter xmlStreamWriter, PropertyDescriptor property) throws XMLStreamException { if (property.getAllowableValues() != null && property.getAllowableValues().size() > 0) { xmlStreamWriter.writeStartElement("ul"); for (AllowableValue value : property.getAllowableValues()) { xmlStreamWriter.writeStartElement("li"); xmlStreamWriter.writeCharacters(value.getDisplayName()); if (value.getDescription() != null) { writeValidValueDescription(xmlStreamWriter, value.getDescription()); } xmlStreamWriter.writeEndElement(); } xmlStreamWriter.writeEndElement(); } else if (property.getControllerServiceDefinition() != null) { Class<? extends ControllerService> controllerServiceClass = property.getControllerServiceDefinition(); writeSimpleElement(xmlStreamWriter, "strong", "Controller Service API: "); xmlStreamWriter.writeEmptyElement("br"); xmlStreamWriter.writeCharacters(controllerServiceClass.getSimpleName()); final List<Class<? extends ControllerService>> implementationList = lookupControllerServiceImpls(controllerServiceClass); // Convert it into an array before proceeding Class<? extends ControllerService>[] implementations = implementationList.stream().toArray(Class[]::new); xmlStreamWriter.writeEmptyElement("br"); if (implementations.length > 0) { final String title = implementations.length > 1 ? "Implementations: " : "Implementation: "; writeSimpleElement(xmlStreamWriter, "strong", title); iterateAndLinkComponents(xmlStreamWriter, implementations, null, "<br>", controllerServiceClass.getSimpleName()); } else { xmlStreamWriter.writeCharacters("No implementations found."); } } }