Class FunctionUtilities
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.FunctionUtilities
-
public final class FunctionUtilities extends Object
A collection of utility methods relating to functions.- Author:
- Thomas Morgner.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
computeElementLocation(ReportElement e)
static Element[]
findAllElements(Band band, String element)
Try to find all element with the given name in the last active root-band.static Element[]
findAllElements(CrosstabCellBody band, String element)
Try to find all element with the given name in the last active root-band.static Element
findElement(Band band, String element)
Try to find the first element with the given name in the last active root-band.static ReportElement
findElementByAttribute(Section band, String attributeNamespace, String attributeName, String attributeValue)
Try to find the defined element in the last active root-band.static ReportElement
findElementById(ReportDefinition reportDefinition, String id)
static ReportElement
findElementById(Section band, String id)
Try to find the defined element in the last active root-band.static ReportElement
findElementByInstanceId(ReportDefinition reportDefinition, InstanceID id)
static ReportElement
findElementByInstanceId(Section band, InstanceID id)
Try to find the defined element in the last active root-band.static ReportElement
findElementByName(Section band, String name)
static Group
getCurrentDeepTraverseGroup(ReportEvent event)
Returns the current group instance, based on the given report event.static Group
getCurrentGroup(ReportEvent event)
Returns the current group instance, based on the given report event.static boolean
isCrosstabDefined(ReportEvent event)
static boolean
isCrosstabFilterValid(ReportDefinition def, String filterName)
static boolean
isDefinedGroup(String groupName, ReportEvent event)
Returns true if the events current groupname is equal to the group name.static boolean
isDefinedPrepareRunLevel(Function f, ReportEvent event)
Returns true, if the current run level is defined for the given function and this is a prepare run.static boolean
isLayoutLevel(ReportEvent event)
Returns true or false.
-
-
-
Method Detail
-
findElement
public static Element findElement(Band band, String element)
Try to find the first element with the given name in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.element
- the element name.- Returns:
- the found element or null, if no element could be found.
-
findElementById
public static ReportElement findElementById(ReportDefinition reportDefinition, String id)
-
findElementByInstanceId
public static ReportElement findElementByInstanceId(ReportDefinition reportDefinition, InstanceID id)
-
findElementById
public static ReportElement findElementById(Section band, String id)
Try to find the defined element in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.id
- the element's unique id.- Returns:
- the found element or null, if no element could be found.
-
findElementByInstanceId
public static ReportElement findElementByInstanceId(Section band, InstanceID id)
Try to find the defined element in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.id
- the element's unique id.- Returns:
- the found element or null, if no element could be found.
-
findElementByName
public static ReportElement findElementByName(Section band, String name)
-
findElementByAttribute
public static ReportElement findElementByAttribute(Section band, String attributeNamespace, String attributeName, String attributeValue)
Try to find the defined element in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.attributeNamespace
- the namespace of the attribute, never null.attributeName
- the attribute name, never null.attributeValue
- the value, never null.- Returns:
- the found element or null, if no element could be found.
-
findAllElements
public static Element[] findAllElements(Band band, String element)
Try to find all element with the given name in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.element
- the element name.- Returns:
- the found element or null, if no element could be found.
-
findAllElements
public static Element[] findAllElements(CrosstabCellBody band, String element)
Try to find all element with the given name in the last active root-band.- Parameters:
band
- the band that is suspected to contain the element.element
- the element name.- Returns:
- the found element or null, if no element could be found.
-
isDefinedGroup
public static boolean isDefinedGroup(String groupName, ReportEvent event)
Returns true if the events current groupname is equal to the group name.- Parameters:
groupName
- the group name.event
- the report event.- Returns:
- A boolean.
-
isDefinedPrepareRunLevel
public static boolean isDefinedPrepareRunLevel(Function f, ReportEvent event)
Returns true, if the current run level is defined for the given function and this is a prepare run. The prepare run is used to compute the function values.- Parameters:
f
- the function.event
- the event.- Returns:
- A boolean.
-
isLayoutLevel
public static boolean isLayoutLevel(ReportEvent event)
Returns true or false.- Parameters:
event
- the report event.- Returns:
- A boolean.
-
getCurrentGroup
public static Group getCurrentGroup(ReportEvent event)
Returns the current group instance, based on the given report event.- Parameters:
event
- the event which is base for the action.- Returns:
- the current group of the event, never null.
-
getCurrentDeepTraverseGroup
public static Group getCurrentDeepTraverseGroup(ReportEvent event)
Returns the current group instance, based on the given report event.- Parameters:
event
- the event which is base for the action.- Returns:
- the current group of the event, or null if the event is a deep traversing event.
-
isCrosstabFilterValid
public static boolean isCrosstabFilterValid(ReportDefinition def, String filterName)
-
isCrosstabDefined
public static boolean isCrosstabDefined(ReportEvent event)
-
computeElementLocation
public static String computeElementLocation(ReportElement e)
-
-