Added ISO 3166-1 for country code checks.

This commit is contained in:
Christian P. MOMON 2021-01-15 05:18:55 +01:00
parent fe471608fe
commit dd593ceb14

View file

@ -46,6 +46,7 @@ public class PropertyChecker
public static final String MONTHS = "^\\d*(,\\d*){0,11}$"; public static final String MONTHS = "^\\d*(,\\d*){0,11}$";
public static final String WEEKS = "^\\d*(,\\d*){0,52}$"; public static final String WEEKS = "^\\d*(,\\d*){0,52}$";
public static final String DAYS = "^\\d*(,\\d*){0,365}$"; 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 SUBS = "^subs\\.\\S+$";
public static final String METRICS_NAME = "^metrics\\.\\S+\\.name$"; 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.*.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.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.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(SUBS, URL, PropertyMode.OPTIONAL);
this.organizationRules.add(METRICS_NAME, STRING, 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.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.provider.type", "^(HOME|HOSTEDBAY|HOSTEDSERVER|OUTSOURCED)$", PropertyMode.MANDATORY);
this.serviceRules.add("host.country.name", STRING, PropertyMode.WISHED); 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(SUBS, URL, PropertyMode.OPTIONAL);
this.serviceRules.add(METRICS_NAME, STRING, PropertyMode.OPTIONAL); this.serviceRules.add(METRICS_NAME, STRING, PropertyMode.OPTIONAL);