task_21363 #1

Closed
francesco.mangiacrapa wants to merge 53 commits from task_21363 into master
20 changed files with 606 additions and 172 deletions
Showing only changes of commit 3a5f01f2e4 - Show all commits

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java"> <classpathentry kind="src" output="target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
@ -29,10 +29,6 @@
<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"> <classpathentry kind="lib" path="/home/francesco-mangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
<attributes> <classpathentry kind="output" path="target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

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

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled 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,11 @@
<?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.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="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <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"/>
<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/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> </wb-module>
</project-modules> </project-modules>

View File

@ -1,8 +1,8 @@
<?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="java" version="1.8"/>
<installed facet="jst.web" version="2.3"/> <installed facet="jst.web" version="2.3"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/> <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"/>
</faceted-project> </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). 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 First Release

148
pom.xml
View File

@ -13,8 +13,8 @@
<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>war</packaging>
<version>0.0.1-SNAPSHOT</version> <version>0.1.0-SNAPSHOT</version>
<name>gCube Ckan Content Moderator Widget</name> <name>gCube Ckan Content Moderator Widget</name>
<description> <description>
@ -30,13 +30,14 @@
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion> <gwtVersion>2.9.0</gwtVersion>
<!-- <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> --> <!-- <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> -->
<distroDirectory>distro</distroDirectory> <distroDirectory>distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <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> <maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -44,7 +45,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.1-SNAPSHOT</version> <version>3.6.2-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -59,10 +60,30 @@
</dependencyManagement> </dependencyManagement>
<dependencies> <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> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -70,22 +91,49 @@
<artifactId>gwt-bootstrap</artifactId> <artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version> <version>2.3.2.0</version>
</dependency> </dependency>
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material</artifactId> -->
<!-- <version>2.1.1</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material-addins</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material-table</artifactId> -->
<!-- <version>2.1.1</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.gwtplatform</groupId> -->
<!-- <artifactId>gwtp-mvp-client</artifactId> -->
<!-- <version>1.6</version> -->
<!-- <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> -->
<dependency> <dependency>
<groupId>org.gcube.datacatalogue</groupId> <groupId>org.slf4j</groupId>
<artifactId>catalogue-util-library</artifactId> <artifactId>slf4j-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope> <scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@ -96,21 +144,7 @@
<build> <build>
<!-- Generate compiled stuff in the folder used for developing mode --> <!-- Generate compiled stuff in the folder used for developing mode -->
<!-- <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory> --> <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
@ -123,7 +157,7 @@
<execution> <execution>
<goals> <goals>
<goal>compile</goal> <goal>compile</goal>
<goal>test</goal> <!-- <goal>test</goal> -->
</goals> </goals>
</execution> </execution>
</executions> </executions>
@ -131,19 +165,39 @@
documentation at codehaus.org --> documentation at codehaus.org -->
<configuration> <configuration>
<runTarget>CkanContentModeratorWidget.html</runTarget> <runTarget>CkanContentModeratorWidget.html</runTarget>
<modules> <hostedWebapp>${webappDirectory}</hostedWebapp>
<module>org.gcube.portlets.widgets.ckancontentmoderator.CkanContentModeratorWidget</module> </configuration>
</modules> </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> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin> </plugin>
<!-- SA Plugin --> <!-- SA Plugin -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration> <configuration>
<descriptors> <descriptors>
<descriptor>descriptor.xml</descriptor> <descriptor>descriptor.xml</descriptor>
@ -159,6 +213,32 @@
</execution> </execution>
</executions> </executions>
</plugin> </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> </plugins>
</build> </build>

View File

@ -0,0 +1,25 @@
<?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 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.GwtMaterialDesign" /> -->
<!-- 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

@ -1,9 +1,6 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client; package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.server.ContentModeratorSystem.ItemStatus;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -18,7 +15,7 @@ public interface CkanContentModeratorService extends RemoteService {
public void setStatus(String itemId, ItemStatus theStatus); public void setStatus(String itemId, ItemStatus theStatus);
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus); //public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus);
public void approveItem(String itemId); public void approveItem(String itemId);

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client; package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
import org.gcube.portlets.widgets.ckancontentmoderator.server.ContentModeratorSystem.ItemStatus;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
@ -13,7 +10,7 @@ public interface CkanContentModeratorServiceAsync {
void approveItem(String itemId, AsyncCallback<Void> callback); void approveItem(String itemId, AsyncCallback<Void> callback);
void getListItemsForStatus(ItemStatus theStatus, AsyncCallback<List<CkanDataset>> callback); //void getListItemsForStatus(ItemStatus theStatus, AsyncCallback<List<CkanDataset>> callback);
void permanentlyDelete(String itemId, AsyncCallback<Void> callback); void permanentlyDelete(String itemId, AsyncCallback<Void> callback);

View File

@ -1,53 +1,49 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client; 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 com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
/** /**
* Entry point classes define <code>onModuleLoad()</code>. * Entry point classes define <code>onModuleLoad()</code>.
*/ */
public class CkanContentModeratorWidget implements EntryPoint { public class CkanContentModeratorWidget implements EntryPoint {
/** /**
* The message displayed to the user when the server cannot be reached or * The message displayed to the user when the server cannot be reached or
* returns an error. * returns an error.
*/ */
private static final String SERVER_ERROR = "An error occurred while " private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your network " + "attempting to contact the server. Please check your network " + "connection and try again.";
+ "connection and try again.";
/** /**
* Create a remote service proxy to talk to the server-side Greeting service. * Create a remote service proxy to talk to the server-side Greeting service.
*/ */
private final CkanContentModeratorServiceAsync greetingService = GWT.create(CkanContentModeratorService.class); private final CkanContentModeratorServiceAsync greetingService = GWT.create(CkanContentModeratorService.class);
/**
* This is the entry point method.
*/
public void onModuleLoad() {
//CustomizedView cvTable = new CustomizedView();
// cvTable.setData(DataGenerator.generateUsers(10));
//
// RootPanel.get().add(cvTable);
/** //
* This is the entry point method. // greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() {
*/ //
public void onModuleLoad() { // @Override
// public void onSuccess(List<CkanDataset> result) {
// // TODO Auto-generated method stub
greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() { //
// }
@Override //
public void onSuccess(List<CkanDataset> result) { // @Override
// TODO Auto-generated method stub // public void onFailure(Throwable caught) {
// // TODO Auto-generated method stub
} //
// }
@Override // });
public void onFailure(Throwable caught) { }
// TODO Auto-generated method stub
}
});
}
} }

