diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index bc825c0394..7cdd769018 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -54,16 +54,33 @@ define( ); }; + /** + * A function used to check if a domain object should be cloned + * or not. + * @callback platform/entanglement.CopyService~filter + * @param {DomainObject} domainObject the object to be cloned + * @returns {boolean} true if the object should be cloned; false + * if it should be linked + */ + /** * Creates a duplicate of the object tree starting at domainObject to * the new parent specified. - * @param domainObject - * @param parent - * @param progress + * + * Any domain objects which cannot be created will not be cloned; + * instead, these will appear as links. If a filtering function + * is provided, any objects which fail that check will also be + * linked instead of cloned + * + * @param {DomainObject} domainObject the object to duplicate + * @param {DomainObject} parent the destination for the clone + * @param {platform/entanglement.CopyService~filter} [filter] + * an optional function used to filter out objects from + * the cloning process * @returns a promise that will be completed with the clone of * domainObject when the duplication is successful. */ - CopyService.prototype.perform = function (domainObject, parent) { + CopyService.prototype.perform = function (domainObject, parent, filter) { var $q = this.$q, copyTask = new CopyTask(domainObject, parent, this.policyService, this.$q); if (this.validate(domainObject, parent)) {