Compare commits
53 Commits
master
...
task_21363
22
.classpath
22
.classpath
|
@ -11,6 +11,16 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
@ -24,16 +34,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
<classpathentry kind="lib" path="/home/francescomangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
11
.project
11
.project
|
@ -15,6 +15,16 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.gwtplugins.gwt.eclipse.core.gwtProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
|
@ -32,6 +42,7 @@
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
lastWarOutDir=/home/francescomangiacrapa/git/ckan-content-moderator-widget/target/ckan-content-moderator-widget-0.1.0-SNAPSHOT
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/ckan-content-moderator-widget/target/ckan-content-moderator-widget-1.2.0-SNAPSHOT
|
warSrcDir=src/main/webapp
|
||||||
warSrcDir=
|
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
entryPointModules=
|
entryPointModules=
|
||||||
filesCopiedToWebInfLib=
|
|
||||||
gwtSyncCodeServer=true
|
|
||||||
|
|
|
@ -1,59 +1,53 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="ckan-content-moderator-widget-0.1.0-SNAPSHOT">
|
||||||
|
|
||||||
<wb-module deploy-name="ckan-content-moderator-widget-1.2.0-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
<dependent-module archiveName="catalogue-util-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library">
|
<dependent-module archiveName="catalogue-util-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library">
|
||||||
|
|
||||||
|
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
|
|
||||||
|
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="ckan-content-moderator-widget"/>
|
<property name="context-root" value="ckan-content-moderator-widget"/>
|
||||||
<property name="java-output-path" value="/ckan-content-moderator-widget/target/classes"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<property name="java-output-path" value="/ckan-content-moderator-widget/target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<root>
|
||||||
|
<facet id="jst.jaxrs">
|
||||||
|
<node name="libprov">
|
||||||
|
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||||
|
</node>
|
||||||
|
</facet>
|
||||||
|
</root>
|
|
@ -1,7 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<fixed facet="wst.jsdt.web"/>
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
<installed facet="java" version="1.8"/>
|
<installed facet="java" version="1.8"/>
|
||||||
<installed facet="jst.utility" version="1.0"/>
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -4,31 +4,8 @@
|
||||||
All notable changes to this project will be documented in this file.
|
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).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [v1.2.0] - 2023-01-19
|
|
||||||
|
|
||||||
#### Enhancements
|
## [v1.0.0-SNAPSHOT] - 2022-04-04
|
||||||
|
|
||||||
- [#23903] Catalogue Moderation: allow to send a message to the moderators on reject to pending operation
|
|
||||||
- [#24519] Added social_post=true to approve request
|
|
||||||
|
|
||||||
## [v1.1.1] - 2022-10-27
|
|
||||||
|
|
||||||
#### Fixing
|
|
||||||
|
|
||||||
- GWT-Servlet at provided
|
|
||||||
|
|
||||||
## [v1.1.0] - 2022-08-01
|
|
||||||
|
|
||||||
#### Enhancements
|
|
||||||
|
|
||||||
- [#23692] Optimized the listing and the paging of catalogue items
|
|
||||||
|
|
||||||
## [v1.0.1] - 2022-06-27
|
|
||||||
|
|
||||||
- [#23525] Removed the scope of xml-apis dependency
|
|
||||||
- Moved to maven-portal-bom v3.6.4
|
|
||||||
|
|
||||||
## [v1.0.0] - 2022-05-18
|
|
||||||
|
|
||||||
- [#21363] Implemented the ckan-content-moderator-widget
|
- [#21363] Implemented the ckan-content-moderator-widget
|
||||||
- [#20650] Provided moderator skills to Catalogue Moderator(s)
|
- [#20650] Provided moderator skills to Catalogue Moderator(s)
|
||||||
|
|
22
pom.xml
22
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>ckan-content-moderator-widget</artifactId>
|
<artifactId>ckan-content-moderator-widget</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.2.0</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<name>gCube Ckan Content Moderator Widget</name>
|
<name>gCube Ckan Content Moderator Widget</name>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.4</version>
|
<version>3.6.3-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
|
@ -66,6 +66,22 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- needed to compile/run in devMode with gwt > 2.7 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- needed to compile/run in devMode with gwt > 2.7 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>xml-apis</groupId>
|
||||||
|
<artifactId>xml-apis</artifactId>
|
||||||
|
<version>1.4.01</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt-user</artifactId>
|
<artifactId>gwt-user</artifactId>
|
||||||
|
@ -76,7 +92,7 @@
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt-servlet</artifactId>
|
<artifactId>gwt-servlet</artifactId>
|
||||||
<version>${gwtVersion}</version>
|
<version>${gwtVersion}</version>
|
||||||
<scope>provided</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
|
|
|
@ -106,10 +106,7 @@ public class CkanContentModeratorCheckConfigs {
|
||||||
attemptLC++;
|
attemptLC++;
|
||||||
GWT.log("checking configuration loaded, attempt " + attemptLC + " of "
|
GWT.log("checking configuration loaded, attempt " + attemptLC + " of "
|
||||||
+ MAX_RETRY_ON_LOADING_CONFIG);
|
+ MAX_RETRY_ON_LOADING_CONFIG);
|
||||||
int confLoaded = getConfigurationLoaded();
|
boolean configsLoaded = getConfigurationLoaded() == CONFIGURATION_EXPECTED;
|
||||||
GWT.log("configuration loaded " + confLoaded + " of "
|
|
||||||
+ CONFIGURATION_EXPECTED);
|
|
||||||
boolean configsLoaded = confLoaded == CONFIGURATION_EXPECTED;
|
|
||||||
GWT.log("configsLoaded: " + configsLoaded);
|
GWT.log("configsLoaded: " + configsLoaded);
|
||||||
if (configsLoaded) {
|
if (configsLoaded) {
|
||||||
GWT.log("ContentModeratorCheckConfig loaded correclty");
|
GWT.log("ContentModeratorCheckConfig loaded correclty");
|
||||||
|
|
|
@ -21,6 +21,17 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
@RemoteServiceRelativePath("ckanContentModeratorService")
|
@RemoteServiceRelativePath("ckanContentModeratorService")
|
||||||
public interface CkanContentModeratorService extends RemoteService {
|
public interface CkanContentModeratorService extends RemoteService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the status. Currently, this only used to change the status from Rejected
|
||||||
|
* to Pending
|
||||||
|
*
|
||||||
|
* @param theStatus the the status
|
||||||
|
* @param itemNames the item names
|
||||||
|
* @return the operation report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject item.
|
* Reject item.
|
||||||
*
|
*
|
||||||
|
@ -48,15 +59,12 @@ public interface CkanContentModeratorService extends RemoteService {
|
||||||
* @param theStatus the the status
|
* @param theStatus the the status
|
||||||
* @param offset the offset
|
* @param offset the offset
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param allFields the all fields. If true returns the all
|
* @param restrictedToLoggedInUser the restricted to logged in user
|
||||||
* fields of an item
|
|
||||||
* @param restrictedToLoggedInUser if true restricts the list of items to logged
|
|
||||||
* in user
|
|
||||||
* @param sortForField the sort for field
|
* @param sortForField the sort for field
|
||||||
* @return the list items for status
|
* @return the list items for status
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int offset, int limit, boolean allFields,
|
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int offset, int limit,
|
||||||
boolean restrictedToLoggedInUser, String sortForField) throws Exception;
|
boolean restrictedToLoggedInUser, String sortForField) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,16 +132,5 @@ public interface CkanContentModeratorService extends RemoteService {
|
||||||
* @return the item for name
|
* @return the item for name
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public CatalogueDataset getItemForName(String itemName) throws Exception;
|
CatalogueDataset getItemForName(String itemName) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the status.
|
|
||||||
*
|
|
||||||
* @param theStatus the the status
|
|
||||||
* @param itemNames the item names
|
|
||||||
* @return the operation report
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames, String message) throws Exception;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,14 +36,13 @@ public interface CkanContentModeratorServiceAsync {
|
||||||
* @param theStatus the the status
|
* @param theStatus the the status
|
||||||
* @param offset the offset
|
* @param offset the offset
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param allFields the all fields
|
|
||||||
* @param restrictedToLoggedInUser the restricted to logged in user
|
* @param restrictedToLoggedInUser the restricted to logged in user
|
||||||
* @param sortForField the sort for field
|
* @param sortForField the sort for field
|
||||||
* @param callback the callback
|
* @param callback the callback
|
||||||
* @return the list items for status
|
* @return the list items for status
|
||||||
*/
|
*/
|
||||||
void getListItemsForStatus(ItemStatus theStatus, int offset, int limit, boolean allFields,
|
void getListItemsForStatus(ItemStatus theStatus, int offset, int limit, boolean restrictedToLoggedInUser,
|
||||||
boolean restrictedToLoggedInUser, String sortForField, AsyncCallback<List<CatalogueDataset>> callback);
|
String sortForField, AsyncCallback<List<CatalogueDataset>> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the data for status.
|
* Gets the data for status.
|
||||||
|
@ -82,11 +81,9 @@ public interface CkanContentModeratorServiceAsync {
|
||||||
*
|
*
|
||||||
* @param theStatus the the status
|
* @param theStatus the the status
|
||||||
* @param itemNames the item names
|
* @param itemNames the item names
|
||||||
* @param message the message
|
|
||||||
* @param callback the callback
|
* @param callback the callback
|
||||||
*/
|
*/
|
||||||
void setStatus(ItemStatus theStatus, List<String> itemNames, String message,
|
void setStatus(ItemStatus theStatus, List<String> itemNames, AsyncCallback<OperationReport> callback);
|
||||||
AsyncCallback<OperationReport> callback);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the CMS roles for user in the context.
|
* Gets the CMS roles for user in the context.
|
||||||
|
|
|
@ -123,8 +123,6 @@ public class CkanContentModeratorWidgetController {
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
eventBus.fireEvent(new ShowItemEvent<CatalogueDataset>(Arrays.asList(result),true));
|
eventBus.fireEvent(new ShowItemEvent<CatalogueDataset>(Arrays.asList(result),true));
|
||||||
//Fired to set selectable row (i.e. checkbox) on STATUS (e.g. REJECT)
|
|
||||||
eventBus.fireEvent(new SelectItemsWithItemStatusEvent(status, null, null, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -278,21 +276,6 @@ public class CkanContentModeratorWidgetController {
|
||||||
GWT.log("sortForField is: " + sortForField);
|
GWT.log("sortForField is: " + sortForField);
|
||||||
howeView.loadItemsWithStatus(statusSelectedEvent.getItemStatus(), sortForField);
|
howeView.loadItemsWithStatus(statusSelectedEvent.getItemStatus(), sortForField);
|
||||||
mainTabPanel.selectTab(0);
|
mainTabPanel.selectTab(0);
|
||||||
|
|
||||||
//#23903 Enabling the owner of the rejected item, to change the Status and send a message
|
|
||||||
switch (statusSelectedEvent.getItemStatus()) {
|
|
||||||
case REJECTED:
|
|
||||||
howeView.hideUpdateStatusAction(false);
|
|
||||||
howeView.hideSelectableRow(false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
howeView.hideUpdateStatusAction(readOnlyMode);
|
|
||||||
howeView.hideSelectableRow(readOnlyMode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//#23903 end
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusSelectedEvent.getDisplayMessage() != null) {
|
if (statusSelectedEvent.getDisplayMessage() != null) {
|
||||||
|
|
|
@ -199,15 +199,6 @@ public class ContentModeratorPaginatedView {
|
||||||
*/
|
*/
|
||||||
private void setNewPageResult(SearchedData result) {
|
private void setNewPageResult(SearchedData result) {
|
||||||
GWT.log("setNewPageResult: " + result);
|
GWT.log("setNewPageResult: " + result);
|
||||||
|
|
||||||
if(!GWT.isProdMode()) {
|
|
||||||
if(result.getData()!=null) {
|
|
||||||
for (CatalogueDataset dataset : result.getData()) {
|
|
||||||
GWT.log("dataset: " + dataset.getStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
serverStartIndex = result.getServerEndIndex();
|
serverStartIndex = result.getServerEndIndex();
|
||||||
SelectionModel<? super CatalogueDataset> sm = getCellTable().getSelectionModel();
|
SelectionModel<? super CatalogueDataset> sm = getCellTable().getSelectionModel();
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,7 @@ public class DoActionCMSView extends Composite {
|
||||||
switch (toStatus) {
|
switch (toStatus) {
|
||||||
case PENDING:
|
case PENDING:
|
||||||
checkBoxPermDelete.setVisible(false);
|
checkBoxPermDelete.setVisible(false);
|
||||||
txtMsgReason.setVisible(true);
|
txtMsgReason.setVisible(false);
|
||||||
txtMsgReason.setPlaceholder("(Optional) Type a message...");
|
|
||||||
break;
|
break;
|
||||||
case APPROVED:
|
case APPROVED:
|
||||||
checkBoxPermDelete.setVisible(false);
|
checkBoxPermDelete.setVisible(false);
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class HomeView extends Composite {
|
||||||
* @param status the status
|
* @param status the status
|
||||||
* @param displayFields the display fields
|
* @param displayFields the display fields
|
||||||
* @param sortByField the sort by field
|
* @param sortByField the sort by field
|
||||||
* @param readOnlyMode the read only mode
|
* @param readOnlyMode the read only mode
|
||||||
* @param restrictDataToLoggedInUser the restrict data to logged in user
|
* @param restrictDataToLoggedInUser the restrict data to logged in user
|
||||||
*/
|
*/
|
||||||
public HomeView(HandlerManager eventBus, ItemStatus status, DISPLAY_FIELD[] displayFields,
|
public HomeView(HandlerManager eventBus, ItemStatus status, DISPLAY_FIELD[] displayFields,
|
||||||
|
@ -423,8 +423,8 @@ public class HomeView extends Composite {
|
||||||
/**
|
/**
|
||||||
* Load form server the items with status.
|
* Load form server the items with status.
|
||||||
*
|
*
|
||||||
* @param itemStatus the item status
|
* @param itemStatus the item status
|
||||||
* @param sortForField
|
* @param sortForField
|
||||||
*/
|
*/
|
||||||
public void loadItemsWithStatus(ItemStatus itemStatus, String sortForField) {
|
public void loadItemsWithStatus(ItemStatus itemStatus, String sortForField) {
|
||||||
GWT.log("loadItemsWithStatus started");
|
GWT.log("loadItemsWithStatus started");
|
||||||
|
@ -456,7 +456,7 @@ public class HomeView extends Composite {
|
||||||
case PENDING:
|
case PENDING:
|
||||||
|
|
||||||
CkanContentModeratorWidgetController.contentModeratorService.setStatus(toStatus, listDatasetNames,
|
CkanContentModeratorWidgetController.contentModeratorService.setStatus(toStatus, listDatasetNames,
|
||||||
doActionCMSView.getTxtReasonMsg(), new AsyncCallback<OperationReport>() {
|
new AsyncCallback<OperationReport>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(OperationReport result) {
|
public void onSuccess(OperationReport result) {
|
||||||
|
|
|
@ -54,7 +54,6 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
||||||
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
||||||
isModerationEnabled = cmsInstance.isModerationEnabled(reloadConfig);
|
isModerationEnabled = cmsInstance.isModerationEnabled(reloadConfig);
|
||||||
LOG.info("is ModerationEnabled? " + isModerationEnabled);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error occured on checking isContentModeratorEnabled, so returning false", e);
|
LOG.error("Error occured on checking isContentModeratorEnabled, so returning false", e);
|
||||||
return false;
|
return false;
|
||||||
|
@ -177,8 +176,6 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
* @param theStatus the the status
|
* @param theStatus the the status
|
||||||
* @param offset the offset
|
* @param offset the offset
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param allFields the all fields. If true returns the all
|
|
||||||
* fields of an item
|
|
||||||
* @param restrictedToLoggedInUser if true restricts the list of items to logged
|
* @param restrictedToLoggedInUser if true restricts the list of items to logged
|
||||||
* in user
|
* in user
|
||||||
* @param sortForField the sort for field
|
* @param sortForField the sort for field
|
||||||
|
@ -187,7 +184,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int offset, int limit,
|
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int offset, int limit,
|
||||||
boolean allFields, boolean restrictedToLoggedInUser, String sortForField) throws Exception {
|
boolean restrictedToLoggedInUser, String sortForField) throws Exception {
|
||||||
LOG.info("called getListItemsForStatus with [status: " + theStatus + ", offset: " + offset + ", limit: " + limit
|
LOG.info("called getListItemsForStatus with [status: " + theStatus + ", offset: " + offset + ", limit: " + limit
|
||||||
+ ", restrictedToLoggedInUser: " + restrictedToLoggedInUser + "]");
|
+ ", restrictedToLoggedInUser: " + restrictedToLoggedInUser + "]");
|
||||||
List<CatalogueDataset> datasetList = null;
|
List<CatalogueDataset> datasetList = null;
|
||||||
|
@ -204,7 +201,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
filters.put(ContentModeratorWidgetConstants.CKAN_FIELD_NAME_AUTHOR_MAIL, valueOfQueryEmails);
|
filters.put(ContentModeratorWidgetConstants.CKAN_FIELD_NAME_AUTHOR_MAIL, valueOfQueryEmails);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CkanDataset> datasets = cmsInstance.getListItemsForStatus(theStatus, limit, offset, allFields, filters,
|
List<CkanDataset> datasets = cmsInstance.getListItemsForStatus(theStatus, limit, offset, filters,
|
||||||
sortForField);
|
sortForField);
|
||||||
if (datasets != null) {
|
if (datasets != null) {
|
||||||
int size = datasets.size();
|
int size = datasets.size();
|
||||||
|
@ -251,34 +248,32 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
String scope = setContexts();
|
String scope = setContexts();
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
||||||
GCubeUser user = GcubeContextUtil.getCurrentUser(this.getThreadLocalRequest());
|
GCubeUser user = GcubeContextUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||||
|
|
||||||
boolean moderationCheckPassed = false;
|
boolean moderationCheckPassed = false;
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
CkanDataset ckanDataset = catalogueImpl.getDataset(itemName, user.getUsername());
|
CkanDataset ckanDataset = catalogueImpl.getDataset(itemName, user.getUsername());
|
||||||
ds = null;
|
ds = null;
|
||||||
if (ckanDataset != null) {
|
if (ckanDataset != null) {
|
||||||
ds = toPatchedCatalogueDataset(ckanDataset, catalogueImpl.getCatalogueUrl());
|
ds = toPatchedCatalogueDataset(ckanDataset, catalogueImpl.getCatalogueUrl());
|
||||||
|
|
||||||
Boolean userModerator = isModeratorRoleAssigned();
|
Boolean userModerator = isModeratorRoleAssigned();
|
||||||
moderationCheckPassed = userModerator ? true : false;
|
moderationCheckPassed = userModerator?true:false;
|
||||||
LOG.info("Moderation check: is the user a Moderator? " + moderationCheckPassed);
|
LOG.info("Moderation check: is the user a Moderator? "+moderationCheckPassed);
|
||||||
// The user is not a Moderator, yes otherwise
|
//The user is not a Moderator, yes otherwise
|
||||||
if (!moderationCheckPassed) {
|
if(!moderationCheckPassed) {
|
||||||
String datasetAuthorMail = ds.getAuthorEmail();
|
String datasetAuthorMail = ds.getAuthorEmail();
|
||||||
String userMail = user.getEmail();
|
String userMail = user.getEmail();
|
||||||
if (datasetAuthorMail != null && userMail != null
|
if(datasetAuthorMail!=null && userMail!=null && datasetAuthorMail.compareTo(userMail)==0) {
|
||||||
&& datasetAuthorMail.compareTo(userMail) == 0) {
|
//The user is the owner of the dataset, so he/she can view the dataset (moderation check passed)
|
||||||
// The user is the owner of the dataset, so he/she can view the dataset
|
moderationCheckPassed = true;
|
||||||
// (moderation check passed)
|
|
||||||
moderationCheckPassed = true;
|
|
||||||
}
|
}
|
||||||
LOG.info("Moderation check: is the user the owner of the dataset? " + moderationCheckPassed);
|
LOG.info("Moderation check: is the user the owner of the dataset? "+moderationCheckPassed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moderationCheckPassed) {
|
if(!moderationCheckPassed) {
|
||||||
LOG.info("Moderation ckeck not passed, returning null");
|
LOG.info("Moderation ckeck not passed, returning null");
|
||||||
ds = null;
|
ds = null;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +283,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("getItemForName " + itemName + ", returning: " + ds);
|
LOG.info("getItemForName "+itemName+", returning: " + ds);
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,29 +292,22 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
*
|
*
|
||||||
* @param theStatus the the status
|
* @param theStatus the the status
|
||||||
* @param itemNames the item names
|
* @param itemNames the item names
|
||||||
* @param message the message to send to Moderators. If null no messange is sent
|
|
||||||
* @return the operation report
|
* @return the operation report
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames, String message) throws Exception {
|
public OperationReport setStatus(ItemStatus theStatus, List<String> itemNames) throws Exception {
|
||||||
LOG.info("Called set status " + theStatus + " for items with name: " + itemNames + ". Is message null?: "+(message==null));
|
LOG.info("Called set status " + theStatus + " for Items with name: " + itemNames);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String scope = setContexts();
|
String scope = setContexts();
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
||||||
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
|
||||||
Map<String, String> errorMapItems = new HashMap<String, String>();
|
Map<String, String> errorMapItems = new HashMap<String, String>();
|
||||||
List<String> changedStatusListItems = new ArrayList<String>();
|
List<String> changedStatusListItems = new ArrayList<String>();
|
||||||
for (String itemName : itemNames) {
|
for (String itemName : itemNames) {
|
||||||
try {
|
try {
|
||||||
catalogueImpl.refreshDataset(itemName);
|
catalogueImpl.refreshDataset(itemName);
|
||||||
LOG.info("refresh dataset done");
|
|
||||||
changedStatusListItems.add(itemName);
|
changedStatusListItems.add(itemName);
|
||||||
if(message!=null && !message.isEmpty()) {
|
|
||||||
LOG.debug("Sending message: "+message);
|
|
||||||
cmsInstance.messageItem(itemName, message);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Error when setting status (updating) the itemName: " + itemName, e);
|
LOG.warn("Error when setting status (updating) the itemName: " + itemName, e);
|
||||||
errorMapItems.put(itemName, e.getMessage());
|
errorMapItems.put(itemName, e.getMessage());
|
||||||
|
@ -356,7 +344,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
List<String> approvedListItems = new ArrayList<String>();
|
List<String> approvedListItems = new ArrayList<String>();
|
||||||
for (String itemName : itemNames) {
|
for (String itemName : itemNames) {
|
||||||
try {
|
try {
|
||||||
cmsInstance.approveItem(itemName, moderatorMessage, true);
|
cmsInstance.approveItem(itemName, moderatorMessage);
|
||||||
approvedListItems.add(itemName);
|
approvedListItems.add(itemName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Error when approving itemName: " + itemName, e);
|
LOG.warn("Error when approving itemName: " + itemName, e);
|
||||||
|
@ -484,7 +472,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
List<CatalogueDataset> listDataset = new ArrayList<CatalogueDataset>();
|
List<CatalogueDataset> listDataset = new ArrayList<CatalogueDataset>();
|
||||||
try {
|
try {
|
||||||
LOG.debug("getListItemsForStatus with searchStartIndex: " + searchStartIndex + ", limit: " + limit);
|
LOG.debug("getListItemsForStatus with searchStartIndex: " + searchStartIndex + ", limit: " + limit);
|
||||||
listDataset = getListItemsForStatus(status, searchStartIndex, limit, true, restrictedToLoggedInUser,
|
listDataset = getListItemsForStatus(status, searchStartIndex, limit, restrictedToLoggedInUser,
|
||||||
sortForField);
|
sortForField);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String error = "Error occurred on getting items for status: " + status;
|
String error = "Error occurred on getting items for status: " + status;
|
||||||
|
@ -508,4 +496,5 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
||||||
LOG.debug("Returning: " + searchedData);
|
LOG.debug("Returning: " + searchedData);
|
||||||
return searchedData;
|
return searchedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/resources/
|
|
|
@ -17,36 +17,32 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class CkanContentModeratorServiceTest {
|
public class CkanContentModeratorServiceTest {
|
||||||
|
|
||||||
private String scope = "/gcube/devsec/devVRE";
|
//private String scope = "/gcube/devsec/devVRE";
|
||||||
// private String scope = "/pred4s/preprod/Dorne";
|
private String scope = "/pred4s/preprod/Dorne";
|
||||||
private String testUser = "francesco.mangiacrapa";
|
private String testUser = "francesco.mangiacrapa";
|
||||||
// private String authorizationToken = "";
|
private String authorizationToken = "";
|
||||||
// private String scope = "/gcube/devsec";
|
|
||||||
private String authorizationToken = ""; // devVRE
|
|
||||||
|
|
||||||
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceTest.class);
|
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceTest.class);
|
||||||
|
|
||||||
// @Test
|
//@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void loadItemsForStatus() {
|
public void loadItemsForStatus() {
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeProvider.instance.set(scope);
|
||||||
SecurityTokenProvider.instance.set(authorizationToken);
|
SecurityTokenProvider.instance.set(authorizationToken);
|
||||||
ItemStatus itemStatus = ItemStatus.PENDING;
|
ItemStatus itemStatus = ItemStatus.PENDING;
|
||||||
try {
|
try {
|
||||||
CatalogueContentModeratorSystem cms = CatalogueCMSFactory.getFactory().getCMSPerScope(scope);
|
CatalogueContentModeratorSystem cms = CatalogueCMSFactory.getFactory().getCMSPerScope(scope);
|
||||||
Map<String, String> filters = new HashMap<String, String>(1);
|
Map<String, String> filters = new HashMap<String, String>(1);
|
||||||
filters.put(ContentModeratorWidgetConstants.CKAN_FIELD_NAME_AUTHOR_MAIL,
|
filters.put(ContentModeratorWidgetConstants.CKAN_FIELD_NAME_AUTHOR_MAIL, "francesco.mangiacrapa@isti.cnr.it");
|
||||||
"francesco.mangiacrapa@isti.cnr.it");
|
List<CkanDataset> items = cms.getListItemsForStatus(itemStatus, 20, 0, filters, GCatCaller.DEFAULT_SORT_VALUE);
|
||||||
List<CkanDataset> items = cms.getListItemsForStatus(itemStatus, 20, 0, true, filters,
|
|
||||||
GCatCaller.DEFAULT_SORT_VALUE);
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
System.out.println("Datasets with status " + itemStatus + " are: " + items.size());
|
System.out.println("Datasets with status "+itemStatus+" are: "+items.size());
|
||||||
for (CkanDataset ckanDataset : items) {
|
for (CkanDataset ckanDataset : items) {
|
||||||
System.out.println(i++ + ")Read dataset: " + ckanDataset);
|
System.out.println(i++ +")Read dataset: "+ckanDataset);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
/devNext.gcubekey
|
||||||
|
/devVRE.gcubekey
|
||||||
|
/devsec.gcubekey
|
||||||
|
/gCubeApps.gcubekey
|
||||||
|
/gcube.gcubekey
|
||||||
|
/log4j.properties
|
||||||
|
/pred4s.gcubekey
|
||||||
|
/preprod.gcubekey
|
Loading…
Reference in New Issue