org.rhq.core.domain.util
Class DisambiguationReportRenderer

java.lang.Object
  extended by org.rhq.core.domain.util.DisambiguationReportRenderer

public class DisambiguationReportRenderer
extends Object

This class can be used to produce a "pretty" textual representation of a DisambiguationReport. It supports a simple templating mechanism to configure the representation's format.

In the DisambiguationReport, a resource (either the resource being disambiguated or one of its parents) is represented by an instance of DisambiguationReport.Resource. The template uses this instance and its properties:

The template has the following format:
...text...%([..text...])?<identifier>([...text...])?...text...

It is best explained by an example. The default segment template looks like this:
%type.name[ ]%[(]type.plugin[) ]%name

The %type.name[ ] is rendered as the name of the resource type followed by a space IF the resource type and the name are not null. If either of them is null %type.name[ ] renders as an empty string.

%[(]type.plugin[) ] renders as a bracket followed by the name of the plugin followed by a bracket and a space if both resource type and plugin are not null. If either of them is null, again the whole %... is rendered as an empty string.

The escape character is \.


Nested Class Summary
static class DisambiguationReportRenderer.RenderingOrder
           
 
Field Summary
static String DEFALUT_SEGMENT_SEPARATOR
           
static String DEFAULT_SEGMENT_TEMPLATE
           
 
Constructor Summary
DisambiguationReportRenderer()
           
 
Method Summary
 DisambiguationReportRenderer.RenderingOrder getRenderingOrder()
           
 String getSegmentSeparator()
           
 String getSegmentTemplate()
           
 String getSingletonSegmentTemplate()
           
 boolean isIncludeParents()
           
 boolean isIncludeResource()
           
 String render(DisambiguationReport<?> report)
           
 void setIncludeParents(boolean includeParents)
           
 void setIncludeResource(boolean includeResource)
           
 void setRenderingOrder(DisambiguationReportRenderer.RenderingOrder renderingOrder)
           
 void setSegmentSeparator(String segmentSeparator)
           
 void setSegmentTemplate(String segmentTemplate)
           
 void setSingletonSegmentTemplate(String singletonSegmentTemplate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEGMENT_TEMPLATE

public static final String DEFAULT_SEGMENT_TEMPLATE
See Also:
Constant Field Values

DEFALUT_SEGMENT_SEPARATOR

public static final String DEFALUT_SEGMENT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

DisambiguationReportRenderer

public DisambiguationReportRenderer()
Method Detail

isIncludeResource

public boolean isIncludeResource()
Returns:
the includeResource

setIncludeResource

public void setIncludeResource(boolean includeResource)
Parameters:
includeResource - the includeResource to set

isIncludeParents

public boolean isIncludeParents()
Returns:
the includeParents

setIncludeParents

public void setIncludeParents(boolean includeParents)
Parameters:
includeParents - the includeParents to set

getRenderingOrder

public DisambiguationReportRenderer.RenderingOrder getRenderingOrder()
Returns:
the renderingOrder

setRenderingOrder

public void setRenderingOrder(DisambiguationReportRenderer.RenderingOrder renderingOrder)
Parameters:
renderingOrder - the renderingOrder to set

getSegmentTemplate

public String getSegmentTemplate()
Returns:
the segmentTemplate

setSegmentTemplate

public void setSegmentTemplate(String segmentTemplate)
Parameters:
segmentTemplate - the segmentTemplate to set

getSingletonSegmentTemplate

public String getSingletonSegmentTemplate()
Returns:
the singletonSegmentTemplate

setSingletonSegmentTemplate

public void setSingletonSegmentTemplate(String singletonSegmentTemplate)
Parameters:
singletonSegmentTemplate - the singletonSegmentTemplate to set

getSegmentSeparator

public String getSegmentSeparator()
Returns:
the segmentSeparator

setSegmentSeparator

public void setSegmentSeparator(String segmentSeparator)
Parameters:
segmentSeparator - the segmentSeparator to set

render

public String render(DisambiguationReport<?> report)


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.