[Creation] Retain space prefix

Retain space prefix from a parent when creating a new domain object,
if there is a space prefix.
This commit is contained in:
Victor Woeltjen
2015-11-05 17:25:39 -08:00
parent fd4c1ea747
commit 99f3b986b6

View File

@@ -34,8 +34,9 @@ define(
* @memberof platform/core * @memberof platform/core
* @param $injector Angular's `$injector` * @param $injector Angular's `$injector`
*/ */
function CreationCapability($injector) { function CreationCapability($injector, domainObject) {
this.$injector = $injector; this.$injector = $injector;
this.domainObject = domainObject;
} }
/** /**
@@ -64,6 +65,12 @@ define(
CreationCapability.prototype.create = function (model) { CreationCapability.prototype.create = function (model) {
var id = uuid(), var id = uuid(),
capabilities = this.getCapabilities(model); capabilities = this.getCapabilities(model);
// Retain any space-prefixing from the parent
if (this.domainObject.getId().indexOf(":") !== -1) {
id = this.domainObject.getId().split(":")[0] + ":" + id;
}
return new DomainObjectImpl(id, model, capabilities); return new DomainObjectImpl(id, model, capabilities);
}; };