2015-06-03 20:46:25 +00:00
|
|
|
|
|
|
|
define(
|
|
|
|
[],
|
|
|
|
function () {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Policy allowing composition only for domain object types which
|
|
|
|
* have a composition property.
|
2015-08-07 18:44:54 +00:00
|
|
|
* @constructor
|
|
|
|
* @memberof platform/containment
|
2015-08-11 18:01:13 +00:00
|
|
|
* @implements {Policy.<Type, Type>}
|
2015-06-03 20:46:25 +00:00
|
|
|
*/
|
|
|
|
function CompositionModelPolicy() {
|
|
|
|
}
|
|
|
|
|
2016-03-04 19:41:48 +00:00
|
|
|
CompositionModelPolicy.prototype.allow = function (candidate) {
|
2017-03-24 23:59:30 +00:00
|
|
|
var candidateType = candidate.getCapability('type');
|
2015-08-11 18:01:13 +00:00
|
|
|
return Array.isArray(
|
2017-03-24 23:59:30 +00:00
|
|
|
(candidateType.getInitialModel() || {}).composition
|
2015-08-11 18:01:13 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2015-06-03 20:46:25 +00:00
|
|
|
return CompositionModelPolicy;
|
|
|
|
}
|
2015-08-07 18:44:54 +00:00
|
|
|
);
|