Java Doc for DBPersist.java in  » Groupware » hipergate » com » knowgate » dataobjs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » hipergate » com.knowgate.dataobjs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.knowgate.dataobjs.DBPersist

All known Subclasses:   com.knowgate.training.Subject,  com.knowgate.hipergate.MetaAttribute,  com.knowgate.hipergate.CategoryLabel,  com.knowgate.scheduler.Atom,  com.knowgate.hipergate.InvoiceLine,  com.knowgate.projtrack.Duty,  com.knowgate.billing.Account,  com.knowgate.hipergate.Shop,  com.knowgate.crm.SalesMan,  com.knowgate.hipergate.OrderLine,  com.knowgate.hipergate.AbstractOrder,  com.knowgate.dataxslt.db.PageSetDB,  com.knowgate.training.Course,  com.knowgate.addrbook.Room,  com.knowgate.addrbook.FellowTitle,  com.knowgate.crm.Company,  com.knowgate.hipergate.BankAccount,  com.knowgate.projtrack.Project,  com.knowgate.hipergate.ProductFare,  com.knowgate.hipergate.Address,  com.knowgate.crm.WelcomePack,  com.knowgate.scheduler.Job,  com.knowgate.hipergate.Keyword,  com.knowgate.crm.WelcomePackChangeLog,  com.knowgate.addrbook.ToDo,  com.knowgate.projtrack.Bug,  com.knowgate.training.Evaluation,  com.knowgate.crm.SalesObjectives,  com.knowgate.crm.Oportunity,  com.knowgate.hipergate.ProductAttribute,  com.knowgate.forums.Subscription,  com.knowgate.training.AcademicCourse,  com.knowgate.forums.NewsMessage,  com.knowgate.acl.ACLUser,  com.knowgate.crm.DistributionList,  com.knowgate.projtrack.ProjectCost,  com.knowgate.crm.Attachment,  com.knowgate.hipergate.Term,  com.knowgate.acl.ACLPwd,  com.knowgate.crm.Contact,  com.knowgate.acl.ACLDomain,  com.knowgate.crm.PhoneCall,  com.knowgate.hipergate.Image,  com.knowgate.dataxslt.db.MicrositeDB,  com.knowgate.acl.ACLGroup,  com.knowgate.hipermail.MailAccount,  com.knowgate.crm.MemberAddress,  com.knowgate.hipergate.ProductLocation,  com.knowgate.hipergate.DespatchAdviceLine,  com.knowgate.hipergate.QueryByForm,  com.knowgate.training.AcademicCourseBooking,  com.knowgate.hipergate.Product,  com.knowgate.hipergate.ProductKeyword,  com.knowgate.training.AcademicCourseAlumni,  com.knowgate.training.Absentism,  com.knowgate.workareas.WorkArea,  com.knowgate.addrbook.Fellow,  com.knowgate.hipergate.Category,  com.knowgate.crm.Note,  com.knowgate.addrbook.Meeting,
DBPersist
public class DBPersist implements Map(Code)

Core class for persisting Java objects as registers in a RDMS.

Althought not an abstract class, DBPersist is mainly designed to be inherited by a child class implementing specific behavior for reading a writting a Java object from and to a relational database.

DBPersist mantains an internal collection of values each one mapped to a database field.

This mapping is done automatically by DBPersist reading the target table metadata definition and preparing the proper internal value set.

This object keeps the internal value set in memory as long as it is not garbage collected, but it does not mantaing any session information nor transaction management with the database. It is the programmer's responsability to pass an open database connection on each method call and to commit or rollback transaction involving the usage of a DBPersist object.
author:
   Sergio Montoro Ten
version:
   3.0



Field Summary
protected  HashMapAllVals
    
protected  StringsAuditCls
    
protected  StringsAuditUsr
    
protected  StringsTransactId
    

Constructor Summary
public  DBPersist(String sTableName, String sAuditClass)
    
public  DBPersist(String sTableName, String sAuditClass, boolean bAllValuesUpperCase)
    

Method Summary
public  voidallcaps(boolean bAllValuesUpperCase)
    
