branch develop updated (77ae6b6 -> ce44d31)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git from 77ae6b6 Simplify maven configuration. Remove src assembly. new ce44d31 fixes #1319: Add a way to create a tree structure from a template The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ce44d31e82987f19f812d94e214e3400fc811523 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Mar 1 16:04:39 2016 +0100 fixes #1319: Add a way to create a tree structure from a template Summary of changes: src/main/java/org/chorem/jtimer/JTimerConfig.java | 15 ++++++++++----- src/site/rst/configuration.rst | 5 +++-- src/test/java/org/chorem/jtimer/JTimerFactoryTest.java | 7 ++++++- src/test/resources/jtimertest.properties | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See http://git.chorem.org/jtimer.git commit ce44d31e82987f19f812d94e214e3400fc811523 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Mar 1 16:04:39 2016 +0100 fixes #1319: Add a way to create a tree structure from a template --- src/main/java/org/chorem/jtimer/JTimerConfig.java | 15 ++++++++++----- src/site/rst/configuration.rst | 5 +++-- src/test/java/org/chorem/jtimer/JTimerFactoryTest.java | 7 ++++++- src/test/resources/jtimertest.properties | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/JTimerConfig.java b/src/main/java/org/chorem/jtimer/JTimerConfig.java index 1dff394..46dfbed 100644 --- a/src/main/java/org/chorem/jtimer/JTimerConfig.java +++ b/src/main/java/org/chorem/jtimer/JTimerConfig.java @@ -24,6 +24,9 @@ package org.chorem.jtimer; import java.util.List; import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.TreeMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -150,10 +153,13 @@ public class JTimerConfig { * @return task template as map */ public Map<String, List<?>> getTaskTemplates() { - String value = appConfig.getOption(JTimerOption.UI_TASK_TEMPLATES.key); - Map<String, List<?>> result = null; - if (value != null) { - result = (Map<String, List<?>>)JSONValue.parse(value); + String prefix = "jtimer.ui.task.templates."; + Properties props = appConfig.getOptionStartsWith(prefix); + Map<String, List<?>> result = new TreeMap<>(); + for (Entry<Object, Object> e : props.entrySet()) { + String name = ((String)e.getKey()).substring(prefix.length()); + List<?> value = (List<?>)JSONValue.parse((String)e.getValue()); + result.put(name, value); } return result; } @@ -205,7 +211,6 @@ public class JTimerConfig { UI_IDLE_TIME("jtimer.ui.idletime", "300"), UI_SHOW_CLOSED("jtimer.ui.showclosed", "false"), UI_CLOSE_TO_SYSTRAY("jtimer.ui.closetosystray", "true"), - UI_TASK_TEMPLATES("jtimer.ui.task.templates", null), UI_REPORT_FIRSTDAYOFWEEK("jtimer.ui.report.firstdayofweek", "0"); protected String key; diff --git a/src/site/rst/configuration.rst b/src/site/rst/configuration.rst index c9c28b9..8788b5d 100644 --- a/src/site/rst/configuration.rst +++ b/src/site/rst/configuration.rst @@ -44,9 +44,10 @@ Task template ------------- jTimer can create a task using subtask template. You can specify template, as json format, using cofiguration option:: - jtimer.ui.task.templates={"template name 1":[{"name":"dev", "tasks":[{"name":"E1"},{"name":"E2"}]},{"name":"ano", "tasks":[{"name":"A1"}]},{"name":"admin", "tasks":[{"name":"database", "tasks":[{"name":"sub database task1"},{"name":"sub database task2"}]}]},{"name":"meetings"},{"name":"releases"}]} + jtimer.ui.task.templates.templatename1=[{"name":"dev", "tasks":[{"name":"E1"},{"name":"E2"}]},{"name":"ano", "tasks":[{"name":"A1"}]},{"name":"admin", "tasks":[{"name":"database", "tasks":[{"name":"sub database task1"},{"name":"sub database task2"}]}]},{"name":"meetings"},{"name":"releases"}] + jtimer.ui.task.templates.templatename2=[{"name":"dev"}, {"name":"admin"}] -This will create following hierachy version is:: +The template named 'templatename1' will create following hierachy version is:: dev: E1: diff --git a/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java b/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java index e72fe5f..95db308 100644 --- a/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java +++ b/src/test/java/org/chorem/jtimer/JTimerFactoryTest.java @@ -72,10 +72,15 @@ public class JTimerFactoryTest extends AbstractJTimerTest { @Test public void testJsonTaskTemplates() { Map<String, List<?>> templates = JTimer.config.getTaskTemplates(); - List<?> p1Tpl = templates.get("projet1"); + List<?> p1Tpl = templates.get("project1"); Assert.assertNotNull(p1Tpl); + List<?> p2Tpl = templates.get("project2"); + Assert.assertNotNull(p2Tpl); + List<?> p3Tpl = templates.get("project3"); + Assert.assertNull(p3Tpl); Assert.assertEquals(p1Tpl.size(), 5); + Assert.assertEquals(p2Tpl.size(), 5); } /** diff --git a/src/test/resources/jtimertest.properties b/src/test/resources/jtimertest.properties index e8ceafb..6bd82b7 100644 --- a/src/test/resources/jtimertest.properties +++ b/src/test/resources/jtimertest.properties @@ -31,4 +31,5 @@ jtimer.io.saver.directory=${user.home}/testngdata jtimer.io.saver.autosavedelay=199 # Task templates as json -jtimer.ui.task.templates={"projet1":[{"name":"dev", "tasks":[{"name":"E1"},{"name":"E2"}]},{"name":"ano", "tasks":[{"name":"A1"}]},{"name":"admin", "tasks":[{"name":"database", "tasks":[{"name":"sub database task1"},{"name":"sub database task2"}]}]},{"name":"meetings"},{"name":"releases"}]} +jtimer.ui.task.templates.project1=[{"name":"dev1", "tasks":[{"name":"E1"},{"name":"E2"}]},{"name":"ano1", "tasks":[{"name":"A1"}]},{"name":"admin", "tasks":[{"name":"database", "tasks":[{"name":"sub database task1"},{"name":"sub database task2"}]}]},{"name":"meetings"},{"name":"releases"}] +jtimer.ui.task.templates.project2=[{"name":"dev2", "tasks":[{"name":"E1"},{"name":"E2"}]},{"name":"ano2", "tasks":[{"name":"A1"}]},{"name":"admin", "tasks":[{"name":"database", "tasks":[{"name":"sub database task1"},{"name":"sub database task2"}]}]},{"name":"meetings"},{"name":"releases"}] -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm