You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/03/16 16:51:03 UTC
[3/6] incubator-brooklyn git commit: fix bug where some persistence
calls (eg from rest api) use non-instantiable catalog item (DO not DTO)
fix bug where some persistence calls (eg from rest api) use non-instantiable catalog item (DO not DTO)
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/8542c515
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/8542c515
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/8542c515
Branch: refs/heads/master
Commit: 8542c515e9ed8572ea82b48a9d491ccd8619dc04
Parents: b955f7f
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Mar 13 09:12:02 2015 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Mar 13 09:13:07 2015 +0000
----------------------------------------------------------------------
.../java/brooklyn/entity/rebind/dto/MementosGenerators.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8542c515/core/src/main/java/brooklyn/entity/rebind/dto/MementosGenerators.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/dto/MementosGenerators.java b/core/src/main/java/brooklyn/entity/rebind/dto/MementosGenerators.java
index a81edef..a9d4b66 100644
--- a/core/src/main/java/brooklyn/entity/rebind/dto/MementosGenerators.java
+++ b/core/src/main/java/brooklyn/entity/rebind/dto/MementosGenerators.java
@@ -28,6 +28,7 @@ import java.util.Set;
import brooklyn.basic.BrooklynObject;
import brooklyn.basic.BrooklynTypes;
import brooklyn.catalog.CatalogItem;
+import brooklyn.catalog.internal.CatalogItemDo;
import brooklyn.config.ConfigKey;
import brooklyn.enricher.basic.AbstractEnricher;
import brooklyn.entity.Application;
@@ -41,7 +42,6 @@ import brooklyn.event.AttributeSensor;
import brooklyn.event.AttributeSensor.SensorPersistenceMode;
import brooklyn.event.feed.AbstractFeed;
import brooklyn.location.Location;
-import brooklyn.location.basic.AbstractLocation;
import brooklyn.location.basic.LocationInternal;
import brooklyn.management.ManagementContext;
import brooklyn.management.Task;
@@ -364,6 +364,9 @@ public class MementosGenerators {
}
public static CatalogItemMemento newCatalogItemMemento(CatalogItem<?, ?> catalogItem) {
+ if (catalogItem instanceof CatalogItemDo<?,?>) {
+ catalogItem = ((CatalogItemDo<?,?>)catalogItem).getDto();
+ }
BasicCatalogItemMemento.Builder builder = BasicCatalogItemMemento.builder();
populateBrooklynObjectMementoBuilder(catalogItem, builder);
builder.catalogItemJavaType(catalogItem.getCatalogItemJavaType())