public  booleanallcaps()
    
protected  HashMapchangelog(DBPersist oOldInstance)
    
public  voidclear()
    
public  voidclone(DBPersist oSource)
    
public  booleancontainsKey(Object oKey)
    
public  booleancontainsValue(Object oKey)
     Returns true if any of this DBPersist fields has the specified value.
public  booleandelete(JDCConnection oConn)
    
public  SetentrySet()
    
public  booleanexists(JDCConnection oConn)
    
public  Objectget(String sKey)
    

Get value for a field name


Parameters:
  sKey - String Field Name Field value.
public  Objectget(Object oKey)
    

Get value for a field name


Parameters:
  sKey - String Field Name Field value.
public  StringgetAuditClassName()
    
public  DategetCreationDate(JDCConnection oConn)
    
public  java.util.DategetDate(String sKey)
    
public  StringgetDateFormated(String sKey, String sFormat)
    
public  StringgetDateShort(String sKey)
    
public  StringgetDateTime(String sKey)
    
public  StringgetDateTime24(String sKey)
    
public  BigDecimalgetDecimal(String sKey)
    
public  StringgetDecimalFormated(String sKey, String sPattern)
    
public  doublegetDouble(String sKey)
    
public  StringgetDoubleFormated(String sKey, String sPattern)
    
public  floatgetFloat(String sKey)
    
public  StringgetFloatFormated(String sKey, String sPattern)
    
public  intgetInt(String sKey)
    
public  IntegergetInteger(String sKey)
    
public  intgetIntervalPart(String sKey, String sPart)
    
public  HashMapgetItemMap()
    
public  SetgetItems()
    
public  MoneygetMoney(String sKey)
    
public  java.sql.DategetSQLDate(String sKey)
    
public  TimegetSQLTime(String sKey)
    
public  shortgetShort(String sKey)
    
public  StringgetString(String sKey)
    
public  StringgetStringNull(String sKey, String sDefault)
    

Get value for a CHAR, VARCHAR or LONGVARCHAR field replacing null with a default value.


Parameters:
  sKey - Field Name
Parameters:
  sDefault - Value to be returned if field is null.

public  DBTablegetTable()
    
public  DBTablegetTable(JDCConnection oConn)
     Get DBTable object witch holds this DBPersist registers.
Parameters:
  oConn - JDBC Database Connection DBTable object where data is storedor null if the table does not exist at the database.
throws:
  IllegalStateException - DBPersist uses the internal static table mapfrom DBBind.
public  StringgetTableName()
    
public  StringgetTime(String sKey)
    
public  TimegetTimeOfDay(String sKey)
    
public  TimestampgetTimestamp(String sKey)
    
protected static  StringgetUIdFromName(JDCConnection oConn, Integer iDomainId, String sInstanceNm, String sStoredProc)
    
public  booleanisEmpty()
    
public  booleanisNull(String sKey)
     Test is a readed field was null.
public  Iteratoriterator()
    
public  SetkeySet()
    
public  booleanload(JDCConnection oConn, Object[] PKVals)
    
public  booleanload(JDCConnection oConn, String sKey)
    
public  voidparseXML(String sXMLFilePath)
    
public  voidput(String sKey, String sVal)
    
public  voidput(String sKey, Object oObj)
    
public  Objectput(Object sKey, Object oObj)
    

Set value at internal collection

If internal collection previously contained a mapping for this key, the old value is replaced.
public  voidput(String sKey, int iVal)
    
public  voidput(String sKey, short iVal)
    
public  voidput(String sKey, Date dtVal)
    
public  voidput(String sKey, Time tmVal)
    
public  voidput(String sKey, String sDate, SimpleDateFormat oPattern)
    
public  voidput(String sKey, double dVal)
    
public  voidput(String sKey, BigDecimal oDecVal)
    
public  voidput(String sKey, String sDecVal, DecimalFormat oPattern)
    
public  voidput(String sKey, float fVal)
    
public  voidput(String sKey, Money mVal)
    
public  voidput(String sKey, File oFile)
    
