mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 18:06:59 +00:00
26 lines
654 B
JavaScript
26 lines
654 B
JavaScript
|
|
define(
|
|
[],
|
|
function () {
|
|
|
|
/**
|
|
* Policy allowing composition only for domain object types which
|
|
* have a composition property.
|
|
* @constructor
|
|
* @memberof platform/containment
|
|
* @implements {Policy.<Type, Type>}
|
|
*/
|
|
function CompositionModelPolicy() {
|
|
}
|
|
|
|
CompositionModelPolicy.prototype.allow = function (candidate) {
|
|
var candidateType = candidate.getCapability('type');
|
|
return Array.isArray(
|
|
(candidateType.getInitialModel() || {}).composition
|
|
);
|
|
};
|
|
|
|
return CompositionModelPolicy;
|
|
}
|
|
);
|