Enterprise Information Portal APIs

com.ibm.mm.sdk.server
Class DKResultSetCursorOD

java.lang.Object
  |
  +--com.ibm.mm.sdk.server.dkAbstractResultSetCursor
        |
        +--com.ibm.mm.sdk.server.DKResultSetCursorOD
All Implemented Interfaces:
DKConstant, DKConstantOD, DKMessageId, DKMessageIdOD, dkResultSetCursor

public class DKResultSetCursorOD
extends dkAbstractResultSetCursor
implements DKConstantOD, DKMessageIdOD


Fields inherited from interface com.ibm.mm.sdk.common.DKConstantOD
    For details, see the class or interface
 
Fields inherited from interface com.ibm.mm.sdk.common.DKConstant
    For details, see the class or interface
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageIdOD
DK_OD_MSG_INIT_FAILED, DK_OD_MSG_INVALID_API, DK_OD_MSG_INVALID_CHOICE, DK_OD_MSG_INVALID_DATE, DK_OD_MSG_INVALID_DECIMAL, DK_OD_MSG_INVALID_INTEGER, DK_OD_MSG_INVALID_OPERATOR, DK_OD_MSG_INVALID_RANGE, DK_OD_MSG_INVALID_SEARCH, DK_OD_MSG_INVALID_SEGMENT_NUM, DK_OD_MSG_MSGID_NOT_FOUND, DK_OD_MSG_NO_VALUES_SPECIFIED, DK_OD_MSG_ONLY_ONE_VALUE_GIVEN, DK_OD_MSG_SERVER_TIMEOUT, DK_OD_MSG_UNDEFINED, DK_OD_MSG_UNKNOWN_ERROR, DK_OD_MSG_VALUE_NOT_SPECIFIED
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageId
    For details, see the class or interface
 
Method Summary
 void addObject(DKDDO ddo)
          Adds a new element of the same type, represented by the given DDO, to the datastore.
 int cardinality()
          Gets the number of elements in the resultset
 void close()
          Closes the cursor and invalidates the result set.
 void common(DKDatastoreOD ds, DKNVPair[] parms, DKNVPair[] options, java.lang.String sqlStr, PAppGrpSchemaOD schema)
           
 java.lang.String datastoreName()
          Gets the name of the datastore associated with the datastore definition to which the resultset cursor belongs
 java.lang.String datastoreType()
          Gets the type of the datastore associated with the datastore definition to which the resultset cursor belongs
 void deleteObject()
          Deletes the element at the current position from the datastore
 void destroy()
          Destroys the cursor.
 DKDDO fetchNext()
          Fetches the next element of the result set and returns it as a DDO.
 java.lang.Object fetchNextByName(java.lang.String dataItemName)
          Sets cursor to point to the position of the next data object and fetches the data item value in the cursor at that position by data item name.
 boolean fetchNextN(int how_many, dkCollection collection)
          Fetches the next N elements of the result set and inserts them in the given collection.
 boolean fetchNextNByName(java.lang.String dataItemName, int how_many, java.lang.Object[] array)
          Fetches the next N data item values of the cursor and inserts them into the given array
 DKDDO fetchObject()
          Fetches the element of the result set at the current position and returns it as a DDO.
 java.lang.Object fetchObjectByName(java.lang.String dataItemName)
          Fetches the data item value in the cursor at the current position by data item name
 DKDDO findObject(int position, java.lang.String predicate)
          Finds the data object which satisfies the given predicate, move the cursor to that position, fetch and return the data object.
 int getPosition()
          Gets the current position of the cursor
 DKHandle handle(int type)
          Gets the resultset handle that is associated with the resultset cursor by type.
 DKHandle handle(java.lang.String type)
          Gets a cursor handle
 boolean isBegin()
          Checks if the cursor is positioned at the beginning
 boolean isEnd()
          Checks if the cursor is positioned at the end
 boolean isInBetween()
          Checks if the cursor is positioned in between data objects in the result set
 boolean isOpen()
          Checks if the cursor is in the open state
 boolean isScrollable()
          Checks if the cursor can be scrolled forward and backward
 boolean isUpdatable()
          Checks if the cursor is updateable
 boolean isValid()
          Checks if the cursor is valid
 DKDDO newObject()
          Creates a new element of the same type
 void open()
          Opens the cursor, and if necessary, execute the query to get the the result set.
 void open(DKNVPair[] parms)
          Opens the cursor, and if necessary, execute the query to get the the result set.
 void setPosition(int position, java.lang.Object value)
          Sets the cursor to the given position
 void setToNext()
          Sets the cursor to point to the position of the next data object in the result set.
 void updateObject(DKDDO ddo)
          Updates the element at the current position in the datastore, using the given DDO.
 
Methods inherited from class com.ibm.mm.sdk.server.dkAbstractResultSetCursor
objectType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

common

public void common(DKDatastoreOD ds,
                   DKNVPair[] parms,
                   DKNVPair[] options,
                   java.lang.String sqlStr,
                   PAppGrpSchemaOD schema)
            throws DKException,
                   java.lang.Exception

isScrollable

