Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.tools.jdbc
Class JdbcBeanSerializer

    java.lang.Object
      |
      +--org.w3c.tools.jdbc.JdbcBeanSerializer

public class JdbcBeanSerializer
extends java.lang.Object
implements java.beans.PropertyChangeListener

Read http://www.w3.org/Jigsaw/Doc/Programmer/jspdb.html to know how to use this class.

Field Summary
`protected JdbcBeanInterface` | `bean` Our bean.
`protected static int` | `EXCEPT`
`protected JdbcBeanSerializer` | `except_serializer`
`protected static int` | `INTERSECT`
`protected JdbcBeanSerializer` | `intersect_serializer`
`protected static int` | `NOTHING` INTERSECT, UNION, EXCEPT.
`protected int[]` | `priority`
`protected java.sql.ResultSet` | `result` The ResultSet
`protected static int` | `UNION`
`protected JdbcBeanSerializer` | `union_serializer`

Constructor Summary
`JdbcBeanSerializer(JdbcBeanInterface bean)` Constructor

Method Summary
`void` | `clean()` Clean cached properties (relative to our bean)
`protected java.lang.String` | `computeSQLCount(boolean all, boolean distinct, java.lang.String[] properties)`
`protected java.lang.String` | `computeSQLDelete()`
`protected java.lang.String` | `computeSQLInsert()` Compute the SQL request necessary to update the Database.
`protected java.lang.String` | `computeSQLSelect(java.lang.String[] orderby, boolean[] asc, boolean all, java.lang.String select, java.lang.String[] properties)`
`protected java.lang.String` | `computeSQLUpdate(java.lang.String[] primarykeys)`
`int` | `count()` Count the number or row with columns matching the value of the bean properties.
`int` | `count(boolean all)` Count the number or row with columns matching the value of the bean properties.
`int` | `count(boolean all, boolean distinct)` Count the number or row with columns matching the value of the bean properties
`int` | `count(boolean all, boolean distinct, java.lang.String[] properties)` Count the number or row with columns matching the value of the given properties.
`int` | `count(java.lang.String[] properties)` Count the number or row with columns matching the value of the given properties.
`boolean` | `delete()` Delete the row relative to the current bean.
`JdbcBeanSerializer` | `except(JdbcBeanInterface ebean)` USE THIS METHOD ONLY BEFORE SELECT QUERIES.
`protected void` | `finalize()` Called by the Garbage Collector.
`boolean` | `first()` Go to the first row
`protected JdbcServer` | `getJdbcServer()`
`void` | `initBean()` Restore default value except for JdbcBean properties.
`boolean` | `insert()` Insert the current bean values in the associated table.
`JdbcBeanSerializer` | `intersect(JdbcBeanInterface ibean)` USE THIS METHOD ONLY BEFORE SELECT QUERIES.
`boolean` | `isLast()` Did we reached the last row?
`protected boolean` | `isModified()`
`protected void` | `markModified(boolean modified)`
`boolean` | `next()` Update our bean with the value of the next row
`void` | `propertyChange(java.beans.PropertyChangeEvent evt)` PropertyChangeListener implementation: This method gets called when a bound property is changed.
`void` | `removeExceptBean()` Remove the except bean
`void` | `removeIntersectBean()` Remove the intersect bean
`void` | `removeUnionBean()` Remove the union bean
`void` | `select()` Perform a sql select to update the beans properties.
`void` | `select(boolean all)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String orderby)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String[] orderby)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String[] orderby, boolean[] asc, boolean all, boolean distinct)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String[] orderby, boolean[] asc, boolean all, boolean distinct, java.lang.String[] toselect)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String orderby, boolean asc, boolean all)` Perform a sql select to update the beans properties.
`void` | `select(java.lang.String orderby, boolean asc, boolean all, boolean distinct)` Perform a sql select to update the beans properties.
`void` | `selectDistinct(java.lang.String column)` Perform a sql select to update only the given columns.
`JdbcBeanSerializer` | `union(JdbcBeanInterface ubean)` USE THIS METHOD ONLY BEFORE QUERIES.
`boolean` | `update(java.lang.String primarykey)` Update the row relative to our bean.
`boolean` | `update(java.lang.String[] primarykeys)` Update the row relative to our bean.
`void` | `updateProperties(JdbcBeanInterface ubean)` Update our bean property with the given bean property (must be an instance of the same class).

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### bean

    protected JdbcBeanInterface bean

  Our bean.

