|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ojb.broker.util.BrokerHelper
Field Summary | |
static java.lang.String |
REPOSITORY_NAME_SEPARATOR
|
Constructor Summary | |
BrokerHelper(PersistenceBroker broker)
|
Method Summary | |
boolean |
assertValidPkFields(FieldDescriptor[] fieldDescriptors,
java.lang.Object[] pkValues)
returns true if the primary key fields are valid, else false. |
static PBKey |
crossCheckPBKey(PBKey key)
Check if the user of the given PBKey was null , if so we try to
get user/password from the jdbc-connection-descriptor matching the given
PBKey.getAlias(). |
boolean |
doesExist(ClassDescriptor cld,
Identity oid,
java.lang.Object obj)
TODO: This method should be moved to JdbcAccess
before 1.1 release. |
static PBKey |
extractAllTokens(java.lang.String name)
splits up the name string and extract db url, user name and password and build a new PBKey instance - the token '#' is used to separate the substrings. |
java.lang.Object[] |
extractValueArray(ValueContainer[] containers)
Extract an value array of the given ValueContainer array. |
ValueContainer[] |
getAllRwValues(ClassDescriptor cld,
java.lang.Object obj)
returns an array containing values for all the Objects attribute (READ/WRITE only) |
protected java.lang.Object |
getAutoIncrementValue(FieldDescriptor fd,
java.lang.Object obj,
java.lang.Object cv)
Get an autoincremented value that has already had a field conversion run on it. |
Query |
getCountQuery(Query aQuery)
Build a Count-Query based on aQuery |
ValueContainer[] |
getKeyValues(ClassDescriptor cld,
Identity oid)
Return key Values of an Identity |
ValueContainer[] |
getKeyValues(ClassDescriptor cld,
Identity oid,
boolean convertToSql)
Return key Values of an Identity |
ValueContainer[] |
getKeyValues(ClassDescriptor cld,
java.lang.Object objectOrProxy)
returns an Array with an Objects PK VALUES, with any java-to-sql FieldConversion applied. |
ValueContainer[] |
getKeyValues(ClassDescriptor cld,
java.lang.Object objectOrProxy,
boolean convertToSql)
returns an Array with an Objects PK VALUES if convertToSql is true, any associated java-to-sql conversions are applied. |
ValueContainer[] |
getNonKeyRwValues(ClassDescriptor cld,
java.lang.Object obj)
returns an Array with an Objects NON-PK VALUES (READ/WRITE only) |
ValueContainer[] |
getValuesForObject(FieldDescriptor[] fields,
java.lang.Object obj,
boolean convertToSql)
Get the values of the fields for an obj |
boolean |
hasNullPKField(ClassDescriptor cld,
java.lang.Object obj)
Detect if the given object has a PK field represents a 'null' value. |
boolean |
representsNull(FieldDescriptor fld,
java.lang.Object aValue)
Decide if the given object value represents 'null'. - If given value is 'null' itself, true will be returned - If given value is instance of Number with value 0 and the field-descriptor is a primary key and represents a primitive field, true will be returned - If given value is instance of String with length 0 and the field-descriptor is a primary key, true will be returned |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String REPOSITORY_NAME_SEPARATOR
Constructor Detail |
public BrokerHelper(PersistenceBroker broker)
Method Detail |
public static PBKey extractAllTokens(java.lang.String name)
PersistenceBrokerException
- if given name was null
public static PBKey crossCheckPBKey(PBKey key)
null
, if so we try to
get user/password from the jdbc-connection-descriptor matching the given
PBKey.getAlias().
public ValueContainer[] getKeyValues(ClassDescriptor cld, java.lang.Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException
objectOrProxy
- convertToSql
-
PersistenceBrokerException
public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException
cld
- oid
-
PersistenceBrokerException
public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid, boolean convertToSql) throws PersistenceBrokerException
cld
- oid
- convertToSql
-
PersistenceBrokerException
public ValueContainer[] getKeyValues(ClassDescriptor cld, java.lang.Object objectOrProxy) throws PersistenceBrokerException
objectOrProxy
-
PersistenceBrokerException
public boolean representsNull(FieldDescriptor fld, java.lang.Object aValue)
public boolean hasNullPKField(ClassDescriptor cld, java.lang.Object obj)
protected java.lang.Object getAutoIncrementValue(FieldDescriptor fd, java.lang.Object obj, java.lang.Object cv)
The data type of the value that is returned by this method is compatible with the java-world. The return value has NOT been run through a field conversion and converted to a corresponding sql-type.
MetadataException
- if there is an erros accessing obj field valuespublic ValueContainer[] getValuesForObject(FieldDescriptor[] fields, java.lang.Object obj, boolean convertToSql) throws PersistenceBrokerException
fields
- obj
-
PersistenceBrokerException
public ValueContainer[] getNonKeyRwValues(ClassDescriptor cld, java.lang.Object obj) throws PersistenceBrokerException
MetadataException
- if there is an erros accessing o field values
PersistenceBrokerException
public ValueContainer[] getAllRwValues(ClassDescriptor cld, java.lang.Object obj) throws PersistenceBrokerException
MetadataException
- if there is an erros accessing obj field values
PersistenceBrokerException
public java.lang.Object[] extractValueArray(ValueContainer[] containers)
ValueContainer
array.
containers
-
public boolean assertValidPkFields(FieldDescriptor[] fieldDescriptors, java.lang.Object[] pkValues)
fieldDescriptors
- the array of PK fielddescriptorspkValues
- the array of PK values
public Query getCountQuery(Query aQuery)
aQuery
-
public boolean doesExist(ClassDescriptor cld, Identity oid, java.lang.Object obj)
JdbcAccess
before 1.1 release. This method only checks if the requested object can be
found in DB (without full object materialization).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |