com.stimulsoft.report.dictionary.dataSources
Class StiDataSource

java.lang.Object
  extended by com.stimulsoft.base.serializing.StiSerializedObject
      extended by com.stimulsoft.report.dictionary.dataSources.StiDataSource
All Implemented Interfaces:
IStiJsonReportObject, IStiSerializable, IStiSerializableRef, IStiName, IStiEnumerator, IStiInherited, IStiStateSaveRestore, java.lang.Cloneable
Direct Known Subclasses:
StiDataSourceEmpty, StiDataStoreSource

public abstract class StiDataSource
extends StiSerializedObject
implements IStiSerializableRef, java.lang.Cloneable, IStiStateSaveRestore, IStiEnumerator, IStiName, IStiInherited, IStiJsonReportObject


Field Summary
 StiDataColumnsCollection columns
           
 boolean connectOnStart
           
 java.util.ArrayList<DataRow> detailRows
           
 boolean initForSubreport
           
 java.util.Hashtable RowToLevel
           
 
Fields inherited from interface com.stimulsoft.base.serializing.interfaceobject.IStiSerializableRef
REFERENCE_EMPTY, REFERENCE_REPORT
 
Constructor Summary
StiDataSource()
           
StiDataSource(java.lang.String name, java.lang.String alias)
          Creates a new Data Source.
 
Method Summary
 void CheckColumnsIndexs()
          Internal use only.
 void clearAllStates()
          Clear all states.
 void ClearAllStates()
          Clear all earlier saved object states.
abstract  void connect()
           
abstract  void connect(java.lang.Boolean fillTable)
           
 void disconnect()
           
 void First()
          Sets a position at the beginning.
 java.lang.Object get(java.lang.String columnName)
           
 java.lang.String getAlias()
          Gets or sets of the Data Source alias.
 java.lang.String GetCategoryName()
          Returns the name to categories of the Data Source.
 StiDataSource GetChildDataSource(java.lang.String relationName)
          Returns the child Data Source by the relation name.
 StiDataRelationsCollection GetChildRelations()
          Returns a collection of Child relations.
 int GetColumnIndex(java.lang.String columnName)
          Returns the index of a column in the data source.
 StiDataColumnsCollection getColumns()
          Gets or sets the column collection.
 java.lang.Object[][][] GetConditions(StiDataBand dataBand)
           
 int getConnectionOrder()
          Gets or sets value which indicates in which order that datasource will be connect to the data.
 boolean getConnectOnStart()
          Gets or sets value which indicates that datasource not connect to the data automatically.
 int getCount()
          Gets count of elements.
 java.lang.Object GetData(java.lang.String columnName)
          Returns the value by the column name and the current position in the Data Source.
 java.lang.Object getData(java.lang.String columnName, int rowIndex)
           
 java.lang.Object GetData(java.lang.String columnName, int rowIndex)
          Returns the value by the column name and index of row in the Data Source.
