: Class JdbcBeanSerializer

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

Field Summary
`protected JdbcBeanInterface` | `bean` Our bean.
`protected JdbcBeanInterface[]` | `beans` The associated JdbcBean
`protected java.util.Vector` | `beantables` The tables/bean used to generate the SQL request (in the correct order)
`protected static int` | `EXCEPT`
`protected JdbcBeanSerializer` | `except_serializer`
`protected static java.util.Hashtable` | `foreignKeys` The Foreign keys <(class,class), String[]>
`protected static int` | `INTERSECT`
`protected JdbcBeanSerializer` | `intersect_serializer`
`protected boolean` | `modified` Bean modified?
`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)`

Method Summary
`protected java.lang.String` | `_computeSQLSelect(boolean all, java.lang.String select, java.lang.String[] properties)`
`protected void` | `appendForeignKeys(java.util.Vector tables, java.lang.StringBuffer buffer, java.beans.PropertyDescriptor[] pds, java.lang.String[] properties)`
`protected void` | `appendForeignKeys(java.util.Vector tables, java.lang.StringBuffer buffer, java.lang.String[] properties)`
`void` | `clean()` Clean cached properties (relative to our bean)
`protected static java.lang.String[]` | `computeForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)`
`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)`
`protected java.lang.String` | `computeSQLSelect(java.lang.String[] orderby, boolean[] asc, boolean all, java.lang.String select)`
`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()`
`protected static boolean` | `equalsForeignKeys(java.lang.String key1, java.lang.String key2)` toto_username == username
`JdbcBeanSerializer` | `except(JdbcBeanInterface ebean)`
`protected void` | `executeSQLQuery(java.lang.String sqlrequest)`
`protected int` | `executeSQLUpdate(java.lang.String sqlrequest)`
`boolean` | `exists()`
`protected void` | `finalize()` Called by the Garbage Collector.
`protected int` | `findColumn(java.util.Vector tables, java.sql.ResultSet result, java.lang.String colname)`
`boolean` | `first()` Go to the first row
`static java.lang.String[]` | `getForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)`
`protected JdbcBeanInterface[]` | `getJdbcBeans()`
`protected JdbcServer` | `getJdbcServer()`
`protected java.beans.PropertyDescriptor` | `getPropertyDescriptor(java.lang.String property)`
`protected java.lang.String[]` | `getSQLOperatorNValue(JdbcBeanInterface bean, java.beans.PropertyDescriptor pd)` Get the raw value of the given property, split the operator and the value and convert the raw value into a SQL value.
`protected java.lang.String` | `getSQLValue(JdbcBeanInterface bean, java.beans.PropertyDescriptor pd)` Get the SQL value of the given property.
`void` | `initBean()` Restore default value except for JdbcBean properties.
`boolean` | `insert()`
`JdbcBeanSerializer` | `intersect(JdbcBeanInterface ibean)`
`boolean` | `isLast()`
`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.
`static void` | `registerForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)`
`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.
`protected void` | `setPriority(int p)`
`JdbcBeanSerializer` | `union(JdbcBeanInterface ubean)`
`boolean` | `update(java.lang.String primarykey)`
`boolean` | `update(java.lang.String[] primarykeys)`
`protected void` | `updateForeignKeys(JdbcBeanInterface jbean)`
`protected boolean` | `updateProperties()`
`protected boolean` | `updateProperties(boolean all)`
`void` | `updateProperties(JdbcBeanInterface ubean)` Update our bean property with the given bean property (must be an instance of the same class).
`protected boolean` | `updateProperties(java.util.Vector tables, java.sql.ResultSet result)`
`protected boolean` | `updateProperties(java.util.Vector tables, java.sql.ResultSet result, boolean all)`

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

Field Detail

### modified

    protected boolean modified

  Bean modified?

### bean

    protected JdbcBeanInterface bean

  Our bean.

### beans

    protected JdbcBeanInterface[] beans

  The associated JdbcBean

### 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

