|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.fc.PersistenceHelper
The class contains utility methods associated with the PersistenceManager.
Supported API: true
Extendable: false
Field Summary | |
private static String |
CLASSNAME
|
static String |
DB_ENCODING
|
static int |
DB_MAX_BYTES_PER_CHAR
|
static int |
DB_MAX_SQL_STRING_SIZE
|
static PersistenceManager |
manager
Supported API: true |
static int |
NAVIGATE_RESULT_LINK_INDEX
|
static int |
NAVIGATE_RESULT_ROLE_INDEX
|
private static String |
RESOURCE
|
Constructor Summary | |
PersistenceHelper()
|
Method Summary | |
static NavigateSpec |
buildNavigateSpec(Object source,
String role,
Class linkClass,
boolean onlyOtherSide)
This method builds a query specification for navigating an association. |
static boolean |
checkStoredLength(String str,
int max_length)
Check the length of a string against a maximum length. |
static boolean |
checkStoredLength(String str,
int max_length,
boolean enforce_varchar_limit)
Check the length of a string against a maximum length. |
static boolean |
equals(Persistable p,
Object o)
Determines if two objects are equal from a persistence perspective by comparing their ObjectIdentifier s. |
static Timestamp |
getCreateStamp(Persistable obj)
Retrives the create timestamp for the given Persistable object. |
static Timestamp |
getModifyStamp(Persistable obj)
Retrives the modify timestamp for the given Persistable object. |
static ObjectIdentifier |
getObjectIdentifier(Persistable obj)
Retrives the object identifier for the given Persistable object. |
static int |
getStoredLength(Object obj,
String str)
Deprecated. Replaced by checkStoredLength(String, int) |
static QueryResult |
getUnassignedObjects()
Finds all Persistable objects that don't have an ObjectIdentifier with an assigned id value. |
static SearchCondition |
getUnassignedOidSearchCondition(Class a_class)
Creates a SearchCondition that will find all objects of a given class that don't have an ObjectIdentifier with an assigned id value. |
static int |
hashCode(Persistable p)
Returns a hash code based on the object's ObjectIdentifier
If the object does not have an oid, then returns a hash code based
on the object's memory location. |
static boolean |
isDeleted(Persistable obj)
Returns true if the specified persistable object is marked as deleted. |
static boolean |
isEquivalent(Persistable obj1,
Persistable obj2)
Returns true if the two given objects are equivalent persistable object. |
static boolean |
isPersistent(Object obj)
Returns true if the given object is Peristable and has already been saved in the database. |
static boolean |
isPersistent(Persistable obj)
Returns true if the given Persistable object is saved in the datastore. |
static void |
makeNonPersistent(Persistable obj)
Indicate that the given object is no longer concidered to be persistent. |
static QueryResult |
navigate(Object source,
String role,
Class linkClass,
boolean onlyOtherSide)
Retrieves objects related to the specfied source object(s) role and link class. |
static WTList |
navigateToOtherSideObjectList(Object a_source,
String a_role,
Class a_linkClass)
Retrieves objects related to the specified source object(s), role, and link class. |
static String |
truncateStoredLength(Object obj,
String str,
int len)
Deprecated. Replaced by truncateStoredLength(String, int) |
static String |
truncateStoredLength(String str,
int max_length)
Return truncation of given string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
public static final PersistenceManager manager
public static final String DB_ENCODING
public static final int DB_MAX_BYTES_PER_CHAR
public static final int DB_MAX_SQL_STRING_SIZE
public static final int NAVIGATE_RESULT_ROLE_INDEX
public static final int NAVIGATE_RESULT_LINK_INDEX
Constructor Detail |
public PersistenceHelper()
Method Detail |
public static Timestamp getCreateStamp(Persistable obj)
obj
-
public static Timestamp getModifyStamp(Persistable obj)
obj
-
public static ObjectIdentifier getObjectIdentifier(Persistable obj)
obj
-
public static boolean isDeleted(Persistable obj)
obj
-
public static boolean isEquivalent(Persistable obj1, Persistable obj2)
obj1
- obj2
-
public static boolean isPersistent(Persistable obj)
obj
-
public static boolean isPersistent(Object obj)
obj
-
public static void makeNonPersistent(Persistable obj)
obj
- public static SearchCondition getUnassignedOidSearchCondition(Class a_class) throws QueryException
a_class
-
QueryException
public static QueryResult getUnassignedObjects() throws QueryException, WTException
QueryException
WTException
public static NavigateSpec buildNavigateSpec(Object source, String role, Class linkClass, boolean onlyOtherSide) throws WTException
source
- The source of the navigate operation. This argument can be a single Persistable object or a WTCollection of Persistable objects.role
- The role to navigate to.linkClass
- The association link class to navigate.onlyOtherSide
- Indicates that only the other side objects of the association should be returned. If false, then the link objects are returned (the other side object can be obtained via the link object's getter method).
WTException
public static QueryResult navigate(Object source, String role, Class linkClass, boolean onlyOtherSide) throws WTException
source
- The source of the navigate operation. This argument can be a single Persistable object or a WTCollection of Persistable objects.role
- The role to navigate to.linkClass
- The association link class to navigate.onlyOtherSide
- Indicates that only the other side objects of the association should be returned. If false, then the link objects are returned (the other side object can be obtained via the link object's getter method).
WTException
public static WTList navigateToOtherSideObjectList(Object a_source, String a_role, Class a_linkClass) throws WTException
WTException
public static boolean checkStoredLength(String str, int max_length)
str
- string to check (may be null)max_length
- declared maximum length
public static boolean checkStoredLength(String str, int max_length, boolean enforce_varchar_limit)
str
- string to check (may be null)max_length
- declared maximum lengthenforce_varchar_limit
- require stored string length to be <= DB_MAX_SQL_STRING_SIZE.
public static String truncateStoredLength(String str, int max_length)
str
- string to truncatemax_length
- declared maximum length
public static int getStoredLength(Object obj, String str)
ObjectMappable
then database storage encoding is taken into consideration. If the given object
is null or not a ObjectMappable
, then the string length in
characters is returned.
obj
- object determining storage encoding (may be null)str
- string to measure (may be null)
public static String truncateStoredLength(Object obj, String str, int len)
ObjectMappable
then database storage encoding is
taken into consideration. If the given object is null or not a
ObjectMappable
, then the string is truncated normally.
When truncating multi-byte character encodings, only whole characters are
returned.
obj
- object determining storage encoding (may be null)str
- string to truncatelen
- stored length
public static boolean equals(Persistable p, Object o)
ObjectIdentifier
s.
If the objects do not have oids, or have unassigned oids,
then they are considered equal if they refer to the same
in-memory object.
Delegated to by the equals method of Persistable
s.
p
- o
-
public static int hashCode(Persistable p)
ObjectIdentifier
If the object does not have an oid, then returns a hash code based
on the object's memory location.
Delegated to by the hashCode method of Persistable
s.
p
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |