Legacy and new object providers work together (#3461)

* Strip mct namespace from ids when getting models from cache

* Revert PersistenceCapability to use legacy code
Enforce empty namespace for LegacyPersistenceAdapter for new object providers

* Reverts change to caching provider

* CouchObject provider is registered with the mct space.
When saving objects via the persistence capability use the mct space to find the couchdb object provider
This commit is contained in:
Shefali Joshi
2020-10-19 10:17:18 -07:00
committed by GitHub
parent d27f73579b
commit e53399495b
6 changed files with 26 additions and 36 deletions

View File

@ -114,7 +114,12 @@ define(["objectUtils"],
var self = this,
domainObject = this.domainObject;
let newStyleObject = objectUtils.toNewFormat(domainObject.getModel(), domainObject.getId());
const identifier = {
namespace: this.getSpace(),
key: this.getKey()
};
let newStyleObject = objectUtils.toNewFormat(domainObject.getModel(), identifier);
return this.openmct.objects
.save(newStyleObject)
@ -146,6 +151,7 @@ define(["objectUtils"],
return domainObject.useCapability("mutation", function () {
return model;
}, modified);
}
}
@ -153,11 +159,10 @@ define(["objectUtils"],
return this.$q.when(true);
}
return this.openmct.objects.get(domainObject.getId()).then((newStyleObject) => {
let oldStyleObject = this.openmct.legacyObject(newStyleObject);
return updateModel(oldStyleObject.getModel());
});
return this.persistenceService.readObject(
this.getSpace(),
this.getKey()
).then(updateModel);
};
/**