NIFI-309 better support for See also using class names

This commit is contained in:
danbress 2015-03-05 14:01:24 -05:00
parent 376a9c6acf
commit 6722fc9dbc
5 changed files with 9 additions and 6 deletions

View File

@ -46,7 +46,7 @@ public @interface SeeAlso {
*
* @return
*/
public Class<? extends ConfigurableComponent>[] value();
public Class<? extends ConfigurableComponent>[] value() default {};
/**
* Fully qualified class names you want to link to. Use this when the class
@ -55,5 +55,5 @@ public @interface SeeAlso {
*
* @return
*/
public String[] classNames() default "";
public String[] classNames() default {};
}

View File

@ -144,7 +144,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
private void writeSeeAlso(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter)
throws XMLStreamException {
final SeeAlso seeAlso = configurableComponent.getClass().getAnnotation(SeeAlso.class);
if (seeAlso != null && seeAlso.value().length > 0) {
if (seeAlso != null) {
writeSimpleElement(xmlStreamWriter, "h3", "See Also:");
xmlStreamWriter.writeStartElement("p");
int index = 0;
@ -167,7 +167,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
final String link = "../" + linkedComponent + "/index.html";
final int indexOfLastPeriod = Math.min(0, linkedComponent.lastIndexOf("."));
final int indexOfLastPeriod = Math.max(0, linkedComponent.lastIndexOf("."));
writeLink(xmlStreamWriter, linkedComponent.substring(indexOfLastPeriod), link);

View File

@ -88,9 +88,11 @@ public class HtmlProcessorDocumentationWriter extends HtmlDocumentationWriter {
xmlStreamWriter.writeStartElement("tr");
writeSimpleElement(xmlStreamWriter, "td",
StringUtils.defaultIfBlank(attribute.attribute(), "Not Specified"));
// TODO allow for HTML characters here.
writeSimpleElement(xmlStreamWriter, "td",
StringUtils.defaultIfBlank(attribute.description(), "Not Specified"));
xmlStreamWriter.writeEndElement();
}
xmlStreamWriter.writeEndElement();
@ -123,6 +125,7 @@ public class HtmlProcessorDocumentationWriter extends HtmlDocumentationWriter {
xmlStreamWriter.writeStartElement("tr");
writeSimpleElement(xmlStreamWriter, "td",
StringUtils.defaultIfBlank(attribute.attribute(), "Not Specified"));
// TODO allow for HTML characters here.
writeSimpleElement(xmlStreamWriter, "td",
StringUtils.defaultIfBlank(attribute.description(), "Not Specified"));
xmlStreamWriter.writeEndElement();

View File

@ -42,7 +42,7 @@ import org.apache.nifi.processor.util.StandardValidators;
@CapabilityDescription("This is a processor that is used to test documentation.")
@WritesAttributes({@WritesAttribute(attribute="first", description="this is the first attribute i write"), @WritesAttribute(attribute="second")})
@ReadsAttribute(attribute = "incoming", description="this specifies the format of the thing")
@SeeAlso({FullyDocumentedControllerService.class, FullyDocumentedReportingTask.class})
@SeeAlso(value={FullyDocumentedControllerService.class, FullyDocumentedReportingTask.class}, classNames={"org.apache.nifi.processor.ExampleProcessor"})
public class FullyDocumentedProcessor extends AbstractProcessor {
public static final PropertyDescriptor DIRECTORY = new PropertyDescriptor.Builder().name("Input Directory")

View File

@ -57,7 +57,7 @@ import org.apache.nifi.processor.util.StandardValidators;
+ "\"description\", which is specified in the <FlowFile Description> property. If the FlowFile is not determined to be a duplicate, the Processor "
+ "routes the FlowFile to 'non-duplicate'")
@WritesAttribute(attribute="original.flowfile.description", description="All FlowFiles routed to the duplicate relationship will have an attribute added named original.flowfile.description. The value of this attribute is determined by the attributes of the original copy of the data and by the FlowFile Description property.")
@SeeAlso(value={DistributedMapCacheClient.class}, classNames={"org.apache.nifi.distributed.cache.server.map.DistributedMapCacheServer"})
@SeeAlso(classNames={"org.apache.nifi.distributed.cache.client.DistributedMapCacheClientService", "org.apache.nifi.distributed.cache.server.map.DistributedMapCacheServer"})
public class DetectDuplicate extends AbstractProcessor {
public static final String ORIGINAL_DESCRIPTION_ATTRIBUTE_NAME = "original.flowfile.description";