From: Bruno Sinou Date: Thu, 15 Nov 2012 13:00:07 +0000 (+0000) Subject: Remove hours and add title property to the result process path on request of O. Capillon X-Git-Tag: argeo-slc-2.1.7~530 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;ds=sidebyside;h=bebb6cdbcd30be43c2b401210c34266463c66d05;hp=3c64f85f1c05fbc3f12475b88678383acda52a11;p=gpl%2Fargeo-slc.git Remove hours and add title property to the result process path on request of O. Capillon git-svn-id: https://svn.argeo.org/slc/trunk@5830 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/SlcJcrUtils.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/SlcJcrUtils.java index ab2f15405..3473827cd 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/SlcJcrUtils.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/SlcJcrUtils.java @@ -17,11 +17,14 @@ package org.argeo.slc.jcr; import java.util.Calendar; import java.util.GregorianCalendar; +import java.util.List; import javax.jcr.Node; import javax.jcr.NodeIterator; +import javax.jcr.Property; import javax.jcr.RepositoryException; import javax.jcr.Session; +import javax.jcr.nodetype.NodeType; import org.argeo.jcr.JcrUtils; import org.argeo.jcr.UserJcrUtils; @@ -112,8 +115,26 @@ public class SlcJcrUtils implements SlcNames { public static String createResultPath(Session session, String uuid) throws RepositoryException { Calendar now = new GregorianCalendar(); - return SlcJcrResultUtils.getSlcResultsBasePath(session) + '/' - + JcrUtils.dateAsPath(now, true) + uuid; + StringBuffer absPath = new StringBuffer( + SlcJcrResultUtils.getSlcResultsBasePath(session) + '/'); + // Remove hours and add title property to the result process path on + // request of O. Capillon + // return getSlcProcessesBasePath(session) + '/' + // + JcrUtils.dateAsPath(now, true) + uuid; + String relPath = JcrUtils.dateAsPath(now, false); + List names = JcrUtils.tokenize(relPath); + for (String name : names) { + absPath.append(name + "/"); + Node node = JcrUtils.mkdirs(session, absPath.toString()); + try { + node.addMixin(NodeType.MIX_TITLE); + node.setProperty(Property.JCR_TITLE, name.substring(1)); + } catch (RepositoryException e) { + throw new SlcException( + "unable to create execution process path", e); + } + } + return absPath.toString() + uuid; } /**