From 6f6f9d17c8a301ee1324c0734091c397b796e0b5 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 29 Oct 2020 02:16:46 +0100 Subject: [PATCH] Added missing properties display un property check page. --- .../statoolinfos/checker/PropertyChecker.java | 19 ++++++++++++--- .../statoolinfos/checker/PropertyRules.java | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java index 6de8586..f68d904 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java @@ -148,7 +148,7 @@ public class PropertyChecker this.serviceRules.add("service.logo", URL, PropertyMode.WISHED); this.serviceRules.add("service.contact.url", URL, PropertyMode.WISHED); this.serviceRules.add("service.contact.email", EMAIL, PropertyMode.WISHED); - this.serviceRules.add("^service\\.socialnetworks\\.\\S+$", URL, PropertyMode.WISHED); + this.serviceRules.add("^service\\.socialnetworks\\.\\S+$", URL, PropertyMode.OPTIONAL); this.serviceRules.add("service.legal.url", URL, PropertyMode.WISHED); this.serviceRules.add("service.guide.user", URL, PropertyMode.WISHED); this.serviceRules.add("service.guide.technical", URL, PropertyMode.WISHED); @@ -190,7 +190,9 @@ public class PropertyChecker result = new PropertyChecks(); // - for (PropertyRule rule : rules.getMandatories()) + PropertyRules requiredRules = rules.getMandatories(); + requiredRules.addAll(rules.getWished()); + for (PropertyRule rule : requiredRules) { boolean ended = false; Iterator iterator = lines.iterator(); @@ -214,7 +216,18 @@ public class PropertyChecker else { ended = true; - PropertyCheck check = new PropertyCheck(0, rule.getPathPattern().replaceAll("\\\\.", "."), Status.ERROR, "Propriété manquante"); + Status status; + switch (rule.getMode()) + { + default: + case MANDATORY: + status = Status.ERROR; + break; + case WISHED: + status = Status.WARNING; + break; + } + PropertyCheck check = new PropertyCheck(0, rule.getPathPattern().replaceAll("\\\\.", "."), status, "Propriété manquante"); result.add(check); } } diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyRules.java b/src/fr/devinsy/statoolinfos/checker/PropertyRules.java index 86e019e..bfe4048 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyRules.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyRules.java @@ -124,4 +124,27 @@ public class PropertyRules extends ArrayList // return result; } + + /** + * Gets the wished. + * + * @return the wished + */ + public PropertyRules getWished() + { + PropertyRules result; + + result = new PropertyRules(); + + for (PropertyRule rule : this) + { + if (rule.isWished()) + { + result.add(rule); + } + } + + // + return result; + } } \ No newline at end of file