Author: julien(a)jboss.com
Date: 2008-07-06 16:35:49 -0400 (Sun, 06 Jul 2008)
New Revision: 11306
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java
Log:
simplify a bit
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-07-06
20:31:36 UTC (rev 11305)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-07-06
20:35:49 UTC (rev 11306)
@@ -159,19 +159,7 @@
//
for (StructuralObject addedStructuralChild : refresh.getAddedChildren())
{
- ObjectVisit childVisit = load(addedStructuralChild);
- if (childVisit instanceof ObjectVisit.Load)
- {
- addedObjects.add(childVisit);
- }
- else if (childVisit instanceof ObjectVisit.Skip)
- {
- addedObjects.add(childVisit);
- }
- else
- {
- throw new AssertionError();
- }
+ addedObjects.add(load(addedStructuralChild));
}
//
@@ -259,19 +247,7 @@
Collection<ObjectVisit> addedChildren = new
ArrayList<ObjectVisit>();
for (StructuralObject structuralChild :
structuralStateContext.loadChildren(structuralObject))
{
- ObjectVisit childVisit = load(structuralChild);
- if (childVisit instanceof ObjectVisit.Load)
- {
- addedChildren.add(childVisit);
- }
- else if (childVisit instanceof ObjectVisit.Skip)
- {
- addedChildren.add(childVisit);
- }
- else
- {
- throw new AssertionError();
- }
+ addedChildren.add(load(structuralChild));
}
return ObjectVisit.createRecursiveLoad(object, addedChildren);
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java 2008-07-06
20:31:36 UTC (rev 11305)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java 2008-07-06
20:35:49 UTC (rev 11306)
@@ -147,13 +147,13 @@
}
//
-// for (ObjectVisit addedChild : addedChildren)
-// {
-// if (!(addedChild instanceof Evict || addedChild instanceof Load))
-// {
-// throw new AssertionError();
-// }
-// }
+ for (ObjectVisit addedChild : addedChildren)
+ {
+ if (!(addedChild instanceof Skip || addedChild instanceof Load))
+ {
+ throw new AssertionError("Cannot accept added child " +
addedChild);
+ }
+ }
//
this.addedChildren = addedChildren;
@@ -215,6 +215,15 @@
}
//
+ for (ObjectVisit addedChild : addedChildren)
+ {
+ if (!(addedChild instanceof Evict || addedChild instanceof Load))
+ {
+ throw new AssertionError();
+ }
+ }
+
+ //
this.addedChildren = addedChildren;
this.validChildren = validChildren;
this.staleChildren = staleChildren;