- openByPath added

- replaced some warning log with debug
This commit is contained in:
lucio 2020-03-11 15:00:40 +01:00
parent 868eadfdaa
commit 177888e1b4
6 changed files with 20 additions and 20 deletions

View File

@ -74,7 +74,7 @@ public class Item2NodeConverter {
if (obj!=null) if (obj!=null)
iterateItemNodeAttributeFields(obj, newNode, nodeName); iterateItemNodeAttributeFields(obj, newNode, nodeName);
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value",e); logger.debug("error setting value",e);
} }
@ -113,7 +113,7 @@ public class Item2NodeConverter {
if (values.isMulti()) newNode.setProperty(attribute.value(), values.getValues()); if (values.isMulti()) newNode.setProperty(attribute.value(), values.getValues());
else newNode.setProperty(attribute.value(), values.getValue()); else newNode.setProperty(attribute.value(), values.getValue());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value",e); logger.debug("error setting value",e);
} }
} else if (field.isAnnotationPresent(MapAttribute.class)){ } else if (field.isAnnotationPresent(MapAttribute.class)){
//logger.debug("found field {} of type annotated as MapAttribute in class {}", field.getName(), clazz.getName()); //logger.debug("found field {} of type annotated as MapAttribute in class {}", field.getName(), clazz.getName());
@ -125,7 +125,7 @@ public class Item2NodeConverter {
if (values.isMulti()) newNode.setProperty(entry.getKey(), values.getValues()); if (values.isMulti()) newNode.setProperty(entry.getKey(), values.getValues());
else newNode.setProperty(entry.getKey(), values.getValue()); else newNode.setProperty(entry.getKey(), values.getValue());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value",e); logger.debug("error setting value",e);
} }
} else if (field.isAnnotationPresent(ListNodes.class)){ } else if (field.isAnnotationPresent(ListNodes.class)){
@ -204,7 +204,7 @@ public class Item2NodeConverter {
else contentNode.setProperty(attribute.value(), values.getValue()); else contentNode.setProperty(attribute.value(), values.getValue());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value for attribute "+attribute.value(),e); logger.debug("error setting value for attribute "+attribute.value(),e);
} }
} }
} }
@ -246,7 +246,7 @@ public class Item2NodeConverter {
} }
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value",e); logger.debug("error setting value",e);
} }
} }

View File

@ -131,7 +131,7 @@ public class Node2ItemConverter {
}catch(PathNotFoundException e){ }catch(PathNotFoundException e){
logger.trace("the current node dosn't contain {} property",attribute.value()); logger.trace("the current node dosn't contain {} property",attribute.value());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value for property {} ",attribute.value()); logger.debug("error setting value for property {} ",attribute.value());
} }
} else if (field.isAnnotationPresent(NodeAttribute.class)){ } else if (field.isAnnotationPresent(NodeAttribute.class)){
String fieldNodeName = field.getAnnotation(NodeAttribute.class).value(); String fieldNodeName = field.getAnnotation(NodeAttribute.class).value();
@ -146,7 +146,7 @@ public class Node2ItemConverter {
}catch(PathNotFoundException e){ }catch(PathNotFoundException e){
logger.trace("the current node dosn't contain {} node",fieldNodeName); logger.trace("the current node dosn't contain {} node",fieldNodeName);
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value",e); logger.debug("error setting value",e);
} }
@ -169,7 +169,7 @@ public class Node2ItemConverter {
}catch(PathNotFoundException e){ }catch(PathNotFoundException e){
logger.trace("the current node dosn't contain {} property",attribute.value()); logger.trace("the current node dosn't contain {} property",attribute.value());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value {}",e.getMessage()); logger.debug("error setting value {}",e.getMessage());
} }
} else if (field.isAnnotationPresent(MapAttribute.class)){ } else if (field.isAnnotationPresent(MapAttribute.class)){
logger.trace("found field {} of type annotated as MapAttribute in class {} and node name {}", field.getName(), clazz.getName(), node.getName()); logger.trace("found field {} of type annotated as MapAttribute in class {} and node name {}", field.getName(), clazz.getName(), node.getName());
@ -188,7 +188,7 @@ public class Node2ItemConverter {
}catch(PathNotFoundException e){ }catch(PathNotFoundException e){
logger.warn("the property {} is not mapped",prop.getName()); logger.warn("the property {} is not mapped",prop.getName());
} catch (Exception e ) { } catch (Exception e ) {
logger.warn("error setting value {}",e.getMessage()); logger.debug("error setting value {}",e.getMessage());
} }
} }
} }

View File

@ -170,16 +170,19 @@ public class ItemsManager {
String nextId = id; String nextId = id;
String[] paths = relativePath.split("/"); String[] paths = relativePath.split("/");
for (String actualPath: paths) { for (String actualPath: paths) {
item = getChildrenMatchingName(ses, nextId, actualPath, excludes); item = getChildrenMatchingName(ses, nextId, actualPath, Excludes.ALL);
if (item ==null) throw new InvalidCallParameters("relative path "+actualPath+" not found under item with id "+nextId); if (item ==null) throw new InvalidCallParameters("relative path "+actualPath+" not found under item with id "+nextId);
authChecker.checkReadAuthorizationControl(ses, item.getId()); authChecker.checkReadAuthorizationControl(ses, item.getId());
nextId = item.getId(); nextId = item.getId();
} }
return new ItemWrapper<Item>(item); if (excludes.containsAll(Excludes.ALL))
return new ItemWrapper<Item>(item);
else
return new ItemWrapper<Item>(node2Item.getItem(ses.getNodeByIdentifier(item.getId()), excludes));
}catch(RepositoryException re){ }catch(RepositoryException re){
log.error("jcr error getting item", re); log.error("jcr error getting item by path", re);
GXOutboundErrorResponse.throwException(new BackendGenericError("jcr error searching item", re)); GXOutboundErrorResponse.throwException(new BackendGenericError("jcr error getting item by path", re));
}catch(StorageHubException she ){ }catch(StorageHubException she ){
log.error(she.getErrorMessage(), she); log.error(she.getErrorMessage(), she);
GXOutboundErrorResponse.throwException(she, Response.Status.fromStatusCode(she.getStatus())); GXOutboundErrorResponse.throwException(she, Response.Status.fromStatusCode(she.getStatus()));

View File

@ -27,9 +27,6 @@ import javax.ws.rs.core.Response;
import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.gxrest.response.outbound.GXOutboundErrorResponse; import org.gcube.common.gxrest.response.outbound.GXOutboundErrorResponse;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.common.storagehub.model.Excludes; import org.gcube.common.storagehub.model.Excludes;
import org.gcube.common.storagehub.model.Paths; import org.gcube.common.storagehub.model.Paths;
import org.gcube.common.storagehub.model.exceptions.BackendGenericError; import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
@ -189,7 +186,7 @@ public class WorkspaceManager {
Session ses = null; Session ses = null;
List<Item> recentItems = Collections.emptyList(); List<Item> recentItems = Collections.emptyList();
try{ try{
String login = AuthorizationProvider.instance.get().getClient().getId(); //String login = AuthorizationProvider.instance.get().getClient().getId();
ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context)); ses = repository.getRepository().login(CredentialHandler.getAdminCredentials(context));
VRE vre = Utils.getVreFolderItem(ses, node2Item, vreManager, excludes); VRE vre = Utils.getVreFolderItem(ses, node2Item, vreManager, excludes);
@ -220,7 +217,7 @@ public class WorkspaceManager {
public ItemWrapper<Item> getTrashRootFolder(){ public ItemWrapper<Item> getTrashRootFolder(){
InnerMethodName.instance.set("getTrashRootFolder"); InnerMethodName.instance.set("getTrashRootFolder");
Session ses = null; Session ses = null;
String user = AuthorizationProvider.instance.get().getClient().getId(); //String user = AuthorizationProvider.instance.get().getClient().getId();
org.gcube.common.storagehub.model.Path trashPath = Paths.append(Utils.getWorkspacePath(), Constants.TRASH_ROOT_FOLDER_NAME); org.gcube.common.storagehub.model.Path trashPath = Paths.append(Utils.getWorkspacePath(), Constants.TRASH_ROOT_FOLDER_NAME);
Item item = null; Item item = null;
try{ try{

View File

@ -25,7 +25,7 @@ The projects leading to this software have received funding from a series of
Version Version
-------------------------------------------------- --------------------------------------------------
1.1.0 (2020-03-03) 1.1.0-SNAPSHOT (2020-03-11)
Please see the file named "changelog.xml" in this directory for the release notes. Please see the file named "changelog.xml" in this directory for the release notes.

View File

@ -1,7 +1,7 @@
<application mode='online'> <application mode='online'>
<name>StorageHub</name> <name>StorageHub</name>
<group>DataAccess</group> <group>DataAccess</group>
<version>1.1.0</version> <version>1.1.0-SNAPSHOT</version>
<description>Storage Hub webapp</description> <description>Storage Hub webapp</description>
<local-persistence location='target' /> <local-persistence location='target' />
</application> </application>