public boolean isScrollable()
                     throws DKException,
                            java.lang.Exception
Checks if the cursor can be scrolled forward and backward
Overrides:
isScrollable in class dkAbstractResultSetCursor
Returns:
true if the cursor can be scrolled forward and backward. The default is non-scrollable.
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isUpdatable

public boolean isUpdatable()
                    throws DKException,
                           java.lang.Exception
Checks if the cursor is updateable
Overrides:
isUpdatable in class dkAbstractResultSetCursor
Returns:
true if the cursor is updateable
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isValid

public boolean isValid()
                throws DKException,
                       java.lang.Exception
Checks if the cursor is valid
Overrides:
isValid in class dkAbstractResultSetCursor
Returns:
true if the cursor is valid
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isOpen

public boolean isOpen()
               throws DKException,
                      java.lang.Exception
Checks if the cursor is in the open state
Overrides:
isOpen in class dkAbstractResultSetCursor
Returns:
true if the cursor is in the open state
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isBegin

public boolean isBegin()
                throws DKException,
                       java.lang.Exception
Checks if the cursor is positioned at the beginning
Overrides:
isBegin in class dkAbstractResultSetCursor
Returns:
true if the cursor is positioned at the beginning
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isEnd

public boolean isEnd()
              throws DKException,
                     java.lang.Exception
Checks if the cursor is positioned at the end
Overrides:
isEnd in class dkAbstractResultSetCursor
Returns:
true if the cursor is positioned at the end
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

isInBetween

public boolean isInBetween()
                    throws DKException,
                           java.lang.Exception
Checks if the cursor is positioned in between data objects in the result set
Overrides:
isInBetween in class dkAbstractResultSetCursor
Returns:
true If the cursor is positioned in between data objects in the result set. It is not at the begining, at the end, or pointing to a data object in the result set.
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

getPosition

public int getPosition()
                throws DKException,
                       java.lang.Exception
Gets the current position of the cursor
Overrides:
getPosition in class dkAbstractResultSetCursor
Returns:
the current position of the cursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

setPosition

public void setPosition(int position,
                        java.lang.Object value)
                 throws DKException,
                        java.lang.Exception
Sets the cursor to the given position
Overrides:
setPosition in class dkAbstractResultSetCursor
Parameters:
position - the value for the position

The valid positions are:

  • DK_ABSOLUTE - absolute position in the result set
  • DK_BEGIN - the beginning position of the result set
  • DK_END - the end of the result set
  • DK_FIRST - the first data object in the result set
  • DK_LAST - the last data object in the result set
  • DK_NEXT - the next data object from the current position
  • DK_PREVIOUS - the previous data object from the current position
  • DK_RELATIVE - relative position in the result set from the current position

value - a Long object

If the position is specified as DK_ABSOLUTE or DK_RELATIVE, the value parameter specifies the absolute or relative position value. For non-scrollable cursor, the valid positions are only DK_NEXT and DK_RELATIVE.

Throws:
DKException - if error defected
java.lang.Exception - if error dedected

setToNext

public void setToNext()
               throws DKException,
                      java.lang.Exception
Sets the cursor to point to the position of the next data object in the result set.
Overrides:
setToNext in class dkAbstractResultSetCursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

fetchObject

public DKDDO fetchObject()
                  throws DKException,
                         java.lang.Exception
Fetches the element of the result set at the current position and returns it as a DDO. If repeated, the same element will be returned.
Overrides:
fetchObject in class dkAbstractResultSetCursor
Returns:
the element of the result set at the current position
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

fetchNext

public DKDDO fetchNext()
                throws DKException,
                       java.lang.Exception
Fetches the next element of the result set and returns it as a DDO.
Overrides:
fetchNext in class dkAbstractResultSetCursor
Returns:
the next element of the result set
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

fetchNextN

public boolean fetchNextN(int how_many,
                          dkCollection collection)
                   throws DKException,
                          java.lang.Exception
Fetches the next N elements of the result set and inserts them in the given collection.
Overrides:
fetchNextN in class dkAbstractResultSetCursor
Parameters:
how_many - the number of elements to fetch
collection - the dkCollection object to hold the retrieved elements
Returns:
true if there is at least one data object returned. The number of elements in the returned collection maybe lesss than how_many if there is not enough memory. To process the entire result set, call fetchNextN() repeatedly until it returns false.
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

fetchObjectByName

public java.lang.Object fetchObjectByName(java.lang.String dataItemName)
                                   throws DKException,
                                          java.lang.Exception
Description copied from interface: dkResultSetCursor
Fetches the data item value in the cursor at the current position by data item name
Overrides:
fetchObjectByName in class dkAbstractResultSetCursor
Following copied from interface: com.ibm.mm.sdk.common.dkResultSetCursor
Parameters:
dataItemName - data item name
Returns:
data item value

fetchNextByName

public java.lang.Object fetchNextByName(java.lang.String dataItemName)
                                 throws DKException,
                                        java.lang.Exception
