From 62b9eb5180cfa7188d9f5a604e65d713b28ba7b0 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 5 Nov 2015 15:36:33 -0800 Subject: [PATCH] [Creation] Simplify creationService Add the newly-created domain object directly, instead of via its id. --- .../commonUI/browse/src/creation/CreationService.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index 0c7808f997..bfd8a0c403 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -75,10 +75,10 @@ define( // Add the newly-created object's id to the parent's // composition, so that it will subsequently appear // as a child contained by that parent. - function addToComposition(id, parent, parentPersistence) { + function addToComposition() { var compositionCapability = parent.getCapability('composition'), addResult = compositionCapability && - compositionCapability.add(id); + compositionCapability.add(newObject); return self.$q.when(addResult).then(function (result) { if (!result) { @@ -86,7 +86,7 @@ define( return undefined; } - return parentPersistence.persist().then(function () { + return persistence.persist().then(function () { return result; }); }); @@ -100,10 +100,7 @@ define( } // Persist the new object, then add it to composition. - return newObjectPersistence.persist().then(function () { - var id = newObject.getId(); - return addToComposition(id, parent, persistence); - }); + return newObjectPersistence.persist().then(addToComposition); };