From dd593ceb14209873a9acd11f5c9d503f4b3fc870 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 15 Jan 2021 05:18:55 +0100 Subject: [PATCH] Added ISO 3166-1 for country code checks. --- src/fr/devinsy/statoolinfos/checker/PropertyChecker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java index 8d7754d..464f0b6 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java @@ -46,6 +46,7 @@ public class PropertyChecker public static final String MONTHS = "^\\d*(,\\d*){0,11}$"; public static final String WEEKS = "^\\d*(,\\d*){0,52}$"; public static final String DAYS = "^\\d*(,\\d*){0,365}$"; + public static final String COUNTRY_CODE = "^[A-Z]{2}$"; public static final String SUBS = "^subs\\.\\S+$"; public static final String METRICS_NAME = "^metrics\\.\\S+\\.name$"; @@ -126,6 +127,8 @@ public class PropertyChecker this.organizationRules.add("organization.memberof.*.enddate", "^organization\\.memberof\\.\\S+\\.enddate$", DATE, PropertyMode.OPTIONAL); this.organizationRules.add("organization.memberof.*.status.level", "^organization\\.memberof\\.\\S+\\.status.level$", "^(ACTIVE|IDLE|AWAY)$", PropertyMode.MANDATORY); this.organizationRules.add("organization.memberof.*.status.description", "^organization\\.memberof\\.\\S+\\.status.description$", STRING, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.country.name", STRING, PropertyMode.MANDATORY); + this.organizationRules.add("organization.country.code", COUNTRY_CODE, PropertyMode.MANDATORY); this.organizationRules.add(SUBS, URL, PropertyMode.OPTIONAL); this.organizationRules.add(METRICS_NAME, STRING, PropertyMode.OPTIONAL); @@ -174,7 +177,7 @@ public class PropertyChecker this.serviceRules.add("host.server.type", "^(NANO|PHYSICAL|VIRTUAL|SHARED|CLOUD)$", PropertyMode.MANDATORY); this.serviceRules.add("host.provider.type", "^(HOME|HOSTEDBAY|HOSTEDSERVER|OUTSOURCED)$", PropertyMode.MANDATORY); this.serviceRules.add("host.country.name", STRING, PropertyMode.WISHED); - this.serviceRules.add("host.country.code", STRING, PropertyMode.WISHED); + this.serviceRules.add("host.country.code", COUNTRY_CODE, PropertyMode.WISHED); this.serviceRules.add(SUBS, URL, PropertyMode.OPTIONAL); this.serviceRules.add(METRICS_NAME, STRING, PropertyMode.OPTIONAL);