com.flexive.shared.search
Class FxEmptyResultSet

java.lang.Object
  extended by com.flexive.shared.search.FxEmptyResultSet
All Implemented Interfaces:
FxResultSet, java.io.Serializable

public final class FxEmptyResultSet
extends java.lang.Object
implements FxResultSet, java.io.Serializable

An empty FxResultSet to be used when an exception is thrown but a result set is still needed to render a user interface.

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.flexive.shared.search.FxResultSet
FxResultSet.WrappedLock
 
Field Summary
static FxPK EMPTY_PK
           
 
Constructor Summary
FxEmptyResultSet()
          
 
Method Summary
<T> java.util.List<T>
collectColumn(int columnIndex)
          Projects a single column to a list.
 int getColumnCount()
          Returns the number of columns in this FxResultSet object.
 int getColumnIndex(java.lang.String name)
          Get the index for the given column.
 java.util.Map<java.lang.String,java.lang.Integer> getColumnIndexMap()
          Returns a map returning the column index using the lowercase column name as a key.
 java.lang.String getColumnLabel(int index)
          Returns the column label of the given index in the calling user's language.
 java.lang.String[] getColumnLabels()
          Returns the column labels in the calling user's language.
 java.lang.String getColumnName(int pos)
          Get the designated column's name.
 java.lang.String[] getColumnNames()
          Returns the column names.
 java.util.List<FxFoundType> getContentTypes()
          Returns a list of all content types that are part of the resultset.
 long getCreatedBriefcaseId()
          If the query created a new briefcase, its ID can be retrieved with this method.
 long getCreationTime()
          Returns the time this resultset was created at.
 int getDbSearchTime()
          Returns the time needed to find all matching records in the database.
 int getFetchTime()
          Returns the time needed to find fetch the matching records from the database.
 ResultLocation getLocation()
          Returns the location for which the query was executed.
 int getMaxFetchRows()
          Returns the maximum rows parameter specified with the search.
 java.lang.Object getObject(int rowIndex, int columnIndex)
          Retrieves the value of the designated column in the current row of this FxResultSet object as a Object.
 int getParserExecutionTime()
          Returns the time that was spent parsing the statement.
 int getPrimaryKeyIndex()
          Return the index of the @pk column if it was selected, or -1 otherwise.
 FxResultRow getResultRow(FxPK pk)
          Return a result row wrapper for the given pk, or null if the result row can't be determined.
 FxResultRow getResultRow(int index)
          Return a result row wrapper for the given row number.
 java.lang.Iterable<FxResultRow> getResultRows()
          Return a result row iterator for this result set.
 int getRowCount()
          Returns the number of rows in this FxResultSet object.
 java.util.List<java.lang.Object[]> getRows()
          Returns all rows.
 int getStartIndex()
          Returns the start index specified with the search.
 java.lang.String getString(int rowIndex, int columnIndex)
          Retrieves the value of the designated column in the current row of this FxResultSet object as a String.
 int getTotalRowCount()
          Returns the total row count.
 int getTotalTime()
          Returns the total time spent for the search.
 int getUserWildcardIndex()
          Return the start column index of the properties selected by the user wildcard @*, or -1 if no such wildcard was present in the original statement.
 ResultViewType getViewType()
          Returns the view type for which the query was executed.
 boolean isTruncated()
          Returns true if the found entry set was truncted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_PK

public static final FxPK EMPTY_PK
Constructor Detail

FxEmptyResultSet

public FxEmptyResultSet()

Method Detail

getCreationTime

public long getCreationTime()
Returns the time this resultset was created at.

Specified by:
getCreationTime in interface FxResultSet
Returns:
the creation time of the resultset

getStartIndex

public int getStartIndex()
Returns the start index specified with the search.

Specified by:
getStartIndex in interface FxResultSet
Returns:
the start index specified with the search

getMaxFetchRows

public int getMaxFetchRows()
Returns the maximum rows parameter specified with the search.

Specified by:
getMaxFetchRows in interface FxResultSet
Returns:
the maximum rows parameter specified with the search

getColumnNames

public java.lang.String[] getColumnNames()
Returns the column names.

Specified by:
getColumnNames in interface FxResultSet
Returns:
the column names.

getRows

public java.util.List<java.lang.Object[]> getRows()
Returns all rows.

Specified by:
getRows in interface FxResultSet
Returns:
the rows

getColumnLabel

public java.lang.String getColumnLabel(int index)
                                throws java.lang.ArrayIndexOutOfBoundsException
Returns the column label of the given index in the calling user's language.

Specified by:
getColumnLabel in interface FxResultSet
Parameters:
index - the column index (first column is 1)
Returns:
the column label of the given index in the calling user's language.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the given position is not valid

getColumnLabels

public java.lang.String[] getColumnLabels()
Returns the column labels in the calling user's language.

Specified by:
getColumnLabels in interface FxResultSet
Returns:
the column labels in the calling user's language.

getColumnName

public java.lang.String getColumnName(int pos)
                               throws java.lang.ArrayIndexOutOfBoundsException
Get the designated column's name.

Specified by:
getColumnName in interface FxResultSet
Parameters:
pos - the first column is 1, the second is 2, ...
Returns:
the column name at the given position
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the given position is not valid

getColumnIndex

public int getColumnIndex(java.lang.String name)
Get the index for the given column. Returns -1 if the column name does not exist in the result set.

