lumis.doui.source
Class TabularSource<F extends ITabularSourceField>

Package class diagram package TabularSource
java.lang.Object
  extended by java.util.Observable
      extended by lumis.doui.source.Source<F>
          extended by lumis.doui.source.TabularSource<F>
Type Parameters:
F - the source field class for this source.
All Implemented Interfaces:
Comparator<ISourceData>
Direct Known Subclasses:
SearchSource, TableSource

@StableMinor(version="5.5",
             sinceVersion="4.0")
public class TabularSource<F extends ITabularSourceField>
extends Source<F>
implements Comparator<ISourceData>

A source that has its data in a tabular format.

Since:
4.0.0

Field Summary
protected  F primaryKeySourceField
           
protected  List<F> searchableSourceFields
           
protected  TabularData tabularData
           
 
Fields inherited from class lumis.doui.source.Source
administrationInterfaceId, connectionId, fields, fieldsMap, id, introductionSourceField, keywordsSourceField, load, metaDataSourceId, parameters, primaryNameSourceField, readData, SOURCE_READ_DATA_ALWAYS, SOURCE_READ_DATA_NEVER, SOURCE_READ_DATA_ON_DEMAND, sourceContext, sourceDefinitionNode
 
Constructor Summary
TabularSource(Node sourceDefinitionNode, ISourceContext sourceContext)
          Creates a tabular source.
 
Method Summary
 void applyPostLoadFilters()
          Apply the filters specified in this source to its data.
 void applyPostLoadPagination()
          Adjusts the data of this source for pagination.
 int compare(ISourceData row1, ISourceData row2)
          Compares two rows based on the DouiContext.DOUI_ORDER_BY_FIELD parameter value.
protected  int compareField(ISourceData row1, ISourceData row2, String fieldId, String direction)
          Returns an integer that represents the comparason between the same field value of two different rows.
protected  void convertDataToDefinedDataTypes()
          Converts the data in this source to the values that should be used according to its fields definitions.
protected  TabularData convertDataToDefinedDataTypes(TabularData originalData)
          Converts the given data to another data with the values that should be used according to this source's fields definitions.
protected  F createSourceField(Node fieldNode)
          Factory method for creating a source field instance that corresponds to the field node given.
 TabularData getData()
          Returns this source's data.
protected  String getDefaultProviderClass()
          Returns data provider class for the source.
protected  String getDefaultSourceSearchContentFillerClassName()
          Returns the default source search content search filler class name.
 DouiHyperlinkItemParameterField getDouiHyperlinkItemParameterField()
          Returns the information about the field that is associated with the item id page parameter.
 Class getFieldClass(String fieldId)
          Returns the class object of the field.
 String getFieldId(String fieldCriteria)
          Deprecated. This method may be removed in the future, because it is public and references field xml definition.
 Set<String> getFieldIds(String fieldCriteria)
          Deprecated. This method may be removed in the future, because it is public and references field xml definition.
 String getFieldName(String fieldId)
          Returns the field name given a field id.
 Node getFieldsDefinitionNode()
          Returs the fields node of the source.
 Collection<String> getHyperlinkDefaultParameters()
          Returns the default parameters that should be used when creating a hyperlink url from this source.
 String getIndexerEngineId()
          Returns the identifier of the indexing engine for this source
 String getIndexerId()
          Returns the identifier of the indexer for this source.
 int getMaxRows()
          Returns the maximum rows that data of this source shold contain.
 F getPrimaryKeyField()
          Returns the field id of the primary key field.
 String getReindexerTabularDataProcessorClassName()
          Returns the class name of the reindexer for this source
 List<F> getSearchableFields()
          Returns a collection of fields that are searchable
 String getSearcherEngineId()
          Returns the searcher engine for this source
 String getSearcherId()
          Returns the identifier of the searcher for this source.
 SortedSet<String> getSortedFieldIds(String fieldCriteria)
          Deprecated. This method may be removed in the future, because it is public and references field xml definition.
 String getSourceSearchContentFillerClassName()
          Returns the defined search filler class name
 int getStartAt()
          Returns the row start position the data of this source shold be read from.
 boolean hasField(String fieldCriteria)
          Deprecated. This method may be removed in the future, because it is public and references field xml definition.
 boolean isSearchEnabled()
          Returns whether search is enabled for this source or not.
