Author: ppoddar
Date: Mon Sep 10 09:01:40 2007
New Revision: 574289
URL: http://svn.apache.org/viewvc?rev=574289&view=rev
Log:
OPENJPA-357, OPENJPA-358: Adding @since tag/comments to new additions to
FetchGroup inclusion
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java?rev=574289&r1=574288&r2=574289&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java
Mon Sep 10 09:01:40 2007
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -108,6 +109,9 @@
if (fg._includes != null)
for (Iterator itr = fg._includes.iterator(); itr.hasNext();)
addDeclaredInclude((String) itr.next());
+ if (fg._containedBy != null)
+ this._containedBy = new HashSet(fg._containedBy);
+
if (fg._depths != null) {
Map.Entry entry;
for (Iterator itr = fg._depths.entrySet().iterator();
@@ -155,7 +159,7 @@
if (_includes != null) {
if (_includes.contains(fgName))
return true;
- if (recurse) {
+ if (recurse && _meta!=null) {
FetchGroup fg;
for (Iterator i = _includes.iterator(); i.hasNext();) {
fg = _meta.getFetchGroup((String) i.next());
@@ -177,14 +181,18 @@
}
/**
- * Sets this receiver as one of the included fetch groups of the given
+ * Adds this receiver as one of the included fetch groups of the given
* parent.
- * The parent fecth grop must include this receiver before this call.
+ * The parent fecth group will include this receiver as a side-effect of
+ * this call.
*
* @see #includes(String, boolean)
* @see #addDeclaredInclude(String)
+ *
+ * @return true if given parent is a new addition. false othrwise.
+ * @since 1.1.1
*/
- public boolean setContainedBy(FetchGroup parent) {
+ public boolean addContainedBy(FetchGroup parent) {
parent.addDeclaredInclude(this.getName());
if (_containedBy==null)
_containedBy = new HashSet();
@@ -195,11 +203,12 @@
* Gets the name of the fetch groups in which this receiver has been
* included.
*
- * @see #setContainedBy(FetchGroup)
+ * @see #addContainedBy(FetchGroup)
+ * @since 1.1.1
*/
- public String[] getContainedBy() {
- return (_containedBy == null) ? new String[0]
- : (String[]) _containedBy.toArray(new String[_containedBy.size()]);
+ public Set getContainedBy() {
+ return (_containedBy == null) ? Collections.EMPTY_SET :
+ Collections.unmodifiableSet(_containedBy);
}
/**
Modified:
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=574289&r1=574288&r2=574289&view=diff
==============================================================================
---
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
(original)
+++
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
Mon Sep 10 09:01:40 2007
@@ -902,7 +902,7 @@
fg = meta.getFetchGroup(group.name());
String[] includedFetchGropNames = fg.getDeclaredIncludes();
for (String includedFectchGroupName:includedFetchGropNames)
-
meta.getFetchGroup(includedFectchGroupName).setContainedBy(fg);
+
meta.getFetchGroup(includedFectchGroupName).addContainedBy(fg);
}
for (FetchGroup group : groups) {
@@ -925,9 +925,9 @@
meta, attr.name()));
field.setInFetchGroup(fg.getName(), true);
- String[] parentFetchGroups = fg.getContainedBy();
- for (String parentFetchGroup:parentFetchGroups)
- field.setInFetchGroup(parentFetchGroup, true);
+ Set parentFetchGroups = fg.getContainedBy();
+ for (Object parentFetchGroup:parentFetchGroups)
+ field.setInFetchGroup(parentFetchGroup.toString(), true);
if (attr.recursionDepth() != Integer.MIN_VALUE)
fg.setRecursionDepth(field, attr.recursionDepth());
}