Search in sources :

Example 1 with DynamicRelationship

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

the class HtmlProcessorDocumentationWriter method writeDynamicRelationships.

private void writeDynamicRelationships(final Processor processor, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
    List<DynamicRelationship> dynamicRelationships = getDynamicRelationships(processor);
    if (dynamicRelationships.size() > 0) {
        writeSimpleElement(xmlStreamWriter, "h3", "Dynamic Relationships: ");
        xmlStreamWriter.writeStartElement("p");
        xmlStreamWriter.writeCharacters("A Dynamic Relationship may be created based on how the user configures the Processor.");
        xmlStreamWriter.writeStartElement("table");
        xmlStreamWriter.writeAttribute("id", "dynamic-relationships");
        xmlStreamWriter.writeStartElement("tr");
        writeSimpleElement(xmlStreamWriter, "th", "Name");
        writeSimpleElement(xmlStreamWriter, "th", "Description");
        xmlStreamWriter.writeEndElement();
        for (DynamicRelationship dynamicRelationship : dynamicRelationships) {
            xmlStreamWriter.writeStartElement("tr");
            writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.name());
            writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.description());
            xmlStreamWriter.writeEndElement();
        }
        xmlStreamWriter.writeEndElement();
        xmlStreamWriter.writeEndElement();
    }
}
Also used : DynamicRelationship(org.apache.nifi.annotation.behavior.DynamicRelationship)

Example 2 with DynamicRelationship

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

the class HtmlProcessorDocumentationWriter method getDynamicRelationships.

private List<DynamicRelationship> getDynamicRelationships(Processor processor) {
    List<DynamicRelationship> results = new ArrayList<>();
    DynamicRelationship dynamicRelationships = processor.getClass().getAnnotation(DynamicRelationship.class);
    if (dynamicRelationships != null) {
        results.add(dynamicRelationships);
    }
    return results;
}
Also used : DynamicRelationship(org.apache.nifi.annotation.behavior.DynamicRelationship) ArrayList(java.util.ArrayList)

Aggregations

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