Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-01-15 17:48:09 +0000
committerEike Stepper2016-01-15 17:48:09 +0000
commit00e61cd9bbb13a48ad936852f6c1e8de46072c10 (patch)
tree3f9cb03a56c27ce6fe69834b1fd01e5d8403c7d4
parent11cdaee2b9ed25674935f4d7b7cdbc1d7a7abd53 (diff)
downloadcdo-00e61cd9bbb13a48ad936852f6c1e8de46072c10.tar.gz
cdo-00e61cd9bbb13a48ad936852f6c1e8de46072c10.tar.xz
cdo-00e61cd9bbb13a48ad936852f6c1e8de46072c10.zip
[485961] Provide CDORevisionUtil.getChildRevisions() method that skips containment proxies
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485961
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java42
1 files changed, 38 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
index 50fdcfbe7a..ebf583c476 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
@@ -368,8 +368,17 @@ public final class CDORevisionUtil
*/
public static List<CDORevision> getChildRevisions(CDOID container, CDORevisionProvider provider)
{
+ return getChildRevisions(container, provider, false);
+ }
+
+ /**
+ * @since 4.5
+ */
+ public static List<CDORevision> getChildRevisions(CDOID container, CDORevisionProvider provider,
+ boolean onlyProperContents)
+ {
InternalCDORevision revision = (InternalCDORevision)provider.getRevision(container);
- return getChildRevisions(revision, provider);
+ return getChildRevisions(revision, provider, onlyProperContents);
}
/**
@@ -377,11 +386,25 @@ public final class CDORevisionUtil
*/
public static List<CDORevision> getChildRevisions(CDORevision container, CDORevisionProvider provider)
{
+ return getChildRevisions(container, provider, false);
+ }
+
+ /**
+ * @since 4.5
+ */
+ public static List<CDORevision> getChildRevisions(CDORevision container, CDORevisionProvider provider,
+ boolean onlyProperContents)
+ {
List<CDORevision> children = new ArrayList<CDORevision>();
InternalCDORevision revisionData = (InternalCDORevision)container;
CDOClassInfo classInfo = revisionData.getClassInfo();
+ if (onlyProperContents && classInfo.isResource())
+ {
+ onlyProperContents = false;
+ }
+
for (EStructuralFeature feature : classInfo.getAllPersistentContainments())
{
if (feature instanceof EReference)
@@ -393,14 +416,14 @@ public final class CDORevisionUtil
{
for (Object value : list)
{
- addChildRevision(value, provider, children);
+ addChildRevision(value, provider, children, onlyProperContents);
}
}
}
else
{
Object value = revisionData.getValue(feature);
- addChildRevision(value, provider, children);
+ addChildRevision(value, provider, children, onlyProperContents);
}
}
}
@@ -408,7 +431,8 @@ public final class CDORevisionUtil
return children;
}
- private static void addChildRevision(Object value, CDORevisionProvider provider, List<CDORevision> children)
+ private static void addChildRevision(Object value, CDORevisionProvider provider, List<CDORevision> children,
+ boolean onlyProperContents)
{
if (value instanceof CDOID)
{
@@ -416,6 +440,16 @@ public final class CDORevisionUtil
CDORevision child = provider.getRevision(id);
if (child != null)
{
+ if (onlyProperContents)
+ {
+ // Check proper contents (i.e., no containment proxy).
+ CDOID resourceID = child.data().getResourceID();
+ if (!CDOIDUtil.isNull(resourceID))
+ {
+ return;
+ }
+ }
+
children.add(child);
}
}

Back to the top