copy: if source and dest have the same id, return

This commit is contained in:
Roberto Cirillo 2021-09-10 09:44:05 +02:00
parent 0472efaf36
commit de82a56a72
2 changed files with 2 additions and 1 deletions

View File

@ -310,6 +310,7 @@ public class MongoIOManager {
updateCommonFields(f, resource, OPERATION.REMOVE);
// check if the file is linked
if((f!=null) && (f.containsField(Costants.COUNT_IDENTIFIER)) && (f.get(Costants.COUNT_IDENTIFIER) != null)){
logger.debug("RemovingObject: the following object "+idToRemove+" contains a COUNT field");
// this field is only added for reporting tool: storage-manager-trigger
String filename=(String)f.get("filename");
f.put("onScope", filename);
@ -322,6 +323,7 @@ public class MongoIOManager {
// check if the file is a link
}else if((f.containsField(Costants.LINK_IDENTIFIER)) && (f.get(Costants.LINK_IDENTIFIER) != null )){
while((f!=null) && (f.containsField(Costants.LINK_IDENTIFIER)) && (f.get(Costants.LINK_IDENTIFIER) != null )){
logger.debug("RemovingObject: the following object "+idToRemove+" contains a LINK field");
// remove f and decrement linkCount field on linked object
String id=(String)f.get(Costants.LINK_IDENTIFIER);
GridFSDBFile fLink=findGFSCollectionObject(new ObjectId(id));

View File

@ -14,7 +14,6 @@ import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.LOCA
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.OPERATION;
import org.gcube.contentmanagement.blobstorage.resource.OperationDefinition.REMOTE_RESOURCE;
import org.gcube.contentmanagement.blobstorage.service.operation.Monitor;
import org.gcube.contentmanagement.blobstorage.service.operation.Operation;
import org.gcube.contentmanagement.blobstorage.service.operation.SoftCopy;
import org.gcube.contentmanagement.blobstorage.transport.backend.MongoIOManager;
import org.gcube.contentmanagement.blobstorage.transport.backend.MongoOperationManager;