abstract  java.lang.Class<? extends StiDatabase> getDatabaseClass()
           
 DataRow GetDataRow(int index)
           
 DataTable getDataTable()
          Gets DataTable.
 StiDictionary getDictionary()
          Gets or sets the dictionary in which this Data Source is located.
 boolean getInherited()
           
 boolean getIsBof()
          Gets value indicates that this position specifies to the beginning of data.
 boolean getIsConnected()
          Gets value indicates which Data Source is connected with data.
 boolean getIsEmpty()
          Gets value indicates that no data.
 boolean getIsEof()
          Gets value indicates that this position specifies to the data end.
 java.lang.Object getItem(java.lang.String columnName)
          Indexer to work with the current row of data.
 java.lang.String getKey()
           
 int GetLevel()
          Returns level of data in hierarchical band.
 java.lang.String getName()
          Gets or sets of the Data Source name.
 StiDataParametersCollection getParameters()
          Gets or sets the parameter collection.
 StiDataRow GetParentData(java.lang.String relationName)
          Returns the parent row with data for the indicated relation.
 StiDataSource GetParentDataSource(java.lang.String relationName)
          Returns the parent Data Source by the relation name.
 StiDataRelationsCollection GetParentRelations()
          Returns the colection of Parent relations.
 int getPosition()
          Gets the current position.
 int getPositionValue()
           
 int getRealCount()
           
 StiDataRelation getRelations(java.lang.String relationName)
           
 StiRowsCollection getRows()
          Gets or sets rows collection.
 StiDataParameter getVariableParameterByName(java.lang.String name)
           
 java.util.List<StiDataParameter> getVariableParameters()
           
 boolean isEmpty()
           
 void Last()
          Sets a position on the last element.
 void LoadFromJsonObject(JSONObject jObject)
           
 void Next()
          Sets a position on the next element.
 void prepareData()
           
 void Prior()
          Sets a position on the previous element.
 void ResetData()
           
 void ResetDetailsRows()
           
 void restoreState(java.lang.String stateName)
          Restores the earlier saved object state.
 void RestoreState(java.lang.String stateName)
          Restores the earlier saved object state.
 void saveState(java.lang.String stateName)
          Saves the current state of an object.
 JSONObject SaveToJsonObject(StiJsonSaveMode mode)
           
 void setAlias(java.lang.String value)
           
 void setColumns(StiDataColumnsCollection value)
           
 void setConnectionOrder(int value)
           
 void setConnectOnStart(boolean value)
           
 void setCorrectName(java.lang.String correctName)
           
 void SetData(StiDataBand dataBand, java.lang.String relationName, java.lang.Object filterMethod, java.util.ArrayList<java.lang.String> sortColumns, boolean reinit, StiComponent component)
           
 void setDataTable(DataTable value)
           
 void SetDetails(java.lang.String relationName)
          Set the details data for Data Source.
 void setDictionary(StiDictionary value)
           
 void SetFilter(java.lang.Object filterMethod)
          Apply filter to data.
 void setInherited(boolean value)
           
 void setIsBof(boolean value)
           
 void setIsEof(boolean value)
           
 void setKey(java.lang.String key)
           
 void setName(java.lang.String value)
           
 void setParameters(StiDataParametersCollection value)
           
 void setPosition(int value)
           
 void setPositionValue(int positionValue)
           
 void setRows(StiRowsCollection value)
           
 void SetSort(java.lang.Object[][][] conditions, java.util.ArrayList<java.lang.String> sortColumns, StiComponent component, StiDataBand databand, java.util.ArrayList<StiGroupHeaderBand> groupHeaders)
          Sorts data.
 void setVariableParameters(java.util.List<StiDataParameter> variableParameters)
           
 int size()
           
 java.lang.String toString()
          Returns the text view of the Data Source.
 
Methods inherited from class com.stimulsoft.base.serializing.StiSerializedObject
cleanReference, getReference, setReference
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.stimulsoft.base.serializing.interfaceobject.IStiSerializableRef
getReference, setReference
 

Field Detail

initForSubreport

public boolean initForSubreport

detailRows

public java.util.ArrayList<DataRow> detailRows

RowToLevel

public java.util.Hashtable RowToLevel

connectOnStart

public boolean connectOnStart

columns

public StiDataColumnsCollection columns
Constructor Detail

StiDataSource

public StiDataSource()

StiDataSource

public StiDataSource(java.lang.String name,
                     java.lang.String alias)
Creates a new Data Source.

Parameters:
name - Data Source name.
alias - Data Source alias.
Method Detail

getKey

public java.lang.String getKey()
Returns:
the key

setKey

public void setKey(java.lang.String key)
Parameters:
key - the key to set

getInherited

public final boolean getInherited()
Specified by:
getInherited in interface IStiInherited

setInherited

public final void setInherited(boolean value)
Specified by:
setInherited in interface IStiInherited

getDatabaseClass

public abstract java.lang.Class<? extends StiDatabase> getDatabaseClass()

getName

public final java.lang.String getName()
Gets or sets of the Data Source name.

Specified by:
getName in interface IStiName

setName

public final void setName(java.lang.String value)
Specified by:
setName in interface IStiName

setCorrectName

public void setCorrectName(java.lang.String correctName)

getPosition

public int getPosition()
Gets the current position.

Specified by:
getPosition in interface IStiEnumerator

setPosition

public void setPosition(int value)
Specified by:
setPosition in interface IStiEnumerator

