task_21363 #1

Closed
francesco.mangiacrapa wants to merge 53 commits from task_21363 into master
11 changed files with 82 additions and 369 deletions
Showing only changes of commit b726ba0b83 - Show all commits

View File

@ -5,6 +5,6 @@ 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).
## [v0.2.0-SNAPSHOT] - 2021-06-15
## [v1.0.0-SNAPSHOT] - 2021-06-15
First Release

31
pom.xml
View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-content-moderator-widget</artifactId>
<packaging>jar</packaging>
<version>0.2.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<name>gCube Ckan Content Moderator Widget</name>
<description>
@ -30,7 +30,7 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<gwtVersion>2.9.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@ -66,18 +66,21 @@
<dependencies>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>xml-apis</groupId> -->
<!-- <artifactId>xml-apis</artifactId> -->
<!-- <version>1.4.01</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- 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>
<groupId>com.google.gwt</groupId>

View File

@ -1,313 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-content-moderator-widget</artifactId>
<packaging>war</packaging>
<version>0.1.0-SNAPSHOT</version>
<name>gCube Ckan Content Moderator Widget</name>
<description>
The gCube Ckan Content Moderator Widget caters for the approval stage before publishing in the D4Science Catalogue
</description>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.9.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<gwt-material.version>2.4.0</gwt-material.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
</dependency>
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-jquery</artifactId>
<version>${gwt-material.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material-addins</artifactId> -->
<!-- <version>${gwt-material.version}</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-table</artifactId>
<version>${gwt-material.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>${gwt-material.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-themes</artifactId>
<version>${gwt-material.version}</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-configuration-scanner</artifactId>
<scope>provided</scope>
</dependency>
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.datacatalogue</groupId>
<artifactId>catalogue-util-library</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<scope>compile</scope>
</dependency>
<!-- PORTAL MANAGER -->
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<scope>provided</scope>
</dependency>
<!-- User Management Core -->
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>CkanContentModeratorWidget.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -17,7 +17,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
*
* Jan 11, 2022
*/
@RemoteServiceRelativePath("greet")
@RemoteServiceRelativePath("ckanContentModeratorService")
public interface CkanContentModeratorService extends RemoteService {
/**

View File

@ -80,7 +80,7 @@
}
.cellTableKeyboardSelectedRow, .cellTableKeyboardSelectedRow td, .cellTableKeyboardSelectedRow th {
background: #3A87AD !important;
background: #b0cddd !important;
}
.cellTableSelectedRow, .cellTableSelectedRow td, .cellTableSelectedRow th
@ -93,15 +93,15 @@
}
.cellTableSelectedRowCell, .cellTableSelectedRow td.cellTableSelectedRowCell {
background: #3A87AD !important;
background: #b0cddd !important;
}
.cellTableKeyboardSelectedRowCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedRowCell{
background: #3A87AD !important;
background: #b0cddd !important;
}
.cellTableKeyboardSelectedCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedCell{
background: #3A87AD !important;
background: #b0cddd !important;
color: white !important;
}

View File

@ -10,6 +10,7 @@ import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.HelpBlock;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
@ -79,6 +80,7 @@ public class DoActionCMSView extends Composite {
initWidget(uiBinder.createAndBindUi(this));
this.alertBlockDoAction.setClose(true);
this.alertBlockDoAction.setAnimation(true);
this.alertBlockDoAction.setType(AlertType.INFO);
this.checkBoxPermDelete.setVisible(false);
this.txtMsgReason.setVisible(false);

View File

@ -18,13 +18,18 @@
.margin-left-10 {
margin-left: 10px;
}
.text-area-message{
max-width: 100%;
width: 100%;
margin-bottom: 2px;
}
</ui:style>
<g:HTMLPanel>
<b:AlertBlock ui:field="alertBlockDoAction">
<g:HTML ui:field="htmlDisplayMessage"
addStyleNames="{style.fontsize-16}"></g:HTML>
<b:Form type="VERTICAL" addStyleNames="{style.margin-top-15}">
<b:TextArea placeholder="Rejecting reason..."
<b:TextArea placeholder="Rejecting reason..." addStyleNames="{style.text-area-message}"
ui:field="txtMsgReason" />
<b:CheckBox ui:field="checkBoxPermDelete"
title="Permanently removes the selected item/s from Catalogue">Permanently Delete</b:CheckBox>

View File

@ -10,6 +10,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.events.SelectItems
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.OperationReport;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
@ -408,40 +409,41 @@ public class HomeView extends Composite {
case APPROVED:
CkanContentModeratorWidgetController.contentModeratorService.approveItem(listDatasetNames,
new AsyncCallback<Void>() {
CkanContentModeratorWidgetController.contentModeratorService.approveItem(listDatasetNames, doActionCMSView.getTxtReasonMsg(), new AsyncCallback<OperationReport>() {
@Override
public void onSuccess(Void result) {
// TODO Auto-generated method stub
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
}
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
@Override
public void onSuccess(OperationReport result) {
// TODO Auto-generated method stub
}
});
}
});
break;
case REJECTED:
CkanContentModeratorWidgetController.contentModeratorService.rejectItem(listDatasetNames,
doActionCMSView.isPermanentlyDelete(), doActionCMSView.getTxtReasonMsg(),
new AsyncCallback<Void>() {
CkanContentModeratorWidgetController.contentModeratorService.rejectItem(listDatasetNames, doActionCMSView.isPermanentlyDelete(), doActionCMSView.getTxtReasonMsg(), new AsyncCallback<OperationReport>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
}
@Override
public void onSuccess(Void result) {
// TODO Auto-generated method stub
@Override
public void onSuccess(OperationReport result) {
// TODO Auto-generated method stub
}
});
}
});
break;
default:
break;

View File

@ -5,6 +5,10 @@
word-wrap: break-word;
}
.table-cms-widget th {
border-top: 1px solid black !important;
}
.table-cms-widget td, th {
overflow: hidden !important;
}

View File

@ -6,13 +6,13 @@
version="3.0">
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-name>ckanContentModeratorServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/CkanContentModeratorWidget/greet</url-pattern>
<servlet-name>ckanContentModeratorServlet</servlet-name>
<url-pattern>/CkanContentModeratorWidget/ckanContentModeratorService</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->

View File

@ -14,9 +14,17 @@ import org.slf4j.LoggerFactory;
public class CkanContentModeratorServiceTest {
private String scope = "/gcube/devsec/devVRE";
//devVRE
//private String scope = "/gcube/devsec/devVRE";
//Dorne
private String scope = "/pred4s/preprod/Dorne";
private String testUser = "francesco.mangiacrapa";
//devVRE
//private String authorizationToken = "8e74a17c-92f1-405a-b591-3a6090066248-98187548";
//Dorne
private String authorizationToken = "";
//debd432e-de72-4e1c-960c-fd2af916c5e8-980114272 Dorne
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceTest.class);
@ -25,14 +33,16 @@ public class CkanContentModeratorServiceTest {
fail("Not yet implemented");
}
//@Test
@Test
public void loadItemsForStatus() {
ScopeProvider.instance.set(scope);
SecurityTokenProvider.instance.set(authorizationToken);
ItemStatus itemStatus = ItemStatus.PENDING;
try {
CatalogueContentModeratorSystem cms = CatalogueCMSFactory.getFactory().getCMSPerScope(scope);
List<CkanDataset> items = cms.getListItemsForStatus(ItemStatus.PENDING, 20, 0);
List<CkanDataset> items = cms.getListItemsForStatus(itemStatus, 20, 0);
int i = 0;
System.out.println("Datasets with status "+itemStatus+" are: "+items.size());
for (CkanDataset ckanDataset : items) {
System.out.println(i++ +")Read dataset: "+ckanDataset);
}