Compare commits

...

9 Commits

34 changed files with 1943 additions and 387 deletions

View File

@ -11,17 +11,9 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" 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">
@ -29,10 +21,19 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/francescomangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/eclipse-workspace/ckan-content-moderator-widget/target/ckan-content-moderator-widget-0.0.1-SNAPSHOT
lastWarOutDir=/home/francescomangiacrapa/git/ckan-content-moderator-widget/target/ckan-content-moderator-widget-0.1.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
entryPointModules=

View File

@ -1,11 +1,16 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,11 +1,54 @@
<?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.0.1-SNAPSHOT">
<wb-module deploy-name="ckan-content-moderator-widget-0.1.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="/target/generated-sources/gwt"/>
<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">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="ckan-content-moderator-widget"/>
<property name="java-output-path" value="/ckan-content-moderator-widget/target/ckan-content-moderator-widget-0.0.1-SNAPSHOT/WEB-INF/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>
</project-modules>

View File

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

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<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="java" version="1.8"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

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).
## [v1.0.0] - 2021-05-06
## [v0.1.0-SNAPSHOT] - 2021-05-06
First Release

189
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.0.1-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
<name>gCube Ckan Content Moderator Widget</name>
<description>
@ -30,13 +30,14 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<!-- <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> -->
<gwtVersion>2.8.2</gwtVersion>
<distroDirectory>distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<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>
@ -44,25 +45,56 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>${gwtVersion}</version>
<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>
@ -70,22 +102,101 @@
<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>
<!-- 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.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<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>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -95,8 +206,6 @@
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<!-- <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory> -->
<resources>
<resource>
<directory>src/main/java</directory>
@ -107,13 +216,11 @@
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@ -123,22 +230,18 @@
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<!-- <goal>run</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>CkanContentModeratorWidget.html</runTarget>
<modules>
<module>org.gcube.portlets.widgets.ckancontentmoderator.CkanContentModeratorWidget</module>
</modules>
</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>
@ -159,7 +262,33 @@
</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>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>

313
pom_war_back.xml Normal file
View File

@ -0,0 +1,313 @@
<?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

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='CkanContentModeratorWidget'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="gwt.material.design.jquery.JQuery" />
<inherits
name="gwt.material.design.GwtMaterialBasicWithJQuery" />
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
<inherits name="gwt.material.design.themes.ThemeBlue" />
<inherits name="gwt.material.design.GwtMaterialTable" />
<inherits
name="org.gcube.datacatalogue.utillibrary.CkanUtilLibrary" />
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<!-- <entry-point
class='org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidget' /> -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -2,28 +2,69 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.server.ContentModeratorSystem.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 14, 2021
*/
@RemoteServiceRelativePath("greet")
public interface CkanContentModeratorService extends RemoteService {
/**
* Checks if is content moderator enabled.
*
* @return true, if is content moderator enabled
*/
public boolean isContentModeratorEnabled();
/**
* Sets the status.
*
* @param itemId the item id
* @param theStatus the the status
*/
public void setStatus(String itemId, ItemStatus theStatus);
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus);
/**
* Approve item.
*
* @param itemId the item id
*/
public void approveItem(String itemId);
/**
* Reject item.
*
* @param itemId the item id
* @param permanentlyDelete the permanently delete
* @param reasonMsg the reason msg
*/
public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg);
/**
* Permanently delete.
*
* @param itemId the item id
*/
public void permanentlyDelete(String itemId);
/**
* Gets the list items for status.
*
* @param theStatus the the status
* @param limit the limit
* @param offset the offset
* @return the list items for status
* @throws Exception
*/
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int limit, int offset) throws Exception;
}

View File

@ -2,23 +2,72 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.server.ContentModeratorSystem.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The Interface CkanContentModeratorServiceAsync.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 14, 2021
*/
public interface CkanContentModeratorServiceAsync {
/**
* Checks if is content moderator enabled.
*
* @param callback the callback
*/
void isContentModeratorEnabled(AsyncCallback<Boolean> callback);
/**
* Approve item.
*
* @param itemId the item id
* @param callback the callback
*/
void approveItem(String itemId, AsyncCallback<Void> callback);
void getListItemsForStatus(ItemStatus theStatus, AsyncCallback<List<CkanDataset>> callback);
/**
* Permanently delete.
*
* @param itemId the item id
* @param callback the callback
*/
void permanentlyDelete(String itemId, AsyncCallback<Void> callback);
/**
* Reject item.
*
* @param itemId the item id
* @param permanentlyDelete the permanently delete
* @param reasonMsg the reason msg
* @param callback the callback
*/
void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg, AsyncCallback<Void> callback);
/**
* Sets the status.
*
* @param itemId the item id
* @param theStatus the the status
* @param callback the callback
*/
void setStatus(String itemId, ItemStatus theStatus, AsyncCallback<Void> callback);
/**
* Gets the list items for status.
*
* @param theStatus the the status
* @param limit the limit
* @param offset the offset
* @param callback the callback
* @return the list items for status
*/
void getListItemsForStatus(ItemStatus theStatus, int limit, int offset,
AsyncCallback<List<CatalogueDataset>> callback);
}

View File

@ -2,52 +2,64 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.server.ContentModeratorSystem.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.CustomizedView;
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.DataTableClientBundle;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class CkanContentModeratorWidget implements EntryPoint {
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network "
+ "connection and try again.";
/**
* The message displayed to the user when the server cannot be reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network " + "connection and try again.";
/**
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final CkanContentModeratorServiceAsync greetingService = GWT.create(CkanContentModeratorService.class);
/**
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final CkanContentModeratorServiceAsync greetingService = GWT.create(CkanContentModeratorService.class);
/**
* This is the entry point method.
*/
public void onModuleLoad() {
/*StyleInjector.inject(DataTableClientBundle.INSTANCE.dataTable().getText());
// MaterialDataTable<String> table = new MaterialDataTable<String>();
// table.getTableTitle().setText("Customers");
// List<String> users = new ArrayList<String>();
// users.add("Pippo");
// table.setRowData(0, users);
/**
* This is the entry point method.
*/
public void onModuleLoad() {
final CustomizedView cvTable = new CustomizedView();
RootPanel.get().add(cvTable);
// table.getView().refresh();
greetingService.getListItemsForStatus(ItemStatus.PENDING, 20, 0, new AsyncCallback<List<CatalogueDataset>>() {
@Override
public void onSuccess(List<CatalogueDataset> result) {
cvTable.setData(result);
}
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
});*/
}
greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() {
@Override
public void onSuccess(List<CkanDataset> result) {
// TODO Auto-generated method stub
}
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
});
}
}

View File