public  voidput(String sKey, byte[] aBytes)
    
public  voidput(String sKey, char[] aChars)
    
public  voidput(String sKey, String sData, int iSQLType)
    

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  sData - Field Value as a String.
public  voidputAll(Properties oPropsCollection)
    
public  voidputAll(Map oMap)
    
public  voidremove(String sKey)
    
public  Objectremove(Object oKey)
    
public  voidreplace(String sKey, Object oObj)
    
public  voidreplace(String sKey, int iVal)
    
public  voidreplace(String sKey, short iVal)
    
public  voidreplace(String sKey, float fVal)
    
public  voidsetAuditTransact(String sAuditTransact)
     Set transaction id for automatic operation auditing.
public  voidsetAuditUser(String sAuditUser)
     Set user id for automatic operation auditing.
public  intsize()
    
public  booleanstore(JDCConnection oConn)
    

Store a register at database representing this instance of DBPersist

Insertions and updates : The store method automatically manages register insertions and updates.

public  voidtoLowerCase(String sKey)
    
public  voidtoUpperCase(String sKey)
    
protected  StringtoXML(String sIdent, String sDelim, HashMap oAttrs)
    
public  StringtoXML(String sIdent, String sDelim)
    
public  StringtoXML(String sIdent)
    

Get an XML dump for the DBPersist values.

Lines are delimited by a single Line Feed CHR(10) '\n' character.


Parameters:
  sIdent - Number of blank spaces for left padding at every line.
public  StringtoXML()
    
public  Collectionvalues()
    

Field Detail
AllVals
protected HashMap AllVals(Code)



sAuditCls
protected String sAuditCls(Code)



sAuditUsr
protected String sAuditUsr(Code)



sTransactId
protected String sTransactId(Code)




Constructor Detail
DBPersist
public DBPersist(String sTableName, String sAuditClass) throws IllegalStateException(Code)
Create instance for reading and writing register from a table
Parameters:
  sTable - Database table name for storing objects.
Parameters:
  sAuditClass - Name of child Java class inheriting from DBPersist.
throws:
  IllegalStateException -



DBPersist
public DBPersist(String sTableName, String sAuditClass, boolean bAllValuesUpperCase) throws IllegalStateException(Code)
Create instance for reading and writing register from a table
Parameters:
  sTable - Database table name for storing objects.
Parameters:
  sAuditClass - Name of child Java class inheriting from DBPersist.
Parameters:
  bAllValuesUpperCase - Convert all put string values to uppercase
throws:
  IllegalStateException -
since:
   3.0




Method Detail
allcaps
public void allcaps(boolean bAllValuesUpperCase)(Code)
Automatically convert put string values to uppercase
Parameters:
  bAllValuesUpperCase - boolean
since:
   3.0



allcaps
public boolean allcaps()(Code)
Get allcaps state boolean
since:
   3.0



changelog
protected HashMap changelog(DBPersist oOldInstance)(Code)
Compares two objects and returns a Map of their differences
Parameters:
  oOldInstance - DBPersist HashMap



clear
public void clear()(Code)

Clears internal values.

No register is deleted at the database.




clone
public void clone(DBPersist oSource)(Code)

Copy another DBPersist into this instance

Table and audit class values are replaced with to ones from source object
Parameters:
  oSource - Source Object
since:
   2.2



containsKey
public boolean containsKey(Object oKey) throws NullPointerException(Code)
Returns true if this DBPersist contains a field for the given name
Parameters:
  oKey - Field Name boolean
throws:
  NullPointerException - If oKey is null
since:
   2.2



containsValue
public boolean containsValue(Object oKey)(Code)
Returns true if any of this DBPersist fields has the specified value.
Parameters:
  oKey - Object whose presence in this map is to be tested boolean
since:
   2.2



delete
public boolean delete(JDCConnection oConn) throws SQLException(Code)

Delete a register from database

The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.


Parameters:
  oConn - Database connection true if register was successfully erased, false if not.
throws:
  SQLException -



entrySet
public Set entrySet()(Code)
Field Values Set
since:
   2.2