getRealCount

public final int getRealCount()

getCount

public final int getCount()
Gets count of elements.

Specified by:
getCount in interface IStiEnumerator

getIsBof

public boolean getIsBof()
Gets value indicates that this position specifies to the beginning of data.

Specified by:
getIsBof in interface IStiEnumerator

setIsBof

public void setIsBof(boolean value)
Specified by:
setIsBof in interface IStiEnumerator

getIsEof

public boolean getIsEof()
Gets value indicates that this position specifies to the data end.

Specified by:
getIsEof in interface IStiEnumerator

setIsEof

public void setIsEof(boolean value)
Specified by:
setIsEof in interface IStiEnumerator

getIsEmpty

public boolean getIsEmpty()
Gets value indicates that no data.

Specified by:
getIsEmpty in interface IStiEnumerator

First

public void First()
Sets a position at the beginning.

Specified by:
First in interface IStiEnumerator

Prior

public void Prior()
Sets a position on the previous element.

Specified by:
Prior in interface IStiEnumerator

Next

public void Next()
Sets a position on the next element.

Specified by:
Next in interface IStiEnumerator

Last

public void Last()
Sets a position on the last element.

Specified by:
Last in interface IStiEnumerator

saveState

public void saveState(java.lang.String stateName)
Saves the current state of an object.

Specified by:
saveState in interface IStiStateSaveRestore
Parameters:
stateName - A name of the state being saved.

ClearAllStates

public void ClearAllStates()
Clear all earlier saved object states.


SetData

public final void SetData(StiDataBand dataBand,
                          java.lang.String relationName,
                          java.lang.Object filterMethod,
                          java.util.ArrayList<java.lang.String> sortColumns,
                          boolean reinit,
                          StiComponent component)

GetConditions

public final java.lang.Object[][][] GetConditions(StiDataBand dataBand)

SetDetails

public final void SetDetails(java.lang.String relationName)
Set the details data for Data Source.

Parameters:
relationName - Relation to find Parent of the Data Source.

getRelations

public StiDataRelation getRelations(java.lang.String relationName)

SetFilter

public final void SetFilter(java.lang.Object filterMethod)
Apply filter to data.

Parameters:
filterMethod -

SetSort

public final void SetSort(java.lang.Object[][][] conditions,
                          java.util.ArrayList<java.lang.String> sortColumns,
                          StiComponent component,
                          StiDataBand databand,
                          java.util.ArrayList<StiGroupHeaderBand> groupHeaders)
Sorts data. If data source is not able to sort data then this command is ignored.

Parameters:
columns - Parameters of sorting. Example: new string[] {"ASC", "Company", "DESC", "ParentRelation", "DATE"}
sortColumns - Array with group conditions. 0 dimension - data rows, 1 dimension - group condition, 2 dimension - sort direction

ResetDetailsRows

public final void ResetDetailsRows()

ResetData

public final void ResetData()

GetDataRow

public final DataRow GetDataRow(int index)

GetParentData

public final StiDataRow GetParentData(java.lang.String relationName)
Returns the parent row with data for the indicated relation.

Parameters:
relationName - Relation name.
Returns:
Relation string.

GetParentRelations

public StiDataRelationsCollection GetParentRelations()
Returns the colection of Parent relations.

Returns:
Collection.

GetChildRelations

public StiDataRelationsCollection GetChildRelations()
Returns a collection of Child relations.

Returns:
Collection.

GetParentDataSource

public StiDataSource GetParentDataSource(java.lang.String relationName)
Returns the parent Data Source by the relation name.

Parameters:
relationName - Relation name.
Returns:
Data Source.

GetChildDataSource

public StiDataSource GetChildDataSource(java.lang.String relationName)
Returns the child Data Source by the relation name.

Parameters:
relationName - Relation name.
Returns:
Data Source.

prepareData

public void prepareData()

disconnect

public void disconnect()

getIsConnected

public final boolean getIsConnected()
Gets value indicates which Data Source is connected with data.


getParameters

public StiDataParametersCollection getParameters()
Gets or sets the parameter collection.


setParameters

public void setParameters(StiDataParametersCollection value)

getItem

