add some comments
This commit is contained in:
parent
3979da000f
commit
745323eb63
|
@ -5,6 +5,7 @@ package org.gcube.contentmanagement.blobstorage.transport.backend.operation;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.gcube.contentmanagement.blobstorage.resource.MemoryType;
|
||||
|
@ -217,10 +218,10 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
ObjectId id=null;
|
||||
if(newId == null){
|
||||
id=new ObjectId();
|
||||
logger.debug("generated id for new object link"+id);
|
||||
logger.debug("generated id for new object link "+id);
|
||||
}else{
|
||||
id=newId;
|
||||
logger.debug("restored id for new object link"+id);
|
||||
logger.debug("restored id for new object link "+id);
|
||||
}
|
||||
document.put("_id", id);
|
||||
|
||||
|
@ -274,11 +275,21 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
searchQuery.put("_id" ,mapId);
|
||||
DBObject mapObject=mongoPrimaryInstance.findCollectionObject(metaCollectionInstance, searchQuery);
|
||||
// BasicDBObject updateObject= new BasicDBObject().append("$inc",new BasicDBObject().append("count", 1));;
|
||||
int count=(int)mapObject.get("count");
|
||||
count++;
|
||||
mapObject.put("count", count);
|
||||
// metaCollectionInstance.update(mapObject, updateObject);
|
||||
metaCollectionInstance.save(mapObject);
|
||||
if(!Objects.isNull(mapObject)) {
|
||||
Object counting=mapObject.get("count");
|
||||
if(Objects.nonNull(counting)) {
|
||||
int count=(int)counting;
|
||||
count++;
|
||||
mapObject.put("count", count);
|
||||
}else {
|
||||
mapObject.put("count", 1);
|
||||
}
|
||||
// metaCollectionInstance.update(mapObject, updateObject);
|
||||
metaCollectionInstance.save(mapObject);
|
||||
}else {
|
||||
logger.error("no object found associated to the following id: "+mapId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ObjectId getDuplicatesMap(String md5){
|
||||
|
@ -293,8 +304,10 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
private boolean isMap(GridFSDBFile sourceObject) {
|
||||
String type=sourceObject.get("type").toString();
|
||||
logger.debug("object type: "+type);
|
||||
if(type.equals("map"))
|
||||
if(type.equals("map")) {
|
||||
logger.debug("sourceFile is a map: "+sourceObject.toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue