From be274efdea30f3159227d2b06bab1a6bef15d5bc Mon Sep 17 00:00:00 2001
From: naji <naji@cines.fr>
Date: Thu, 3 Mar 2022 18:19:11 +0100
Subject: [PATCH] [JAVA] retour PR

---
 .../pastis/common/dto/ElementProperties.java  |  6 +-
 .../pastis/common/dto/JsonFromRng.java        |  2 +-
 .../vitamui/pastis/common/rest/RestApi.java   |  4 +-
 ...mportPuaTest.java => JsonFromPuaTest.java} | 43 ++++------
 .../service/PuaPastisValidatorNOKTest.java    | 78 +++++++++++++++++++
 .../service/PuaPastisValidatorOKTest.java     | 78 +++++++++++++++++++
 .../service/PuaPastisValidatorTest.java       | 57 ++++++++++++++
 .../VitamArchivalProfileUnitService.java      |  8 --
 .../common/service/VitamProfileService.java   |  8 --
 ...ArchivalProfileUnitInternalController.java |  1 -
 .../rest/ProfileInternalController.java       |  1 -
 .../upload-profile.component.ts               |  3 +-
 .../src/assets/config/config-standalone.json  |  8 +-
 .../src/assets/config/config-vitam-ui.json    |  6 +-
 14 files changed, 238 insertions(+), 65 deletions(-)
 rename api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/{ImportPuaTest.java => JsonFromPuaTest.java} (83%)
 create mode 100644 api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorNOKTest.java
 create mode 100644 api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorOKTest.java
 create mode 100644 api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorTest.java

