Update of
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8071/src/main/java/org/xdoclet/plugin/hibernate
Modified Files:
HibernateMappingPlugin.java
Log Message:
(XDP-89) Fix bug with incorrect property accumulation on inherited interfaces
Index: HibernateMappingPlugin.java
===================================================================
RCS file:
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/HibernateMappingPlugin.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** HibernateMappingPlugin.java 10 Aug 2005 15:42:03 -0000 1.46
--- HibernateMappingPlugin.java 15 Aug 2005 14:33:51 -0000 1.47
***************
*** 15,19 ****
import org.apache.commons.logging.LogFactory;
- import org.generama.GeneramaException;
import org.generama.JellyTemplateEngine;
import org.generama.QDoxCapableMetadataProvider;
--- 15,18 ----
***************
*** 111,115 ****
List retval = new ArrayList();
! getPropertiesRecursive(clazz, null, ALLOWED_IN_PROPERTIES_TAGS,
retval);
CollectionUtils.filter(retval,
new Predicate() {
--- 110,114 ----
List retval = new ArrayList();
! accumulatePropertiesRecursive(clazz, null, true,
ALLOWED_IN_PROPERTIES_TAGS, retval);
CollectionUtils.filter(retval,
new Predicate() {
***************
*** 155,159 ****
public List getClassId(JavaClass clazz) {
List retval = new ArrayList();
! getPropertiesRecursive(clazz, null, ID_TAGS, retval);
return retval;
}
--- 154,158 ----
public List getClassId(JavaClass clazz) {
List retval = new ArrayList();
! accumulatePropertiesRecursive(clazz, null, true, ID_TAGS, retval);
return retval;
}
***************
*** 165,169 ****
public List getClassProperties(JavaClass clazz) {
List retval = new ArrayList();
! getPropertiesRecursive(clazz, null, PROPERTY_TAGS, retval);
return retval;
}
--- 164,168 ----
public List getClassProperties(JavaClass clazz) {
List retval = new ArrayList();
! accumulatePropertiesRecursive(clazz, null, true, PROPERTY_TAGS,
retval);
return retval;
}
***************
*** 261,265 ****
public List getSubclassProperties(JavaClass clazz) {
List retval = new ArrayList();
! getPropertiesRecursive(clazz, HIERARCHY_STOP_TAGS, PROPERTY_TAGS,
retval);
return retval;
}
--- 260,264 ----
public List getSubclassProperties(JavaClass clazz) {
List retval = new ArrayList();
! accumulatePropertiesRecursive(clazz, HIERARCHY_STOP_TAGS, true,
PROPERTY_TAGS, retval);
return retval;
}
***************
*** 317,321 ****
public List getVersionOrTimestamp(JavaClass clazz) {
List retval = new ArrayList();
! getPropertiesRecursive(clazz, null, VERSION_TAGS, retval);
return retval;
}
--- 316,320 ----
public List getVersionOrTimestamp(JavaClass clazz) {
List retval = new ArrayList();
! accumulatePropertiesRecursive(clazz, null, true, VERSION_TAGS,
retval);
return retval;
}
***************
*** 397,401 ****
* gather hibernate propertis from given class into list
*/
! private void getProperties(JavaClass clazz, Collection requieredTags,
List accumulate) {
// walk through property getters
BeanProperty[] beanProperties = clazz.getBeanProperties();
--- 396,400 ----
* gather hibernate propertis from given class into list
*/
! private void accumulateProperties(JavaClass clazz, Collection
requieredTags, List accumulate) {
// walk through property getters
BeanProperty[] beanProperties = clazz.getBeanProperties();
***************
*** 436,463 ****
/**
* recursive property retrival stopping at stop tag
*/
! private void getPropertiesRecursive(JavaClass clazz, Collection stopTags,
Collection requiredTags, List accumulate) {
! getProperties(clazz, requiredTags, accumulate);
JavaClass superclass = clazz.getSuperJavaClass();
if (superclass != null) {
! // stop recursion?
! if ((stopTags != null) && !getTags(superclass,
stopTags).isEmpty()) {
! // yep.
! return;
! }
!
! getPropertiesRecursive(superclass, stopTags, requiredTags,
accumulate);
}
JavaClass[] ifaces = clazz.getImplementedInterfaces();
- if ((ifaces == null) || (ifaces.length == 0)) {
- return;
- }
-
for (int i = 0; i < ifaces.length; i++) {
! JavaClass iface = ifaces[i];
! getPropertiesRecursive(iface, stopTags, requiredTags, accumulate);
}
}
--- 435,462 ----
/**
* recursive property retrival stopping at stop tag
+ * @param skipStopTags needs more explanation here. We need to skip
checking on stop tags on the first method invocation
+ * (I mean when we dont dive into recursion cycle) because it have
already @hibernate.property tag (which is stop tag)
*/
! private void accumulatePropertiesRecursive(JavaClass clazz, Collection
stopTags, boolean skipStopTags,
! Collection requiredTags, List accumulate) {
! // stop recursion?
! if (!skipStopTags && stopTags != null && !getTags(clazz,
stopTags).isEmpty()) {
! // yep.
! return;
! }
!
! accumulateProperties(clazz, requiredTags, accumulate);
! //Look at subclass
JavaClass superclass = clazz.getSuperJavaClass();
if (superclass != null) {
! accumulatePropertiesRecursive(superclass, stopTags, false,
requiredTags, accumulate);
}
+ //Browse over all implemented interfaces
JavaClass[] ifaces = clazz.getImplementedInterfaces();
for (int i = 0; i < ifaces.length; i++) {
! accumulatePropertiesRecursive(ifaces[i], stopTags, false,
requiredTags, accumulate);
}
}
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits