feature_23903 #5

Merged
francesco.mangiacrapa merged 3 commits from feature_23903 into master 2023-02-07 08:37:16 +01:00
5 changed files with 75 additions and 14 deletions

View File

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.3.0-SNAPSHOT] - 2023-02-06
**Enhancements**
- [#23903] Catalogue Moderation: allow to send a message to the moderators
- [#23692] Changed interface 'approveItem' adding the parameter socialPost
## [v1.2.0] - 2022-08-01
**Enhancements**

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.datacatalogue</groupId>
<artifactId>catalogue-util-library</artifactId>
<version>1.2.0</version>
<version>1.3.0-SNAPSHOT</version>
<name>Ckan utility library</name>
<description>
Utility library to retrieve users information, organizations information and so on from the ckan d4science datacatalogue

View File

@ -162,21 +162,41 @@ public class GCatCaller {
}
/**
* Message item. Send a message to Moderators
*
* @param datasetName the dataset name
* @param moderatorMessage the moderator message
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
*/
public void messageItem(String datasetName, String moderatorMessage)
throws WebApplicationException, MalformedURLException {
LOG.trace("messageItem called");
LOG.info("Calling mesage item with name: " + datasetName + ", and msg: " + moderatorMessage);
new Item().message(datasetName, moderatorMessage);
return;
}
/**
* Approve item.
*
* @param datasetName the dataset name
* @param moderatorMessage the moderator message
* @param sendSocialPost the send social post. If 'true` sends the social post
* @return the string
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
*/
public String approveItem(String datasetName, String moderatorMessage)
public String approveItem(String datasetName, String moderatorMessage, Boolean sendSocialPost)
throws WebApplicationException, MalformedURLException {
LOG.trace("approveItem called");
LOG.info("Calling approve item with name: " + datasetName + ", and msg: " + moderatorMessage);
LOG.info("Calling approve item with name: " + datasetName + ", sendSocialPost: " + sendSocialPost
+ ", msg: " + moderatorMessage);
return new Item().approve(datasetName, moderatorMessage, sendSocialPost);
return new Item().approve(datasetName, moderatorMessage);
}
@ -239,8 +259,8 @@ public class GCatCaller {
LOG.info("called getListItemsForCMStatus called with [status: " + status + "], [limit: " + limit
+ "], [offset: " + offset + "], [filters: " + filters + "]");
Map<String, String> queryParams = GCatCallerUtil.genericQueryBuilderFor(status, limit, offset, false, allFields, filters,
sortForField);
Map<String, String> queryParams = GCatCallerUtil.genericQueryBuilderFor(status, limit, offset, false, allFields,
filters, sortForField);
return getListItemsForQuery(queryParams);
}
@ -249,7 +269,7 @@ public class GCatCaller {
* Count list items for CM status.
*
* @param status the status
* @param filters
* @param filters the filters
* @return the number of items
* @throws WebServiceException the web service exception
* @throws MalformedURLException the malformed URL exception
@ -312,7 +332,7 @@ public class GCatCaller {
*
* @param reload the reload
* @return the configuration
* @throws MalformedURLException
* @throws MalformedURLException the malformed URL exception
*/
public GCatCatalogueConfiguration getConfiguration(boolean reload) throws MalformedURLException {
LOG.trace("getConfiguration called");
@ -337,6 +357,13 @@ public class GCatCaller {
return catalogueConfiguration;
}
/**
* Offset to page number.
*
* @param limit the limit
* @param offset the offset
* @return the int
*/
private static int offsetToPageNumber(int limit, int offset) {
int pageNumber = offset;

View File

@ -82,11 +82,20 @@ public interface CatalogueContentModeratorSystem {
*
* @param itemName the item name
* @param moderatorMessage the moderator message
* @param sendSocialPost the send social post. If 'true` sends the social post
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
*/
void approveItem(String itemName, String moderatorMessage) throws WebApplicationException, MalformedURLException;
void approveItem(String itemName, String moderatorMessage, Boolean sendSocialPost) throws WebApplicationException, MalformedURLException;
/**
* Message item.
*
* @param datasetName the dataset name
* @param moderatorMessage the moderator message
* @throws WebServiceException the web service exception
* @throws MalformedURLException the malformed URL exception
*/
void messageItem(String datasetName, String moderatorMessage) throws WebServiceException, MalformedURLException;
}

View File

@ -50,10 +50,11 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
}
/**
* Checks if is Moderation is enabled in the working scope
* Checks if is Moderation is enabled in the working scope.
*
* @param reloadConfig the reload config
* @return true, if is content moderator enabled
* @throws MalformedURLException
* @throws MalformedURLException the malformed URL exception
*/
@Override
public boolean isModerationEnabled(boolean reloadConfig) throws MalformedURLException {
@ -65,13 +66,30 @@ public class DataCatalogueCMSImpl implements CatalogueContentModeratorSystem {
*
* @param datasetName the dataset name
* @param moderatorMessage the moderator message
* @param sendSocialPost the send social post. If 'true` sends the social post
* @throws WebApplicationException the web application exception
* @throws MalformedURLException the malformed URL exception
*/
@Override
public void approveItem(String datasetName, String moderatorMessage)
public void approveItem(String datasetName, String moderatorMessage, Boolean sendSocialPost)
throws WebApplicationException, MalformedURLException {
gCatCaller.approveItem(datasetName, moderatorMessage);
gCatCaller.approveItem(datasetName, moderatorMessage, sendSocialPost);
}
/**
* Message item.
*
* @param datasetName the dataset name
* @param moderatorMessage the moderator message
* @throws WebServiceException the web service exception
* @throws MalformedURLException the malformed URL exception
*/
@Override
public void messageItem(String datasetName, String moderatorMessage)
throws WebServiceException, MalformedURLException {
gCatCaller.messageItem(datasetName, moderatorMessage);
}