|
|
|
@ -54,6 +54,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
|
|
|
|
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
|
|
|
|
isModerationEnabled = cmsInstance.isModerationEnabled(reloadConfig);
|
|
|
|
|
LOG.info("is ModerationEnabled? " + isModerationEnabled);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOG.error("Error occured on checking isContentModeratorEnabled, so returning false", e);
|
|
|
|
|
return false;
|
|
|
|
@ -296,22 +297,29 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
*
|
|
|
|
|
* @param theStatus the the status
|
|
|
|
|
* @param itemNames the item names
|
|
|
|
|
* @param message the message to send to Moderators. If null no messange is sent
|
|
|
|
|
* @return the operation report
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames) throws Exception {
|
|
|
|
|
LOG.info("Called set status " + theStatus + " for Items with name: " + itemNames);
|
|
|
|
|
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames, String message) throws Exception {
|
|
|
|
|
LOG.info("Called set status " + theStatus + " for items with name: " + itemNames + ". Is message null?: "+(message==null));
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String scope = setContexts();
|
|
|
|
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
|
|
|
|
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
|
|
|
|
Map<String, String> errorMapItems = new HashMap<String, String>();
|
|
|
|
|
List<String> changedStatusListItems = new ArrayList<String>();
|
|
|
|
|
for (String itemName : itemNames) {
|
|
|
|
|
try {
|
|
|
|
|
catalogueImpl.refreshDataset(itemName);
|
|
|
|
|
LOG.info("refresh dataset done");
|
|
|
|
|
changedStatusListItems.add(itemName);
|
|
|
|
|
if(message!=null && !message.isEmpty()) {
|
|
|
|
|
LOG.debug("Sending message: "+message);
|
|
|
|
|
cmsInstance.messageItem(itemName, message);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOG.warn("Error when setting status (updating) the itemName: " + itemName, e);
|
|
|
|
|
errorMapItems.put(itemName, e.getMessage());
|
|
|
|
@ -500,5 +508,4 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
|
|
|
|
LOG.debug("Returning: " + searchedData);
|
|
|
|
|
return searchedData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|