com.dynamide.db
Class RDBDatasource

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.db.SimpleDatasource
          extended by com.dynamide.db.RDBDatasource
All Implemented Interfaces:
IDatasource, IDatasourceBasic, IRowChangeListener, IGet

public class RDBDatasource
extends SimpleDatasource
implements IDatasource, IRowChangeListener


Nested Class Summary
static class RDBDatasource.ColMeta
           
 
Nested classes/interfaces inherited from class com.dynamide.db.SimpleDatasource
SimpleDatasource.SimpleDatasourceIterator
 
Field Summary
static int STATE_DISPLAY
           
static int STATE_INSERT
           
static int STATE_LOADING
           
static int STATE_UPDATE
           
 
Fields inherited from class com.dynamide.db.SimpleDatasource
m_propertiesTable
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Fields inherited from interface com.dynamide.db.IDatasource
AFTER, BEFORE, BEFORE_FIRST, BEGIN, END, ROW_COUNT_NOT_ALLOWED, ROW_INDEX_UNKNOWN
 
Constructor Summary
RDBDatasource()
           
RDBDatasource(DynamideObject owner)
           
RDBDatasource(DynamideObject owner, Session session, java.lang.String id)
           
 
Method Summary
 void addRowChangeListener(IRowChangeListener new_listener)
           
 void cancel()
          This method returns the state to DISPLAY, and doesn't unload the data; however, current edits will be lost.
 void edit()
           
 RDBDatabase getDatabase()
           
 Property getProperty(java.lang.String propertyName)
          %% this is funky, since right now all are stored as String name and value. isEvent is just lost, for example.
 IPropertyProvider getPropertyProvider()
           
 java.lang.String getPropertyStringValue(java.lang.String what)
           
 java.lang.String getState()
           
 Widget getWidget()
           
 boolean go(int distance)
          go(0) should go to the first row in the set, if supported, go(-1) should go back a row, if supported, go(1) should go forward a row if supported, go(IDatasource.END) should go to the last row in the set, leaving the last row active, that is, not after the last row, and all unsupported actions should simply be no-ops.
 void insert()
           
 void load()
           
 void load(java.lang.String sql)
           
 int loadFromResultSet(java.sql.ResultSet resultSet)
           
 void loadFromResultSetWReset(java.sql.ResultSet resultSet)
           
 void logError(java.lang.String msg, java.lang.Exception e)
           
 void logWarn(java.lang.String msg, java.lang.Exception e)
           
protected  void notifyRowChangeListeners(java.lang.Object oldValue, java.lang.Object newValue)
           
 void onRowChanged()
          Fired from superclass, we hook this to fire widget events.
 void onRowChanged(ChangeEvent event)
           
 boolean post()
          Post the modified or inserted row to the database.
 void registerColumnTypeMapper(java.lang.String datatype, java.lang.String classnameOfIColumnTypeMapper)
           
 void registerWithSession()
           
 void reload()
           
 void removeRowChangeListener(IRowChangeListener listener)
           
 void setDatabase(RDBDatabase new_value)
           
 Field setFieldValues(java.lang.String fieldName, java.lang.Object value, java.lang.String stringValue, java.lang.String sqltype)
           
 void setProperty(java.lang.String name, java.lang.String value)
          Rather than having a complicated interface to IDatasource, specialized behaviors can be set/retrieved using setProperty/getProperty, for example, "isMultiRowEditable".
 void setPropertyProvider(IPropertyProvider new_value)
           
 void setWidget(Widget new_value)
           
 void unregisterFromSession()
           
 void wireToMaster()
           
 
Methods inherited from class com.dynamide.db.SimpleDatasource
addColumn, addField, addField, addRow, clear, clearColumns, clearCurrentRow, clearRows, deleteRow, deleteRow, distanceToIndex, distanceToIndex, dump, dump, dumpErrorsHTML, dumpRow, dumpRow, dumpRow, fixCase, get, getCaseInsensitive, getCategoryID, getColumnNames, getColumnNamesList, getCurrentRow, getCurrentRowIndex, getDatasourceHelper, getField, getField, getFields, getID, getMetadataForColumn, getProperties, getRow, getRowCount, getSession, hasMore, insertRow, insertRow, isCurrentRow, isReadOnly, isRowCountAllowed, iterator, next, seek, seekBegin, seekEnd, setCaseInsensitive, setColumnNames, setCurrentRow, setFieldError, setFieldValue, setFieldValue, setReadOnly, setSession, toString, updateCurrentRowPointers
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, dump, dumpHTML, expand, finalize, findParentExpander, findParentPage, findParentSession, findTopParentPage, getDotName, getNextGetter, getObjectID, getOwner, getProfiler, isDebugEnabled, isInfoEnabled, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logWarn, logWarn, logWarn, logWarn, popLogContext, printf, printProfiler, profileEnter, profileLeave, pushLogContext, setDotName, setID, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.dynamide.db.IDatasource
clear, dumpErrorsHTML, get, getCurrentRowIndex, getDatasourceHelper, getField, getField, getFields, getID, getRowCount, insertRow, isReadOnly, isRowCountAllowed, iterator, seek, seekBegin, seekEnd, setFieldValue, setFieldValue
 

Field Detail

STATE_LOADING