Description copied from interface: dkResultSetCursor
Sets cursor to point to the position of the next data object and fetches the data item value in the cursor at that position by data item name.
Overrides:
fetchNextByName in class dkAbstractResultSetCursor
Following copied from interface: com.ibm.mm.sdk.common.dkResultSetCursor
Parameters:
dataItemName - data item name
Returns:
data item value

fetchNextNByName

public boolean fetchNextNByName(java.lang.String dataItemName,
                                int how_many,
                                java.lang.Object[] array)
                         throws DKException,
                                java.lang.Exception
Description copied from interface: dkResultSetCursor
Fetches the next N data item values of the cursor and inserts them into the given array
Overrides:
fetchNextNByName in class dkAbstractResultSetCursor
Following copied from interface: com.ibm.mm.sdk.common.dkResultSetCursor
Parameters:
dataItemName - data item name
how_many - how many data item values the user wants to be returned in the collection.
array - the array where the data item values that are fetched are stored.
Returns:
false when no more data item values to return.

findObject

public DKDDO findObject(int position,
                        java.lang.String predicate)
                 throws DKException,
                        java.lang.Exception
Finds the data object which satisfies the given predicate, move the cursor to that position, fetch and return the data object.
Overrides:
findObject in class dkAbstractResultSetCursor
Parameters:
position - The valid positions for the scrollable cursor are DK_FIRST, DK_LAST, DK_NEXT, and DK_PREVIOUS. These positions are described in setPosition().

predicate - The prdicate string. The format of the predicate string is AttributeName RelOp Value, where RelOp are relational operators, such as =, ==, <=, >=, <, >, or <>.
Returns:
the DDO object that matches the search criteria
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

deleteObject

public void deleteObject()
                  throws DKException,
                         java.lang.Exception
Deletes the element at the current position from the datastore
Overrides:
deleteObject in class dkAbstractResultSetCursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

updateObject

public void updateObject(DKDDO ddo)
                  throws DKException,
                         java.lang.Exception
Updates the element at the current position in the datastore, using the given DDO. The type of cursor element must match with the type of DDO.
Overrides:
updateObject in class dkAbstractResultSetCursor
Parameters:
ddo - the given DDO object used to update the element
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

newObject

public DKDDO newObject()
                throws DKException,
                       java.lang.Exception
Creates a new element of the same type
Overrides:
newObject in class dkAbstractResultSetCursor
Returns:
the DDO object that's just created
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

addObject

public void addObject(DKDDO ddo)
               throws DKException,
                      java.lang.Exception
Adds a new element of the same type, represented by the given DDO, to the datastore.
Overrides:
addObject in class dkAbstractResultSetCursor
Parameters:
ddo - the given DDO object used to add the new element
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

open

public void open()
          throws DKException,
                 java.lang.Exception
Opens the cursor, and if necessary, execute the query to get the the result set. Open() resets the position to the beginning.
Overrides:
open in class dkAbstractResultSetCursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

close

public void close()
           throws DKException,
                  java.lang.Exception
Closes the cursor and invalidates the result set.
Overrides:
close in class dkAbstractResultSetCursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

destroy

public void destroy()
             throws DKException,
                    java.lang.Exception
Destroys the cursor. This method allows for cleanup, before the cursor is garbage-collected.
Overrides:
destroy in class dkAbstractResultSetCursor
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

open

public void open(DKNVPair[] parms)
          throws DKException,
                 java.lang.Exception
Opens the cursor, and if necessary, execute the query to get the the result set. Open() resets the position to the beginning.
Overrides:
open in class dkAbstractResultSetCursor
Parameters:
parms - the array of DKNVPair (name-value pair) objects that's used to check for combined query
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

datastoreName

public java.lang.String datastoreName()
                               throws java.lang.Exception
Gets the name of the datastore associated with the datastore definition to which the resultset cursor belongs
Overrides:
datastoreName in class dkAbstractResultSetCursor
Returns:
the name of the datastore
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

datastoreType

public java.lang.String datastoreType()
                               throws java.lang.Exception
Gets the type of the datastore associated with the datastore definition to which the resultset cursor belongs
Overrides:
datastoreType in class dkAbstractResultSetCursor
Returns:
the datastore type
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

handle

public DKHandle handle(int type)
                throws java.lang.Exception
Gets the resultset handle that is associated with the resultset cursor by type. The default type is DK_RSCURSOR_DEFAULT_HANDLE.
Overrides:
handle in class dkAbstractResultSetCursor
Returns:
The default resultset handle, if the default type is specified, and the handle is available. NULL is returned, if no handle is available.
Throws:
DKException - if error defected
java.lang.Exception - if error dedected

handle

public DKHandle handle(java.lang.String type)
                throws java.lang.Exception
Description copied from interface: dkResultSetCursor
Gets a cursor handle
Overrides:
handle in class dkAbstractResultSetCursor
Following copied from interface: com.ibm.mm.sdk.common.dkResultSetCursor
Parameters:
type - type of cursor handle wanted
Returns:
a cursor handle

cardinality

public int cardinality()
                throws java.lang.Exception
Gets the number of elements in the resultset
Overrides:
cardinality in class dkAbstractResultSetCursor
Returns:
the number of elements in the resultset
Throws:
java.lang.Exception - if error dedected

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.