### NOTHING

    protected static final int NOTHING

  INTERSECT, UNION, EXCEPT.

### INTERSECT

    protected static final int INTERSECT

### UNION

    protected static final int UNION

### EXCEPT

    protected static final int EXCEPT

### priority

    protected int[] priority

### intersect_serializer

    protected JdbcBeanSerializer intersect_serializer

### union_serializer

    protected JdbcBeanSerializer union_serializer

### except_serializer

    protected JdbcBeanSerializer except_serializer

### result

    protected java.sql.ResultSet result

  The ResultSet

Constructor Detail

### JdbcBeanSerializer

    public JdbcBeanSerializer(JdbcBeanInterface bean)

  Constructor
  Parameters:
    `bean` - the JdbcBean to serialize

Method Detail

### markModified

    protected void markModified(boolean modified)

### isModified

    protected boolean isModified()

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent evt)

  PropertyChangeListener implementation: This method gets called when a bound property is changed.
  Specified by:
    propertyChange in interface java.beans.PropertyChangeListener
  Parameters:
    `evt` - A PropertyChangeEvent object describing the event source and the property that has changed.

### computeSQLCount

    protected java.lang.String computeSQLCount(boolean all,
                                               boolean distinct,
                                               java.lang.String[] properties)

### computeSQLSelect

    protected java.lang.String computeSQLSelect(java.lang.String[] orderby,
                                                boolean[] asc,
                                                boolean all,
                                                java.lang.String select,
                                                java.lang.String[] properties)

### computeSQLInsert

    protected java.lang.String computeSQLInsert()

  Compute the SQL request necessary to update the Database.
  Returns:
    a String

### computeSQLDelete

    protected java.lang.String computeSQLDelete()

### computeSQLUpdate

    protected java.lang.String computeSQLUpdate(java.lang.String[] primarykeys)

### getJdbcServer

    protected JdbcServer getJdbcServer()

### count

    public int count()

  Count the number or row with columns matching the value of the bean properties.
  Returns:
    an int

### count

    public int count(java.lang.String[] properties)

  Count the number or row with columns matching the value of the given properties.
  Parameters:
    `properties` - The property names
  Returns:
    an int

### count

    public int count(boolean all)

  Count the number or row with columns matching the value of the bean properties.
  Parameters:
    `all` - (join with associated beans?)
  Returns:
    an int

### count

    public int count(boolean all,
                     boolean distinct)

  Count the number or row with columns matching the value of the bean properties
  Parameters:
    `all` - (join with associated beans?)
    `distinct` - (SELECT DISTINCT?)
  Returns:
    an int

### count

    public int count(boolean all,
                     boolean distinct,
                     java.lang.String[] properties)

  Count the number or row with columns matching the value of the given properties.
  Parameters:
    `all` - (join with associated beans?)
    `distinct` - (SELECT DISTINCT?)
    `properties` - The property names
  Returns:
    an int

### select

    public void select()

  Perform a sql select to update the beans properties.

### select

    public void select(boolean all)

  Perform a sql select to update the beans properties.
  Parameters:
    `all` - join with attached beans? (default is true)

### select

    public void select(java.lang.String orderby)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - orderby rule

### select

    public void select(java.lang.String orderby,
                       boolean asc,
                       boolean all)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - orderby rule
    `asc` - boolean if true orderby is ASC if false it it DESC (relative to the orderby[] parameter)
    `all` - join with attached beans? (default is true)

