diff --git a/log4j.properties b/log4j.properties index ea18fcd..c2869e5 100644 --- a/log4j.properties +++ b/log4j.properties @@ -3,8 +3,8 @@ # priority setting: DEBUG < INFO < WARN < ERROR log4j.rootLogger = DEBUG, console - -log4j.logger.fr.devinsy.xidyn = INFO +log4j.logger.org.april.agirstatool = INFO +log4j.logger.fr.devinsy.xidyn = WARN #-- log4j.appender.console = org.apache.log4j.ConsoleAppender diff --git a/src/org/april/agirstatool/core/AgirStatool.java b/src/org/april/agirstatool/core/AgirStatool.java index e934b7d..6d924e9 100644 --- a/src/org/april/agirstatool/core/AgirStatool.java +++ b/src/org/april/agirstatool/core/AgirStatool.java @@ -25,6 +25,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import org.apache.commons.io.FileUtils; import org.april.agirstatool.charts.DateCount; @@ -473,6 +475,54 @@ public class AgirStatool return result; } + /** + * Checks for to refresh. + * + * @param project + * the project + * @return true, if successful + */ + public boolean hasToRefresh(final Project project) + { + boolean result; + + if (project == null) + { + result = false; + } + else + { + File target = new File(this.targetDirectory, project.getPath()); + if (target.exists()) + { + if (project.hasIssue()) + { + LocalDateTime lastFileUpdate = LocalDateTime.ofEpochSecond(target.lastModified() / 1000, 0, ZoneOffset.UTC); + + if (project.issueStats().getLastUpdate().isAfter(lastFileUpdate)) + { + result = true; + } + else + { + result = false; + } + } + else + { + result = false; + } + } + else + { + result = true; + } + } + + // + return result; + } + /** * List projects. * @@ -590,7 +640,7 @@ public class AgirStatool } for (Project project : projects) { - logger.info("Fetching Created/Closed history for " + project.getName()); + logger.debug("Fetching Created/Closed history for " + project.getName()); if (project.hasIssue()) { { @@ -605,7 +655,7 @@ public class AgirStatool } } } - logger.info("Fetching Created/Closed history done."); + logger.debug("Fetching Created/Closed history done."); // Transform as tree. for (Project project : projects) @@ -831,8 +881,9 @@ public class AgirStatool { try { - if (project != null) + if (hasToRefresh(project)) { + logger.info("Refresh project page for {}", project.getName()); String page = ProjectPage.build(project); FileUtils.write(new File(this.targetDirectory, project.getIdentifier() + ".xhtml"), page, StandardCharsets.UTF_8); } diff --git a/src/org/april/agirstatool/core/pages/ChartBarView.java b/src/org/april/agirstatool/core/pages/ChartBarView.java index 318c73d..b873c98 100644 --- a/src/org/april/agirstatool/core/pages/ChartBarView.java +++ b/src/org/april/agirstatool/core/pages/ChartBarView.java @@ -52,8 +52,6 @@ public class ChartBarView try { - logger.info("Building chartBar view…"); - String source = XidynUtils.load(AgirStatool.class.getResource("/org/april/agirstatool/core/pages/chartBarView.xhtml")); String code = XidynUtils.extractBodyContent(source); diff --git a/src/org/april/agirstatool/core/pages/ChartPolarView.java b/src/org/april/agirstatool/core/pages/ChartPolarView.java index 11bb089..aea5778 100644 --- a/src/org/april/agirstatool/core/pages/ChartPolarView.java +++ b/src/org/april/agirstatool/core/pages/ChartPolarView.java @@ -52,8 +52,6 @@ public class ChartPolarView try { - logger.info("Building polar chart view…"); - String source = XidynUtils.load(AgirStatool.class.getResource("/org/april/agirstatool/core/pages/chartPolarView.xhtml")); String code = XidynUtils.extractBodyContent(source); diff --git a/src/org/april/agirstatool/core/pages/CreatedConcludedCountChartView.java b/src/org/april/agirstatool/core/pages/CreatedConcludedCountChartView.java index 76a4791..cf5ff8a 100644 --- a/src/org/april/agirstatool/core/pages/CreatedConcludedCountChartView.java +++ b/src/org/april/agirstatool/core/pages/CreatedConcludedCountChartView.java @@ -62,8 +62,6 @@ public class CreatedConcludedCountChartView try { - logger.info("Building created/closed x months chart view…"); - if (project.hasIssue()) { String source = XidynUtils.load(AgirStatool.class.getResource("/org/april/agirstatool/core/pages/chartLineView.xhtml")); @@ -113,7 +111,7 @@ public class CreatedConcludedCountChartView try { - logger.info("Building created/concluded chart view…"); + logger.debug("Building created/concluded chart view…"); if (project.hasIssue()) { @@ -162,8 +160,6 @@ public class CreatedConcludedCountChartView { String result; - logger.info("Building created/closed x months chart view…"); - result = build(title, project, LocalDate.now().minusMonths(monthCount), LocalDate.now()); // @@ -180,8 +176,6 @@ public class CreatedConcludedCountChartView { String result; - logger.info("Building created/closed x months chart view…"); - result = buildYear(title, project, LocalDate.now().getYear() - 1); // @@ -253,8 +247,6 @@ public class CreatedConcludedCountChartView { String result; - logger.info("Building created/closed x months chart view…"); - LocalDate start = LocalDate.of(year, 1, 1).minusDays(7); LocalDate end = LocalDate.of(year + 1, 1, 1).minusDays(1); diff --git a/src/org/april/agirstatool/core/pages/IssueStatChartView.java b/src/org/april/agirstatool/core/pages/IssueStatChartView.java index c6eb59b..e1d311c 100644 --- a/src/org/april/agirstatool/core/pages/IssueStatChartView.java +++ b/src/org/april/agirstatool/core/pages/IssueStatChartView.java @@ -45,8 +45,6 @@ public class IssueStatChartView { String result; - logger.info("Building issue stat chart view…"); - StringList labels = new StringList("Maybe", "New", "Confirmed", "Ongoing", "Waiting", "Resolved"); StringList values = new StringList(); values.append(project.issueStats().getMaybeCount()); @@ -76,8 +74,6 @@ public class IssueStatChartView { String result; - logger.info("Building issue stat chart view…"); - StringList labels = new StringList("Maybe", "Active", "Resolved"); StringList values = new StringList(); values.append(project.issueStats().getMaybeCount()); diff --git a/src/org/april/agirstatool/core/pages/ProjectPage.java b/src/org/april/agirstatool/core/pages/ProjectPage.java index 811af99..2fe1418 100644 --- a/src/org/april/agirstatool/core/pages/ProjectPage.java +++ b/src/org/april/agirstatool/core/pages/ProjectPage.java @@ -51,7 +51,7 @@ public class ProjectPage try { - logger.info("Building project page " + project.getName() + "…"); + logger.debug("Building project page {}…", project.getName()); TagDataManager data = new TagDataManager(); diff --git a/src/org/april/agirstatool/core/pages/ProjectsGroupedView.java b/src/org/april/agirstatool/core/pages/ProjectsGroupedView.java index 1df7cd3..f04265c 100644 --- a/src/org/april/agirstatool/core/pages/ProjectsGroupedView.java +++ b/src/org/april/agirstatool/core/pages/ProjectsGroupedView.java @@ -54,7 +54,7 @@ public class ProjectsGroupedView try { - logger.info("Building ProjectsGrouped view…"); + logger.debug("Building ProjectsGrouped view…"); TagDataManager data = new TagDataManager(); diff --git a/src/org/april/agirstatool/core/pages/ProjectsRawView.java b/src/org/april/agirstatool/core/pages/ProjectsRawView.java index 8f79d5b..499733b 100644 --- a/src/org/april/agirstatool/core/pages/ProjectsRawView.java +++ b/src/org/april/agirstatool/core/pages/ProjectsRawView.java @@ -52,7 +52,7 @@ public class ProjectsRawView try { - logger.info("Building ProjectsRaw view…"); + logger.debug("Building ProjectsRaw view…"); TagDataManager data = new TagDataManager(); diff --git a/src/org/april/agirstatool/core/pages/UnassignedPolarChartView.java b/src/org/april/agirstatool/core/pages/UnassignedPolarChartView.java index a8815f2..41bf0ee 100644 --- a/src/org/april/agirstatool/core/pages/UnassignedPolarChartView.java +++ b/src/org/april/agirstatool/core/pages/UnassignedPolarChartView.java @@ -46,8 +46,6 @@ public class UnassignedPolarChartView { String result; - logger.info("Building issue stat chart view…"); - StringList labels = new StringList("Confirmed", "Ongoing", "Waiting", "Resolved", "Rejected", "Closed"); StringList values = new StringList(); IssueStats stats = project.issueStats(); @@ -78,8 +76,6 @@ public class UnassignedPolarChartView { String result; - logger.info("Building issue stat chart view…"); - StringList labels = new StringList("Started", "Resolved", "Concluded"); StringList values = new StringList(); IssueStats stats = project.issueStats();