@ -0,0 +1,226 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.material.table;
import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import gwt.material.design.client.data.events.ColumnSortHandler;
import gwt.material.design.client.data.events.RowSelectEvent;
import gwt.material.design.client.data.events.RowSelectHandler;
import gwt.material.design.client.ui.table.MaterialDataTable;
public class CustomizedView extends Composite {
interface CustomizedViewUiBinder extends UiBinder<Widget, CustomizedView> {
}
private static CustomizedViewUiBinder uiBinder = GWT.create(CustomizedViewUiBinder.class);
private List<CatalogueDataset> users;
@UiField
MaterialDataTable<CatalogueDataset> table;
public CustomizedView() {
initWidget(uiBinder.createAndBindUi(this));
setupTable();
}
public void setupTable() {
// MaterialIcon icon = new MaterialIcon();
// icon.setPadding(4);
// icon.setIconType(IconType.ADD_CIRCLE_OUTLINE);
//
// icon.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// users.add(0, new DataGenerator().generateUsers(1).get(0));
// setData(users);
//
// }
// });
// table.setWaves(null);
// table.setUseStickyHeader(false);
//table.getScaffolding().getToolPanel().add(icon);
// MaterialIcon delete = new MaterialIcon();
// delete.setPadding(4);
// delete.setIconType(IconType.DELETE);
// table.getScaffolding().getToolPanel().add(delete);
//
// delete.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// User user = table.getView().getSelectedRowModels(true).get(0);
// users.remove(user);
// setData(users);
//
// }
// });
// table.addColumn("Image", new WidgetColumn<User, MaterialPanel>() {
// @Override
// public MaterialPanel getValue(User object) {
// MaterialPanel panel = new MaterialPanel();
// MaterialImage image = new MaterialImage();
// // image.setUrl(object.getImage());
// image.setWidth("32px");
// image.setHeight("32px");
// image.setCircle(true);
// panel.add(image);
// return panel;
// }
// });
table.addColumn("Title", new gwt.material.design.client.ui.table.cell.TextColumn<CatalogueDataset>() {
@Override
public String getValue(CatalogueDataset object) {
return object.getTitle();
}
@Override
public boolean sortable() {
return true;
}
});
// table.addColumn("Option", new WidgetColumn<User, MaterialListBox>() {
// @Override
// public MaterialListBox getValue(User object) {
// MaterialListBox listBox = new MaterialListBox();
// listBox.addItem("Option 1");
// listBox.addItem("Option 2");
// listBox.addItem("Option 3");
// return listBox;
// }
// }).width(200);
table.addColumn("Author", new gwt.material.design.client.ui.table.cell.TextColumn<CatalogueDataset>() {
@Override
public String getValue(CatalogueDataset object) {
return object.getAuthor();
}
@Override
public boolean sortable() {
return true;
}
});
table.addRowSelectHandler(new RowSelectHandler<CatalogueDataset>() {
@Override
public void onRowSelect(RowSelectEvent<CatalogueDataset> event) {
log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected());
}
});
table.addColumnSortHandler(new ColumnSortHandler<CatalogueDataset>() {
@Override
public void onColumnSort(gwt.material.design.client.data.events.ColumnSortEvent<CatalogueDataset> event) {
log("ColumnSortEvent",
"Sorted: " + event.getSortContext().getSortDir() + ", columnIndex: " + event.getColumnIndex());
table.getView().refresh();
}
});
/*
* // Add category opened handler, called when a category is opened.
* table.addCategoryOpenedHandler(event -> { log("CategoryOpenedEvent",
* "Category Opened: " + event.getName()); });
*
* // Add category closed handler, called when a category is closed.
* table.addCategoryClosedHandler(event -> { log("CategoryClosedEvent",
* "Category Closed: " + event.getName()); });
*
* // Add a row double click handler, called when a row is double clicked.
* table.addRowDoubleClickHandler(event -> { log("RowDoubleClickEvent",
* "Row Double Clicked: " + event.getModel().getName() + ", x:" +
* event.getMouseEvent().getPageX() + ", y: " +
* event.getMouseEvent().getPageY()); });
*
* // Configure the tables long press duration configuration. // The short press
* is when a click is held less than this duration.
* table.setLongPressDuration(400);
*
* // Add a row long press handler, called when a row is long pressed.
* table.addRowLongPressHandler(event -> { log("RowLongPressEvent",
* "Row Long Pressed: " + event.getModel().getName() + ", x:" +
* event.getMouseEvent().getPageX() + ", y: " +
* event.getMouseEvent().getPageY()); });
*
* // Add a row short press handler, called when a row is short pressed.
* table.addRowShortPressHandler(event -> { log("RowShortPressEvent",
* "Row Short Pressed: " + event.getModel().getName() + ", x:" +
* event.getMouseEvent().getPageX() + ", y: " +
* event.getMouseEvent().getPageY()); });
*
* // Add rendered handler, called when 'setRowData' calls finish rendering. //
* Guaranteed to only be called once from the data set render, ignoring sort
* renders and refreshView renders. table.addRenderedHandler(e -> {
* log("RenderedEvent", "Table Rendered"); });
*
* // Add components rendered handler, Called each time when components are
* rendered, // which includes sorting renders and refreshView() renders.
* table.addComponentsRenderedHandler(e -> { log("ComponentsRenderedEvent",
* "Data Table Components Rendered"); });
*/
}
protected void log(String eventName, String description) {
GWT.log(description);
}
public void setData(List<CatalogueDataset> users) {
this.users = users;
// Customized Table Scaffolding elements
table.getTableTitle().setText("Customers");
table.setRowData(0, users);
table.getView().refresh();
}
// @Override
// public void setupOptions() {
// // Table Name
// tableName.addKeyUpHandler(event -> table.getTableTitle().setText(tableName.getValue()));
//
// // Selection Type
// selectionType.add(SelectionType.NONE);
// selectionType.add(SelectionType.SINGLE);
// selectionType.add(SelectionType.MULTIPLE);
// selectionType.addValueChangeHandler(event -> table.setSelectionType(event.getValue()));
// selectionType.setValue(SelectionType.SINGLE, true);
// // Density
// }
//
// @UiHandler("stickyHeader")
// void stickyHeader(ValueChangeEvent<Boolean> event) {
// table.setUseStickyHeader(event.getValue());
// }
//
// @UiHandler("striped")
// void striped(ValueChangeEvent<Boolean> event) {
// if (event.getValue()) {
// table.getScaffolding().getTable().addStyleName("striped");
// } else {
// table.getScaffolding().getTable().removeStyleName("striped");
// }
// }
public void reload() {
table.getView().setRedraw(true);
table.getView().refresh();
}
}

View File

@ -0,0 +1,14 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:m="urn:import:gwt.material.design.client.ui"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<m:MaterialPanel>
<m:MaterialRow>
<m:MaterialColumn grid="s12 m10" offset="m1">
<m:table.MaterialDataTable
ui:field="table" shadow="1" height="440px" marginBottom="80" />
</m:MaterialColumn>
</m:MaterialRow>
</m:MaterialPanel>
</ui:UiBinder>

View File

@ -0,0 +1,17 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.TextResource;
/**
* Client Bundle for Icon Morph component
* @author kevzlou7979
*/
public interface DataTableClientBundle extends ClientBundle {
DataTableClientBundle INSTANCE = GWT.create(DataTableClientBundle.class);
@Source("css/data-table.css")
TextResource dataTable();
}

View File