exists
public boolean exists(JDCConnection oConn) throws SQLException(Code)

Find out whether or not a particular register exists at database


Parameters:
  oConn - database connection true if a register exists a DBPersist base table witchprimary key coincides with the one set in memory for the DBPersist.
throws:
  SQLException -



get
public Object get(String sKey)(Code)

Get value for a field name


Parameters:
  sKey - String Field Name Field value. If field is null or DBPersist has not been loaded,or no field with given name exists at table, get() returns null.



get
public Object get(Object oKey) throws NullPointerException(Code)

Get value for a field name


Parameters:
  sKey - String Field Name Field value. If field is null or DBPersist has not been loaded,or no field with given name exists at table, get() returns null.
throws:
  NullPointerException - If oKey is null
since:
   2.2



getAuditClassName
public String getAuditClassName()(Code)
Get audit class name Name of base table for this DBPersist



getCreationDate
public Date getCreationDate(JDCConnection oConn) throws SQLException(Code)
Get dt_created column of register corresponding to this DBPersist instace
Parameters:
  oConn - JDCConnection Date or null if no data is found
throws:
  SQLException - If table for this DBPersist does not have a column named dt_created



getDate
public java.util.Date getDate(String sKey) throws ClassCastException(Code)

Get value for a DATETIME field


Parameters:
  sKey - Field Name Date value or null.
throws:
  ClassCastException - if sKey field is not of type DATETIME




getDateFormated
public String getDateFormated(String sKey, String sFormat) throws ClassCastException(Code)

Get value for a DATE, DATETIME or TIMESTAMP field formated a String


Parameters:
  sKey - Field Name
Parameters:
  sFormat - Date Format (like "yyyy-MM-dd HH:mm:ss") Formated date or null.
throws:
  ClassCastException - if sKey field is not of type DATE, DATETIME or TIMESTAMP
See Also:   java.text.SimpleDateFormat




getDateShort
public String getDateShort(String sKey) throws ClassCastException(Code)

Get DATE formated as ccyy-MM-dd


Parameters:
  sKey - Field Name
throws:
  ClassCastException - if sKey field is not of type DATE String value for Date or null.




getDateTime
public String getDateTime(String sKey)(Code)

Get value for a DATE, DATETIME or TIMESTAMP field formated a yyyy-MM-dd hh:mm:ss


Parameters:
  sKey - String Field Name String Formated date or null.
throws:
  ClassCastException - if sKey field is not of type DATE
since:
   3.0




getDateTime24
public String getDateTime24(String sKey)(Code)

Get value for a DATE, DATETIME or TIMESTAMP field formated a yyyy-MM-dd HH:mm:ss


Parameters:
  sKey - String Field Name String Formated date or null.
throws:
  ClassCastException - if sKey field is not of type DATE, DATETIME or TIMESTAMP
since:
   3.0




getDecimal
public BigDecimal getDecimal(String sKey) throws ClassCastException, NumberFormatException(Code)

Get value for a DECIMAL or NUMERIC field


Parameters:
  sKey - Field Name Field value or null.
throws:
  java.lang.ClassCastException -
throws:
  java.lang.NumberFormatException -




getDecimalFormated
public String getDecimalFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)

Get decimal formated as a String using the given pattern and the symbols for the default locale


Parameters:
  sKey - Field Name
Parameters:
  sPattern - A non-localized pattern string, for example: "#0.00" String decimal value formated according to sPatern or null
throws:
  ClassCastException -
throws:
  NumberFormatException -
throws:
  NullPointerException - if sPattern is null
throws:
  IllegalArgumentException - if sPattern is invalid



getDouble
public double getDouble(String sKey) throws NullPointerException, NumberFormatException(Code)

Get value for a DOUBLE or NUMBER([1..28],m) field


Parameters:
  sKey - Field Name Field value.
throws:
  NullPointerException - if field is null or no field withsuch name was found at internal value collection.
throws:
  NumberFormatException -




getDoubleFormated
public String getDoubleFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)

Get double formated as a String using the given pattern and the symbols for the default locale


Parameters:
  sKey - Field Name
Parameters:
  sPattern - A non-localized pattern string, for example: "#0.00" String decimal value formated according to sPatern or null
throws:
  ClassCastException -
throws:
  NumberFormatException -
throws:
  NullPointerException -
throws:
  IllegalArgumentException -



getFloat
public float getFloat(String sKey) throws NullPointerException, NumberFormatException(Code)

Get value for a FLOAT or NUMBER([1..28],m) field


Parameters:
  sKey - Field Name Field value.
throws:
  NullPointerException - if field is null or no field withsuch name was found at internal value collection.
throws:
  NumberFormatException -




getFloatFormated
public String getFloatFormated(String sKey, String sPattern) throws ClassCastException, NumberFormatException, NullPointerException, IllegalArgumentException(Code)

Get float formated as a String using the given pattern and the symbols for the default locale


Parameters:
  sKey - Field Name
Parameters:
  sPattern - A non-localized pattern string, for example: "#0.00" String decimal value formated according to sPatern or null
throws:
  ClassCastException -
throws:
  NumberFormatException -
throws:
  NullPointerException -
throws:
  IllegalArgumentException -



getInt
public int getInt(String sKey) throws NullPointerException, NumberFormatException(Code)

Get value for a INTEGER or NUMBER([1..11]) field


Parameters:
  sKey - Field Name Field value.
throws:
  NullPointerException - if field is null or no field withsuch name was found at internal value collection.
throws:
  NumberFormatException -




getInteger
public Integer getInteger(String sKey) throws NumberFormatException(Code)

Get value for a INTEGER or NUMBER([1..11]) field


Parameters:
  sKey - Field Name Field value or null.
throws:
  NumberFormatException -




getIntervalPart
public int getIntervalPart(String sKey, String sPart) throws NullPointerException, NumberFormatException, IllegalArgumentException(Code)

Get a part of an interval value

This function only works for PostgreSQL
Parameters:
  sKey - String String Field Name
Parameters:
  sPart - String Currently, only "days" is allowed as interval part int Number of days in the given interval
throws:
  NullPointerException - if interval is null
throws:
  IllegalArgumentException - is sPart is not "days"
throws:
  NumberFormatException - if interval has no days
since:
   3.0



getItemMap
public HashMap getItemMap()(Code)
Values Map



getItems
public Set getItems()(Code)
Field Names Set



getMoney
public Money getMoney(String sKey) throws NumberFormatException(Code)

Get value of a VARCHAR field that holds a money+currency amount

Money values are stored with its currency sign embedded inside, like "26.32 USD" or "$48.3" or "35.44 €"
Parameters:
  sKey - Field Name com.knowgate.math.Money
throws:
  NumberFormatException -
since:
   3.0




getSQLDate
public java.sql.Date getSQLDate(String sKey) throws ClassCastException(Code)

Get value for a DATE field


Parameters:
  sKey - Field Name java.sql.Date
throws:
  ClassCastException - if sKey field is not of type DATE, DATETIME or TIMESTAMP
since:
   3.0




getSQLTime
public Time getSQLTime(String sKey) throws ClassCastException(Code)

Get value for a TIME field


Parameters:
  sKey - Field Name java.sql.Time
throws:
  ClassCastException -
since:
   3.0




getShort
public short getShort(String sKey) throws java.lang.NullPointerException(Code)

Get value for a SMALLINT field


Parameters:
  sKey - Field Name Field value.
throws:
  NullPointerException - if field is null or no field withsuch name was found at internal value collection.




getString
public String getString(String sKey) throws NullPointerException(Code)

Get value for a CHAR, VARCHAR or LONGVARCHAR field


Parameters:
  sKey - Field Name Field value or null.
throws:
  NullPointerException - if field is null or no field withsuch name was found at internal value collection.




getStringNull
public String getStringNull(String sKey, String sDefault)(Code)

Get value for a CHAR, VARCHAR or LONGVARCHAR field replacing null with a default value.


Parameters:
  sKey - Field Name
Parameters:
  sDefault - Value to be returned if field is null. sDefault may itselfbe null, provinding a null safe version of getString() method. Field value or default value.




getTable
public DBTable getTable()(Code)
DBTable object where data is storedor null if the table does not exist at the database.DBPersist.getTable(JDCConnection) getTable(JDCConnection)



getTable
public DBTable getTable(JDCConnection oConn) throws SQLException, IllegalStateException(Code)
Get DBTable object witch holds this DBPersist registers.
Parameters:
  oConn - JDBC Database Connection DBTable object where data is storedor null if the table does not exist at the database.
throws:
  IllegalStateException - DBPersist uses the internal static table mapfrom DBBind. The internal DBBind table map is loaded upon first call toa DBBind constructor. Thus, if a DBPersist object is instantiated beforeinstantiating any DBBind object, the internal table map will not bepreloaded and an IllegalStateException will be raised.
since:
   2.0



getTableName
public String getTableName()(Code)
Get base table name Name of base table for this DBPersist



getTime
public String getTime(String sKey) throws ClassCastException(Code)

Get time part of date as a String


Parameters:
  sKey - Field Name String HH24:MI:SS or null
throws:
  ClassCastException - if sKey field is not of type DATE



getTimeOfDay
public Time getTimeOfDay(String sKey)(Code)

Get value for SQL92 TIME field


Parameters:
  sKey - Field Name java.sql.Time
since:
   3.0



getTimestamp
public Timestamp getTimestamp(String sKey)(Code)

Get value for a DATETIME or TIMESTAMP field


Parameters:
  sKey - Field Name Field value or null.




getUIdFromName
protected static String getUIdFromName(JDCConnection oConn, Integer iDomainId, String sInstanceNm, String sStoredProc) throws SQLException(Code)

Internal method for being called by inherited classes

Searches an object instance GUID from its unique name


Parameters:
  oConn - Database Connection
Parameters:
  iDomainId - Domain Identifier
Parameters:
  sInstanceNm - Instance Name
Parameters:
  sStoredProc - Stored Procedure or PL/pgSQL Function Name Global Unique Identifier of instance been searched or nullif no instance was found with such name.
throws:
  SQLException -



isEmpty
public boolean isEmpty()(Code)
Returns whether or not this DBPersist contains no field values boolean



isNull
public boolean isNull(String sKey)(Code)
Test is a readed field was null.
Parameters:
  sKey - Field Name true if readed field was null or if no field with given namewas found at internal collection.



iterator
public Iterator iterator()(Code)
Iterator for values stored in-memory at this DBPersist.



keySet
public Set keySet()(Code)
Field Names Set
since:
   2.2



load
public boolean load(JDCConnection oConn, Object[] PKVals) throws SQLException(Code)

Load the internal value set from a register at a database table


Parameters:
  oConn - Database Connection
Parameters:
  PKVals - Primary key values in order of appearance true if a register was found, false if no register wasfound with such primary key.
throws:
  SQLException -



load
public boolean load(JDCConnection oConn, String sKey) throws SQLException(Code)

Load the internal value set from a register at a database table


Parameters:
  oConn - JDCConnection
Parameters:
  sKey - String Primary key value true if a register was found, false if no register wasfound with such primary key.
throws:
  SQLException -
since:
   3.0



parseXML
public void parseXML(String sXMLFilePath) throws SAXException, SAXNotRecognizedException, SAXNotSupportedException, SAXParseException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException(Code)

Load an XML String into DBPersist internal collection.

Each tag ... found will be stored as a DBPersist value.

Example of input file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ACLUser>
  <gu_user>32f4f56fda343a5898c15a021203dd82</gu_user>
  <id_domain>1026</id_domain>
  <nm_user>The 7th Guest</nm_user>
  <tx_pwd>123456</tx_pwd>
  <tx_main_email>guest7@domain.com</tx_main_email>
  <tx_alt_email>admin@hipergate.com</tx_alt_email>
  <dt_last_updated>Fri, 29 Aug 2003 13:30:00 GMT+0130</dt_last_updated>
  <tx_comments><![CDATA[Sôme ñasti & ïnternational chars stuff]]></tx_comments>