protected  void readFieldsIntoFieldsMap()
          Reads this source's fields into the Source.fieldsMap.
 void reindex(boolean localServerOnly)
          Deprecated. 
 void setData(TabularData tabularData)
          Sets the data in this source.
 void setMaxRows(int maxRows)
          Sets the maximum rows that data of this source shold contain.
 void setStartAt(int startAt)
          Sets the row start position the data of this source shold be read from.
 
Methods inherited from class lumis.doui.source.Source
createCustomSourceField, createDefaultCompositeFilterInstance, createDefaultFilterInstance, createSourceFilter, getAdministrationInterfaceId, getDataProvider, getDefinitionNode, getDistinct, getDouiContext, getField, getFields, getFilter, getFiltersNode, getId, getIntroductionField, getKeywordsField, getLoad, getMetaDataSourceId, getParameterClass, getParameterValue, getPrimaryNameField, getReadData, getSourceContainer, getSourceContext, getTransaction, isAdministrationInterface, load, postProcessSource, setLoad, setParameterValue, setReadData, valueChanged
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

tabularData

protected TabularData tabularData

primaryKeySourceField

protected F extends ITabularSourceField primaryKeySourceField

searchableSourceFields

protected List<F extends ITabularSourceField> searchableSourceFields
Constructor Detail

TabularSource

public TabularSource(Node sourceDefinitionNode,
                     ISourceContext sourceContext)
              throws PortalException
Creates a tabular source.

Parameters:
sourceDefinitionNode - the source definition node.
sourceContext - the source context.
Throws:
PortalException
Since:
4.0.4
Method Detail

createSourceField

protected F createSourceField(Node fieldNode)
                                                   throws PortalException
Description copied from class: Source
Factory method for creating a source field instance that corresponds to the field node given. This method instantiate and returns the source field, without initializing it.

Overrides:
createSourceField in class Source<F extends ITabularSourceField>
Parameters:
fieldNode - the field node.
Returns:
the ISourceField created, or null if no field should be created for this node.
Throws:
PortalException
See Also:
Source.createCustomSourceField(Node)

readFieldsIntoFieldsMap

protected void readFieldsIntoFieldsMap()
                                throws PortalException
Description copied from class: Source
Reads this source's fields into the Source.fieldsMap. The order the source fields are put in the map will define the order the fields will be in the Source.fields list. This order may affect some field processing.

Overrides:
readFieldsIntoFieldsMap in class Source<F extends ITabularSourceField>
Throws:
PortalException - if an error was found while reading the source's fields into the Source.fields map.

getPrimaryKeyField

public F getPrimaryKeyField()
Returns the field id of the primary key field.

Returns:
Since:
4.0.11

getIndexerEngineId

public String getIndexerEngineId()
                          throws PortalException
Returns the identifier of the indexing engine for this source

Returns:
Throws:
PortalException
Since:
4.0.11

getSearcherEngineId

public String getSearcherEngineId()
                           throws PortalException
Returns the searcher engine for this source

Returns:
Throws:
PortalException
Since:
4.0.11

getIndexerId

public String getIndexerId()
                    throws PortalException
Returns the identifier of the indexer for this source.

Returns:
Throws:
PortalException
Since:
4.0.11

getSearcherId

public String getSearcherId()
                     throws PortalException
Returns the identifier of the searcher for this source.

Returns:
Throws:
PortalException
Since:
4.0.11

isSearchEnabled

