X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.node.api%2Fsrc%2Forg%2Fargeo%2Fnode%2FNodeUtils.java;h=afb64bd7a4a8df6327ef2673d1fc4209382c4af8;hb=54e74b900b1c0f7b1de0def771de35e50a8d4071;hp=b9281043d0efbe2e0f079ebc7be01fe4e994b1ba;hpb=0243aa5633af84d8608ba912483dbaaaefac42f1;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.node.api/src/org/argeo/node/NodeUtils.java b/org.argeo.node.api/src/org/argeo/node/NodeUtils.java index b9281043d..afb64bd7a 100644 --- a/org.argeo.node.api/src/org/argeo/node/NodeUtils.java +++ b/org.argeo.node.api/src/org/argeo/node/NodeUtils.java @@ -36,7 +36,7 @@ import javax.jcr.query.qom.StaticOperand; public class NodeUtils { /** * Wraps the call to the repository factory based on parameter - * {@link NodeConstants#JCR_REPOSITORY_ALIAS} in order to simplify it and + * {@link NodeConstants#CN} in order to simplify it and * protect against future API changes. */ public static Repository getRepositoryByAlias(RepositoryFactory repositoryFactory, String alias) { @@ -52,7 +52,7 @@ public class NodeUtils { /** * Wraps the call to the repository factory based on parameter - * {@link NodeConstants#JCR_REPOSITORY_URI} in order to simplify it and + * {@link NodeConstants#LABELED_URI} in order to simplify it and * protect against future API changes. */ public static Repository getRepositoryByUri(RepositoryFactory repositoryFactory, String uri) { @@ -61,7 +61,7 @@ public class NodeUtils { /** * Wraps the call to the repository factory based on parameter - * {@link NodeConstants#JCR_REPOSITORY_URI} in order to simplify it and + * {@link NodeConstants#LABELED_URI} in order to simplify it and * protect against future API changes. */ public static Repository getRepositoryByUri(RepositoryFactory repositoryFactory, String uri, String alias) { @@ -111,7 +111,7 @@ public class NodeUtils { * a session with a different user ID than the one searched, * typically when a system or admin session is used. * @param cn - * the username of the user + * the name of the group */ public static Node getGroupHome(Session session, String cn) { try { @@ -159,24 +159,10 @@ public class NodeUtils { return getUserHome(session, userID); } - // public static Node getUserProfile(Session session, String username) { - // try { - // QueryObjectModelFactory qomf = session.getWorkspace() - // .getQueryManager().getQOMFactory(); - // Selector userHomeSel = qomf.selector(ArgeoTypes.ARGEO_USER_PROFILE, - // "userProfile"); - // DynamicOperand userIdDop = qomf.propertyValue( - // userHomeSel.getSelectorName(), ArgeoNames.ARGEO_USER_ID); - // StaticOperand userIdSop = qomf.literal(session.getValueFactory() - // .createValue(username)); - // Constraint constraint = qomf.comparison(userIdDop, - // QueryObjectModelFactory.JCR_OPERATOR_EQUAL_TO, userIdSop); - // Query query = qomf.createQuery(userHomeSel, constraint, null, null); - // return querySingleNode(query); - // } catch (RepositoryException e) { - // throw new RuntimeException( - // "Cannot find profile for user " + username, e); - // } - // } - // + public static String getDataPath(String cn, Node node) throws RepositoryException { + assert node != null; + StringBuilder buf = new StringBuilder(NodeConstants.PATH_DATA); + return buf.append('/').append(cn).append('/').append(node.getSession().getWorkspace().getName()) + .append(node.getPath()).toString(); + } }