Compare commits
9 Commits
master
...
test_gwt_m
Author | SHA1 | Date |
---|---|---|
Francesco Mangiacrapa | e517689cc0 | 3 years ago |
Francesco Mangiacrapa | e13a087c7a | 3 years ago |
Francesco Mangiacrapa | 2ce14fe572 | 3 years ago |
Francesco Mangiacrapa | 00a9c62879 | 3 years ago |
Francesco Mangiacrapa | f99b5b9fb3 | 3 years ago |
Francesco Mangiacrapa | 53df376b96 | 3 years ago |
Francesco Mangiacrapa | a36d2ca1f4 | 3 years ago |
Francesco Mangiacrapa | 857ff7996a | 3 years ago |
Francesco Mangiacrapa | 3a5f01f2e4 | 3 years ago |
@ -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
|
||||
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -0,0 +1,7 @@
|
||||
<root>
|
||||
<facet id="jst.jaxrs">
|
||||
<node name="libprov">
|
||||
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||
</node>
|
||||
</facet>
|
||||
</root>
|
@ -1,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>
|
||||
|
@ -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>
|
@ -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>
|
@ -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();
|
||||
}
|
||||
}
|
@ -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>
|
@ -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();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
@ -1,2 +0,0 @@
|
||||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
@ -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>
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
/devNext.gcubekey
|
||||
/devVRE.gcubekey
|
||||
/devsec.gcubekey
|
||||
/gCubeApps.gcubekey
|
||||
/gcube.gcubekey
|
||||
/log4j.properties
|
||||
/pred4s.gcubekey
|
||||
/preprod.gcubekey
|
Loading…
Reference in New Issue