Skip to content

Commit

Permalink
tr(api): deprecate API tenant admin (#2753)
Browse files Browse the repository at this point in the history
  • Loading branch information
akantcheff authored Oct 12, 2023
1 parent 17f0e88 commit 81f9886
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/**
Expand All @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TenantAdminItem>
implements APIHasGet<TenantAdminItem>, APIHasUpdate<TenantAdminItem> {

Expand All @@ -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<String, String> attributes) {
return getTenantAdminDatastore().update(id, attributes);
}
Expand All @@ -62,8 +69,12 @@ public TenantAdminItem update(final APIID id, final Map<String, String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TenantAdminItem>, DatastoreHasGet<TenantAdminItem> {

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<String, String> attributes) {
logDeprecatedAPIUsage();
final TenantAdminItem tenantAdminItem = new TenantAdminItem();
Expand All @@ -57,7 +66,15 @@ public TenantAdminItem update(final APIID unusedId, final Map<String, String> 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();
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 81f9886

Please sign in to comment.