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) {
/**
* 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) {
/**
* 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) {
* 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 {
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();
+ }
}