@ -0,0 +1,11 @@
.table-container {
width: 90% !important;
/*width: 700px;*/
margin: auto !important;
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
}
.active-header {
background-color: #e1f5fe !important;
color: #2196F3 !important;
border-bottom: none !important;
}

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.function.Function;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CatalogueBeansConverter {
private static Logger LOG = LoggerFactory.getLogger(CatalogueBeansConverter.class);
/** The to S sync folder descriptor. */
public static Function<CkanDataset, CatalogueDataset> toCatalogueDataset = new Function<CkanDataset, CatalogueDataset>() {
public CatalogueDataset apply(CkanDataset t) {
CatalogueDataset myDataset = new CatalogueDataset();
if (t == null) {
LOG.info("Input " + CkanDataset.class.getSimpleName() + " is null, returning empty "
+ CkanDataset.class.getSimpleName());
return myDataset;
}
myDataset.setAuthor(t.getAuthor());
myDataset.setAuthorEmail(t.getAuthorEmail());
myDataset.setCkanDatasetURL(null);
myDataset.setId(t.getId());
myDataset.setLicenseId(t.getLicenseId());
myDataset.setMaintainer(t.getMaintainer());
myDataset.setMaintainerEmail(t.getMaintainerEmail());
myDataset.setName(t.getName());
myDataset.setNotes(t.getNotes());
myDataset.setOwnerOrg(t.getOwnerOrg());
myDataset.setTitle(t.getTitle());
myDataset.setType(t.getType());
myDataset.setUrl(t.getUrl());
return myDataset;
}
};
}

View File

@ -0,0 +1,99 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.concurrent.ConcurrentHashMap;
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueImpl;
import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A factory for getting CatalogueContentModeratorSystem objects.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 14, 2021
*/
public class CatalogueCMSFactory {
private static final Logger logger = LoggerFactory.getLogger(CatalogueCMSFactory.class);
private static final long MAX_LIFETIME = 1000 * 60 * 30; // 30 MINUTES
private static CatalogueCMSFactory instance = new CatalogueCMSFactory();
private static ConcurrentHashMap<String, CacheBean> cache;
/**
* The Class CacheBean.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 14, 2021
*/
private class CacheBean {
CatalogueContentModeratorSystem cmsInstance;
long ttl;
/**
* Instantiates a new cache bean.
*
* @param ttl the ttl
* @param cmsInstance the cms instance
*/
public CacheBean(long ttl, CatalogueContentModeratorSystem cmsInstance) {
this.ttl = ttl;
this.cmsInstance = cmsInstance;
}
}
/**
* Private constructor.
*/
private CatalogueCMSFactory() {
logger.debug(CatalogueCMSFactory.class.getSimpleName() + " object build");
cache = new ConcurrentHashMap<String, CacheBean>();
}
/**
* Get the factory instance.
*
* @return the factory
*/
public static CatalogueCMSFactory getFactory() {
logger.debug(CatalogueCMSFactory.class.getSimpleName() + " requested");
return instance;
}
/**
* Gets the CMS per scope.
*
* @param scope the scope
* @return the CMS per scope
* @throws Exception the exception
*/
public CatalogueContentModeratorSystem getCMSPerScope(String scope) throws Exception {
if (scope == null || scope.isEmpty())
throw new IllegalArgumentException("Invalid scope given!");
if (cache.containsKey(scope) && !expired(cache.get(scope))) {
return cache.get(scope).cmsInstance;
} else {
logger.info("Creating "+CatalogueCMSFactory.class.getSimpleName()+" for scope " + scope);
DataCatalogueImpl dci = new DataCatalogueImpl(scope);
CatalogueContentModeratorSystem cmsInstance = dci.getCatalogueContentModerator();
cache.put(scope, new CacheBean(System.currentTimeMillis(), cmsInstance));
return cmsInstance;
}
}
/**
* Check if the ckan information must be retrieved again.
*
* @param cacheBean the cache bean
* @return true, if successful
*/
private boolean expired(CacheBean cacheBean) {
return (cacheBean.ttl + MAX_LIFETIME < System.currentTimeMillis());
}
}

View File