### select

    public void select(java.lang.String orderby,
                       boolean asc,
                       boolean all,
                       boolean distinct)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - orderby rule
    `asc` - boolean if true orderby is ASC if false it it DESC (relative to the orderby[] parameter)
    `all` - join with attached beans? (default is true)
    `distinct` - if true, result won't have duplicate row (default is false)

### select

    public void select(java.lang.String[] orderby)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - array of orderby rules (ASC by default)

### select

    public void select(java.lang.String[] orderby,
                       boolean[] asc,
                       boolean all,
                       boolean distinct)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - array of orderby rules
    `asc` - array of boolean if true orderby is ASC if false it it DESC (relative to the orderby[] parameter)
    `all` - join with attached beans? (default is true)
    `distinct` - if true, result won't have duplicate row (default is false)

### select

    public void select(java.lang.String[] orderby,
                       boolean[] asc,
                       boolean all,
                       boolean distinct,
                       java.lang.String[] toselect)

  Perform a sql select to update the beans properties.
  Parameters:
    `orderby` - array of orderby rules
    `asc` - array of boolean if true orderby is ASC if false it it DESC (relative to the orderby[] parameter)
    `all` - join with attached beans? (default is true)
    `distinct` - if true, result won't have duplicate row (default is
    `toselect` - array of columns name to select false)

### selectDistinct

    public void selectDistinct(java.lang.String column)

  Perform a sql select to update only the given columns. (distinct flag is set as true.
  Parameters:
    `column` - the bean property to update

### intersect

    public JdbcBeanSerializer intersect(JdbcBeanInterface ibean)

  USE THIS METHOD ONLY BEFORE SELECT QUERIES. This will produce a select query with an INTERSECT statement in it using the values of the given bean.
  Parameters:
    `ibean` - the intersect bean

### union

    public JdbcBeanSerializer union(JdbcBeanInterface ubean)

  USE THIS METHOD ONLY BEFORE QUERIES. This will produce a select query with an UNION statement in it using the values of the given bean.
  Parameters:
    `ibean` - the intersect bean

### except

    public JdbcBeanSerializer except(JdbcBeanInterface ebean)

  USE THIS METHOD ONLY BEFORE SELECT QUERIES. This will produce a select query with an EXCEPT statement in it using the values of the given bean.
  Parameters:
    `ibean` - the intersect bean

### removeIntersectBean

    public void removeIntersectBean()

  Remove the intersect bean

### removeUnionBean

    public void removeUnionBean()

  Remove the union bean

### removeExceptBean

    public void removeExceptBean()

  Remove the except bean

### insert

    public boolean insert()

  Insert the current bean values in the associated table.
  Returns:
    false if the INSERT request failed.

### update

    public boolean update(java.lang.String primarykey)

  Update the row relative to our bean.
  Parameters:
    `primarykey` - The primary key of the SQL table
  Returns:
    false if the UPDATE request failed.

### update

    public boolean update(java.lang.String[] primarykeys)

  Update the row relative to our bean.
  Parameters:
    `primarykey` - The primary key of the SQL table
  Returns:
    false if the UPDATE request failed.

### delete

    public boolean delete()

  Delete the row relative to the current bean.
  Returns:
    false if the DELETE request failed.

### first

    public boolean first()

  Go to the first row
  Returns:
    false if there is no first row

### next

    public boolean next()

  Update our bean with the value of the next row
  Returns:
    false if there is no more row

### isLast

    public boolean isLast()

  Did we reached the last row?
  Returns:
    true if the last row is reached

### clean

    public void clean()

  Clean cached properties (relative to our bean)

### initBean

    public void initBean()

  Restore default value except for JdbcBean properties.

### updateProperties

    public void updateProperties(JdbcBeanInterface ubean)

  Update our bean property with the given bean property (must be an instance of the same class).
  Parameters:
    `ubean` - the bean to get new properties

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Called by the Garbage Collector.
  Overrides:
    finalize in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD