|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.w3c.tools.jdbc.JdbcBeanSerializer
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 |
protected boolean modified
protected JdbcBeanInterface bean
protected JdbcBeanInterface[] beans
protected static final int NOTHING
protected static final int INTERSECT
protected static final int UNION
protected static final int EXCEPT
protected int[] priority
protected JdbcBeanSerializer intersect_serializer
protected JdbcBeanSerializer union_serializer
protected JdbcBeanSerializer except_serializer
protected java.sql.ResultSet result
protected java.util.Vector beantables
protected static java.util.Hashtable foreignKeys
Constructor Detail |
public JdbcBeanSerializer(JdbcBeanInterface bean)
Method Detail |
public static void registerForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)
public static java.lang.String[] getForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)
protected static java.lang.String[] computeForeignKeys(java.lang.Class beanclass1, java.lang.Class beanclass2)
protected static boolean equalsForeignKeys(java.lang.String key1, java.lang.String key2)
protected void markModified(boolean modified)
protected boolean isModified()
public void propertyChange(java.beans.PropertyChangeEvent evt)
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.protected java.lang.String[] getSQLOperatorNValue(JdbcBeanInterface bean, java.beans.PropertyDescriptor pd)
ie "~A.*" will become { " ~ " , "'A.*'" }
bean
- the property holderpd
- the property descriptorprotected java.lang.String getSQLValue(JdbcBeanInterface bean, java.beans.PropertyDescriptor pd)
bean
- the property holderpd
- the property descriptorprotected JdbcBeanInterface[] getJdbcBeans()
protected void appendForeignKeys(java.util.Vector tables, java.lang.StringBuffer buffer, java.lang.String[] properties) throws java.beans.IntrospectionException
protected void appendForeignKeys(java.util.Vector tables, java.lang.StringBuffer buffer, java.beans.PropertyDescriptor[] pds, java.lang.String[] properties) throws java.beans.IntrospectionException
protected java.lang.String computeSQLCount(boolean all, boolean distinct, java.lang.String[] properties)
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 _computeSQLSelect(boolean all, java.lang.String select, java.lang.String[] properties)
protected java.lang.String computeSQLInsert()
protected java.lang.String computeSQLDelete()
protected java.lang.String computeSQLUpdate(java.lang.String[] primarykeys)
protected JdbcServer getJdbcServer()
protected void executeSQLQuery(java.lang.String sqlrequest) throws java.sql.SQLException
protected int executeSQLUpdate(java.lang.String sqlrequest) throws java.sql.SQLException
public boolean exists()
public int count()
public int count(java.lang.String[] properties)
properties
- The property namespublic int count(boolean all)
all
- (join with associated beans?)public int count(boolean all, boolean distinct)
all
- (join with associated beans?)distinct
- (SELECT DISTINCT?)public int count(boolean all, boolean distinct, java.lang.String[] properties)
all
- (join with associated beans?)distinct
- (SELECT DISTINCT?)properties
- The property namespublic void select()
public void select(boolean all)
all
- join with attached beans? (default is true)public void select(java.lang.String orderby)
orderby
- orderby rulepublic void select(java.lang.String orderby, boolean asc, boolean all)
orderby
- orderby ruleasc
- boolean if true orderby is ASC if false it it
DESC (relative to the orderby[] parameter)all
- join with attached beans? (default is true)public void select(java.lang.String orderby, boolean asc, boolean all, boolean distinct)
orderby
- orderby ruleasc
- 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)public void select(java.lang.String[] orderby)
orderby
- array of orderby rules (ASC by default)public void select(java.lang.String[] orderby, boolean[] asc, boolean all, boolean distinct)
orderby
- array of orderby rulesasc
- 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)public void select(java.lang.String[] orderby, boolean[] asc, boolean all, boolean distinct, java.lang.String[] toselect)
orderby
- array of orderby rulesasc
- 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 istoselect
- array of columns name to select
false)public void selectDistinct(java.lang.String column)
column
- the bean property to updateprotected void setPriority(int p)
public JdbcBeanSerializer intersect(JdbcBeanInterface ibean)
public JdbcBeanSerializer union(JdbcBeanInterface ubean)
public JdbcBeanSerializer except(JdbcBeanInterface ebean)
public boolean insert()
public boolean update(java.lang.String primarykey)
public boolean update(java.lang.String[] primarykeys)
public boolean delete()
public boolean first()
public boolean next()
public boolean isLast()
public void clean()
public void initBean()
protected int findColumn(java.util.Vector tables, java.sql.ResultSet result, java.lang.String colname) throws java.sql.SQLException
protected boolean updateProperties()
protected boolean updateProperties(boolean all)
protected boolean updateProperties(java.util.Vector tables, java.sql.ResultSet result)
protected boolean updateProperties(java.util.Vector tables, java.sql.ResultSet result, boolean all)
public void updateProperties(JdbcBeanInterface ubean)
ubean
- the bean to get new propertiesprotected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String property)
protected void updateForeignKeys(JdbcBeanInterface jbean)
protected void finalize() throws java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |