From 689f80bb231b84c355d3cd4d6569e9c43e7a7923 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 10 Nov 2015 12:21:53 -0800 Subject: [PATCH] [Persistence] Use identifierService from persistence User identifierService from the persistence capability, for consistent interpretation of spaces associated with domain object identifiers. --- .../src/capabilities/PersistenceCapability.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 73a429e305..8bd29c7b7c 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -44,12 +44,16 @@ define( * @constructor * @implements {Capability} */ - function PersistenceCapability(persistenceService, space, domainObject) { + function PersistenceCapability( + persistenceService, + identifierService, + domainObject + ) { // Cache modified timestamp this.modified = domainObject.getModel().modified; this.domainObject = domainObject; - this.space = space; + this.identifierService = identifierService; this.persistenceService = persistenceService; } @@ -135,11 +139,8 @@ define( * be used to persist this object */ PersistenceCapability.prototype.getSpace = function () { - if (this.domainObject.getId().indexOf(":") !== -1) { - return this.domainObject.getId().split(":")[0]; - } - - return this.space; + var id = this.domainObject.getId(); + return this.identifierService.parse(id).getSpace(); }; return PersistenceCapability;