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