View File

@ -0,0 +1,249 @@
///*
// * #%L
// * GwtMaterial
// * %%
// * Copyright (C) 2015 - 2017 GwtMaterialDesign
// * %%
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// * #L%
// */
//package org.gcube.portlets.widgets.ckancontentmoderator.client.material.table;
//
//import java.util.List;
//
//
//import org.gcube.portlets.widgets.ckancontentmoderator.shared.User;
//
//import com.google.gwt.core.client.GWT;
//import com.google.gwt.event.dom.client.ClickEvent;
//import com.google.gwt.event.dom.client.ClickHandler;
//import com.google.gwt.uibinder.client.UiBinder;
//import com.google.gwt.uibinder.client.UiField;
//import com.google.gwt.user.cellview.client.ColumnSortEvent;
//import com.google.gwt.user.cellview.client.TextColumn;
//import com.google.gwt.user.client.ui.Composite;
//import com.google.gwt.user.client.ui.Widget;
//
//
//import gwt.material.design.client.constants.IconType;
//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.MaterialIcon;
//import gwt.material.design.client.ui.MaterialImage;
//import gwt.material.design.client.ui.MaterialListBox;
//import gwt.material.design.client.ui.MaterialPanel;
//import gwt.material.design.client.ui.table.MaterialDataTable;
//import gwt.material.design.client.ui.table.cell.WidgetColumn;
//
//public class CustomizedView extends Composite {
//
// interface CustomizedViewUiBinder extends UiBinder<Widget, CustomizedView> {
// }
//
// private List<User> users;
//
// @UiField
// MaterialDataTable<User> table;
//
//
// public CustomizedView(Binder uiBinder) {
// initWidget(uiBinder.createAndBindUi(this));
// }
//
//
// 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.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("First Name", new TextColumn<User>() {
// @Override
// public String getValue(User object) {
// return object.getName();
// }
//
// @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("City", new TextColumn<User>() {
// @Override
// public String getValue(User object) {
// return object.getCity();
// }
// });
//
// table.addRowSelectHandler(new RowSelectHandler<User>() {
//
// @Override
// public void onRowSelect(RowSelectEvent<User> event) {
// log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected());
//
// }
// });
//
// table.addColumnSortHandler(new ColumnSortHandler<User>() {
//
// @Override
// public void onColumnSort(ColumnSortEvent<User> 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);
// }
//
// @Override
// public void setData(List<User> 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,27 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.material.table;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.User;
public class DataGenerator {
// static {
// MaterialDesign.injectJs(AppResources.INSTANCE.fakerJs());
// }
public static List<User> generateUsers(int total) {
return generateUsers(total, null);
}
public static List<User> generateUsers(int total, String category) {
List<User> users = new ArrayList<>();
for (int i = 0; i < total; i++) {
User user = new User("name "+i, "city "+i);
users.add(user);
}
return users;
}
}

View File

@ -1,9 +1,7 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server; 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 org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@ -26,11 +24,11 @@ public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet imple
} }
@Override // @Override
public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus) { // public List<CkanDataset> getListItemsForStatus(ItemStatus theStatus) {
// TODO Auto-generated method stub // // TODO Auto-generated method stub
return null; // return null;
} // }
@Override @Override
public void approveItem(String itemId) { public void approveItem(String itemId) {
@ -49,4 +47,5 @@ public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet imple
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.widgets.ckancontentmoderator.server; package org.gcube.portlets.widgets.ckancontentmoderator.server;
import java.util.List; import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
@ -37,7 +34,7 @@ public interface ContentModeratorSystem {
* @param theStatus the the status * @param theStatus the the status
* @return the list items for status * @return the list items for status
*/ */
List<CkanDataset> getListItemsForStatus(ItemStatus theStatus); //List<CkanDataset> getListItemsForStatus(ItemStatus theStatus);
/** /**
* Approve item. * Approve item.
@ -62,47 +59,4 @@ public interface ContentModeratorSystem {
*/ */
void permanentlyDelete(String itemId); 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,45 @@
package org.gcube.portlets.widgets.ckancontentmoderator.shared;
/**
* The Enum ItemStatus.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 7, 2021
*/
public 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,52 @@
package org.gcube.portlets.widgets.ckancontentmoderator.shared;
import java.io.Serializable;
// TODO: Auto-generated Javadoc
/**
* The Class User.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* May 26, 2021
*/
public class User implements Serializable {
String name;
String city;
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new user.
*/
public User() {
}
public User(String name, String city) {
super();
this.name = name;
this.city = city;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}

View File

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

View File

@ -6,7 +6,7 @@ import org.junit.Test;
public class CkanContentModeratorServiceAImplTest { public class CkanContentModeratorServiceAImplTest {
@Test //@Test
public void test() { public void test() {
fail("Not yet implemented"); fail("Not yet implemented");
} }