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() {
|
|
|
|
}
|
|
|
|
|
2015-08-11 18:01:13 +00:00
|
|
|
CompositionModelPolicy.prototype.allow = function (candidate, context) {
|
|
|
|
return Array.isArray(
|
|
|
|
(candidate.getInitialModel() || {}).composition
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2015-06-03 20:46:25 +00:00
|
|
|
return CompositionModelPolicy;
|
|
|
|
}
|
2015-08-07 18:44:54 +00:00
|
|
|
);
|