@ -1,52 +0,0 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*/
@SuppressWarnings("serial")
public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet implements
CkanContentModeratorService, ContentModeratorSystem {
@Override
public boolean isContentModeratorEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setStatus(String itemId, ItemStatus theStatus) {
// TODO Auto-generated method stub
}
@Override
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus) {
// TODO Auto-generated method stub
return null;
}
@Override
public void approveItem(String itemId) {
// TODO Auto-generated method stub
}
@Override
public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg) {
// TODO Auto-generated method stub
}
@Override
public void permanentlyDelete(String itemId) {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,91 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.ArrayList;
import java.util.List;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*/
@SuppressWarnings("serial")
public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implements CkanContentModeratorService {
private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceImpl.class);
@Override
public boolean isContentModeratorEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setStatus(String itemId, ItemStatus theStatus) {
// TODO Auto-generated method stub
}
@Override
public List<CatalogueDataset> getListItemsForStatus(ItemStatus theStatus, int limit, int offset) throws Exception {
LOG.info("called getListItemsForStatus with [status: " + theStatus + "], [limit: " + limit + "], [offset: "
+ offset + "]");
List<CatalogueDataset> datasetList = null;
try {
String scope = WsUtil.getCurrentScope(this.getThreadLocalRequest());
GCubeUser user = WsUtil.getCurrentUser(this.getThreadLocalRequest());
String token = WsUtil.getCurrentToken(scope, user.getUsername());
ScopeProvider.instance.set(scope);
SecurityTokenProvider.instance.set(token);
CatalogueContentModeratorSystem cmsInstance = CatalogueCMSFactory.getFactory().getCMSPerScope(scope);
List<CkanDataset> datasets = cmsInstance.getListItemsForStatus(theStatus, limit, offset);
if (datasets != null) {
int size = datasets.size();
datasetList = new ArrayList<CatalogueDataset>(size);
LOG.info("datasetList for input parameters returned by CMS has size: " + size);
for (CkanDataset ckanDataset : datasets) {
CatalogueDataset ds = CatalogueBeansConverter.toCatalogueDataset.apply(ckanDataset);
LOG.debug("converted dataset is: " + ds);
datasetList.add(ds);
}
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new Exception(
"Error occurrend on reading items for status: " + theStatus + ". Caused by: " + e.getMessage());
}
LOG.info("returning "+datasetList.size()+ " dataset");
return datasetList;
}
@Override
public void approveItem(String itemId) {
LOG.info("Called approve Item: " + itemId);
}
@Override
public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg) {
// TODO Auto-generated method stub
}
@Override
public void permanentlyDelete(String itemId) {
// TODO Auto-generated method stub
}
}

View File

@ -1,108 +0,0 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
// TODO: Auto-generated Javadoc
/**
* The Interface ContentModeratorSystem.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 7, 2021
*/
public interface ContentModeratorSystem {
/**
* Checks if is content moderator enabled.
*
* @return true, if is content moderator enabled
*/
boolean isContentModeratorEnabled();
/**
* Sets the status.
*
* @param itemId the item id
* @param theStatus the the status
*/
void setStatus(String itemId, ItemStatus theStatus);
/**
* Gets the list items for status.
*
* @param theStatus the the status
* @return the list items for status
*/
List<CkanDataset> getListItemsForStatus(ItemStatus theStatus);
/**
* Approve item.
*
* @param itemId the item id
*/
void approveItem(String itemId);
/**
* Reject item.
*
* @param itemId the item id
* @param permanentlyDelete the permanently delete
* @param reasonMsg the reason msg
*/
void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg);
/**
* Permanently delete.
*
* @param itemId the item id
*/
void permanentlyDelete(String itemId);
/**
* The Enum ItemStatus.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 7, 2021
*/
static enum ItemStatus {
PENDING("pending", "Pending"), APPROVED("approved", "Approved"), REJECTED("rejected", "Rejected");
private String id;
private String label;
/**
* Instantiates a new item status.
*
* @param id the id
* @param label the label
*/
private ItemStatus(String id, String label) {
this.id = id;
this.label = label;
}
/**
* Gets the id.
*
* @return the id
*/
public String getId() {
return id;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel() {
return label;
}
}
}

View File

@ -0,0 +1,75 @@
/**
*
*/
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.portal.PortalContext;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
// TODO: Auto-generated Javadoc
/**
* The Class WsUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 1, 2021
*/
public class WsUtil {
protected static Logger logger = LoggerFactory.getLogger(WsUtil.class);
/**
* Checks if is within portal.
*
* @return true if you're running into the portal, false if in development
*/
public static boolean isWithinPortal() {
try {
UserLocalServiceUtil.getService();
return true;
} catch (Exception ex) {
logger.trace("Development Mode ON");
return false;
}
}
/**
* Gets the current user.
*
* @param httpServletRequest the http servlet request
* @return the current user
*/
public static GCubeUser getCurrentUser(HttpServletRequest httpServletRequest){
return PortalContext.getConfiguration().getCurrentUser(httpServletRequest);
}
/**
* Gets the current scope.
*
* @param httpServletRequest the http servlet request
* @return the current scope
*/
public static String getCurrentScope(HttpServletRequest httpServletRequest){
return PortalContext.getConfiguration().getCurrentScope(httpServletRequest);
}
/**
* Gets the current token.
*
* @param scope the scope
* @param username the username
* @return the current token
*/
public static String getCurrentToken(String scope, String username){
return PortalContext.getConfiguration().getCurrentUserToken(scope,username);
}
}

View File

