mirror of
https://github.com/nasa/openmct.git
synced 2025-01-25 13:49:56 +00:00
3c00eb86ea
Add general policy for supporting containment rules, WTD-962.
29 lines
868 B
JavaScript
29 lines
868 B
JavaScript
/*global define*/
|
|
|
|
define(
|
|
['./ContainmentTable'],
|
|
function (ContainmentTable) {
|
|
"use strict";
|
|
|
|
/**
|
|
* Defines composition policy as driven by type metadata.
|
|
*/
|
|
function CompositionPolicy(typeService, capabilityService) {
|
|
// We're really just wrapping the containment table and rephrasing
|
|
// it as a policy decision.
|
|
var table = new ContainmentTable(typeService, capabilityService);
|
|
|
|
return {
|
|
/**
|
|
* Is the type identified by the candidate allowed to
|
|
* contain the type described by the context?
|
|
*/
|
|
allow: function (candidate, context) {
|
|
return table.canContain(candidate, context);
|
|
}
|
|
};
|
|
}
|
|
|
|
return CompositionPolicy;
|
|
}
|
|
); |