From 0bf6ba9fa6ff6a401a077558d2f94927cead86da Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 9 Sep 2021 19:54:31 +0300 Subject: [PATCH] Add regex condition for roles to replace '.' with '_' e.g beta.datasource --- .../dnetrolemanagement/utils/AuthoritiesUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/dnetlib/dnetrolemanagement/utils/AuthoritiesUtils.java b/src/main/java/eu/dnetlib/dnetrolemanagement/utils/AuthoritiesUtils.java index 593c587..717cc96 100644 --- a/src/main/java/eu/dnetlib/dnetrolemanagement/utils/AuthoritiesUtils.java +++ b/src/main/java/eu/dnetlib/dnetrolemanagement/utils/AuthoritiesUtils.java @@ -10,11 +10,11 @@ public class AuthoritiesUtils { * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT etc. */ public static String curator(String type) { - return "CURATOR_" + type.toUpperCase(); + return "CURATOR_" + type.replaceAll("[.]", "_").toUpperCase(); } public static String curatorRole(String type) { - return "Curator - " + Character.toString(type.charAt(0)).toUpperCase() + type.substring(1); + return "Curator - " + Character.toString(type.replaceAll("[.]", "_").charAt(0)).toUpperCase() + type.substring(1); } /** @@ -23,7 +23,7 @@ public class AuthoritiesUtils { * Id = EE, EGI, etc */ public static String manager(String type, String id) { - return type.toUpperCase() + "_" + id.toUpperCase() + "_MANAGER"; + return type.replaceAll("[.]", "_").toUpperCase() + "_" + id.toUpperCase() + "_MANAGER"; } /** @@ -32,7 +32,7 @@ public class AuthoritiesUtils { * Id = EE, EGI, etc */ public static String member(String type, String id) { - return type.toUpperCase() + "_" + id.toUpperCase(); + return type.replaceAll("[.]", "_").toUpperCase() + "_" + id.toUpperCase(); } public static String memberRole(String type, String id) {