@ -0,0 +1,202 @@
package org.gcube.portlets.widgets.ckancontentmoderator.shared;
import java.io.Serializable;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import com.google.gwt.user.client.rpc.IsSerializable;
// TODO: Auto-generated Javadoc
/**
* The Class CatalogueDataset.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 14, 2021
*/
public class CatalogueDataset implements Serializable, IsSerializable {
/**
*
*/
private static final long serialVersionUID = 566645830900736239L;
private String author;
private String authorEmail;
private String id;
private String licenseId;
private String maintainer;
private String maintainerEmail;
private String name;
private String notes;
private String ownerOrg;
private ItemStatus status;
private String title;
private String type;
private String url;
private String version;
private String ckanDatasetURL;
/**
* Instantiates a new ckan dataset base.
*/
public CatalogueDataset() {
}
public String getAuthor() {
return author;
}
public String getAuthorEmail() {
return authorEmail;
}
public String getId() {
return id;
}
public String getLicenseId() {
return licenseId;
}
public String getMaintainer() {
return maintainer;
}
public String getMaintainerEmail() {
return maintainerEmail;
}
public String getName() {
return name;
}
public String getNotes() {
return notes;
}
public String getOwnerOrg() {
return ownerOrg;
}
public ItemStatus getStatus() {
return status;
}
public String getTitle() {
return title;
}
public String getType() {
return type;
}
public String getUrl() {
return url;
}
public String getVersion() {
return version;
}
public String getCkanDatasetURL() {
return ckanDatasetURL;
}
public void setAuthor(String author) {
this.author = author;
}
public void setAuthorEmail(String authorEmail) {
this.authorEmail = authorEmail;
}
public void setId(String id) {
this.id = id;
}
public void setLicenseId(String licenseId) {
this.licenseId = licenseId;
}
public void setMaintainer(String maintainer) {
this.maintainer = maintainer;
}
public void setMaintainerEmail(String maintainerEmail) {
this.maintainerEmail = maintainerEmail;
}
public void setName(String name) {
this.name = name;
}
public void setNotes(String notes) {
this.notes = notes;
}
public void setOwnerOrg(String ownerOrg) {
this.ownerOrg = ownerOrg;
}
public void setStatus(ItemStatus status) {
this.status = status;
}
public void setTitle(String title) {
this.title = title;
}
public void setType(String type) {
this.type = type;
}
public void setUrl(String url) {
this.url = url;
}
public void setVersion(String version) {
this.version = version;
}
public void setCkanDatasetURL(String ckanDatasetURL) {
this.ckanDatasetURL = ckanDatasetURL;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CatalogueDataset [author=");
builder.append(author);
builder.append(", authorEmail=");
builder.append(authorEmail);
builder.append(", id=");
builder.append(id);
builder.append(", licenseId=");
builder.append(licenseId);
builder.append(", maintainer=");
builder.append(maintainer);
builder.append(", maintainerEmail=");
builder.append(maintainerEmail);
builder.append(", name=");
builder.append(name);
builder.append(", notes=");
builder.append(notes);
builder.append(", ownerOrg=");
builder.append(ownerOrg);
builder.append(", status=");
builder.append(status);
builder.append(", title=");
builder.append(title);
builder.append(", type=");
builder.append(type);
builder.append(", url=");
builder.append(url);
builder.append(", version=");
builder.append(version);
builder.append(", ckanDatasetURL=");
builder.append(ckanDatasetURL);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,42 +0,0 @@
package org.gcube.portlets.widgets.ckancontentmoderator.shared;
/**
* <p>
* FieldVerifier validates that the name the user enters is valid.
* </p>
* <p>
* This class is in the <code>shared</code> packing because we use it in both
* the client code and on the server. On the client, we verify that the name is
* valid before sending an RPC request so the user doesn't have to wait for a
* network round trip to get feedback. On the server, we verify that the name is
* correct to ensure that the input is correct regardless of where the RPC
* originates.
* </p>
* <p>
* When creating a class that is used on both the client and the server, be sure
* that all code is translatable and does not use native JavaScript. Code that
* is note translatable (such as code that interacts with a database or the file
* system) cannot be compiled into client side JavaScript. Code that uses native
* JavaScript (such as Widgets) cannot be run on the server.
* </p>
*/
public class FieldVerifier {
/**
* Verifies that the specified name is valid for our service.
*
* In this example, we only require that the name is at least four
* characters. In your application, you can use more complex checks to ensure
* that usernames, passwords, email addresses, URLs, and other fields have the
* proper syntax.
*
* @param name the name to validate
* @return true if valid, false if invalid
*/
public static boolean isValidName(String name) {
if (name == null) {
return false;
}
return name.length() > 3;
}
}

View File

@ -1,22 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='CkanContentModeratorWidget'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<inherits name="gwt.material.design.jquery.JQuery" />
<!-- Other module inherits -->
<inherits
name="gwt.material.design.GwtMaterialBasicWithJQuery" />
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
<inherits name="gwt.material.design.themes.ThemeBlue" />
<inherits name="gwt.material.design.GwtMaterialTable" />
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidget' />
<inherits
name="org.gcube.datacatalogue.utillibrary.CkanUtilLibrary" />
<!-- Other module inherits -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidget' /> -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -1,2 +0,0 @@
sendButton = Envoyer
nameField = Entrez votre nom

View File

@ -32,3 +32,325 @@ h1 {
#closeButton {
margin: 15px 6px 6px;
}
html{
overflow-x: hidden !important;
}
body {
padding-top: 70px;
}
pre.prettyprint {
padding: 9.5px !important;
border: none !important;
margin-bottom: 0px !important;
background: transparent !important;
margin-bottom: 10px !important;
}
.page-header {
margin-top: 0px !important;
}
.progress{
background-color: #E8F4FD;
}
nav{
width: calc(100% - 240px);
}
nav .button-collapse i {
font-size: 24px !important;
}
/* Styles for Affix/sidebar shamelessly copied from http://getbootstrap.com/assets/css/docs.css */
/* By default it's not affixed in mobile views, so undo that */
.bs-sidebar.affix {
position: static;
}
/* First level of nav */
.bs-sidenav {
margin-top: 30px;
margin-bottom: 30px;
padding-top: 10px;
padding-bottom: 10px;
text-shadow: 0 1px 0 #fff;
background-color: #f7f5fa;
border-radius: 5px;
}
/* All levels of nav */
.bs-sidebar .nav > li > a {
display: block;
color: #716b7a;
padding: 5px 20px;
}
.bs-sidebar .nav > li > a:hover,
.bs-sidebar .nav > li > a:focus {
text-decoration: none;
background-color: #e5e3e9;
border-right: 1px solid #dbd8e0;
}
.bs-sidebar .nav > .active > a,
.bs-sidebar .nav > .active:hover > a,
.bs-sidebar .nav > .active:focus > a {
font-weight: bold;
color: #563d7c;
background-color: transparent;
border-right: 1px solid #563d7c;
}
/* Nav: second level (shown on .active) */
.bs-sidebar .nav .nav {
display: none; /* Hide by default, but at >768px, show it */
margin-bottom: 8px;
}
.bs-sidebar .nav .nav > li > a {
padding-top: 3px;
padding-bottom: 3px;
padding-left: 30px;
font-size: 90%;
}
/* Mobile down */
@media only screen and (max-width: 600px) {
.panel {
padding: 0px !important;
}
pre.prettyprint {
width: calc(100vw - 80px);
}
}
@media only screen and (max-width: 992px) {
header {
width: 100% !important;
}
}
/* Tablets and up */
@media screen and (min-width: 768px) {
/* Show the docs nav */
.bs-sidebar {
display: block;
}
/* Show the hidden subnavs when space allows it */
.bs-sidebar .nav > .active > ul {
display: block;
}
}
/* Tablets/desktops and up */
@media screen and (min-width: 992px) {
/* Widen the fixed sidebar */
.bs-sidebar.affix,
.bs-sidebar.affix-bottom {
width: 213px;
}
.bs-sidebar.affix {
position: fixed; /* Undo the static from mobile-first approach */
top: 60px;
}
.bs-sidebar.affix-bottom {
position: absolute; /* Undo the static from mobile-first approach */
}
.bs-sidebar.affix-bottom .bs-sidenav,
.bs-sidebar.affix .bs-sidenav {
margin-top: 0;
margin-bottom: 0;
}
}
/* Large desktops and up */
@media screen and (min-width: 1200px) {
/* Widen the fixed sidebar again */
.bs-sidebar.affix-bottom,
.bs-sidebar.affix {
width: 270px;
}
}
ul.side-nav.fixed li:hover,ul.side-nav.fixed li.active {
background-color: rgba(0, 0, 0, 0.05);
}
.side-nav .collapsible-body li.active, .side-nav.fixed .collapsible-body li.active {
background-color: rgba(0, 0, 0, 0.05);
}
/** Top Panel **/
#customTable .top-panel {
background-color: white;
color: black;
}
/** ToolPanel icons **/
#customTable .top-panel .tool-panel i {
color: #e91e63;
}
/** Hovering rows **/
#customTable table tbody tr.data-row:hover {
background: rgba(33, 150, 243, 0.27);
color: #3f3f3f;
}
/** Columns **/
#customTable table tbody td:nth-child(3) {
background: #2196f3 !important;
color: #fff;
border-bottom: 2px solid #1976d2;
}
/** Table Headers **/
#customTable table thead tr th {
color: #1976d2;
}
/** Scroll Navigated menu **/
.table-of-contents.pinned {
top: 80px !important;
}
.side-nav .collapsible-body li.active a, .side-nav.fixed .collapsible-body li.active a {
color: #000 !important;
}
body {
background: #e9e9e9;
}
main .panel {
margin-top: -40px;
}
main .panel, main {
background: none;
}
.code {
margin-bottom: 12px;
}
.code > div:not(.empty-state) h4 {
font-size: 1.2em;
margin-top: 0px !important;
}
.code div p.range-field {
margin-bottom: 0px;
}
.code div p {
margin-bottom: 20px;
}
.code {
padding: 20px;
margin-bottom: 12px;
background: #fff;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.TouchSplitter h4 {
padding-top: 100px;
}
/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
margin: 15px 6px 6px;
}
table tbody tr td img {
max-width: initial !important;
}
.side-nav {
height: 100% !important;
box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
-webkit-box-sizing: border-box !important
}
pre {
padding-top: 20px;
white-space: pre;
background: #F3FBFF;
border: 1px solid rgba(51, 51, 51, .12);
font-size: 1.2em;
padding-left: 10px
}
.tag {
color: #905
}
.attr {
color: #690
}
.comment {
color: #999
}
h1 {
font-size: 2em;
font-weight: 700;
color: #777;
margin: 40px 0 70px;
text-align: center
}
.sendButton {
display: block;
font-size: 16pt
}
.gwt-DialogBox {
width: 400px
}
.dialogVPanel {
margin: 5px
}
.serverResponseLabelError {
color: red
}
#closeButton {
margin: 15px 6px 6px
}
.gitter-open-chat-button, .gitter-open-chat-button:visited {
background: #2465c0
}
aside.gitter-chat-embed {
z-index: 9999
}
/** Carousel **/
#demo-carousel-fixed {
bottom: 16%;
position: fixed;
text-align: center;
left: calc(50% - 90px);
z-index: 1;
z-index: 999;
}

