From 63dd407749141db2a5ef6e6f42852a63b65cf4ac Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 9 Sep 2021 11:49:47 +0200 Subject: [PATCH] Added geolocation property check. --- src/fr/devinsy/statoolinfos/checker/PropertyChecker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java index 10c2d27..91036f8 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java @@ -47,6 +47,7 @@ public class PropertyChecker 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-zA-Z]{2}$"; + public static final String DECIMAL_DEGREE = "^[+-]?\\d+[,\\.]\\d{1,8}$"; public static final String SUBS = "^subs\\.\\S+$"; public static final String METRICS_NAME = "^metrics\\.\\S+\\.name$"; @@ -131,8 +132,8 @@ public class PropertyChecker this.organizationRules.add("organization.country.name", STRING, PropertyMode.WISHED); this.organizationRules.add("organization.country.code", COUNTRY_CODE, PropertyMode.MANDATORY); this.organizationRules.add("organization.funding.*", "^organization\\.funding\\.\\S+$", STRING, PropertyMode.OPTIONAL); - this.organizationRules.add("organization.geolocation.latitude", STRING, PropertyMode.OPTIONAL); - this.organizationRules.add("organization.geolocation.longitude", STRING, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.geolocation.latitude", DECIMAL_DEGREE, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.geolocation.longitude", DECIMAL_DEGREE, PropertyMode.OPTIONAL); this.organizationRules.add("organization.geolocation.address", STRING, PropertyMode.OPTIONAL); this.organizationRules.add(SUBS, URL, PropertyMode.OPTIONAL);