public java.lang.Object getItem(java.lang.String columnName)
Indexer to work with the current row of data. Returns the value by the column name and the current position in the Data Source. Indexer calls the method GetData. ColumnName - name of column.


GetData

public final java.lang.Object GetData(java.lang.String columnName)
Returns the value by the column name and the current position in the Data Source.

Parameters:
columnName - Column name.
Returns:
Value.

GetData

public final java.lang.Object GetData(java.lang.String columnName,
                                      int rowIndex)
Returns the value by the column name and index of row in the Data Source.

Parameters:
columnName - Column name.
rowIndex - Index of row in the Data Source.
Returns:
Value.

GetColumnIndex

public final int GetColumnIndex(java.lang.String columnName)
Returns the index of a column in the data source.

Parameters:
columnName - Column name.
Returns:
Index.

getRows

public final StiRowsCollection getRows()
Gets or sets rows collection.


setRows

public final void setRows(StiRowsCollection value)

CheckColumnsIndexs

public final void CheckColumnsIndexs()
Internal use only.


toString

public java.lang.String toString()
Returns the text view of the Data Source.

Overrides:
toString in class java.lang.Object
Returns:

GetLevel

public final int GetLevel()
Returns level of data in hierarchical band.

Returns:

GetCategoryName

public java.lang.String GetCategoryName()
Returns the name to categories of the Data Source.


getConnectOnStart

public boolean getConnectOnStart()
Gets or sets value which indicates that datasource not connect to the data automatically.


setConnectOnStart

public void setConnectOnStart(boolean value)

getConnectionOrder

public int getConnectionOrder()
Gets or sets value which indicates in which order that datasource will be connect to the data.


setConnectionOrder

public void setConnectionOrder(int value)

getDataTable

public final DataTable getDataTable()
Gets DataTable.


connect

public abstract void connect()
                      throws StiException
Throws:
StiException

connect

public abstract void connect(java.lang.Boolean fillTable)
                      throws StiException
Throws:
StiException

setDataTable

public final void setDataTable(DataTable value)

getDictionary

public final StiDictionary getDictionary()
Gets or sets the dictionary in which this Data Source is located.


setDictionary

public final void setDictionary(StiDictionary value)

getAlias

public final java.lang.String getAlias()
Gets or sets of the Data Source alias.


setAlias

public final void setAlias(java.lang.String value)

getColumns

public StiDataColumnsCollection getColumns()
Gets or sets the column collection.


setColumns

public void setColumns(StiDataColumnsCollection value)

getData

public java.lang.Object getData(java.lang.String columnName,
                                int rowIndex)

restoreState

public void restoreState(java.lang.String stateName)
Description copied from interface: IStiStateSaveRestore
Restores the earlier saved object state.

Specified by:
restoreState in interface IStiStateSaveRestore
Parameters:
stateName - A name of the state being restored.

RestoreState

public void RestoreState(java.lang.String stateName)
Restores the earlier saved object state.

Parameters:
stateName - A name of the state being restored.

clearAllStates

public void clearAllStates()
Description copied from interface: IStiStateSaveRestore
Clear all states.

Specified by:
clearAllStates in interface IStiStateSaveRestore

isEmpty

public boolean isEmpty()

get

public java.lang.Object get(java.lang.String columnName)

setPositionValue

public void setPositionValue(int positionValue)

getPositionValue

public int getPositionValue()

size

public int size()

SaveToJsonObject

public JSONObject SaveToJsonObject(StiJsonSaveMode mode)
                            throws JSONException
Specified by:
SaveToJsonObject in interface IStiJsonReportObject
Throws:
JSONException

LoadFromJsonObject

public void LoadFromJsonObject(JSONObject jObject)
                        throws JSONException
Specified by:
LoadFromJsonObject in interface IStiJsonReportObject
Throws:
JSONException

getVariableParameters

public java.util.List<StiDataParameter> getVariableParameters()
Returns:
the variableParameters

setVariableParameters

public void setVariableParameters(java.util.List<StiDataParameter> variableParameters)
Parameters:
variableParameters - the variableParameters to set

getVariableParameterByName

public StiDataParameter getVariableParameterByName(java.lang.String name)