Class DataSetHandle
- All Implemented Interfaces:
org.eclipse.birt.report.model.elements.interfaces.IDataSetModel
,org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
,org.eclipse.birt.report.model.elements.interfaces.ISimpleDataSetModel
- Direct Known Subclasses:
DerivedDataSetHandle
,JointDataSetHandle
,OdaDataSetHandle
,ScriptDataSetHandle
A data set has three key parts:
- Data access: Retrieving data from an external data source.
- Report-specific properties: Properties for how the data is to be used in the report such as rules for searching, data export and so on.
- Data transforms: Rules for processing the data for use by the report. Data transforms are most frequently defined by report items that use the data set, and are applied to the result set by BIRT.
Data transforms that can be defined on a data set include:
- Column projections: identifying additional required columns, assigning column aliases, and providing column meta-data.
- Filters.
- Computed columns. Sorting, grouping, aggregations and similar transforms are defined by the report elements that use the data set.
The application can use scripts to execute code on certain data set events.
To get a handle for the data source, uses the following example:
DataSetHandle dataHandle = designHandle findDataSet( "My First Data Set " );
This class works with the static design definition of the data set. Many clients will prefer to work with the TBD class that provides both the static definition and additional design information retrieved from the data provider. For example, a particular data set may not define a result set in the design file if the data provider can provide the result set definition itself. This handle will return null for the result set handle. However, the TBD class will provide the full result set: either by returning the one in the design file, or by obtaining it from the data provider.
- See Also:
-
SimpleDataSet
-
Field Summary
Fields inherited from class org.eclipse.birt.report.model.api.ReportElementHandle
element
Fields inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
module
Fields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IDataSetModel
ACL_EXPRESSION_PROP, CACHED_METADATA_PROP, COLUMN_HINTS_PROP, COMPUTED_COLUMNS_PROP, FILTER_PROP, IS_VISIBLE_PROP, LOCALE_PROP, NEEDS_CACHE_PROP, NULLS_ORDERING_PROP, PARAMETERS_PROP, RESULT_SET_HINTS_PROP, RESULT_SET_PROP, ROW_ACL_EXPRESSION_PROP, ROW_FETCH_LIMIT_PROP, SORT_HINTS_PROP
Fields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
COMMENTS_PROP, CUSTOM_XML_PROP, DISPLAY_NAME_ID_PROP, DISPLAY_NAME_PROP, EVENT_HANDLER_CLASS_PROP, EXTENDS_PROP, FULL_LABEL, ID_SUFFIX, NAME_PROP, NEW_HANDLER_ON_EACH_EVENT_PROP, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROP
Fields inherited from interface org.eclipse.birt.report.model.elements.interfaces.ISimpleDataSetModel
AFTER_CLOSE_METHOD, AFTER_OPEN_METHOD, BEFORE_CLOSE_METHOD, BEFORE_OPEN_METHOD, CACHED_ROW_COUNT_PROP, DATA_SET_ROW_LIMIT, DATA_SOURCE_PROP, ON_FETCH_METHOD, PARAM_BINDINGS_PROP
-
Constructor Summary
ConstructorsConstructorDescriptionDataSetHandle
(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element) Constructs a data set handle with the given design and element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the filter condition.Returns an iterator over column hints.Returns an iterator for the list of computed columns.Returns an iterator over filter.Gets the expression handle for theACLExpression
property.Returns the code of the afterClose method.Returns the code of the afterOpen method.Returns the code of the beforeClose method.Returns the code of the beforeOpen method.Return a handle to deal with the cached data set information that include output column information when it gets from databases, input/output parameter definitions.int
Deprecated.by getDataSetRowLimit methodint
Deprecated.duplicate with method getRowFetchLimit()Returns a handle to the data source for this data set.Returns the name of the data source for this data set.com.ibm.icu.util.ULocale
Gets the locale of this data set element.Gets the ordering of null values.Returns the code of the onFetch method.getPropertyHandle
(String propName) Returns a property handle for a top-level property.Gets the expression handle for the ACL expression for one row.int
Returns the max number of rows from data set property value.boolean
Gets the isVisible property value.boolean
Determines whether to do some cache when rendering the report.Returns an iterator over the list of parameter bindings.Returns an iterator over the list of output parameter definitions.void
Removes the filter condition.Returns an iterator over hints of the result set columns.Returns an iterator over the result set columns.void
setAfterClose
(String code) Sets the code for the afterClose method.void
setAfterOpen
(String code) Sets the code for the afterOpen method.void
setBeforeClose
(String code) Sets the code for the beforeClose method.void
setBeforeOpen
(String code) Sets the code for the beforeOpen method.setCachedMetaData
(CachedMetaData metadata) Set the value for the cached data set information.void
setCachedRowCount
(int count) Deprecated.by setDataSetRowLimit methodvoid
setDataSetRowLimit
(int count) Deprecated.duplicate with method setRowFetchLimit()void
setDataSource
(String name) Sets the name of the data source for this data set.void
setIsVisible
(boolean isVisible) Sets the isVisible property value.void
setLocale
(com.ibm.icu.util.ULocale locale) Sets the locale for this data set element.void
setNeedsCache
(boolean needsCache) Sets whether to do some cache when rendering the report.void
setNullsOrdering
(String nullsOrdering) Sets the ordering of null values.void
setOnFetch
(String code) Sets the code for the onFetch method.void
setRowFetchLimit
(int count) Sets the max number of rows from data set property value.Returns an iterator over sort hints.Methods inherited from class org.eclipse.birt.report.model.api.ReportElementHandle
getComments, getCustomXml, getDisplayName, getDisplayNameKey, getElement, getPropertyMask, isValidLayoutForCompoundElement, isValidReferenceForCompoundElement, propertyMaskIterator, setComments, setCustomXml, setDisplayName, setDisplayNameKey, setPropertyMask
Methods inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
add, add, addElement, addElement, addListener, addUserPropertyDefn, cachePropertyHandles, canContain, canContain, canContain, canContain, canDrop, canEdit, canTransformToTemplate, clearAllProperties, clearContents, clearProperty, clientsIterator, copy, copyPropertyTo, createTemplateElement, derivedIterator, doSort, drop, drop, drop, dropAndClear, dropAndClear, dropAndClear, dropUserPropertyDefn, findContentSlot, getBooleanProperty, getChoices, getColorProperty, getContainer, getContainerPropertyHandle, getContainerSlotHandle, getContent, getContentCount, getContents, getDefn, getDesign, getDesignHandle, getDimensionProperty, getDisplayLabel, getDisplayLabel, getDisplayProperty, getEffectiveModule, getElementFactory, getElementProperty, getEventHandlerClass, getExpressionProperty, getExtends, getExternalizedValue, getExternalizedValue, getExternalizedValue, getFactoryElementHandle, getFactoryPropertyHandle, getFloatProperty, getFontProperty, getFullName, getHostViewHandle, getID, getIndex, getIntProperty, getListProperty, getListProperty, getMethods, getModule, getModuleHandle, getName, getNumberProperty, getPrivateStyle, getProperty, getPropertyBinding, getPropertyBindingExpression, getPropertyBindings, getPropertyDefn, getPropertyIterator, getQualifiedName, getRoot, getSemanticErrors, getSlot, getStringProperty, getStyle, getUserProperties, getUserPropertyDefnHandle, getXPath, hasLocalProperties, hasSemanticError, initializeSlotHandles, isDirectionRTL, isInTemplateParameter, isTemplateParameterValue, isValid, localize, move, move, moveTo, moveTo, moveTo, moveTo, newHandlerOnEachEvent, paste, paste, paste, paste, removeListener, revertToReportItem, revertToTemplate, semanticCheck, setBooleanProperty, setEncryption, setEventHandlerClass, setExpressionProperty, setExtends, setExtendsElement, setExtendsName, setFloatProperty, setIntProperty, setName, setNewHandlerOnEachEvent, setNumberProperty, setProperties, setProperty, setPropertyBinding, setPropertyBinding, setStringProperty, setStyle, setStyleElement, setStyleName, setValid, shift, showError, slotsIterator
-
Constructor Details
-
DataSetHandle
public DataSetHandle(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element) Constructs a data set handle with the given design and element. The application generally does not create handles directly. Instead, it uses one of the navigation methods available on other element handles.- Parameters:
module
- the moduleelement
- the model representation of the element
-
-
Method Details
-
getDataSource
Returns a handle to the data source for this data set.- Returns:
- handle to the data source, or
null
if the data source is not set or is undefined.
-
getDataSourceName
Returns the name of the data source for this data set.- Returns:
- the data source name as a string
- See Also:
-
setDataSource
Sets the name of the data source for this data set. This method checks whether the data source name exists in the report design.- Parameters:
name
- the data source name- Throws:
SemanticException
- if the data source does not exist in the report design, or the property if locked.- See Also:
-
parametersIterator
Returns an iterator over the list of output parameter definitions. The iterator returns instances ofDataSetParameterHandle
that represents parameter objects.- Returns:
- iterator over output parameter definitions.
- See Also:
-
paramBindingsIterator
Returns an iterator over the list of parameter bindings. The iterator returns instances ofParamBindingHandle
that represents parameter binding object.- Returns:
- iterator over parameter binding.
- See Also:
-
resultSetIterator
Returns an iterator over the result set columns. The iterator returns instances ofResultSetColumnHandle
that represents result set column object.- Returns:
- iterator over result set columns.
- See Also:
-
resultSetHintsIterator
Returns an iterator over hints of the result set columns. The iterator returns instances ofResultSetColumnHandle
that represents hints of result set column object.- Returns:
- iterator over hints of result set columns.
- See Also:
-
computedColumnsIterator
Returns an iterator for the list of computed columns. The iterator returns instances ofComputedColumnHandle
that represents computed column object.- Returns:
- iterator over computed columns.
- See Also:
-
columnHintsIterator
Returns an iterator over column hints. The iterator returns instances ofColumnHintHandle
that represents column hint object.- Returns:
- iterator over column hints.
- See Also:
-
sortHintsIterator
Returns an iterator over sort hints. The iterator returns instances ofSortHintHandle
that represents sort hint object.- Returns:
- iterator over sort hints.
- See Also:
-
filtersIterator
Returns an iterator over filter. The iterator returns instances ofFilterConditionHandle
that represents filter condition object.- Returns:
- iterator over filters.
- See Also:
-
getBeforeOpen
Returns the code of the beforeOpen method. This is the script called just before opening this data set.- Returns:
- the code of the method
-
setBeforeOpen
Sets the code for the beforeOpen method. This is the script called just before opening this data set.- Parameters:
code
- the code for the method- Throws:
SemanticException
- If the method is locked.
-
getBeforeClose
Returns the code of the beforeClose method. This is the script called just before closing this data set.- Returns:
- the code of the method
-
setBeforeClose
Sets the code for the beforeClose method. This is the script called just before closing this data set.- Parameters:
code
- the code for the method- Throws:
SemanticException
- If the method is locked.
-
getAfterOpen
Returns the code of the afterOpen method. This is the script called just after opening this data set.- Returns:
- the code of the method
-
setAfterOpen
Sets the code for the afterOpen method. This is the script called just after opening this data set.- Parameters:
code
- the code for the method- Throws:
SemanticException
- If the method is locked.
-
getAfterClose
Returns the code of the afterClose method. This is the script called just after closing this data set.- Returns:
- the code of the method
-
setAfterClose
Sets the code for the afterClose method. This is the script called just after closing this data set.- Parameters:
code
- the code for the method- Throws:
SemanticException
- If the method is locked.
-
getOnFetch
Returns the code of the onFetch method. This is the script called just after fetching each row.- Returns:
- the code of the method
-
setOnFetch
Sets the code for the onFetch method. This is the script called just after fetching each row.- Parameters:
code
- the code for the method- Throws:
SemanticException
- If the method is locked.
-
getCachedMetaDataHandle
Return a handle to deal with the cached data set information that include output column information when it gets from databases, input/output parameter definitions.- Returns:
- a
CachedMetaDataHandle
to deal with the cached data set information, returnnull
if the property has not been set.
-
setCachedMetaData
Set the value for the cached data set information.- Parameters:
metadata
- a structure value include output column information , input/output parameter definitions.- Returns:
CachedMetaDataHandle
to the inputmetadata
, returnnull
ifmetadata
isnull
.- Throws:
SemanticException
- the input data is not valid.
-
getPropertyHandle
Description copied from class:DesignElementHandle
Returns a property handle for a top-level property. A top-level property is a property that defines on an element.- Overrides:
getPropertyHandle
in classDesignElementHandle
- Parameters:
propName
- the name of the property to get- Returns:
- The property handle, or
null
if the no property exists with the given name. - See Also:
-
setDataSetRowLimit
Deprecated.duplicate with method setRowFetchLimit()Sets data set row limit property value.- Parameters:
count
-- Throws:
SemanticException
-
getDataSetRowLimit
Deprecated.duplicate with method getRowFetchLimit()Returns value of data set row limit property.- Returns:
- the value of data set row limit property.
-
setCachedRowCount
Deprecated.by setDataSetRowLimit methodsets the cached row count property value.- Parameters:
count
- the cached row count- Throws:
SemanticException
-
getCachedRowCount
Deprecated.by getDataSetRowLimit methodReturns the value of cached row count property.- Returns:
- the row count.
-
setRowFetchLimit
Sets the max number of rows from data set property value.- Parameters:
count
- the row number to fetch from result set- Throws:
SemanticException
-
getRowFetchLimit
public int getRowFetchLimit()Returns the max number of rows from data set property value.- Returns:
- the max number of rows that can be fetched from data set.
-
addFilter
Adds the filter condition.- Parameters:
fc
- the filter condition structure- Throws:
SemanticException
- if the expression of filter condition is empty or null
-
removeFilter
Removes the filter condition.- Parameters:
fc
- the filter condition structure- Throws:
SemanticException
- if the given condition doesn't exist in the filters
-
setNeedsCache
Sets whether to do some cache when rendering the report.- Parameters:
needsCache
- true if needs do caching when rendering the report, otherwise false- Throws:
SemanticException
-
needsCache
public boolean needsCache()Determines whether to do some cache when rendering the report.- Returns:
- true if needs do caching when rendering the report, otherwise false
-
getACLExpression
Gets the expression handle for theACLExpression
property.- Returns:
-
getRowACLExpression
Gets the expression handle for the ACL expression for one row.- Returns:
-
isVisible
public boolean isVisible()Gets the isVisible property value.- Returns:
if that data set is visible outside of the datamart, otherwise return .
-
setIsVisible
Sets the isVisible property value.- Parameters:
isVisible
-if that data set is visible outside of the datamart, otherwise return . - Throws:
SemanticException
-
getLocale
public com.ibm.icu.util.ULocale getLocale()Gets the locale of this data set element.- Returns:
- the locale of this data set
- See Also:
-
setLocale
Sets the locale for this data set element.- Parameters:
locale
- the locale to data set- Throws:
SemanticException
- See Also:
-
getNullsOrdering
Gets the ordering of null values. Its value must be one of the following:NULLS_ORDERING_NULLS_LOWEST
NULLS_ORDERING_NULLS_HIGHEST
NULLS_ORDERING_EXCLUDE_NULLS
- Returns:
- ordering of null values.
-
setNullsOrdering
Sets the ordering of null values. Its value must be one of the following:NULLS_ORDERING_NULLS_LOWEST
NULLS_ORDERING_NULLS_HIGHEST
NULLS_ORDERING_EXCLUDE_NULLS
- Parameters:
nullsOrdering
-- Throws:
SemanticException
-