View File

@ -6,58 +6,47 @@
<!-- differences in layout. -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet" href="CkanContentModeratorWidget.css">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet"
href="CkanContentModeratorWidget.css">
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Web Application Starter Project</title>
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Web Application Starter Project</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" language="javascript" src="CkanContentModeratorWidget/CkanContentModeratorWidget.nocache.js"></script>
</head>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" language="javascript"
src="CkanContentModeratorWidget/CkanContentModeratorWidget.nocache.js"></script>
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic UI. -->
<!-- -->
<body>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic UI. -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
<h1>Web Application Starter Project</h1>
<table align="center">
<tr>
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
</tr>
<tr>
<td id="nameFieldContainer"></td>
<td id="sendButtonContainer"></td>
</tr>
<tr>
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
</tr>
</table>
</body>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<div
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled in order for this
application to display correctly.</div>
</noscript>
<div id="theContentModeratorDiv"></div>
</body>
</html>

View File

@ -1,24 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<web-app>
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceImpl</servlet-class>
</servlet>
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/CkanContentModeratorWidget/greet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/CkanContentModeratorWidget/greet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>CkanContentModeratorWidget.html</welcome-file>
</welcome-file-list>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>CkanContentModeratorWidget.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@ -1,14 +0,0 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import static org.junit.Assert.*;
import org.junit.Test;
public class CkanContentModeratorServiceAImplTest {
@Test
public void test() {
fail("Not yet implemented");
}
}

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server;
import static org.junit.Assert.fail;
import java.util.List;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datacatalogue.utillibrary.server.cms.CatalogueContentModeratorSystem;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.junit.Test;
import org.slf4j.LoggerFactory;
public class CkanContentModeratorServiceTest {
private String scope = "/gcube/devsec/devVRE";
private String testUser = "francesco.mangiacrapa";
private String authorizationToken = "8e74a17c-92f1-405a-b591-3a6090066248-98187548";
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceTest.class);
//@Test
public void test() {
fail("Not yet implemented");
}
//@Test
public void loadItemsForStatus() {
ScopeProvider.instance.set(scope);
SecurityTokenProvider.instance.set(authorizationToken);
try {
CatalogueContentModeratorSystem cms = CatalogueCMSFactory.getFactory().getCMSPerScope(scope);
List<CkanDataset> items = cms.getListItemsForStatus(ItemStatus.PENDING, 20, 0);
int i = 0;
for (CkanDataset ckanDataset : items) {
System.out.println(i++ +")Read dataset: "+ckanDataset);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

8
src/test/resources/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
/devNext.gcubekey
/devVRE.gcubekey
/devsec.gcubekey
/gCubeApps.gcubekey
/gcube.gcubekey
/log4j.properties
/pred4s.gcubekey
/preprod.gcubekey