diff --git a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorCheckConfig.java b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorCheckConfig.java index dab6a67..3c36cf9 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorCheckConfig.java +++ b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorCheckConfig.java @@ -34,13 +34,13 @@ public class CkanContentModeratorCheckConfig { * @param whenDone the when done * @throws Exception the exception */ - public void checkConfigs(final Command whenDone) throws Exception { + public void checkConfigs(final Command whenDone, boolean reloadGCatConfig) throws Exception { configurationLoaded = 0; attemptLC = 0; CkanContentModeratorWidgetController.contentModeratorService - .isContentModeratorEnabled(new AsyncCallback() { + .isModerationEnabled(reloadGCatConfig, new AsyncCallback() { @Override public void onFailure(Throwable caught) { diff --git a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorService.java b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorService.java index af4fcde..8326861 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorService.java +++ b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorService.java @@ -21,13 +21,6 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @RemoteServiceRelativePath("ckanContentModeratorService") public interface CkanContentModeratorService extends RemoteService { - /** - * Checks if is content moderator enabled. - * - * @return true, if is content moderator enabled - */ - public Boolean isContentModeratorEnabled(); - /** * Sets the status. Currently, this only used to change the status from Rejected * to Pending @@ -74,10 +67,10 @@ public interface CkanContentModeratorService extends RemoteService { /** * Gets the data for status. * - * @param status the status - * @param star@Override tIndex the start index - * @param lenght the lenght - * @param serverIndex the server index + * @param status the status + * @param startIndex the start index + * @param lenght the lenght + * @param serverIndex the server index * @return the data for status * @throws Exception the exception * @par@Override am lenght the lenght @@ -102,11 +95,19 @@ public interface CkanContentModeratorService extends RemoteService { */ ModerationUserRole getCMSRolesForUserInTheContext() throws Exception; + /** + * Checks if is moderation enabled. + * + * @param reloadConfig the reload config + * @return the boolean + */ + Boolean isModerationEnabled(boolean reloadConfig); + /** * Checks if is moderator role assigned. * - * @return the moderation user role - * @throws Exception the exception + * @return true, if is moderator role assigned + * @throws Exception */ Boolean isModeratorRoleAssigned() throws Exception; } diff --git a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorServiceAsync.java b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorServiceAsync.java index cb35199..8c85577 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorServiceAsync.java +++ b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/CkanContentModeratorServiceAsync.java @@ -19,13 +19,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback; */ public interface CkanContentModeratorServiceAsync { - /** - * Checks if is content moderator enabled. - * - * @param callback the callback - */ - void isContentModeratorEnabled(AsyncCallback callback); - /** * Reject item. * @@ -96,6 +89,14 @@ public interface CkanContentModeratorServiceAsync { */ void getCMSRolesForUserInTheContext(AsyncCallback callback); + /** + * Checks if is moderation enabled. + * + * @param reloadConfig the reload config + * @param callback the callback + */ + void isModerationEnabled(boolean reloadConfig, AsyncCallback callback); + /** * Checks if is moderator role assigned. * diff --git a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/server/CkanContentModeratorServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/server/CkanContentModeratorServiceImpl.java index e78b67b..c37f07b 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/server/CkanContentModeratorServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/server/CkanContentModeratorServiceImpl.java @@ -29,31 +29,27 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * * Jan 11, 2022 + * @return the boolean */ @SuppressWarnings("serial") public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implements CkanContentModeratorService { private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceImpl.class); - /** - * Checks if is content moderator enabled. - * - * @return true, if is content moderator enabled - */ @Override - public Boolean isContentModeratorEnabled() { + public Boolean isModerationEnabled(boolean reloadConfig) { LOG.info("called isContentModeratorEnabled"); String scope = setContexts(); - boolean isContentModeratorEnabled = false; + boolean isModerationEnabled = false; try { DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope); CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator(); - isContentModeratorEnabled = cmsInstance.isContentModeratorEnabled(); + isModerationEnabled = cmsInstance.isModerationEnabled(reloadConfig); } catch (Exception e) { - LOG.error("Error occured on cheching isContentModeratorEnabled, so returning false", e); + LOG.error("Error occured on checking isContentModeratorEnabled, so returning false", e); return false; } - return isContentModeratorEnabled; + return isModerationEnabled; } /**