ScritpUtil updated

This commit is contained in:
Lucio Lelii 2022-09-28 19:21:49 +02:00
parent 25105ca041
commit e1db5df7c9
3 changed files with 15 additions and 5 deletions

View File

@ -210,11 +210,11 @@ public class Node2ItemConverter {
//for now it excludes only first level node
//if (excludes!=null && excludes.contains(fieldNodeName)) continue;
//for now it excludes only first level node
logger.info("retrieving field node {} on field {}", fieldNodeName, field.getName());
logger.debug("retrieving field node {} on field {}", fieldNodeName, field.getName());
field.setAccessible(true);
try{
Node fieldNode = node.getNode(fieldNodeName);
logger.info("looking in node {} searched with {}",fieldNode.getName(),fieldNodeName);
logger.debug("looking in node {} searched with {}",fieldNode.getName(),fieldNodeName);
field.set(obj, iterateNodeAttributeFields(field.getType(), fieldNode));
}catch(PathNotFoundException e){
logger.warn("the current node dosn't contain {} node",fieldNodeName);
@ -280,7 +280,7 @@ public class Node2ItemConverter {
typeToSubtypeMap.put(listType, subTypesMap);
} else {
logger.info("subtypes already found in cache");
logger.debug("subtypes already found in cache");
subTypesMap = typeToSubtypeMap.get(listType);
}

View File

@ -7,10 +7,13 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.data.access.storagehub.Utils;
import org.gcube.data.access.storagehub.handlers.TrashHandler;
import org.gcube.data.access.storagehub.handlers.items.Node2ItemConverter;
import org.gcube.data.access.storagehub.scripting.ScriptUtil;
@ -19,6 +22,8 @@ public class ScriptUtilImpl implements ScriptUtil {
@Inject Node2ItemConverter node2Item;
@Inject TrashHandler trashHandler;
@Override
public List<Item> getChildren(Predicate<Node> checker, Node parent, List<String> excludes, boolean showHidden, Class<? extends Item> nodeTypeToInclude) throws RepositoryException, BackendGenericError {
return Utils.getItemList(checker, parent, excludes, null, showHidden, nodeTypeToInclude);
@ -28,5 +33,10 @@ public class ScriptUtilImpl implements ScriptUtil {
public Item getItem(Node node, List<String> excludes) throws RepositoryException, BackendGenericError {
return node2Item.getItem(node, excludes);
}
@Override
public void removeNodes(Session ses, List<Item> itemsToDelete) throws RepositoryException, StorageHubException{
trashHandler.removeNodes(ses, itemsToDelete);
}
}

View File

@ -7,4 +7,4 @@ volatile.bucketName=shub-volatile-dev
volatile.key=qa4zD0QqmcG0JZNG
volatile.secret=9jzHtOigmrprBYtPGIkh3Tq1Bago4zxL
volatile.url=https://minio.d4science.org/
volatile.createBucket=true
volatile.createBucket=false