X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=server%2Fruntime%2Forg.argeo.server.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fjcr%2FJcrUtils.java;h=f62196cafe3663de56e1e2ce544832c02ad40fce;hb=a0c5ef0d3f8c263780c919787f1a62a124b552a8;hp=b03be7396bdce3cd4b17733bd73058d5692d60d7;hpb=2b8f41b43cc598398a4bb66dd46d7d87ac000134;p=lgpl%2Fargeo-commons.git diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java index b03be7396..f62196caf 100644 --- a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java +++ b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java @@ -858,7 +858,8 @@ public class JcrUtils implements ArgeoJcrConstants { } catch (Exception e) { // we use this workaround to be sure to get the stack trace // to identify the sink of the bug. - log.warn("trying to create an already existing userHome. Stack trace : "); + log.warn("trying to create an already existing userHome at path:" + + homePath + ". Stack trace : "); e.printStackTrace(); } } @@ -866,8 +867,8 @@ public class JcrUtils implements ArgeoJcrConstants { Node userHome = JcrUtils.mkdirs(session, homePath); Node userProfile; if (userHome.hasNode(ArgeoNames.ARGEO_PROFILE)) { - log.warn("User profile node already exists. We do not add a new one"); - + log.warn("userProfile node already exists for userHome path: " + + homePath + ". We do not add a new one"); } else { userProfile = userHome.addNode(ArgeoNames.ARGEO_PROFILE); userProfile.addMixin(ArgeoTypes.ARGEO_USER_PROFILE); @@ -940,4 +941,31 @@ public class JcrUtils implements ArgeoJcrConstants { throw new ArgeoException("Cannot update last modified", e); } } + + /** + * Returns a String representing the short version (see Node type + * Notation attributes grammar) of the main business attributes of this + * property definition + * + * @param prop + */ + public static String getPropertyDefinitionAsString(Property prop) { + StringBuffer sbuf = new StringBuffer(); + try { + if (prop.getDefinition().isAutoCreated()) + sbuf.append("a"); + if (prop.getDefinition().isMandatory()) + sbuf.append("m"); + if (prop.getDefinition().isProtected()) + sbuf.append("p"); + if (prop.getDefinition().isMultiple()) + sbuf.append("*"); + } catch (RepositoryException re) { + throw new ArgeoException( + "unexpected error while getting property definition as String", + re); + } + return sbuf.toString(); + } }