From 81f988654a3a91ac05cc5213ee8d6f55a5193dce Mon Sep 17 00:00:00 2001 From: Adrien Kantcheff <5028967+akantcheff@users.noreply.github.com> Date: Thu, 12 Oct 2023 02:11:21 +0200 Subject: [PATCH] tr(api): deprecate API tenant admin (#2753) --- .../engine/api/TenantAdministrationAPI.java | 10 ++++--- .../server/api/tenant/APITenantAdmin.java | 11 +++++++ .../system/TenantAdminDatastore.java | 29 +++++++++++++++---- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/TenantAdministrationAPI.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/TenantAdministrationAPI.java index d127d7dbc9c..0821003feae 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/TenantAdministrationAPI.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/TenantAdministrationAPI.java @@ -33,7 +33,9 @@ public interface TenantAdministrationAPI { /** * @return * true if the tenant is paused. + * @deprecated since 9.0.0, use {@link MaintenanceAPI#getMaintenanceDetails()} instead. */ + @Deprecated(since = "9.0.0", forRemoval = true) boolean isPaused(); /** @@ -43,21 +45,21 @@ public interface TenantAdministrationAPI { * All users connected are disconnected (apart from the technical user). * Only IdentityAPI and ProfileAPI are accessible. * + * @deprecated since 9.0.0, use {@link MaintenanceAPI#enableMaintenanceMode()} instead. * @throws org.bonitasoft.engine.exception.UpdateException * if the tenant cannot be paused. - * This method is deprecated, use {@link MaintenanceAPI#enableMaintenanceMode()} instead. */ - @Deprecated + @Deprecated(since = "9.0.0", forRemoval = true) void pause() throws UpdateException; /** * Resume the tenant to a normal state after a pause. * + * @deprecated since 9.0.0, use {@link MaintenanceAPI#disableMaintenanceMode()} instead. * @throws org.bonitasoft.engine.exception.UpdateException * if the tenant cannot be resumed. - * This method is deprecated, use {@link MaintenanceAPI#disableMaintenanceMode()} ()} instead. */ - @Deprecated + @Deprecated(since = "9.0.0", forRemoval = true) void resume() throws UpdateException; /** diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java index 54c11cef301..fa3cf3e5792 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java @@ -27,7 +27,9 @@ /** * @author Julien Reboul + * @deprecated since 9.0.0, use {{@link org.bonitasoft.web.rest.server.api.system.MaintenanceController}} instead. */ +@Deprecated(since = "9.0.0", forRemoval = true) public class APITenantAdmin extends ConsoleAPI implements APIHasGet, APIHasUpdate { @@ -52,8 +54,13 @@ public String defineDefaultSearchOrder() { * * @see org.bonitasoft.web.rest.server.framework.API#update(org.bonitasoft.web.toolkit.client.data.APIID, * java.util.Map) + * @deprecated since 9.0.0, use + * {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController#changeMaintenanceState( + * org.bonitasoft.web.rest.model.system.MaintenanceDetailsClient, javax.servlet.http.HttpSession)} + * instead. */ @Override + @Deprecated(since = "9.0.0", forRemoval = true) public TenantAdminItem update(final APIID id, final Map attributes) { return getTenantAdminDatastore().update(id, attributes); } @@ -62,8 +69,12 @@ public TenantAdminItem update(final APIID id, final Map attribut * get the current Tenant State * * @see org.bonitasoft.web.rest.server.framework.API#get(org.bonitasoft.web.toolkit.client.data.APIID) + * @deprecated since 9.0.0, use + * {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController#getMaintenanceDetails( + * javax.servlet.http.HttpSession)} instead. */ @Override + @Deprecated(since = "9.0.0", forRemoval = true) public TenantAdminItem get(final APIID id) { return getTenantAdminDatastore().get(id); } diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/system/TenantAdminDatastore.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/system/TenantAdminDatastore.java index ca67623bc71..c2bdd2e77d2 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/system/TenantAdminDatastore.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/system/TenantAdminDatastore.java @@ -28,22 +28,31 @@ /** * @author Julien Mege - * @deprecated since Bonita 9.0 Use {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController} instead + * @deprecated since 9.0.0, use {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController} instead. */ @Slf4j -@Deprecated +@Deprecated(since = "9.0.0", forRemoval = true) public class TenantAdminDatastore extends Datastore implements DatastoreHasUpdate, DatastoreHasGet { protected final APISession apiSession; - private static boolean hasShownDeprectedLog = false; + private static boolean hasShownDeprecatedLog = false; public TenantAdminDatastore(final APISession apiSession) { this.apiSession = apiSession; } + /** + * {@inheritDoc} + * + * @deprecated since 9.0.0, use + * {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController#changeMaintenanceState( + * org.bonitasoft.web.rest.model.system.MaintenanceDetailsClient, javax.servlet.http.HttpSession)} + * instead. + */ @Override + @Deprecated(since = "9.0.0", forRemoval = true) public TenantAdminItem update(final APIID unusedId, final Map attributes) { logDeprecatedAPIUsage(); final TenantAdminItem tenantAdminItem = new TenantAdminItem(); @@ -57,7 +66,15 @@ public TenantAdminItem update(final APIID unusedId, final Map at return tenantAdminItem; } + /** + * {@inheritDoc} + * + * @deprecated since 9.0.0, use + * {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController#getMaintenanceDetails( + * javax.servlet.http.HttpSession)} instead. + */ @Override + @Deprecated(since = "9.0.0", forRemoval = true) public TenantAdminItem get(final APIID id) { logDeprecatedAPIUsage(); final TenantAdminItem tenantAdminItem = new TenantAdminItem(); @@ -66,11 +83,11 @@ public TenantAdminItem get(final APIID id) { return tenantAdminItem; } - protected void logDeprecatedAPIUsage() { - if (!hasShownDeprectedLog && log.isWarnEnabled()) { + private static void logDeprecatedAPIUsage() { + if (!hasShownDeprecatedLog && log.isWarnEnabled()) { log.warn( "API system/tenant is deprecated and will be removed in a future release. Please use API system/maintenance instead."); - hasShownDeprectedLog = true; + hasShownDeprecatedLog = true; } }