Specified by:
getColumnIndex in interface FxResultSet
Parameters:
name - the column name
Returns:
the index for the given column name, 1-based

getColumnIndexMap

public java.util.Map<java.lang.String,java.lang.Integer> getColumnIndexMap()
Returns a map returning the column index using the lowercase column name as a key.

Specified by:
getColumnIndexMap in interface FxResultSet
Returns:
a map returning the column index using the lowercase column name as a key.

getColumnCount

public int getColumnCount()
Returns the number of columns in this FxResultSet object.

Specified by:
getColumnCount in interface FxResultSet
Returns:
the number of columns

getRowCount

public int getRowCount()
Returns the number of rows in this FxResultSet object.

Specified by:
getRowCount in interface FxResultSet
Returns:
the number of rows

getTotalRowCount

public int getTotalRowCount()
Returns the total row count.

The total row count is the number of entries found by the search, even if they are not contained in this resultset because of the specified start and end index.

Specified by:
getTotalRowCount in interface FxResultSet
Returns:
the total row count

isTruncated

public boolean isTruncated()
Returns true if the found entry set was truncted.

Specified by:
isTruncated in interface FxResultSet
Returns:
true if the result was truncated

getObject

public java.lang.Object getObject(int rowIndex,
                                  int columnIndex)
                           throws java.lang.ArrayIndexOutOfBoundsException
Retrieves the value of the designated column in the current row of this FxResultSet object as a Object.

Specified by:
getObject in interface FxResultSet
Parameters:
rowIndex - - the first row is 1, the second is 2, ...
columnIndex - - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the given row/column combination is out of range

getString

public java.lang.String getString(int rowIndex,
                                  int columnIndex)
                           throws java.lang.ArrayIndexOutOfBoundsException
Retrieves the value of the designated column in the current row of this FxResultSet object as a String.

Specified by:
getString in interface FxResultSet
Parameters:
rowIndex - - the first row is 1, the second is 2, ...
columnIndex - - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the given row/column combination is out of range

getParserExecutionTime

public int getParserExecutionTime()
Returns the time that was spent parsing the statement.

Specified by:
getParserExecutionTime in interface FxResultSet
Returns:
the time that was spent parsing the statement

getDbSearchTime

public int getDbSearchTime()
Returns the time needed to find all matching records in the database.

Specified by:
getDbSearchTime in interface FxResultSet
Returns:
the time needed to find all matching records in the database

getFetchTime

public int getFetchTime()
Returns the time needed to find fetch the matching records from the database.

Specified by:
getFetchTime in interface FxResultSet
Returns:
the time needed to find fetch the matching records from the database

getTotalTime

public int getTotalTime()
Returns the total time spent for the search.

This time includes the parse time, search time, fetch time and additional programm logic time.

Specified by:
getTotalTime in interface FxResultSet
Returns:
the total time spent for the search

getLocation

public ResultLocation getLocation()
Returns the location for which the query was executed.

Specified by:
getLocation in interface FxResultSet
Returns:
the location for which the query was executed.

getViewType

public ResultViewType getViewType()
Returns the view type for which the query was executed.

Specified by:
getViewType in interface FxResultSet
Returns:
the view type for which the query was executed.

getContentTypes

public java.util.List<FxFoundType> getContentTypes()
Returns a list of all content types that are part of the resultset.

Items filtered by the parameter CTYPE are also taken into account.

Specified by:
getContentTypes in interface FxResultSet
Returns:
a list of all content types that are part of the resultset

getResultRows

public java.lang.Iterable<FxResultRow> getResultRows()
Return a result row iterator for this result set.

Specified by:
getResultRows in interface FxResultSet
Returns:
a result row iterator for this result set.

getResultRow

public FxResultRow getResultRow(int index)
Return a result row wrapper for the given row number.

Specified by:
getResultRow in interface FxResultSet
Parameters:
index - the row number
Returns:
a result row wrapper for the given row number.

getResultRow

public FxResultRow getResultRow(FxPK pk)
Return a result row wrapper for the given pk, or null if the result row can't be determined. (I.e. if "@pk" was not selected).

Specified by:
getResultRow in interface FxResultSet
Parameters:
pk - FxPK
Returns:
a result row wrapper for the given pk, or null if the result row can't be determined.

getCreatedBriefcaseId

public long getCreatedBriefcaseId()
If the query created a new briefcase, its ID can be retrieved with this method.

Specified by:
getCreatedBriefcaseId in interface FxResultSet
Returns:
the ID of the created briefcase, or -1 if no briefcase was created

collectColumn

public <T> java.util.List<T> collectColumn(int columnIndex)
Projects a single column to a list.

Specified by:
collectColumn in interface FxResultSet
Parameters:
columnIndex - the 1-based column index
Returns:
all column values collected in a list

getUserWildcardIndex

public int getUserWildcardIndex()
Return the start column index of the properties selected by the user wildcard @*, or -1 if no such wildcard was present in the original statement.

Specified by:
getUserWildcardIndex in interface FxResultSet
Returns:
the start column index 1-based of the properties selected by the user wildcard @*, or -1 if no such wildcard was present in the original statement.

getPrimaryKeyIndex

public int getPrimaryKeyIndex()
Return the index of the @pk column if it was selected, or -1 otherwise.

Specified by:
getPrimaryKeyIndex in interface FxResultSet
Returns:
the index of the @pk column if it was selected, or -1 otherwise.