public boolean isSearchEnabled()
Returns whether search is enabled for this source or not.

Returns:
Since:
4.0.11

getSearchableFields

public List<F> getSearchableFields()
Returns a collection of fields that are searchable

Returns:
Since:
4.0.11

getDouiHyperlinkItemParameterField

public DouiHyperlinkItemParameterField getDouiHyperlinkItemParameterField()
Description copied from class: Source
Returns the information about the field that is associated with the item id page parameter.

Overrides:
getDouiHyperlinkItemParameterField in class Source<F extends ITabularSourceField>
Returns:
the information about the field that is associated with the item id page parameter.
See Also:
PageConfig.PAGE_PARAMETER_ITEMID, DouiHyperlinkItemParameterField

getHyperlinkDefaultParameters

public Collection<String> getHyperlinkDefaultParameters()
Description copied from class: Source
Returns the default parameters that should be used when creating a hyperlink url from this source.

Overrides:
getHyperlinkDefaultParameters in class Source<F extends ITabularSourceField>
Returns:
a collection with the default parameter names.

getFieldsDefinitionNode

public Node getFieldsDefinitionNode()
                             throws PortalException
Returs the fields node of the source.

Returns:
Throws:
PortalException
Since:
4.0.11

getFieldClass

public Class getFieldClass(String fieldId)
                    throws PortalException
Returns the class object of the field. This implementation always returns the String.class object.

Parameters:
fieldId -
Returns:
Throws:
PortalException
Since:
4.0.11

getData

public TabularData getData()
                    throws PortalException
Description copied from class: Source
Returns this source's data.

Overrides:
getData in class Source<F extends ITabularSourceField>
Returns:
this source's data.
Throws:
PortalException

convertDataToDefinedDataTypes

protected void convertDataToDefinedDataTypes()
                                      throws PortalException
Description copied from class: Source
Converts the data in this source to the values that should be used according to its fields definitions.

Specified by:
convertDataToDefinedDataTypes in class Source<F extends ITabularSourceField>
Throws:
PortalException

convertDataToDefinedDataTypes

protected TabularData convertDataToDefinedDataTypes(TabularData originalData)
                                             throws PortalException
Converts the given data to another data with the values that should be used according to this source's fields definitions.

Parameters:
originalData - the data to be converted.
Returns:
the converted data.
Throws:
PortalException
Since:
4.1.1

setData

public void setData(TabularData tabularData)
             throws PortalException
Sets the data in this source.

Parameters:
tabularData - the data to set in this source.
Throws:
PortalException
Since:
4.0.4

compareField

protected int compareField(ISourceData row1,
                           ISourceData row2,
                           String fieldId,
                           String direction)
Returns an integer that represents the comparason between the same field value of two different rows. This method is used for sorting results after the tabular data is filled.

0 signifies equality 1 signifies the first row is greater -1 signifies the second row is greater

If the direction is QuerySortOrder.DESCENDING, the results are inverted.

Parameters:
row1 -
row2 -
fieldId -
direction - QuerySortOrder.ASCENDING or QuerySortOrder.DESCENDING
Returns:
Since:
4.0.11

compare

public int compare(ISourceData row1,
                   ISourceData row2)
Compares two rows based on the DouiContext.DOUI_ORDER_BY_FIELD parameter value.

0 signifies equality 1 signifies the first row is greater -1 signifies the second row is greater

Specified by:
compare in interface Comparator<ISourceData>

getFieldName

public String getFieldName(String fieldId)
                    throws PortalException
Returns the field name given a field id.

Parameters:
fieldId -
Returns:
Throws:
PortalException
Since:
4.0.11

getSortedFieldIds

public SortedSet<String> getSortedFieldIds(String fieldCriteria)
                                    throws PortalException
Deprecated. This method may be removed in the future, because it is public and references field xml definition.

Get this source's set of field ids having definition node matching the specified criteria, sorted

