mirror of https://github.com/apache/openjpa.git
OPENJPA-357, OPENJPA-358: Adding @since tag/comments to new additions to FetchGroup inclusion
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@574289 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd66165d76
commit
6d5fe3bb8a
|
@ -20,6 +20,7 @@ package org.apache.openjpa.meta;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -108,6 +109,9 @@ public class FetchGroup
|
||||||
if (fg._includes != null)
|
if (fg._includes != null)
|
||||||
for (Iterator itr = fg._includes.iterator(); itr.hasNext();)
|
for (Iterator itr = fg._includes.iterator(); itr.hasNext();)
|
||||||
addDeclaredInclude((String) itr.next());
|
addDeclaredInclude((String) itr.next());
|
||||||
|
if (fg._containedBy != null)
|
||||||
|
this._containedBy = new HashSet(fg._containedBy);
|
||||||
|
|
||||||
if (fg._depths != null) {
|
if (fg._depths != null) {
|
||||||
Map.Entry entry;
|
Map.Entry entry;
|
||||||
for (Iterator itr = fg._depths.entrySet().iterator();
|
for (Iterator itr = fg._depths.entrySet().iterator();
|
||||||
|
@ -155,7 +159,7 @@ public class FetchGroup
|
||||||
if (_includes != null) {
|
if (_includes != null) {
|
||||||
if (_includes.contains(fgName))
|
if (_includes.contains(fgName))
|
||||||
return true;
|
return true;
|
||||||
if (recurse) {
|
if (recurse && _meta!=null) {
|
||||||
FetchGroup fg;
|
FetchGroup fg;
|
||||||
for (Iterator i = _includes.iterator(); i.hasNext();) {
|
for (Iterator i = _includes.iterator(); i.hasNext();) {
|
||||||
fg = _meta.getFetchGroup((String) i.next());
|
fg = _meta.getFetchGroup((String) i.next());
|
||||||
|
@ -177,14 +181,18 @@ public class FetchGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
* 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 #includes(String, boolean)
|
||||||
* @see #addDeclaredInclude(String)
|
* @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());
|
parent.addDeclaredInclude(this.getName());
|
||||||
if (_containedBy==null)
|
if (_containedBy==null)
|
||||||
_containedBy = new HashSet();
|
_containedBy = new HashSet();
|
||||||
|
@ -195,11 +203,12 @@ public class FetchGroup
|
||||||
* Gets the name of the fetch groups in which this receiver has been
|
* Gets the name of the fetch groups in which this receiver has been
|
||||||
* included.
|
* included.
|
||||||
*
|
*
|
||||||
* @see #setContainedBy(FetchGroup)
|
* @see #addContainedBy(FetchGroup)
|
||||||
|
* @since 1.1.1
|
||||||
*/
|
*/
|
||||||
public String[] getContainedBy() {
|
public Set getContainedBy() {
|
||||||
return (_containedBy == null) ? new String[0]
|
return (_containedBy == null) ? Collections.EMPTY_SET :
|
||||||
: (String[]) _containedBy.toArray(new String[_containedBy.size()]);
|
Collections.unmodifiableSet(_containedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -902,7 +902,7 @@ public class AnnotationPersistenceMetaDataParser
|
||||||
fg = meta.getFetchGroup(group.name());
|
fg = meta.getFetchGroup(group.name());
|
||||||
String[] includedFetchGropNames = fg.getDeclaredIncludes();
|
String[] includedFetchGropNames = fg.getDeclaredIncludes();
|
||||||
for (String includedFectchGroupName:includedFetchGropNames)
|
for (String includedFectchGroupName:includedFetchGropNames)
|
||||||
meta.getFetchGroup(includedFectchGroupName).setContainedBy(fg);
|
meta.getFetchGroup(includedFectchGroupName).addContainedBy(fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FetchGroup group : groups) {
|
for (FetchGroup group : groups) {
|
||||||
|
@ -925,9 +925,9 @@ public class AnnotationPersistenceMetaDataParser
|
||||||
meta, attr.name()));
|
meta, attr.name()));
|
||||||
|
|
||||||
field.setInFetchGroup(fg.getName(), true);
|
field.setInFetchGroup(fg.getName(), true);
|
||||||
String[] parentFetchGroups = fg.getContainedBy();
|
Set parentFetchGroups = fg.getContainedBy();
|
||||||
for (String parentFetchGroup:parentFetchGroups)
|
for (Object parentFetchGroup:parentFetchGroups)
|
||||||
field.setInFetchGroup(parentFetchGroup, true);
|
field.setInFetchGroup(parentFetchGroup.toString(), true);
|
||||||
if (attr.recursionDepth() != Integer.MIN_VALUE)
|
if (attr.recursionDepth() != Integer.MIN_VALUE)
|
||||||
fg.setRecursionDepth(field, attr.recursionDepth());
|
fg.setRecursionDepth(field, attr.recursionDepth());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue