#338 Fixed failing tests after refactor
This commit is contained in:
@@ -38,12 +38,9 @@ define(
|
||||
* @memberof platform/entanglement
|
||||
* @implements {platform/entanglement.AbstractComposeService}
|
||||
*/
|
||||
function CopyService($q, creationService, policyService, persistenceService, now) {
|
||||
function CopyService($q, policyService) {
|
||||
this.$q = $q;
|
||||
this.creationService = creationService;
|
||||
this.policyService = policyService;
|
||||
this.persistenceService = persistenceService;
|
||||
this.now = now;
|
||||
}
|
||||
|
||||
CopyService.prototype.validate = function (object, parentCandidate) {
|
||||
@@ -71,7 +68,7 @@ define(
|
||||
*/
|
||||
CopyService.prototype.perform = function (domainObject, parent) {
|
||||
var $q = this.$q,
|
||||
copyTask = new CopyTask(domainObject, parent, this.persistenceService, this.policyService, this.$q, this.now);
|
||||
copyTask = new CopyTask(domainObject, parent, this.policyService, this.$q);
|
||||
if (this.validate(domainObject, parent)) {
|
||||
return copyTask.perform();
|
||||
} else {
|
||||
|
||||
@@ -33,21 +33,16 @@ define(
|
||||
*
|
||||
* @param domainObject The object to copy
|
||||
* @param parent The new location of the cloned object tree
|
||||
* @param persistenceService
|
||||
* @param $q
|
||||
* @param now
|
||||
* @constructor
|
||||
*/
|
||||
function CopyTask (domainObject, parent, persistenceService, policyService, $q, now){
|
||||
function CopyTask (domainObject, parent, policyService, $q){
|
||||
this.domainObject = domainObject;
|
||||
this.parent = parent;
|
||||
this.$q = $q;
|
||||
this.deferred = undefined;
|
||||
this.persistenceService = persistenceService;
|
||||
this.policyService = policyService;
|
||||
this.persistenceSpace = parent.getCapability("persistence") && parent.getCapability("persistence").getSpace();
|
||||
this.persisted = 0;
|
||||
this.now = now;
|
||||
this.clones = [];
|
||||
}
|
||||
|
||||
@@ -154,7 +149,7 @@ define(
|
||||
// creation capability of the targetParent to create the
|
||||
// new clone. This will ensure that the correct persistence
|
||||
// space is used.
|
||||
clone = this.parent.hasCapability("instantiation") && originalParent.useCapability("instantiation", cloneObjectModel(originalObject.getModel()));
|
||||
clone = this.parent.hasCapability("instantiation") && this.parent.useCapability("instantiation", cloneObjectModel(originalObject.getModel()));
|
||||
|
||||
//Iterate through child tree
|
||||
return this.$q.when(originalObject.useCapability('composition')).then(function(composees){
|
||||
@@ -193,7 +188,7 @@ define(
|
||||
var self = this;
|
||||
|
||||
return this.copy(self.domainObject, self.parent).then(function(domainObjectClone){
|
||||
domainObjectClone.model.location = self.parent.getId();
|
||||
domainObjectClone.getModel().location = self.parent.getId();
|
||||
return self;
|
||||
});
|
||||
};
|
||||
@@ -207,7 +202,7 @@ define(
|
||||
this.deferred = this.$q.defer();
|
||||
|
||||
if (!this.parent.hasCapability('composition')){
|
||||
return self.$q.reject();
|
||||
return this.$q.reject();
|
||||
}
|
||||
|
||||
this.buildCopyPlan()
|
||||
|
||||
Reference in New Issue
Block a user