### beantables

    protected java.util.Vector beantables

  The tables/bean used to generate the SQL request (in the correct order)

### foreignKeys

    protected static java.util.Hashtable foreignKeys

  The Foreign keys <(class,class), String[]>

Constructor Detail

### JdbcBeanSerializer

    public JdbcBeanSerializer(JdbcBeanInterface bean)

Method Detail

### registerForeignKeys

    public static void registerForeignKeys(java.lang.Class beanclass1,
                                           java.lang.Class beanclass2)

### getForeignKeys

    public static java.lang.String[] getForeignKeys(java.lang.Class beanclass1,
                                                    java.lang.Class beanclass2)

### computeForeignKeys

    protected static java.lang.String[] computeForeignKeys(java.lang.Class beanclass1,
                                                           java.lang.Class beanclass2)

### equalsForeignKeys

    protected static boolean equalsForeignKeys(java.lang.String key1,
                                               java.lang.String key2)

  toto_username == username

### 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.

### getSQLOperatorNValue

    protected java.lang.String[] getSQLOperatorNValue(JdbcBeanInterface bean,
                                                      java.beans.PropertyDescriptor pd)

  Get the raw value of the given property, split the operator and the value and convert the raw value into a SQL value.

  ie "~A.*" will become { " ~ " , "'A.*'" }

  Parameters:
    `bean` - the property holder
    `pd` - the property descriptor

### getSQLValue

    protected java.lang.String getSQLValue(JdbcBeanInterface bean,
                                           java.beans.PropertyDescriptor pd)

  Get the SQL value of the given property.
  Parameters:
    `bean` - the property holder
    `pd` - the property descriptor

### getJdbcBeans

    protected JdbcBeanInterface[] getJdbcBeans()

### appendForeignKeys

    protected void appendForeignKeys(java.util.Vector tables,
                                     java.lang.StringBuffer buffer,
                                     java.lang.String[] properties)
                              throws java.beans.IntrospectionException

### appendForeignKeys

    protected void appendForeignKeys(java.util.Vector tables,
                                     java.lang.StringBuffer buffer,
                                     java.beans.PropertyDescriptor[] pds,
                                     java.lang.String[] properties)
                              throws java.beans.IntrospectionException

### 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)

### computeSQLSelect

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

### computeSQLSelect

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

### _computeSQLSelect

    protected java.lang.String _computeSQLSelect(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()

### executeSQLQuery

    protected void executeSQLQuery(java.lang.String sqlrequest)
                            throws java.sql.SQLException

### executeSQLUpdate

    protected int executeSQLUpdate(java.lang.String sqlrequest)
                            throws java.sql.SQLException

### exists

    public boolean exists()

### 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

### setPriority

    protected void setPriority(int p)

### intersect

    public JdbcBeanSerializer intersect(JdbcBeanInterface ibean)

### union

    public JdbcBeanSerializer union(JdbcBeanInterface ubean)

### except

    public JdbcBeanSerializer except(JdbcBeanInterface ebean)

### insert

    public boolean insert()

### update

    public boolean update(java.lang.String primarykey)

### update

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

### delete

    public boolean delete()

### 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()

### clean

    public void clean()

  Clean cached properties (relative to our bean)

### initBean

    public void initBean()

  Restore default value except for JdbcBean properties.

### findColumn

    protected int findColumn(java.util.Vector tables,
                             java.sql.ResultSet result,
                             java.lang.String colname)
                      throws java.sql.SQLException

### updateProperties

    protected boolean updateProperties()

### updateProperties

    protected boolean updateProperties(boolean all)

### updateProperties

    protected boolean updateProperties(java.util.Vector tables,
                                       java.sql.ResultSet result)

### updateProperties

    protected boolean updateProperties(java.util.Vector tables,
                                       java.sql.ResultSet result,
                                       boolean all)

### 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

### getPropertyDescriptor

    protected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String property)

### updateForeignKeys

    protected void updateForeignKeys(JdbcBeanInterface jbean)

### 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