|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.storage.olap.embedded.ResultSet
public class ResultSet
Used for building an in memory multidimensional ResultSet. The MutableResultSet model is designed for a simple definition of multidimensional data. The data is stored in memory within the model. There is no connection or query associated with this model. To use the MutableResultSet model, simply start defining tuples and cells and adding axes with the appropriate data.
Creating an in memory Olap model The following example creates a model with Sales For all Dealers of Ford and Chrysler for the months of January through May. // Make an instance of the Tuple Interface object TupleInterface tuple1 = new Tuple(new TupleElementInterface[] {new TupleElement("All Dealer"), new TupleElement("January")}); TupleInterface tuple2 = new Tuple(new TupleElementInterface[] {new TupleElement("All Dealer"), new TupleElement("February")}); TupleInterface tuple3 = new Tuple(new TupleElementInterface[] {new TupleElement("All Dealer"), new TupleElement("March")}); TupleInterface tuple4 = new Tuple(new TupleElementInterface[] {new TupleElement("All Dealer"), new TupleElement("April")}); TupleInterface tuple5 = new Tuple(new TupleElementInterface[] {new TupleElement("All Dealer"), new TupleElement("May")}); TupleInterface tuple6 = new Tuple(new TupleElementInterface[] {new TupleElement("Chrysler")}); TupleInterface tuple7 = new Tuple(new TupleElementInterface[] {new TupleElement("Ford")}); TupleInterface tuple8 = new Tuple(new TupleElementInterface[] {new TupleElement("Sum of Sales")}); // Define the Axis for the model String[] colHeaders = new String[] {"All:Dealers", "Date"} ; String[] rowHeaders = new String[]{"Cars"}; String[] slicerHeaders = new String[]{"Sum of Sales"}; AxisInterface columnAxis = new Axis(AxisInterface.COLUMSNAXIS, colHeaders, new TupleInterface[] {tuple1, tuple2, tuple3, tuple4, tuple5}); AxisInterface rowAxis = new Axis(AxisInterface.ROWSAXIS, rowHeaders, new TupleInterface[] {tuple6, tuple7}); AxisInterface slicerAxis = new Axis(AxisInterface.SLICERSAXIS, slicerHeaders, new TupleInterface[] {tuple8}); AxisInterface[] axes = {columnAxis, rowAxis, slicerAxis}; //create an instance of result set metadata with the axes ResultSetMetadata rsma = new ResultSetMetadata(axes); // create cell values Object[] cells = new Object[] {new Double(20000.0), new Double(47000.0), new Double(52000.0), new Double(20000.0), new Double(24000.00), new Double(10000.0), new Double(40000.0), new Double(2000.0), new Double(30000.0), new Double(36000.0)}; ResultSet rs = new ResultSet(); rs.setResultSetMetadata(rsma); rs.setCells(0, OLAPDataSet.DEFAULT_ENDCELL, cells); // create an olap model (that attaches to the viewer) using the result set OLAPDataSet OLAPDataSet = new OLAPDataSet(rs);
OLAPDataSet
,
ResultSetMetadata
Field Summary |
---|
Fields inherited from interface com.sas.storage.olap.ResultSetInterface |
---|
DEFAULT_END_CELL, DEFAULT_ENDCELL |
Constructor Summary | |
---|---|
ResultSet()
|
|
ResultSet(ResultSetMetadataInterface rsm)
|
Method Summary | |
---|---|
void |
close()
Close the ResultSetInterface |
long |
getCellCount()
Return the cell count for this result set based on the tuples set. |
java.lang.Object[] |
getCells(long startCell,
long endCell)
Returns the data beginning with the startCell ordinal and ending with endCell. |
java.lang.String[] |
getFormattedCells(long startCell,
long endCell)
Returns the data beginning with the startCell ordinal and ending with endCell. |
java.lang.String |
getQueryStatement()
Returns the MDX query that defines this MultiDimensional dataset |
ResultSetMetadataInterface |
getResultSetMetadata()
Return the resultSetMetadata for this result set |
boolean |
isReadOnly()
return the readonly flag |
void |
removeCells(long startCell,
long endCell)
Remove a block of cells. |
void |
setCells(long startCell,
long endCell,
java.lang.Object[] values)
Add/Replace a block of cell values for the cells based on startOrdinal and endOrdinal. |
void |
setFormattedCells(long startCell,
long endCell,
java.lang.String[] values)
Sets the values for the cells |
void |
setResultSetMetadata(ResultSetMetadataInterface rsm)
Set the resultsetmetadata for this result set. |
Constructor Detail |
---|
public ResultSet() throws OLAPException
OLAPException
public ResultSet(ResultSetMetadataInterface rsm) throws OLAPException
OLAPException
Method Detail |
---|
public final ResultSetMetadataInterface getResultSetMetadata() throws OLAPException
getResultSetMetadata
in interface ResultSetInterface
OLAPException
public final java.lang.String getQueryStatement() throws OLAPException
getQueryStatement
in interface ResultSetInterface
OLAPException
public long getCellCount() throws OLAPException
getCellCount
in interface ResultSetInterface
OLAPException
public java.lang.Object[] getCells(long startCell, long endCell) throws OLAPException
getCells
in interface ResultSetInterface
startCell
- Ordinal position for starting cell inclusiveendCell
- Ordinal position for endCell where -1 means all remaining cells -inclusive
OLAPException
- if cannot get the cellspublic java.lang.String[] getFormattedCells(long startCell, long endCell) throws OLAPException
getFormattedCells
in interface ResultSetInterface
startCell
- Ordinal position for starting cellendCell
- Ordinal position for endCell where -1 means all remaining cells - inclusive
OLAPException
- if a database error occurspublic boolean isReadOnly() throws OLAPException
isReadOnly
in interface ResultSetInterface
OLAPException
public void setResultSetMetadata(ResultSetMetadataInterface rsm) throws OLAPException
resultsetmetadata
- for this result set
OLAPException
public void setFormattedCells(long startCell, long endCell, java.lang.String[] values) throws OLAPException
setFormattedCells
in interface ResultSetInterface
startCell
- beginning indexendCellending
- cellvalues
- Set the values for the cells. There is no distinction between formatted
and unformatted values for an embedded ResultSet. The same set of cellValues
will be returned for both getFormattedCells and getUnformattedCells.
OLAPException
public void setCells(long startCell, long endCell, java.lang.Object[] values) throws OLAPException
setCells
in interface ResultSetInterface
beginning
- cell ordinalending
- cell ordinalcellValues
- Sets the values for the cells. There is no distinction between formatted
and unformatted values for an embedded ResultSet. The same set of cellValues
will be returned for both getFormattedCells and getUnformattedCells.
OLAPException
- if the startcell ordinal is not in the result set.public void removeCells(long startCell, long endCell) throws OLAPException
startOrdinal
- of the cellendOrdinal
- of the cell
OLAPException
- if the cells cannot be removedpublic void close()
ResultSetInterface
close
in interface ResultSetInterface
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |