Java Doc for PersistentHelper.java in  » J2EE » Jaffa » org » jaffa » persistence » util » 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 » J2EE » Jaffa » org.jaffa.persistence.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jaffa.persistence.util.PersistentHelper

PersistentHelper
public class PersistentHelper (Code)
Helper methods for persistent objects.




Method Summary
public static  voidcheckMandatoryFields(IPersistent object)
     This will check all the mandatory fields of the persistent object.
public static  booleanexists(UOW uow, IPersistent object)
     This will query the database to see if the primary-key of the input persistent object is already in use. It'll invoke the exists() method of the persistent class perform the check. Note: This method will determine the key fields by looking up the getKeyFields method in the corresponding meta class for the input persistent object.
Parameters:
  uow - The UOW object.
public static  StringgenerateSerializedKey(IPersistent object)
     This will generate a unique string for the input persistent object, based on the persistent class name and its key values. The format of the generated key will be: package.classname;key1value;key2value;key3value For eg: For a Person persistent object having a primary key PersonId, the serialized key could be "org.example.Person;P0021" For an EventEntry persistent object having a composite primary key of EventId and PersonId primary, the serialized key could be "org.example.EventEntry;E01;P0021" The back-slash '\' will be the escape character. Hence, if the key-value contains a '\', then it'll be replaced by '\\' If the key value contains a semi-colon, then it'll be replaced by '\;' Note: This method will determine the key fields by looking up the getKeyFields method in the corresponding meta class for the input persistent object.
Parameters:
  object - The persistent object.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
throws:
  IllegalArgumentException - if the input persistent class does not have any key-fields or if any of the key-fields is null.
public static  FieldMetaData[]getFieldMetaData(String persistentClassName)
     This returns an array of meta information for all the fields of the persistent class.
public static  FieldMetaDatagetFieldMetaData(String persistentClassName, String fieldName)
     Returns the FieldMetaData object from the meta class for the input persistent class for the input field.
public static  FieldMetaData[]getKeyFields(String persistentClassName)
     This returns an array of meta information for all the key fields of the persistent class.
public static  StringgetLabelToken(String persistentClassName)
     This returns the labelToken for a persistent class.
public static  StringgetLabelToken(String persistentClassName, String fieldName)
     This returns the labelToken for a field in a persistent class.
public static  FieldMetaData[]getMandatoryFields(String persistentClassName)
     This returns an array of meta information for all the mandatory fields of the persistent class.
public static  ClassgetMetaClass(String persistentClassName)
     This returns the corresponding meta class for the input persistent class. It assumes the name of the meta class by appending 'Meta' to the input persistent class.
Parameters:
  persistentClassName - The persistent class.
public static  IPersistentloadFromSerializedKey(UOW uow, String serializedKey)
     This will load the persistent object from the input serialized key, by invoking the findByPK() method of the persistent class encoded in the input String.
Parameters:
  uow - The UOW object.



Method Detail
checkMandatoryFields
public static void checkMandatoryFields(IPersistent object) throws ApplicationExceptions, FrameworkException(Code)
This will check all the mandatory fields of the persistent object. It utilises the corresponding Meta class for determining the mandatory fields.
Parameters:
  object - The persistent object.
throws:
  ApplicationExceptions - Will contain a collection of MandatoryFieldExceptions for the all the mandatory fields which do not have values.
throws:
  FrameworkException - If any framework error occurs.



exists
public static boolean exists(UOW uow, IPersistent object) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IllegalArgumentException, FrameworkException(Code)
This will query the database to see if the primary-key of the input persistent object is already in use. It'll invoke the exists() method of the persistent class perform the check. Note: This method will determine the key fields by looking up the getKeyFields method in the corresponding meta class for the input persistent object.
Parameters:
  uow - The UOW object. If null, then a UOW will be created implicitly by the exists() method to load the persistent object.
Parameters:
  object - The persistent object.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
throws:
  IllegalArgumentException - if the input persistent class does not have any key-fields
throws:
  FrameworkException - if the exists() method of the persistent class fails. true if the primary-key is already in use. A false will be returned if the key is not in use or if any of the key fields is null.



generateSerializedKey
public static String generateSerializedKey(IPersistent object) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IllegalArgumentException(Code)
This will generate a unique string for the input persistent object, based on the persistent class name and its key values. The format of the generated key will be: package.classname;key1value;key2value;key3value For eg: For a Person persistent object having a primary key PersonId, the serialized key could be "org.example.Person;P0021" For an EventEntry persistent object having a composite primary key of EventId and PersonId primary, the serialized key could be "org.example.EventEntry;E01;P0021" The back-slash '\' will be the escape character. Hence, if the key-value contains a '\', then it'll be replaced by '\\' If the key value contains a semi-colon, then it'll be replaced by '\;' Note: This method will determine the key fields by looking up the getKeyFields method in the corresponding meta class for the input persistent object.
Parameters:
  object - The persistent object.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
throws:
  IllegalArgumentException - if the input persistent class does not have any key-fields or if any of the key-fields is null. a unique String for identifying the persistent object.



getFieldMetaData
public static FieldMetaData[] getFieldMetaData(String persistentClassName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
This returns an array of meta information for all the fields of the persistent class.
Parameters:
  persistentClassName - The name of the persistent class.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getFieldMetaData()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getFieldMetaData()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getFieldMetaData()' method of the Meta class throws an exception.



getFieldMetaData
public static FieldMetaData getFieldMetaData(String persistentClassName, String fieldName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
Returns the FieldMetaData object from the meta class for the input persistent class for the input field.
Parameters:
  persistentClassName - The name of the persistent class.
Parameters:
  fieldName - the field name.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getFieldMetaData(String fieldName)' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getFieldMetaData(String fieldName)' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getFieldMetaData(String fieldName)' method of the Meta class throws an exception.



getKeyFields
public static FieldMetaData[] getKeyFields(String persistentClassName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
This returns an array of meta information for all the key fields of the persistent class.
Parameters:
  persistentClassName - The name of the persistent class.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.



getLabelToken
public static String getLabelToken(String persistentClassName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
This returns the labelToken for a persistent class. It will look for the persistent meta class and invoke its getLabelToken method to determine the value to return.
Parameters:
  persistentClassName - The persistent class.
throws:
  ClassNotFoundException - If the persistent meta class is not found.
throws:
  NoSuchMethodException - If there is no 'public static String getLabelToken()' method in the persistent meta class.
throws:
  IllegalAccessException - if the method is inaccessible.
throws:
  InvocationTargetException - if the method throws an exception. the labelToken for a persistent class.



getLabelToken
public static String getLabelToken(String persistentClassName, String fieldName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
This returns the labelToken for a field in a persistent class. It will look for the persistent meta class and invoke its getFieldMetaData method to determine the appropriate FieldMetaData object. It will finally return the labelToken as specified in the FieldMetaData object.
Parameters:
  persistentClassName - The persistent class.
Parameters:
  fieldName - The field name.
throws:
  ClassNotFoundException - If the persistent meta class is not found.
throws:
  NoSuchMethodException - If there is no 'public static FieldMetaData getFieldMetaData(String fieldName)' method in the persistent meta class.
throws:
  IllegalAccessException - if the method is inaccessible.
throws:
  InvocationTargetException - if the method throws an exception. the labelToken for a field in a domain class.



getMandatoryFields
public static FieldMetaData[] getMandatoryFields(String persistentClassName) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException(Code)
This returns an array of meta information for all the mandatory fields of the persistent class.
Parameters:
  persistentClassName - The name of the persistent class.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.
throws:
  NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getMandatoryFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getMandatoryFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getMandatoryFields()' method of the Meta class throws an exception.



getMetaClass
public static Class getMetaClass(String persistentClassName) throws ClassNotFoundException(Code)
This returns the corresponding meta class for the input persistent class. It assumes the name of the meta class by appending 'Meta' to the input persistent class.
Parameters:
  persistentClassName - The persistent class. the meta class.
throws:
  ClassNotFoundException - if the Meta class for the input persistent class is not found.



loadFromSerializedKey
public static IPersistent loadFromSerializedKey(UOW uow, String serializedKey) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IllegalArgumentException, IntrospectionException, FrameworkException(Code)
This will load the persistent object from the input serialized key, by invoking the findByPK() method of the persistent class encoded in the input String.
Parameters:
  uow - The UOW object. If null, then a UOW will be created implicitly by the findByPK method to load the persistent object.
Parameters:
  serializedKey - The serialized key which will have the right information to load the persistent object.
throws:
  ClassNotFoundException - if the Persistent class or its Meta class are not found.
throws:
  NoSuchMethodException - if the Persistent class does not have the 'public static IPersistent findByPK(UOW uow, KeyField1...)' method or the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
throws:
  IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
throws:
  InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
throws:
  IllegalArgumentException - if the input persistent class does not have any key-fields or if any of the key-fields is null.
throws:
  IntrospectionException - if an exception occurs during introspection.
throws:
  FrameworkException - if the findByPK() method of the persistent class fails. a Persistent object.



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.