mirror of
https://github.com/nasa/openmct.git
synced 2025-04-28 15:02:29 +00:00
[Persistence] User identifierService from instantiate
This commit is contained in:
parent
1d13b245f9
commit
87684e0945
@ -22,8 +22,8 @@
|
|||||||
/*global define,Promise*/
|
/*global define,Promise*/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
['../objects/DomainObjectImpl', 'uuid'],
|
['../objects/DomainObjectImpl'],
|
||||||
function (DomainObjectImpl, uuid) {
|
function (DomainObjectImpl) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,12 +39,15 @@ define(
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @memberof platform/core
|
* @memberof platform/core
|
||||||
* @param $injector Angular's `$injector`
|
* @param {CapabilityService} capabilityService the service which will
|
||||||
|
* provide instantiated domain objects with their capabilities
|
||||||
|
* @param {IdentifierService} identifierService service to generate
|
||||||
|
* new identifiers
|
||||||
*/
|
*/
|
||||||
function Instantiate(capabilityService) {
|
function Instantiate(capabilityService, identifierService) {
|
||||||
return function (model, id) {
|
return function (model, id) {
|
||||||
var capabilities = capabilityService.getCapabilities(model);
|
var capabilities = capabilityService.getCapabilities(model);
|
||||||
id = id || uuid();
|
id = id || identifierService.generate();
|
||||||
return new DomainObjectImpl(id, model, capabilities);
|
return new DomainObjectImpl(id, model, capabilities);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user