arminw 2005/10/09 16:53:12
Modified: src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
ClassDescriptor.java
Log:
minor improvements, add comments
Revision Changes Path
No revision
No revision
1.88.2.20 +20 -10
db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
Index: ClassDescriptor.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
retrieving revision 1.88.2.19
retrieving revision 1.88.2.20
diff -u -r1.88.2.19 -r1.88.2.20
--- ClassDescriptor.java 29 Sep 2005 17:23:22 -0000 1.88.2.19
+++ ClassDescriptor.java 9 Oct 2005 23:53:12 -0000 1.88.2.20
@@ -798,7 +798,9 @@
}
/**
- * Returns the matching [EMAIL PROTECTED] FieldDescriptor}.
+ * Returns the matching [EMAIL PROTECTED] FieldDescriptor} - only fields
+ * of the current class will be scanned, to include fields defined
+ * the the super-classes too, use method [EMAIL PROTECTED]
#getFieldDescriptor(boolean)}.
*/
public FieldDescriptor getFieldDescriptorByName(String name)
{
@@ -830,7 +832,8 @@
* using relationships <br>
* ie: name, avg(price), adress.street
* @param aPath the path to the attribute
- * @param pathHints a Map containing the class to be used for a segment
+ * @param pathHints a Map containing the class to be used for a segment
or <em>null</em>
+ * if no segment was used.
* @return the FieldDescriptor or null (ie: for m:n queries)
*/
public FieldDescriptor getFieldDescriptorForPath(String aPath, Map
pathHints)
@@ -860,7 +863,7 @@
*/
public FieldDescriptor getFieldDescriptorForPath(String aPath)
{
- return getFieldDescriptorForPath(aPath, new HashMap());
+ return getFieldDescriptorForPath(aPath, null);
}
/*
arminw:
@@ -1111,10 +1114,15 @@
for (int i = 0; i < fields.length; i++)
{
FieldDescriptor fd = fields[i];
- if (!fd.isAccessReadOnly())
+ /*
+ arminw: if locking is enabled and the increment of locking
+ values is done by the database, the field is read-only
+ */
+ if(fd.isAccessReadOnly() || (fd.isLocking() &&
!fd.isUpdateLock()))
{
- rwFields.add(fd);
+ continue;
}
+ rwFields.add(fd);
}
m_RwFieldDescriptors =
(FieldDescriptor[]) rwFields.toArray(new
FieldDescriptor[rwFields.size()]);
@@ -1157,7 +1165,6 @@
return getLockingFields().length > 0;
}
-
/**
* return all AttributeDescriptors for the path<br>
* ie: partner.addresses.street returns a Collection of 3
AttributeDescriptors
@@ -1179,7 +1186,8 @@
* ie: partner.addresses returns a Collection of 2 AttributeDescriptors
* (ObjectReferenceDescriptor, CollectionDescriptor)
* @param aPath the cleaned path to the attribute
- * @param pathHints a Map containing the class to be used for a segment
+ * @param pathHints a Map containing the class to be used for a segment
or <em>null</em>
+ * if no segment was used.
* @return ArrayList of AttributeDescriptors
*/
public ArrayList getAttributeDescriptorsForPath(String aPath, Map
pathHints)
@@ -1194,7 +1202,8 @@
* ie: partner.addresses returns a Collection of 2 AttributeDescriptors
* (ObjectReferenceDescriptor, CollectionDescriptor)
* @param aPath the cleaned path to the attribute
- * @param pathHints a Map containing the class to be used for a segment
+ * @param pathHints a Map containing the class to be used for a segment
or <em>null</em>
+ * if no segment is used.
* @return ArrayList of AttributeDescriptors
*/
private ArrayList getAttributeDescriptorsForCleanPath(String aPath, Map
pathHints)
@@ -1241,7 +1250,7 @@
{
// BRJ : look for hints for the processed segment
// ie: ref pointng to ClassA and ref.ref pointing to ClassC
- List hintClasses = (List)
pathHints.get(processedSegment.toString());
+ List hintClasses = pathHints != null ? (List)
pathHints.get(processedSegment.toString()) : null;
if (hintClasses != null && hintClasses.get(0) != null)
{
itemClass = (Class) hintClasses.get(0);
@@ -1688,6 +1697,7 @@
/**
* Method declaration
+ * @return table name
*/
private String getTableName()
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]