</ACLUser>


Parameters:
  sXMLFilePath - XML Path to XML file to parse
throws:
  SAXException -
throws:
  SAXNotRecognizedException -
throws:
  SAXNotSupportedException -
throws:
  SAXParseException -
throws:
  IOException -
throws:
  ClassNotFoundException -
throws:
  IllegalAccessException -
throws:
  InstantiationException -



put
public void put(String sKey, String sVal) throws NullPointerException(Code)

Set value at internal collection

If allcaps is set tu true then sVal is converted to uppercase
Parameters:
  sKey - Field Name
Parameters:
  sVal - Field Value
throws:
  NullPointerException - If sKey is null



put
public void put(String sKey, Object oObj) throws NullPointerException(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  oObj - Field Value
throws:
  NullPointerException - If sKey is null



put
public Object put(Object sKey, Object oObj) throws NullPointerException(Code)

Set value at internal collection

If internal collection previously contained a mapping for this key, the old value is replaced.
Parameters:
  sKey - Field Name
Parameters:
  oObj - Field Value previous value associated with specified key, or null if there was no mapping for key
throws:
  NullPointerException - If sKey is null
since:
   2.2



put
public void put(String sKey, int iVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  iVal - Field Value



put
public void put(String sKey, short iVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  iVal - Field Value



put
public void put(String sKey, Date dtVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  dtVal - Field Value



put
public void put(String sKey, Time tmVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  tmVal - Field Value
since:
   3.0



put
public void put(String sKey, String sDate, SimpleDateFormat oPattern) throws ParseException(Code)
Put Date value using specified format
Parameters:
  sKey - String Field Name
Parameters:
  sDate - String Field Value as String
Parameters:
  oPattern - SimpleDateFormat Date format to be used
since:
   3.0



put
public void put(String sKey, double dVal)(Code)

Put double value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  dVal - Field Value



put
public void put(String sKey, BigDecimal oDecVal)(Code)

Put BigDecimal value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  oDecVal - Field Value



put
public void put(String sKey, String sDecVal, DecimalFormat oPattern) throws ParseException(Code)
Parse BigDecimal value and put it at internal collection
Parameters:
  sKey - String Field Name
Parameters:
  sDecVal - Field Name as String
Parameters:
  oPattern - DecimalFormat
throws:
  ParseException -
since:
   3.0



put
public void put(String sKey, float fVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  fVal - Field Value



put
public void put(String sKey, Money mVal)(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  mVal - Field Value
since:
   3.0



put
public void put(String sKey, File oFile) throws FileNotFoundException(Code)

Set reference to a binary file for a long field


Parameters:
  sKey - Field Name
Parameters:
  oFile - File Object
throws:
  FileNotFoundException -



put
public void put(String sKey, byte[] aBytes)(Code)

Set reference to a byte array for a long field

Use this method only for binding LONGVARBINARY or BLOB fields


Parameters:
  sKey - Field Name
Parameters:
  aBytes - byte array



put
public void put(String sKey, char[] aChars)(Code)

Set reference to a character array for a long field

Use this method only for binding LONGVARCHAR or CLOB fields


Parameters:
  sKey - Field Name
Parameters:
  aChars - char array



put
public void put(String sKey, String sData, int iSQLType) throws FileNotFoundException, IllegalArgumentException, NullPointerException(Code)

Set value at internal collection


Parameters:
  sKey - Field Name
Parameters:
  sData - Field Value as a String. If iSQLType is BLOB or LONGVARBINARYthen sData is interpreted as a full file path uri.
Parameters:
  iSQLType - SQL Type for field
throws:
  NullPointerException - If sKey is null
throws:
  IllegalArgumentException - If SQL Type is not recognized.Recognized types are { CHAR, VARCHAR, LONGVARCHAR, CLOB, INTEGER, SMALLINT,DATE, TIMESTAMP, DOUBLE, FLOAT, REAL, DECIMAL, NUMERIC, BLOB, LONGVARBINARY }



putAll
public void putAll(Properties oPropsCollection) throws FileNotFoundException(Code)

Load values from a Properties object




putAll
public void putAll(Map oMap)(Code)

Put values from a Map into this DBPersist instance

allcaps has no effect on input data when calling this method
Parameters:
  oMap -
since:
   2.2



remove
public void remove(String sKey)(Code)

Remove a value from internal collection


Parameters:
  sKey - Field Name



remove
public Object remove(Object oKey)(Code)

Remove a value from internal collection


Parameters:
  oKey - Field Name Object previos value associated with given field name
since:
   2.2



replace
public void replace(String sKey, Object oObj)(Code)

Replace a value from internal collection


Parameters:
  sKey - Field Name
Parameters:
  oObj - New Value



replace
public void replace(String sKey, int iVal)(Code)

Replace a value from internal collection


Parameters:
  sKey - Field Name
Parameters:
  iVal - New int value



replace
public void replace(String sKey, short iVal)(Code)

Replace a value from internal collection


Parameters:
  sKey - Field Name
Parameters:
  iVal - New short value



replace
public void replace(String sKey, float fVal)(Code)

Replace a value from internal collection


Parameters:
  sKey - Field Name
Parameters:
  iVal - New float value



setAuditTransact
public void setAuditTransact(String sAuditTransact)(Code)
Set transaction id for automatic operation auditing.



setAuditUser
public void setAuditUser(String sAuditUser)(Code)
Set user id for automatic operation auditing.



size
public int size()(Code)
Actual number of field values on this DBPersist int



store
public boolean store(JDCConnection oConn) throws SQLException(Code)

Store a register at database representing this instance of DBPersist

Insertions and updates : The store method automatically manages register insertions and updates. If the stored object already exists at database then it is updated, if it does not exists then it is inserted. A primary key violation error is never thrown so ther is no need to call delete() method before re-writing an existing object.

NULL fields : All values not set calling put() methods for DBPersist will be assumed to be NULL. If a not nullable field is not set then an SQLException will be raised.
On storing an already existing object all values will we overwrited, so is a DBPersist is not fully loaded before storing it, values not set by calling put() methods that already were present at database will be lost.


Parameters:
  oConn - Database Connection boolean true if register was stored for the first time,false if register already existed.
throws:
  SQLException -



toLowerCase
public void toLowerCase(String sKey)(Code)
Convert value kept with given key to lowercase
Parameters:
  sKey - String
since:
   3.0



toUpperCase
public void toUpperCase(String sKey)(Code)
Convert value kept with given key to uppercase
Parameters:
  sKey - String
since:
   3.0



toXML
protected String toXML(String sIdent, String sDelim, HashMap oAttrs) throws IllegalStateException(Code)

Get an XML dump for the DBPersist values


Parameters:
  sIdent - Number of blank spaces for left padding at every line.
Parameters:
  sDelim - Line delimiter (usually "\n" or "\r\n")
Parameters:
  oAttrs - Map of values to be added as attributes of the toplevel node XML String
throws:
  IllegalStateException - If XML method is invoked before DBPersist object is loaded
since:
   3.0



toXML
public String toXML(String sIdent, String sDelim) throws IllegalStateException(Code)

Get an XML dump for the DBPersist values


Parameters:
  sIdent - Number of blank spaces for left padding at every line.
Parameters:
  sDelim - Line delimiter (usually "\n" or "\r\n") XML String
throws:
  IllegalStateException - If XML method is invoked before DBPersist object is loaded



toXML
public String toXML(String sIdent)(Code)

Get an XML dump for the DBPersist values.

Lines are delimited by a single Line Feed CHR(10) '\n' character.


Parameters:
  sIdent - Number of blank spaces for left padding at every line. XML String



toXML
public String toXML()(Code)

Get an XML dump for the DBPersist values.

No left padding is placed to the left of each line.

Lines are delimited by a single Line Feed CHR(10) '\n' character.

XML String



values
public Collection values()(Code)
Values Collection
since:
   2.2



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.