Search in sources :

Example 1 with DynamicProperty

use of org.apache.nifi.annotation.behavior.DynamicProperty in project nifi by apache.

the class HtmlDocumentationWriter method writeDynamicProperties.

private void writeDynamicProperties(final ConfigurableComponent configurableComponent, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
    final List<DynamicProperty> dynamicProperties = getDynamicProperties(configurableComponent);
    if (dynamicProperties != null && dynamicProperties.size() > 0) {
        writeSimpleElement(xmlStreamWriter, "h3", "Dynamic Properties: ");
        xmlStreamWriter.writeStartElement("p");
        xmlStreamWriter.writeCharacters("Dynamic Properties allow the user to specify both the name and value of a property.");
        xmlStreamWriter.writeStartElement("table");
        xmlStreamWriter.writeAttribute("id", "dynamic-properties");
        xmlStreamWriter.writeStartElement("tr");
        writeSimpleElement(xmlStreamWriter, "th", "Name");
        writeSimpleElement(xmlStreamWriter, "th", "Value");
        writeSimpleElement(xmlStreamWriter, "th", "Description");
        xmlStreamWriter.writeEndElement();
        for (final DynamicProperty dynamicProperty : dynamicProperties) {
            xmlStreamWriter.writeStartElement("tr");
            writeSimpleElement(xmlStreamWriter, "td", dynamicProperty.name(), false, "name");
            writeSimpleElement(xmlStreamWriter, "td", dynamicProperty.value(), false, "value");
            xmlStreamWriter.writeStartElement("td");
            xmlStreamWriter.writeCharacters(dynamicProperty.description());
            if (dynamicProperty.supportsExpressionLanguage()) {
                xmlStreamWriter.writeEmptyElement("br");
                writeSimpleElement(xmlStreamWriter, "strong", "Supports Expression Language: true");
            }
            xmlStreamWriter.writeEndElement();
            xmlStreamWriter.writeEndElement();
        }
        xmlStreamWriter.writeEndElement();
        xmlStreamWriter.writeEndElement();
    }
}
Also used : DynamicProperty(org.apache.nifi.annotation.behavior.DynamicProperty)

Example 2 with DynamicProperty

use of org.apache.nifi.annotation.behavior.DynamicProperty in project nifi by apache.

the class HtmlDocumentationWriter method getDynamicProperties.

private List<DynamicProperty> getDynamicProperties(ConfigurableComponent configurableComponent) {
    final List<DynamicProperty> dynamicProperties = new ArrayList<>();
    final DynamicProperties dynProps = configurableComponent.getClass().getAnnotation(DynamicProperties.class);
    if (dynProps != null) {
        for (final DynamicProperty dynProp : dynProps.value()) {
            dynamicProperties.add(dynProp);
        }
    }
    final DynamicProperty dynProp = configurableComponent.getClass().getAnnotation(DynamicProperty.class);
    if (dynProp != null) {
        dynamicProperties.add(dynProp);
    }
    return dynamicProperties;
}
Also used : DynamicProperty(org.apache.nifi.annotation.behavior.DynamicProperty) ArrayList(java.util.ArrayList) DynamicProperties(org.apache.nifi.annotation.behavior.DynamicProperties)

Aggregations

DynamicProperty (org.apache.nifi.annotation.behavior.DynamicProperty)2 ArrayList (java.util.ArrayList)1 DynamicProperties (org.apache.nifi.annotation.behavior.DynamicProperties)1