diff --git a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/ElementProperties.java b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/ElementProperties.java
index 4fa52ae74..ce2d62bca 100644
--- a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/ElementProperties.java
+++ b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/ElementProperties.java
@@ -90,11 +90,7 @@ public class ElementProperties {
     }
 
     public void setGroupOrChoice(String groupOrChoice) {
-        if (null != RNGConstants.getGroupOrChoiceMap().get(groupOrChoice)) {
-            this.groupOrChoice = RNGConstants.getGroupOrChoiceMap().get(groupOrChoice);
-        } else {
-            this.groupOrChoice = groupOrChoice;
-        }
+        this.groupOrChoice = RNGConstants.getGroupOrChoiceMap().getOrDefault(groupOrChoice, groupOrChoice);
     }
 
     public void initTree(ElementProperties json) {
diff --git a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/JsonFromRng.java b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/JsonFromRng.java
index 3eecb883c..cc54a0823 100644
--- a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/JsonFromRng.java
+++ b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/dto/JsonFromRng.java
@@ -53,7 +53,7 @@ public class JsonFromRng {
 
     String cardinality;
 
-    String valuleOrData;
+    String valueOrData;
 
     String dataType;
 
diff --git a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/rest/RestApi.java b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/rest/RestApi.java
index 02399984b..3976a2e1a 100644
--- a/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/rest/RestApi.java
+++ b/api/api-pastis/pastis-commons/src/main/java/fr/gouv/vitamui/pastis/common/rest/RestApi.java
@@ -52,8 +52,8 @@ public class RestApi {
     public static final String PASTIS_GET_PROFILE_FILE = "/getfile";
     public static final String PASTIS_TRANSFORM_PROFILE_PA = "/editpa";
     public static final String PASTIS_DOWNLOAD_PUA = "/getarchiveunitprofile";
-    public static final String PASTIS_DOWNLOAD_PA = "/getarchiveprofile";
-    public static final String PASTIS_CREATE_PROFILE = "/createprofile";
+    public static final String PASTIS_DOWNLOAD_PA = "/archiveprofile";
+    public static final String PASTIS_CREATE_PROFILE = "/profile";
     public static final String PASTIS = "/pastis";
 
 }
diff --git a/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/ImportPuaTest.java b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/JsonFromPuaTest.java
similarity index 83%
rename from api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/ImportPuaTest.java
rename to api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/JsonFromPuaTest.java
index 6da77d25b..ef5479961 100644
--- a/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/ImportPuaTest.java
+++ b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/JsonFromPuaTest.java
@@ -48,8 +48,6 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.skyscreamer.jsonassert.JSONAssert;
 import org.skyscreamer.jsonassert.JSONCompareMode;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -60,9 +58,8 @@ import java.io.InputStreamReader;
 
 @RunWith(SpringRunner.class)
 @TestPropertySource(locations = "/application-test.yml")
-public class ImportPuaTest {
+public class JsonFromPuaTest {
 
-    PuaPastisValidator puaPastisValidator = new PuaPastisValidator();
     JsonFromPUA jsonFromPUA = new JsonFromPUA();
 
     @Test
@@ -70,19 +67,13 @@ public class ImportPuaTest {
         InputStream inputStreamPua = getClass().getClassLoader().getResourceAsStream("pua/pua_OK.json");
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profileActual = jsonFromPUA.getProfileFromPUA(profileJson);
-
         ObjectMapper mapper = new ObjectMapper();
         String fileNodeActual = mapper.writeValueAsString(profileActual);
         JSONObject fileNodeJSONActual = new JSONObject(fileNodeActual);
-
-        Notice notice = NoticeUtils.getNoticeFromPUA(profileJson);
-
         InputStream inputStreamExpected = getClass().getClassLoader().getResourceAsStream("pua/profile_Expected.json");
         tokener = new JSONTokener(inputStreamExpected);
         JSONObject fileNodeJSONExpected = new JSONObject(tokener);
-
         JSONAssert.assertEquals(fileNodeJSONActual, fileNodeJSONExpected, JSONCompareMode.STRICT);
     }
 
@@ -92,74 +83,66 @@ public class ImportPuaTest {
 
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profileActual = jsonFromPUA.getProfileFromPUA(profileJson);
-
         ObjectMapper mapper = new ObjectMapper();
         String fileNodeActual = mapper.writeValueAsString(profileActual);
         JSONObject fileNodeJSONActual = new JSONObject(fileNodeActual);
-
         InputStream inputStreamExpected =
             getClass().getClassLoader().getResourceAsStream("pua/profile_Expected_with_management.json");
         tokener = new JSONTokener(inputStreamExpected);
         JSONObject fileNodeJSONExpected = new JSONObject(tokener);
-
         JSONAssert.assertEquals(fileNodeJSONActual, fileNodeJSONExpected, JSONCompareMode.STRICT);
     }
 
-    @Test(expected = AssertionError.class)
+    @Test
     public void testImportNOK_missing_definitions() throws IOException {
         InputStream inputStreamPua =
             getClass().getClassLoader().getResourceAsStream("pua/pua_NOK_missing_definitions.json");
 
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profile = jsonFromPUA.getProfileFromPUA(profileJson);
         ObjectMapper mapper = new ObjectMapper();
-        String fileNodeActual = mapper.writeValueAsString(profile);
-        Notice notice = NoticeUtils.getNoticeFromPUA(profileJson);
+        mapper.writeValueAsString(profile);
+        NoticeUtils.getNoticeFromPUA(profileJson);
     }
 
-    @Test(expected = AssertionError.class)
+    @Test
     public void testImportNOK_missing_management() throws IOException {
         InputStream inputStreamPua =
             getClass().getClassLoader().getResourceAsStream("pua/pua_NOK_missing_management.json");
 
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profile = jsonFromPUA.getProfileFromPUA(profileJson);
         ObjectMapper mapper = new ObjectMapper();
-        String fileNodeActual = mapper.writeValueAsString(profile);
-        Notice notice = NoticeUtils.getNoticeFromPUA(profileJson);
+        mapper.writeValueAsString(profile);
+        NoticeUtils.getNoticeFromPUA(profileJson);
     }
 
-    @Test(expected = AssertionError.class)
+    @Test
     public void testImportNOK_missing_properties() throws IOException {
         InputStream inputStreamPua =
             getClass().getClassLoader().getResourceAsStream("pua/pua_NOK_missing_properties.json");
 
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profile = jsonFromPUA.getProfileFromPUA(profileJson);
         ObjectMapper mapper = new ObjectMapper();
-        String fileNodeActual = mapper.writeValueAsString(profile);
-        Notice notice = NoticeUtils.getNoticeFromPUA(profileJson);
+        mapper.writeValueAsString(profile);
+        NoticeUtils.getNoticeFromPUA(profileJson);
     }
 
-    @Test(expected = AssertionError.class)
+    @Test
     public void testImportNOK_both_management_present() throws IOException {
         InputStream inputStreamPua =
             getClass().getClassLoader().getResourceAsStream("pua/pua_NOK_both_management_present.json");
 
         JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
         JSONObject profileJson = new JSONObject(tokener);
-        puaPastisValidator.validatePUA(profileJson);
         ElementProperties profile = jsonFromPUA.getProfileFromPUA(profileJson);
         ObjectMapper mapper = new ObjectMapper();
-        String fileNodeActual = mapper.writeValueAsString(profile);
-        Notice notice = NoticeUtils.getNoticeFromPUA(profileJson);
+        mapper.writeValueAsString(profile);
+        NoticeUtils.getNoticeFromPUA(profileJson);
     }
 }
diff --git a/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorNOKTest.java b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorNOKTest.java
new file mode 100644
index 000000000..a1f58f0ab
--- /dev/null
+++ b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorNOKTest.java
@@ -0,0 +1,78 @@
+/*
+Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
+
+[dad@cines.fr]
+
+This software is a computer program whose purpose is to provide
+a web application to create, edit, import and export archive
+profiles based on the french SEDA standard
+(https://redirect.francearchives.fr/seda/).
+
+
+This software is governed by the CeCILL-C  license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-C
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-C license and that you accept its terms.
+*/
+
+package fr.gouv.vitamui.pastis.common.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import java.util.Arrays;
+import java.util.Collection;
+
+
+@RunWith(Parameterized.class)
+public class PuaPastisValidatorNOKTest {
+
+    @Parameters
+    public static Collection<String> data() {
+        return Arrays.asList(new String[] {
+            "pua/pua_NOK_missing_definitions.json",
+            "pua/pua_NOK_missing_management.json",
+            "pua/pua_NOK_missing_properties.json",
+            "pua/pua_NOK_both_management_present.json"
+        });
+    }
+
+    private final String fileName;
+    private final PuaPastisValidatorTest puaPastisValidatorTest;
+
+    public PuaPastisValidatorNOKTest(String fileName) {
+        this.fileName = fileName;
+        this.puaPastisValidatorTest = new PuaPastisValidatorTest();
+    }
+
+    @Test(expected = AssertionError.class)
+    public void testImports() {
+        puaPastisValidatorTest.testImport(fileName);
+    }
+
+
+}
+
+
diff --git a/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorOKTest.java b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorOKTest.java
new file mode 100644
index 000000000..6bcbd3277
--- /dev/null
+++ b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorOKTest.java
@@ -0,0 +1,78 @@
+/*
+Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
+
+[dad@cines.fr]
+
+This software is a computer program whose purpose is to provide
+a web application to create, edit, import and export archive
+profiles based on the french SEDA standard
+(https://redirect.francearchives.fr/seda/).
+
+
+This software is governed by the CeCILL-C  license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-C
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-C license and that you accept its terms.
+*/
+
+package fr.gouv.vitamui.pastis.common.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+
+@RunWith(Parameterized.class)
+public class PuaPastisValidatorOKTest {
+
+    @Parameters
+    public static Collection<String> data() {
+        return Arrays.asList(new String[] {
+            "pua/pua_OK.json",
+            "pua/pua_OK_with_management.json",
+        });
+    }
+
+    private final String fileName;
+    private final PuaPastisValidatorTest puaPastisValidatorTest;
+
+    public PuaPastisValidatorOKTest(String fileName) {
+        this.fileName = fileName;
+        this.puaPastisValidatorTest = new PuaPastisValidatorTest();
+    }
+
+
+    @Test
+    public void testImports() {
+        puaPastisValidatorTest.testImport(fileName);
+    }
+
+
+}
+
+
diff --git a/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorTest.java b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorTest.java
new file mode 100644
index 000000000..c60d9ff31
--- /dev/null
+++ b/api/api-pastis/pastis-commons/src/test/java/fr/gouv/vitamui/pastis/common/service/PuaPastisValidatorTest.java
@@ -0,0 +1,57 @@
+/*
+Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2020)
+
+[dad@cines.fr]
+
+This software is a computer program whose purpose is to provide
+a web application to create, edit, import and export archive
+profiles based on the french SEDA standard
+(https://redirect.francearchives.fr/seda/).
+
+
+This software is governed by the CeCILL-C  license under French law and
+abiding by the rules of distribution of free software.  You can  use,
+modify and/ or redistribute the software under the terms of the CeCILL-C
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info".
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability.
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or
+data to be ensured and,  more generally, to use and operate it in the
+same conditions as regards security.
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL-C license and that you accept its terms.
+*/
+
+package fr.gouv.vitamui.pastis.common.service;
+
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+
+public class PuaPastisValidatorTest {
+
+    PuaPastisValidator puaPastisValidator = new PuaPastisValidator();
+
+    public void testImport(String pathFile) {
+        InputStream inputStreamPua = getClass().getClassLoader().getResourceAsStream(pathFile);
+        JSONTokener tokener = new JSONTokener(new InputStreamReader(inputStreamPua));
+        JSONObject profileJson = new JSONObject(tokener);
+        puaPastisValidator.validatePUA(profileJson);
+    }
+}
diff --git a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamArchivalProfileUnitService.java b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamArchivalProfileUnitService.java
index 44f2e47ac..2d2661f9c 100644
--- a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamArchivalProfileUnitService.java
+++ b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamArchivalProfileUnitService.java
@@ -57,11 +57,8 @@ public class VitamArchivalProfileUnitService {
      */
     public RequestResponse<ArchiveUnitProfileModel> findArchivalProfiles(final VitamContext vitamContext, final JsonNode select) throws VitamClientException {
         LOGGER.info("Archival Unit Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
-        System.out.println(vitamContext.getTenantId());
         final RequestResponse<ArchiveUnitProfileModel> response = adminExternalClient.findArchiveUnitProfiles(vitamContext, select);
         VitamRestUtils.checkResponse(response);
-        System.out.println(response);
         return response;
     }
 
@@ -75,7 +72,6 @@ public class VitamArchivalProfileUnitService {
      */
     public RequestResponse<ArchiveUnitProfileModel> findArchivalProfileById(final VitamContext vitamContext, final String contractId) throws VitamClientException {
         LOGGER.info("Archival Unit Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         final RequestResponse<ArchiveUnitProfileModel> response = adminExternalClient.findArchiveUnitProfileById(vitamContext, contractId);
         VitamRestUtils.checkResponse(response);
         return response;
@@ -95,7 +91,6 @@ public class VitamArchivalProfileUnitService {
     public RequestResponse<?> updateArchiveUnitProfile(final VitamContext vitamContext, final String id, JsonNode jsonNode) throws VitamClientException, InvalidParseOperationException, AccessExternalClientException {
         LOGGER.debug("patch: {}, {}", id, jsonNode);
         LOGGER.info("Update Archival Unit Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         return adminExternalClient.updateArchiveUnitProfile(vitamContext, id, jsonNode);
     }
 
@@ -115,7 +110,6 @@ public class VitamArchivalProfileUnitService {
         throws InvalidParseOperationException, AccessExternalClientException, VitamClientException, IOException, JAXBException {
 
         LOGGER.info("Create Archival Unit Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         final List<ArchiveUnitProfileModel> archiveUnitProfileModelsList = new ArrayList<>();
         archiveUnitProfileModelsList.add(newArchivalProfile);
         return importArchivalProfiles(vitamContext, archiveUnitProfileModelsList);
@@ -124,7 +118,6 @@ public class VitamArchivalProfileUnitService {
     private RequestResponse<?> importArchivalProfiles(final VitamContext vitamContext, final List<ArchiveUnitProfileModel> archivalProfileModels)
         throws InvalidParseOperationException, AccessExternalClientException, IOException, JAXBException {
         try (ByteArrayInputStream byteArrayInputStream = serializeArchivalProfiles(archivalProfileModels)) {
-            vitamContext.setTenantId(0);
             return adminExternalClient.createArchiveUnitProfile(vitamContext, byteArrayInputStream);
         }
     }
@@ -157,7 +150,6 @@ public class VitamArchivalProfileUnitService {
     public RequestResponse<?> importArchivalUnitProfileByFile(VitamContext vitamContext, String fileName, MultipartFile file) throws InvalidParseOperationException, AccessExternalClientException, VitamClientException, IOException {
         {
             LOGGER.debug("Import archival unit profile by file {}", fileName);
-            vitamContext.setTenantId(0);
             return adminExternalClient.createArchiveUnitProfile(vitamContext, file.getInputStream());
         }
     }
diff --git a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamProfileService.java b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamProfileService.java
index b8f6fb163..6436dbd21 100644
--- a/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamProfileService.java
+++ b/api/api-referential/referential-commons/src/main/java/fr/gouv/vitamui/referential/common/service/VitamProfileService.java
@@ -48,7 +48,6 @@ public class VitamProfileService {
      */
     public RequestResponse<ProfileModel> findArchivalProfiles(final VitamContext vitamContext, final JsonNode select) throws VitamClientException {
         LOGGER.info("Archival Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         final RequestResponse<ProfileModel> response = adminExternalClient.findProfiles(vitamContext, select);
         VitamRestUtils.checkResponse(response);
         return response;
@@ -64,7 +63,6 @@ public class VitamProfileService {
      */
     public RequestResponse<ProfileModel> findArchivalProfileById(final VitamContext vitamContext, final String contractId) throws VitamClientException {
         LOGGER.info("Archival Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         final RequestResponse<ProfileModel> response = adminExternalClient.findProfileById(vitamContext, contractId);
         VitamRestUtils.checkResponse(response);
         return response;
@@ -82,7 +80,6 @@ public class VitamProfileService {
      */
     public Response downloadProfile(VitamContext context, String id) throws VitamClientException, AccessExternalClientException, AccessExternalNotFoundException {
         LOGGER.info("Download profile file EvIdAppSession : {} ", context.getApplicationSessionId());
-        context.setTenantId(0);
         return adminExternalClient.downloadProfileFile(context, id);
     }
 
@@ -98,7 +95,6 @@ public class VitamProfileService {
      */
     public RequestResponse updateProfileFile(VitamContext context, String id, MultipartFile file) throws AccessExternalClientException, InvalidParseOperationException, IOException {
         LOGGER.info("Upload Profile xsd or rng EvIdAppSession : {} ", context.getApplicationSessionId());
-        context.setTenantId(0);
         return adminExternalClient.createProfileFile(context, id, file.getInputStream());
     }
 
@@ -114,7 +110,6 @@ public class VitamProfileService {
     public RequestResponse<?> updateProfile(VitamContext vitamContext, String id, JsonNode jsonNode) throws AccessExternalClientException {
         LOGGER.debug("patch: {}, {}", id, jsonNode);
         LOGGER.info("Update Archival Unit Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         return adminExternalClient.updateProfile(vitamContext, id, jsonNode);
     }
 
@@ -133,7 +128,6 @@ public class VitamProfileService {
     public RequestResponse<?> create(final VitamContext vitamContext, ProfileModel newArchivalProfile)
         throws InvalidParseOperationException, AccessExternalClientException, VitamClientException, IOException, JAXBException {
         LOGGER.info("Create Archival Profile EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
-        vitamContext.setTenantId(0);
         final List<ProfileModel> profileModelNewList = new ArrayList<>();
         profileModelNewList.add(newArchivalProfile);
         return importArchivalProfiles(vitamContext, profileModelNewList);
@@ -143,7 +137,6 @@ public class VitamProfileService {
     public RequestResponse<?> importArchivalProfiles(final VitamContext vitamContext, final List<ProfileModel> archivalProfileModels)
         throws InvalidParseOperationException, AccessExternalClientException, IOException, JAXBException {
         try (ByteArrayInputStream byteArrayInputStream = serializeArchivalProfiles(archivalProfileModels)) {
-            vitamContext.setTenantId(0);
             return adminExternalClient.createProfiles(vitamContext, byteArrayInputStream);
         }
     }
@@ -174,7 +167,6 @@ public class VitamProfileService {
     public RequestResponse<?> importProfileByFile(VitamContext vitamContext, String fileName, MultipartFile file)
         throws InvalidParseOperationException, AccessExternalClientException, VitamClientException, IOException {
         LOGGER.debug("Import profile by file {}", fileName);
-        vitamContext.setTenantId(0);
         return adminExternalClient.createProfiles(vitamContext, file.getInputStream());
     }
 
diff --git a/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ArchivalProfileUnitInternalController.java b/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ArchivalProfileUnitInternalController.java
index 47eab1b1d..e79c0ea25 100755
--- a/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ArchivalProfileUnitInternalController.java
+++ b/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ArchivalProfileUnitInternalController.java
@@ -86,7 +86,6 @@ public class ArchivalProfileUnitInternalController {
         LOGGER.debug("create archival unit profile={}", archivalUnitProfile);
         final VitamContext vitamContext = securityService.buildVitamContext(securityService.getTenantIdentifier());
         archivalUnitProfile.setTenant(0);
-        vitamContext.setTenantId(0);
         return archivalProfileUnitInternalService.create(vitamContext, archivalUnitProfile);
     }
 
diff --git a/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ProfileInternalController.java b/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ProfileInternalController.java
index 551e35465..fc62846e7 100755
--- a/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ProfileInternalController.java
+++ b/api/api-referential/referential-internal/src/main/java/fr/gouv/vitamui/referential/internal/server/rest/ProfileInternalController.java
@@ -160,7 +160,6 @@ public class ProfileInternalController {
         LOGGER.debug("create profile={}", archivalProfile);
         final VitamContext vitamContext = securityService.buildVitamContext(securityService.getTenantIdentifier());
         archivalProfile.setTenant(0);
-        vitamContext.setTenantId(0);
         return profileInternalService.create(vitamContext, archivalProfile);
     }
 
diff --git a/ui/ui-frontend/projects/pastis/src/app/user-actions/upload-profile/upload-profile.component.ts b/ui/ui-frontend/projects/pastis/src/app/user-actions/upload-profile/upload-profile.component.ts
index e87eb0505..1d314fae3 100644
--- a/ui/ui-frontend/projects/pastis/src/app/user-actions/upload-profile/upload-profile.component.ts
+++ b/ui/ui-frontend/projects/pastis/src/app/user-actions/upload-profile/upload-profile.component.ts
@@ -41,7 +41,6 @@ import { FileService } from '../../core/services/file.service';
 import { ProfileService } from '../../core/services/profile.service';
 
 
-const URL = 'http://localhost:8080/rest/createprofilefromfile';
 
 @Component({
   selector: 'pastis-user-action-upload',
@@ -51,7 +50,7 @@ const URL = 'http://localhost:8080/rest/createprofilefromfile';
 export class UserActionUploadProfileComponent implements OnInit {
 
   @Input()
-  uploader: FileUploader = new FileUploader({url: URL});
+  uploader: FileUploader = new FileUploader({url: ""});
   fileToUpload: File = null;
 
   constructor(private profileService: ProfileService, private fileService: FileService) { }
diff --git a/ui/ui-frontend/projects/pastis/src/assets/config/config-standalone.json b/ui/ui-frontend/projects/pastis/src/assets/config/config-standalone.json
index 0b05e4bbf..f25d7d8f2 100644
--- a/ui/ui-frontend/projects/pastis/src/assets/config/config-standalone.json
+++ b/ui/ui-frontend/projects/pastis/src/assets/config/config-standalone.json
@@ -5,11 +5,11 @@
   "pastisPathPrefix": "",
   "getAllProfilesUrl": "/getprofiles",
   "editProfileUrl": "/edit",
-  "createProfileByTypeUrl": "/createprofile",
+  "createProfileByTypeUrl": "/profile",
   "uploadProfileUrl": "/profile",
   "getFileUrl": "/getfile",
-  "savePAasFileUrl": "/getarchiveprofile",
+  "savePAasFileUrl": "/archiveprofile",
   "savePUAasFileUrl": "/getarchiveunitprofile"
-  
-  
+
+
 }
diff --git a/ui/ui-frontend/projects/pastis/src/assets/config/config-vitam-ui.json b/ui/ui-frontend/projects/pastis/src/assets/config/config-vitam-ui.json
index 9c594bda9..89eedb4da 100644
--- a/ui/ui-frontend/projects/pastis/src/assets/config/config-vitam-ui.json
+++ b/ui/ui-frontend/projects/pastis/src/assets/config/config-vitam-ui.json
@@ -5,15 +5,15 @@
   "pastisPathPrefix": "/pastis/tenant/",
   "getAllProfilesUrl": "/pastis/getprofiles",
   "editProfileUrl": "/pastis/edit",
-  "createProfileByTypeUrl": "/pastis/createprofile",
+  "createProfileByTypeUrl": "/pastis/profile",
   "uploadProfileUrl": "/pastis/profile",
   "getFileUrl": "/pastis/getfile",
-  "savePAasFileUrl": "/pastis/getarchiveprofile",
+  "savePAasFileUrl": "/pastis/archiveprofile",
   "savePUAasFileUrl": "/pastis/getarchiveunitprofile",
   "pastisApiPath":"/pastis",
   "archivalProfileUnitApiPath":"/archival-profile",
   "archiveProfileApiPath":"/profile",
-  
+
   "getAllArchivalProfileUrl": "/profile",
   "getProfilePaginatedUrl": "/profile",
   "getProfileById": "/profile/{{identifier}}",
-- 
GitLab