[Entanglement] Separate out location

Separate out location property from the CreationService,
instead handle in the entanglement bundle; this is
consistent with changes for identity management (attaching
a creator to newly-created domain object models).
for nasa/openmctweb#92
This commit is contained in:
Victor Woeltjen
2015-09-01 10:57:56 -07:00
parent e3eda5112c
commit b39753d0a6
6 changed files with 138 additions and 17 deletions

View File

@ -55,6 +55,10 @@ define(
* space an object is created within (as it is possible to
* have multiple persistence spaces attached.)
*
* Note that the model passed in for object creation may be
* modified to attach additional initial properties associated
* with domain object creation.
*
* @param {object} model the model for the newly-created
* domain object
* @param {DomainObject} parent the domain object which
@ -67,12 +71,6 @@ define(
var persistence = parent.getCapability("persistence"),
self = this;
// Store the location of an object relative to it's parent.
function addLocationToModel(modelId, model, parent) {
model.location = parent.getId();
return model;
}
// Persist the new domain object's model; it will be fully
// constituted as a domain object when loaded back, as all
// domain object models are.
@ -135,7 +133,6 @@ define(
// 2. Create a model with that ID in the persistence space
// 3. Add that ID to
return self.$q.when(uuid()).then(function (id) {
model = addLocationToModel(id, model, parent);
return doPersist(persistence.getSpace(), id, model);
}).then(function (id) {
return addToComposition(id, parent, persistence);