[Create] Utilize filtering during clone

This commit is contained in:
Victor Woeltjen
2016-02-10 13:46:19 -08:00
parent 72df464f0f
commit 3146660833

View File

@@ -106,6 +106,14 @@ define(
return fetchObject(object.getModel().location); return fetchObject(object.getModel().location);
} }
function isOriginal(domainObject) {
return domainObject.getCapability('location').isOriginal();
}
function cloneIntoParent(parent) {
return copyService.perform(domainObject, parent, isOriginal);
}
function cancelEditingAfterClone(clonedObject) { function cancelEditingAfterClone(clonedObject) {
return domainObject.getCapability("editor").cancel() return domainObject.getCapability("editor").cancel()
.then(resolveWith(clonedObject)); .then(resolveWith(clonedObject));
@@ -122,7 +130,7 @@ define(
return getParent(domainObject) return getParent(domainObject)
.then(doWizardSave) .then(doWizardSave)
.then(getParent) .then(getParent)
.then(copyService.perform.bind(copyService, domainObject)) .then(cloneIntoParent)
.then(cancelEditingAfterClone) .then(cancelEditingAfterClone)
.catch(resolveWith(false)); .catch(resolveWith(false));
} else { } else {