public static final int STATE_LOADING
See Also:
Constant Field Values

STATE_DISPLAY

public static final int STATE_DISPLAY
See Also:
Constant Field Values

STATE_UPDATE

public static final int STATE_UPDATE
See Also:
Constant Field Values

STATE_INSERT

public static final int STATE_INSERT
See Also:
Constant Field Values
Constructor Detail

RDBDatasource

public RDBDatasource()

RDBDatasource

public RDBDatasource(DynamideObject owner)

RDBDatasource

public RDBDatasource(DynamideObject owner,
                     Session session,
                     java.lang.String id)
Method Detail

getState

public java.lang.String getState()

getWidget

public Widget getWidget()

setWidget

public void setWidget(Widget new_value)

logError

public void logError(java.lang.String msg,
                     java.lang.Exception e)

logWarn

public void logWarn(java.lang.String msg,
                    java.lang.Exception e)

registerWithSession

public void registerWithSession()

unregisterFromSession

public void unregisterFromSession()

registerColumnTypeMapper

public void registerColumnTypeMapper(java.lang.String datatype,
                                     java.lang.String classnameOfIColumnTypeMapper)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getPropertyProvider

public IPropertyProvider getPropertyProvider()

setPropertyProvider

public void setPropertyProvider(IPropertyProvider new_value)

getProperty

public Property getProperty(java.lang.String propertyName)
Description copied from class: SimpleDatasource
%% this is funky, since right now all are stored as String name and value. isEvent is just lost, for example.

Specified by:
getProperty in interface IDatasource
Overrides:
getProperty in class SimpleDatasource
See Also:
IDatasource.get(String)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
                 throws DatatypeException
Description copied from interface: IDatasource
Rather than having a complicated interface to IDatasource, specialized behaviors can be set/retrieved using setProperty/getProperty, for example, "isMultiRowEditable".

Specified by:
setProperty in interface IDatasource
Overrides:
setProperty in class SimpleDatasource
Throws:
DatatypeException

getPropertyStringValue

public java.lang.String getPropertyStringValue(java.lang.String what)

getDatabase

public RDBDatabase getDatabase()

setDatabase

public void setDatabase(RDBDatabase new_value)

setFieldValues

public Field setFieldValues(java.lang.String fieldName,
                            java.lang.Object value,
                            java.lang.String stringValue,
                            java.lang.String sqltype)
                     throws DatatypeException
Throws:
DatatypeException

insert

public void insert()

edit

public void edit()

cancel

public void cancel()
This method returns the state to DISPLAY, and doesn't unload the data; however, current edits will be lost. Call post() to commit edits or inserts.

Specified by:
cancel in interface IDatasource
Overrides:
cancel in class SimpleDatasource

go

public boolean go(int distance)
Description copied from interface: IDatasource
go(0) should go to the first row in the set, if supported, go(-1) should go back a row, if supported, go(1) should go forward a row if supported, go(IDatasource.END) should go to the last row in the set, leaving the last row active, that is, not after the last row, and all unsupported actions should simply be no-ops.

Specified by:
go in interface IDatasource
Overrides:
go in class SimpleDatasource
Returns:
true if navigation to a different row was achieved.

wireToMaster

public void wireToMaster()

onRowChanged

public void onRowChanged()
Fired from superclass, we hook this to fire widget events. Pass "this" as event.inputObject.

Specified by:
onRowChanged in interface IDatasource
Overrides:
onRowChanged in class SimpleDatasource

onRowChanged

public void onRowChanged(ChangeEvent event)
Specified by:
onRowChanged in interface IRowChangeListener

addRowChangeListener

public void addRowChangeListener(IRowChangeListener new_listener)

removeRowChangeListener

public void removeRowChangeListener(IRowChangeListener listener)

notifyRowChangeListeners

protected void notifyRowChangeListeners(java.lang.Object oldValue,
                                        java.lang.Object newValue)

post

public boolean post()
Post the modified or inserted row to the database. The beforePost event is fired, then the post then the afterPost event. To abort the post from the beforePost event, the ScriptEvent resultAction should be set to ScriptEvent.RA_THROW_EXCEPTION and the ScriptEvent.outputObject can be a java.lang.Exception, with an optional message.
  Example:
  <event name="page1_datasource1_beforePost" language="beanshell"><[!CDATA[
     if(...someBadCondition...){
         event.resultAction = RA_THROW_EXCEPTION;
         event.outputObject = new Exception("Bad Condition not allowed");
         return;
     }
  ]]></event>

Specified by:
post in interface IDatasource
Overrides:
post in class SimpleDatasource

reload

public void reload()
            throws java.sql.SQLException
Specified by:
reload in interface IDatasource
Overrides:
reload in class SimpleDatasource
Throws:
java.sql.SQLException

load

public void load()
          throws java.sql.SQLException
Throws:
java.sql.SQLException

load

public void load(java.lang.String sql)
          throws java.sql.SQLException
Throws:
java.sql.SQLException

loadFromResultSetWReset

public void loadFromResultSetWReset(java.sql.ResultSet resultSet)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

loadFromResultSet

public int loadFromResultSet(java.sql.ResultSet resultSet)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException


Copyright © 2001-2013 DYNAMIDE.COM. All Rights Reserved.