|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.persistence.util.PersistentHelper
Helper methods for persistent objects.
| Constructor Summary | |
PersistentHelper()
|
|
| Method Summary | |
static void |
checkMandatoryFields(IPersistent object)
This will check all the mandatory fields of the persistent object. |
static boolean |
exists(UOW uow,
IPersistent object)
This will query the database to see if the primary-key of the input persistent object is already in use. |
static String |
generateSerializedKey(IPersistent object)
This will generate a unique string for the input persistent object, based on the persistent class name and its key values. |
static FieldMetaData[] |
getFieldMetaData(String persistentClassName)
This returns an array of meta information for all the fields of the persistent class. |
static FieldMetaData |
getFieldMetaData(String persistentClassName,
String fieldName)
Returns the FieldMetaData object from the meta class for the input persistent class for the input field. |
static FieldMetaData[] |
getKeyFields(String persistentClassName)
This returns an array of meta information for all the key fields of the persistent class. |
static String |
getLabelToken(String persistentClassName)
This returns the labelToken for a persistent class. |
static String |
getLabelToken(String persistentClassName,
String fieldName)
This returns the labelToken for a field in a persistent class. |
static FieldMetaData[] |
getMandatoryFields(String persistentClassName)
This returns an array of meta information for all the mandatory fields of the persistent class. |
static Class |
getMetaClass(String persistentClassName)
This returns the corresponding meta class for the input persistent class. |
static IPersistent |
loadFromSerializedKey(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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PersistentHelper()
| Method Detail |
public static Class getMetaClass(String persistentClassName)
throws ClassNotFoundException
persistentClassName - The persistent class.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
public static FieldMetaData[] getKeyFields(String persistentClassName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The name of the persistent class.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
public static FieldMetaData[] getMandatoryFields(String persistentClassName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The name of the persistent class.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getMandatoryFields()' method.
IllegalAccessException - if the 'public static FieldMetaData[] getMandatoryFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getMandatoryFields()' method of the Meta class throws an exception.
public static FieldMetaData[] getFieldMetaData(String persistentClassName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The name of the persistent class.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getFieldMetaData()' method.
IllegalAccessException - if the 'public static FieldMetaData[] getFieldMetaData()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getFieldMetaData()' method of the Meta class throws an exception.
public static FieldMetaData getFieldMetaData(String persistentClassName,
String fieldName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The name of the persistent class.fieldName - the field name.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getFieldMetaData(String fieldName)' method.
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.
InvocationTargetException - if the 'public static FieldMetaData[] getFieldMetaData(String fieldName)' method of the Meta class throws an exception.
public static String getLabelToken(String persistentClassName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The persistent class.
ClassNotFoundException - If the persistent meta class is not found.
NoSuchMethodException - If there is no 'public static String getLabelToken()' method in the persistent meta class.
IllegalAccessException - if the method is inaccessible.
InvocationTargetException - if the method throws an exception.
public static String getLabelToken(String persistentClassName,
String fieldName)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException
persistentClassName - The persistent class.fieldName - The field name.
ClassNotFoundException - If the persistent meta class is not found.
NoSuchMethodException - If there is no 'public static FieldMetaData getFieldMetaData(String fieldName)' method in the persistent meta class.
IllegalAccessException - if the method is inaccessible.
InvocationTargetException - if the method throws an exception.
public static void checkMandatoryFields(IPersistent object)
throws ApplicationExceptions,
FrameworkException
object - The persistent object.
ApplicationExceptions - Will contain a collection of MandatoryFieldExceptions for the all the mandatory fields which do not have values.
FrameworkException - If any framework error occurs.
public static boolean exists(UOW uow,
IPersistent object)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
IllegalArgumentException,
FrameworkException
uow - The UOW object. If null, then a UOW will be created implicitly by the exists() method to load the persistent object.object - The persistent object.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
IllegalArgumentException - if the input persistent class does not have any key-fields
FrameworkException - if the exists() method of the persistent class fails.
public static String generateSerializedKey(IPersistent object)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
IllegalArgumentException
object - The persistent object.
ClassNotFoundException - if the Meta class for the input persistent class is not found.
NoSuchMethodException - if the Meta class does not have the 'public static FieldMetaData[] getKeyFields()' method.
IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
IllegalArgumentException - if the input persistent class does not have any key-fields or if any of the key-fields is null.
public static IPersistent loadFromSerializedKey(UOW uow,
String serializedKey)
throws ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
IllegalArgumentException,
IntrospectionException,
FrameworkException
uow - The UOW object. If null, then a UOW will be created implicitly by the findByPK method to load the persistent object.serializedKey - The serialized key which will have the right information to load the persistent object.
ClassNotFoundException - if the Persistent class or its Meta class are not found.
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.
IllegalAccessException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class enforces Java language access control and the underlying method is inaccessible.
InvocationTargetException - if the 'public static FieldMetaData[] getKeyFields()' method of the Meta class throws an exception.
IllegalArgumentException - if the input persistent class does not have any key-fields or if any of the key-fields is null.
IntrospectionException - if an exception occurs during introspection.
FrameworkException - if the findByPK() method of the persistent class fails.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||