Parameters:
fieldCriteria -
Returns:
Throws:
PortalException

getFieldIds

public Set<String> getFieldIds(String fieldCriteria)
                        throws PortalException
Deprecated. This method may be removed in the future, because it is public and references field xml definition.

Get this source's set of field ids having definition node matching the specified criteria

Parameters:
fieldCriteria -
Returns:
Throws:
PortalException

getFieldId

public String getFieldId(String fieldCriteria)
                  throws PortalException
Deprecated. This method may be removed in the future, because it is public and references field xml definition.

Get this source's field id having definition node matching the specified criteria

Parameters:
fieldCriteria -
Returns:
Throws:
PortalException

hasField

public boolean hasField(String fieldCriteria)
                 throws PortalException
Deprecated. This method may be removed in the future, because it is public and references field xml definition.

Check if this source have a field with definition node matching the specified criteria

Parameters:
fieldCriteria -
Returns:
Throws:
PortalException

applyPostLoadFilters

public void applyPostLoadFilters()
                          throws PortalException
Apply the filters specified in this source to its data. This is an utility method for data providers that does not support filtering during the source load operation. After loading the source's data without filtering it, the data provider may call this method for the source to remove data that does not attend to the filters specified.

Data providers that may provide significant quantity of data should implement its own filtering during load instead of using this method, to prevent unnecessary use of server's memory and cpu.

Currently this implementation supports only simple filters, without grouping and of operator 'like'.

Overrides:
applyPostLoadFilters in class Source<F extends ITabularSourceField>
Throws:
PortalException
See Also:
IDataProvider#loadData(lumis.portal.SessionConfig, Source, lumis.util.ITransaction)

applyPostLoadPagination

public void applyPostLoadPagination()
Adjusts the data of this source for pagination.

The total rows of this data is set to its size, and then its rows are trimmed, according to the getStartAt() and getMaxRows() values.

For correct behavior, the rows presence or ordering may not be changed after this processing.

Since:
4.0.9

setStartAt

public void setStartAt(int startAt)
Sets the row start position the data of this source shold be read from. Used for pagination funcionalities. The row number is 1-based.

Parameters:
startAt -
Since:
4.0.11

getStartAt

public int getStartAt()
Returns the row start position the data of this source shold be read from. Used for pagination funcionalities. The row number is 1-based.

Returns:
the row start position the data of this source shold be read from.
Since:
4.0.5

setMaxRows

public void setMaxRows(int maxRows)
Sets the maximum rows that data of this source shold contain. Used for pagination funcionalities. The row number is 1-based.

Parameters:
maxRows -
Since:
4.0.11

getMaxRows

public int getMaxRows()
Returns the maximum rows that data of this source shold contain. Used for pagination funcionalities. The row number is 1-based.

Returns:
Since:
4.0.11

getDefaultSourceSearchContentFillerClassName

protected String getDefaultSourceSearchContentFillerClassName()
Returns the default source search content search filler class name.

The default value defined in this class is lumis.doui.search.DouiTabularSourceSearchContentFiller.

Returns:
Since:
4.0.11

getSourceSearchContentFillerClassName

public String getSourceSearchContentFillerClassName()
Returns the defined search filler class name

Returns:
Since:
4.0.11

getReindexerTabularDataProcessorClassName

public String getReindexerTabularDataProcessorClassName()
Returns the class name of the reindexer for this source

Returns:
Since:
4.0.11

getDefaultProviderClass

protected String getDefaultProviderClass()
                                  throws PortalException
Returns data provider class for the source. Always throws an exceptions since this source does not have a default provider class.

Specified by:
getDefaultProviderClass in class Source<F extends ITabularSourceField>
Returns:
Throws:
PortalException

reindex

@Deprecated
public void reindex(boolean localServerOnly)
             throws PortalException
Deprecated. 

For internal use only.

Throws:
PortalException
Since:
4.2.0


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.