task_21363 #1

Closed
francesco.mangiacrapa wants to merge 53 commits from task_21363 into master
4 changed files with 30 additions and 32 deletions
Showing only changes of commit cff1e2a78f - Show all commits

View File

@ -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<Boolean>() {
.isModerationEnabled(reloadGCatConfig, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {

View File

@ -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;
}

View File

@ -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<Boolean> callback);
/**
* Reject item.
*
@ -96,6 +89,14 @@ public interface CkanContentModeratorServiceAsync {
*/
void getCMSRolesForUserInTheContext(AsyncCallback<ModerationUserRole> callback);
/**
* Checks if is moderation enabled.
*
* @param reloadConfig the reload config
* @param callback the callback
*/
void isModerationEnabled(boolean reloadConfig, AsyncCallback<Boolean> callback);
/**
* Checks if is moderator role assigned.
*

View File

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