task_21363 #1
13
.classpath
13
.classpath
|
@ -18,10 +18,15 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<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="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<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="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">
|
||||||
|
@ -30,11 +35,5 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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="lib" path="/home/francescomangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
|
||||||
<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="output" path="target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/ckan-content-moderator-widget-0.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
entryPointModules=
|
|
@ -1,21 +1,31 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="ckan-content-moderator-widget-0.1.0-SNAPSHOT">
|
<wb-module deploy-name="ckan-content-moderator-widget-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.1.0-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>
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
<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"/>
|
<installed facet="java" version="1.8"/>
|
||||||
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
63
pom.xml
63
pom.xml
|
@ -31,7 +31,6 @@
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.9.0</gwtVersion>
|
<gwtVersion>2.9.0</gwtVersion>
|
||||||
<!-- <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>
|
||||||
|
@ -132,12 +131,56 @@
|
||||||
<version>${gwt-material.version}</version>
|
<version>${gwt-material.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency> -->
|
<!-- FWS -->
|
||||||
<!-- <groupId>org.gcube.datacatalogue</groupId> -->
|
<dependency>
|
||||||
<!-- <artifactId>catalogue-util-library</artifactId> -->
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0)</version> -->
|
<artifactId>ic-client</artifactId>
|
||||||
<!-- <scope>compile</scope> -->
|
<scope>provided</scope>
|
||||||
<!-- </dependency> -->
|
</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>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
@ -183,7 +226,6 @@
|
||||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Copy static web files before executing gwt:run -->
|
<!-- Copy static web files before executing gwt:run -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -203,11 +245,16 @@
|
||||||
<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>
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
<inherits name="gwt.material.design.jquery.JQuery" />
|
<inherits name="gwt.material.design.jquery.JQuery" />
|
||||||
|
|
||||||
<inherits name="gwt.material.design.GwtMaterialBasicWithJQuery" />
|
<inherits
|
||||||
|
name="gwt.material.design.GwtMaterialBasicWithJQuery" />
|
||||||
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
|
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
|
||||||
<inherits name="gwt.material.design.themes.ThemeBlue" />
|
<inherits name="gwt.material.design.themes.ThemeBlue" />
|
||||||
<inherits name="gwt.material.design.GwtMaterialTable" />
|
<inherits name="gwt.material.design.GwtMaterialTable" />
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
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.CkanDataset;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
@ -15,7 +18,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);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
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.CkanDataset;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -10,7 +13,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);
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
package org.gcube.portlets.widgets.ckancontentmoderator.client;
|
package org.gcube.portlets.widgets.ckancontentmoderator.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.CustomizedView;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.CustomizedView;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.material.table.DataGenerator;
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.DataTableClientBundle;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.DataTableClientBundle;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.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.dom.client.StyleInjector;
|
import com.google.gwt.dom.client.StyleInjector;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.table.MaterialDataTable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -44,27 +41,40 @@ public class CkanContentModeratorWidget implements EntryPoint {
|
||||||
// users.add("Pippo");
|
// users.add("Pippo");
|
||||||
// table.setRowData(0, users);
|
// table.setRowData(0, users);
|
||||||
|
|
||||||
CustomizedView cvTable = new CustomizedView();
|
final CustomizedView cvTable = new CustomizedView();
|
||||||
cvTable.setData(DataGenerator.generateUsers(10));
|
|
||||||
|
|
||||||
RootPanel.get().add(cvTable);
|
RootPanel.get().add(cvTable);
|
||||||
// table.getView().refresh();
|
// table.getView().refresh();
|
||||||
|
|
||||||
|
greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() {
|
||||||
|
|
||||||
// greetingService.getListItemsForStatus(ItemStatus.PENDING, new AsyncCallback<List<CkanDataset>>() {
|
@Override
|
||||||
//
|
public void onSuccess(List<CkanDataset> result) {
|
||||||
// @Override
|
cvTable.setData(result);
|
||||||
// public void onSuccess(List<CkanDataset> result) {
|
|
||||||
// // TODO Auto-generated method stub
|
}
|
||||||
//
|
|
||||||
// }
|
@Override
|
||||||
//
|
public void onFailure(Throwable caught) {
|
||||||
// @Override
|
// TODO Auto-generated method stub
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// // TODO Auto-generated method stub
|
}
|
||||||
//
|
});
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
greetingService.approveItem("ciao", new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
GWT.log("OK");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,27 +2,18 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client.material.table;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.User;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
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.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import gwt.material.design.client.base.Waves;
|
|
||||||
import gwt.material.design.client.constants.IconType;
|
|
||||||
import gwt.material.design.client.data.events.ColumnSortHandler;
|
import gwt.material.design.client.data.events.ColumnSortHandler;
|
||||||
import gwt.material.design.client.data.events.RowSelectEvent;
|
import gwt.material.design.client.data.events.RowSelectEvent;
|
||||||
import gwt.material.design.client.data.events.RowSelectHandler;
|
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.MaterialDataTable;
|
||||||
import gwt.material.design.client.ui.table.cell.WidgetColumn;
|
|
||||||
|
|
||||||
public class CustomizedView extends Composite {
|
public class CustomizedView extends Composite {
|
||||||
|
|
||||||
|
@ -30,10 +21,10 @@ public class CustomizedView extends Composite {
|
||||||
}
|
}
|
||||||
private static CustomizedViewUiBinder uiBinder = GWT.create(CustomizedViewUiBinder.class);
|
private static CustomizedViewUiBinder uiBinder = GWT.create(CustomizedViewUiBinder.class);
|
||||||
|
|
||||||
private List<User> users;
|
private List<CkanDataset> users;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
MaterialDataTable<User> table;
|
MaterialDataTable<CkanDataset> table;
|
||||||
|
|
||||||
|
|
||||||
public CustomizedView() {
|
public CustomizedView() {
|
||||||
|
@ -43,21 +34,21 @@ public class CustomizedView extends Composite {
|
||||||
|
|
||||||
|
|
||||||
public void setupTable() {
|
public void setupTable() {
|
||||||
MaterialIcon icon = new MaterialIcon();
|
// MaterialIcon icon = new MaterialIcon();
|
||||||
icon.setPadding(4);
|
// icon.setPadding(4);
|
||||||
icon.setIconType(IconType.ADD_CIRCLE_OUTLINE);
|
// icon.setIconType(IconType.ADD_CIRCLE_OUTLINE);
|
||||||
|
//
|
||||||
icon.addClickHandler(new ClickHandler() {
|
// icon.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(ClickEvent event) {
|
// public void onClick(ClickEvent event) {
|
||||||
users.add(0, new DataGenerator().generateUsers(1).get(0));
|
// users.add(0, new DataGenerator().generateUsers(1).get(0));
|
||||||
setData(users);
|
// setData(users);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
table.setWaves(null);
|
// table.setWaves(null);
|
||||||
table.setUseStickyHeader(false);
|
// table.setUseStickyHeader(false);
|
||||||
//table.getScaffolding().getToolPanel().add(icon);
|
//table.getScaffolding().getToolPanel().add(icon);
|
||||||
|
|
||||||
// MaterialIcon delete = new MaterialIcon();
|
// MaterialIcon delete = new MaterialIcon();
|
||||||
|
@ -90,10 +81,10 @@ public class CustomizedView extends Composite {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
table.addColumn("First Name", new gwt.material.design.client.ui.table.cell.TextColumn<User>() {
|
table.addColumn("Title", new gwt.material.design.client.ui.table.cell.TextColumn<CkanDataset>() {
|
||||||
@Override
|
@Override
|
||||||
public String getValue(User object) {
|
public String getValue(CkanDataset object) {
|
||||||
return object.getName();
|
return object.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,10 +104,10 @@ public class CustomizedView extends Composite {
|
||||||
// }
|
// }
|
||||||
// }).width(200);
|
// }).width(200);
|
||||||
|
|
||||||
table.addColumn("City", new gwt.material.design.client.ui.table.cell.TextColumn<User>() {
|
table.addColumn("Author", new gwt.material.design.client.ui.table.cell.TextColumn<CkanDataset>() {
|
||||||
@Override
|
@Override
|
||||||
public String getValue(User object) {
|
public String getValue(CkanDataset object) {
|
||||||
return object.getCity();
|
return object.getAuthor();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean sortable() {
|
public boolean sortable() {
|
||||||
|
@ -124,19 +115,19 @@ public class CustomizedView extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
table.addRowSelectHandler(new RowSelectHandler<User>() {
|
table.addRowSelectHandler(new RowSelectHandler<CkanDataset>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRowSelect(RowSelectEvent<User> event) {
|
public void onRowSelect(RowSelectEvent<CkanDataset> event) {
|
||||||
log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected());
|
log("RowSelectEvent", event.getModel().getName() + ": " + event.isSelected());
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
table.addColumnSortHandler(new ColumnSortHandler<User>() {
|
table.addColumnSortHandler(new ColumnSortHandler<CkanDataset>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onColumnSort(gwt.material.design.client.data.events.ColumnSortEvent<User> event) {
|
public void onColumnSort(gwt.material.design.client.data.events.ColumnSortEvent<CkanDataset> event) {
|
||||||
log("ColumnSortEvent",
|
log("ColumnSortEvent",
|
||||||
"Sorted: " + event.getSortContext().getSortDir() + ", columnIndex: " + event.getColumnIndex());
|
"Sorted: " + event.getSortContext().getSortDir() + ", columnIndex: " + event.getColumnIndex());
|
||||||
table.getView().refresh();
|
table.getView().refresh();
|
||||||
|
@ -192,7 +183,7 @@ public class CustomizedView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setData(List<User> users) {
|
public void setData(List<CkanDataset> users) {
|
||||||
this.users = users;
|
this.users = users;
|
||||||
// Customized Table Scaffolding elements
|
// Customized Table Scaffolding elements
|
||||||
table.getTableTitle().setText("Customers");
|
table.getTableTitle().setText("Customers");
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +1,16 @@
|
||||||
package org.gcube.portlets.widgets.ckancontentmoderator.server;
|
package org.gcube.portlets.widgets.ckancontentmoderator.server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.gcat.client.Item;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorService;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CkanDataset;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
||||||
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
@ -12,6 +21,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet implements
|
public class CkanContentModeratorServiceAImpl extends RemoteServiceServlet implements
|
||||||
CkanContentModeratorService, ContentModeratorSystem {
|
CkanContentModeratorService, ContentModeratorSystem {
|
||||||
|
|
||||||
|
private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceAImpl.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContentModeratorEnabled() {
|
public boolean isContentModeratorEnabled() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -24,15 +35,35 @@ 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
|
LOG.info("Called getListItemsForStatus: "+theStatus);
|
||||||
// return null;
|
|
||||||
// }
|
try {
|
||||||
|
//DataCatalogueImpl catalogue = DataCatalogueFactory.getFactory().getUtilsPerScope(scope);
|
||||||
|
String scope = WsUtil.getCurrentScope(getThreadLocalRequest());
|
||||||
|
GCubeUser user = WsUtil.getCurrentUser(getThreadLocalRequest());
|
||||||
|
|
||||||
|
String token = WsUtil.getCurrentToken(scope, user.getUsername());
|
||||||
|
LOG.info("Setting scope: "+scope);
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
LOG.info("Setting token: "+token);
|
||||||
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
String datasetId = new Item().list(10, 0);
|
||||||
|
System.out.println("the datasetId: " +datasetId);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
LOG.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void approveItem(String itemId) {
|
public void approveItem(String itemId) {
|
||||||
// TODO Auto-generated method stub
|
LOG.info("Called approve Item: "+itemId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
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.CkanDataset;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.ItemStatus;
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
|
||||||
/**
|
/**
|
||||||
* The Interface ContentModeratorSystem.
|
* The Interface ContentModeratorSystem.
|
||||||
*
|
*
|
||||||
|
@ -34,7 +36,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.
|
||||||
|
|
|
@ -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,299 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CkanDataset.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2021
|
||||||
|
*/
|
||||||
|
public class CkanDataset 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 state;
|
||||||
|
private String title;
|
||||||
|
private String type;
|
||||||
|
private String url;
|
||||||
|
private String version;
|
||||||
|
private String ckanDatasetURL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new ckan dataset base.
|
||||||
|
*/
|
||||||
|
public CkanDataset() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the author.
|
||||||
|
*
|
||||||
|
* @return the author
|
||||||
|
*/
|
||||||
|
public String getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the author email.
|
||||||
|
*
|
||||||
|
* @return the author email
|
||||||
|
*/
|
||||||
|
public String getAuthorEmail() {
|
||||||
|
return authorEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the id.
|
||||||
|
*
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the license id.
|
||||||
|
*
|
||||||
|
* @return the license id
|
||||||
|
*/
|
||||||
|
public String getLicenseId() {
|
||||||
|
return licenseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maintainer.
|
||||||
|
*
|
||||||
|
* @return the maintainer
|
||||||
|
*/
|
||||||
|
public String getMaintainer() {
|
||||||
|
return maintainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maintainer email.
|
||||||
|
*
|
||||||
|
* @return the maintainer email
|
||||||
|
*/
|
||||||
|
public String getMaintainerEmail() {
|
||||||
|
return maintainerEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the notes.
|
||||||
|
*
|
||||||
|
* @return the notes
|
||||||
|
*/
|
||||||
|
public String getNotes() {
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the owner org.
|
||||||
|
*
|
||||||
|
* @return the owner org
|
||||||
|
*/
|
||||||
|
public String getOwnerOrg() {
|
||||||
|
return ownerOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the title.
|
||||||
|
*
|
||||||
|
* @return the title
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type.
|
||||||
|
*
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the url.
|
||||||
|
*
|
||||||
|
* @return the url
|
||||||
|
*/
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the version.
|
||||||
|
*
|
||||||
|
* @return the version
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ckan dataset URL.
|
||||||
|
*
|
||||||
|
* @return the ckan dataset URL
|
||||||
|
*/
|
||||||
|
public String getCkanDatasetURL() {
|
||||||
|
return ckanDatasetURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the author.
|
||||||
|
*
|
||||||
|
* @param author the new author
|
||||||
|
*/
|
||||||
|
public void setAuthor(String author) {
|
||||||
|
this.author = author;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the author email.
|
||||||
|
*
|
||||||
|
* @param authorEmail the new author email
|
||||||
|
*/
|
||||||
|
public void setAuthorEmail(String authorEmail) {
|
||||||
|
this.authorEmail = authorEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the id.
|
||||||
|
*
|
||||||
|
* @param id the new id
|
||||||
|
*/
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the license id.
|
||||||
|
*
|
||||||
|
* @param licenseId the new license id
|
||||||
|
*/
|
||||||
|
public void setLicenseId(String licenseId) {
|
||||||
|
this.licenseId = licenseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the maintainer.
|
||||||
|
*
|
||||||
|
* @param maintainer the new maintainer
|
||||||
|
*/
|
||||||
|
public void setMaintainer(String maintainer) {
|
||||||
|
this.maintainer = maintainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the maintainer email.
|
||||||
|
*
|
||||||
|
* @param maintainerEmail the new maintainer email
|
||||||
|
*/
|
||||||
|
public void setMaintainerEmail(String maintainerEmail) {
|
||||||
|
this.maintainerEmail = maintainerEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name.
|
||||||
|
*
|
||||||
|
* @param name the new name
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the notes.
|
||||||
|
*
|
||||||
|
* @param notes the new notes
|
||||||
|
*/
|
||||||
|
public void setNotes(String notes) {
|
||||||
|
this.notes = notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the owner org.
|
||||||
|
*
|
||||||
|
* @param ownerOrg the new owner org
|
||||||
|
*/
|
||||||
|
public void setOwnerOrg(String ownerOrg) {
|
||||||
|
this.ownerOrg = ownerOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the title.
|
||||||
|
*
|
||||||
|
* @param title the new title
|
||||||
|
*/
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the type.
|
||||||
|
*
|
||||||
|
* @param type the new type
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the url.
|
||||||
|
*
|
||||||
|
* @param url the new url
|
||||||
|
*/
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the version.
|
||||||
|
*
|
||||||
|
* @param version the new version
|
||||||
|
*/
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ckan dataset URL.
|
||||||
|
*
|
||||||
|
* @param ckanDatasetURL the new ckan dataset URL
|
||||||
|
*/
|
||||||
|
public void setCkanDatasetURL(String ckanDatasetURL) {
|
||||||
|
this.ckanDatasetURL = ckanDatasetURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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,52 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
<inherits name="gwt.material.design.jquery.JQuery" />
|
<inherits name="gwt.material.design.jquery.JQuery" />
|
||||||
|
|
||||||
<inherits name="gwt.material.design.GwtMaterialBasicWithJQuery" />
|
<inherits
|
||||||
|
name="gwt.material.design.GwtMaterialBasicWithJQuery" />
|
||||||
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
|
<inherits name="gwt.material.design.addins.GwtMaterialAddins" />
|
||||||
<inherits name="gwt.material.design.themes.ThemeBlue" />
|
<inherits name="gwt.material.design.themes.ThemeBlue" />
|
||||||
<inherits name="gwt.material.design.GwtMaterialTable" />
|
<inherits name="gwt.material.design.GwtMaterialTable" />
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE web-app
|
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
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.CkanContentModeratorServiceAImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
<!-- Servlets -->
|
<servlet-mapping>
|
||||||
<servlet>
|
<servlet-name>greetServlet</servlet-name>
|
||||||
<servlet-name>greetServlet</servlet-name>
|
<url-pattern>/CkanContentModeratorWidget/greet</url-pattern>
|
||||||
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceAImpl</servlet-class>
|
</servlet-mapping>
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<!-- Default page to serve -->
|
||||||
<servlet-name>greetServlet</servlet-name>
|
<welcome-file-list>
|
||||||
<url-pattern>/CkanContentModeratorWidget/greet</url-pattern>
|
<welcome-file>CkanContentModeratorWidget.html</welcome-file>
|
||||||
</servlet-mapping>
|
</welcome-file-list>
|
||||||
|
|
||||||
<!-- Default page to serve -->
|
|
||||||
<welcome-file-list>
|
|
||||||
<welcome-file>CkanContentModeratorWidget.html</welcome-file>
|
|
||||||
</welcome-file-list>
|
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
@ -1,187 +0,0 @@
|
||||||
/*!
|
|
||||||
jQuery Autosize v1.16.12
|
|
||||||
(c) 2013 Jack Moore - jacklmoore.com
|
|
||||||
updated: 2013-05-31
|
|
||||||
license: http://www.opensource.org/licenses/mit-license.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function ($) {
|
|
||||||
var
|
|
||||||
defaults = {
|
|
||||||
className: 'autosizejs',
|
|
||||||
append: '',
|
|
||||||
callback: false
|
|
||||||
},
|
|
||||||
hidden = 'hidden',
|
|
||||||
borderBox = 'border-box',
|
|
||||||
lineHeight = 'lineHeight',
|
|
||||||
|
|
||||||
// border:0 is unnecessary, but avoids a bug in FireFox on OSX
|
|
||||||
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',
|
|
||||||
|
|
||||||
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
|
||||||
copyStyle = [
|
|
||||||
'fontFamily',
|
|
||||||
'fontSize',
|
|
||||||
'fontWeight',
|
|
||||||
'fontStyle',
|
|
||||||
'letterSpacing',
|
|
||||||
'textTransform',
|
|
||||||
'wordSpacing',
|
|
||||||
'textIndent'
|
|
||||||
],
|
|
||||||
oninput = 'oninput',
|
|
||||||
onpropertychange = 'onpropertychange',
|
|
||||||
|
|
||||||
// to keep track which textarea is being mirrored when adjust() is called.
|
|
||||||
mirrored,
|
|
||||||
|
|
||||||
// the mirror element, which is used to calculate what size the mirrored element should be.
|
|
||||||
mirror = $(copy).data('autosize', true)[0];
|
|
||||||
|
|
||||||
// test that line-height can be accurately copied.
|
|
||||||
mirror.style.lineHeight = '99px';
|
|
||||||
if ($(mirror).css(lineHeight) === '99px') {
|
|
||||||
copyStyle.push(lineHeight);
|
|
||||||
}
|
|
||||||
mirror.style.lineHeight = '';
|
|
||||||
|
|
||||||
$.fn.autosize = function (options) {
|
|
||||||
options = $.extend({}, defaults, options || {});
|
|
||||||
|
|
||||||
if (mirror.parentNode !== document.body) {
|
|
||||||
$(document.body).append(mirror);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.each(function () {
|
|
||||||
var
|
|
||||||
ta = this,
|
|
||||||
$ta = $(ta),
|
|
||||||
minHeight,
|
|
||||||
maxHeight,
|
|
||||||
resize,
|
|
||||||
boxOffset = 0,
|
|
||||||
callback = $.isFunction(options.callback);
|
|
||||||
|
|
||||||
if ($ta.data('autosize')) {
|
|
||||||
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){
|
|
||||||
boxOffset = $ta.outerHeight() - $ta.height();
|
|
||||||
}
|
|
||||||
|
|
||||||
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
|
||||||
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
|
||||||
|
|
||||||
resize = ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal';
|
|
||||||
|
|
||||||
$ta.css({
|
|
||||||
overflow: hidden,
|
|
||||||
overflowY: hidden,
|
|
||||||
wordWrap: 'break-word',
|
|
||||||
resize: resize
|
|
||||||
}).data('autosize', true);
|
|
||||||
|
|
||||||
function initMirror() {
|
|
||||||
mirrored = ta;
|
|
||||||
mirror.className = options.className;
|
|
||||||
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
|
||||||
|
|
||||||
// mirror is a duplicate textarea located off-screen that
|
|
||||||
// is automatically updated to contain the same text as the
|
|
||||||
// original textarea. mirror always has a height of 0.
|
|
||||||
// This gives a cross-browser supported way getting the actual
|
|
||||||
// height of the text, through the scrollTop property.
|
|
||||||
$.each(copyStyle, function(i, val){
|
|
||||||
mirror.style[val] = $ta.css(val);
|
|
||||||
});
|
|
||||||
|
|
||||||
// The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
|
|
||||||
// new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
|
|
||||||
if (oninput in ta) {
|
|
||||||
var value = ta.value;
|
|
||||||
ta.value = '';
|
|
||||||
ta.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using mainly bare JS in this function because it is going
|
|
||||||
// to fire very often while typing, and needs to very efficient.
|
|
||||||
function adjust() {
|
|
||||||
var height, overflow, original;
|
|
||||||
|
|
||||||
if (mirrored !== ta) {
|
|
||||||
initMirror();
|
|
||||||
}
|
|
||||||
|
|
||||||
mirror.value = ta.value + options.append;
|
|
||||||
mirror.style.overflowY = ta.style.overflowY;
|
|
||||||
original = parseInt(ta.style.height,10);
|
|
||||||
|
|
||||||
// Update the width in case the original textarea width has changed
|
|
||||||
// A floor of 0 is needed because IE8 returns a negative value for hidden textareas, raising an error.
|
|
||||||
mirror.style.width = Math.max($ta.width(), 0) + 'px';
|
|
||||||
|
|
||||||
// Needed for IE8 and lower to reliably return the correct scrollTop
|
|
||||||
mirror.scrollTop = 0;
|
|
||||||
|
|
||||||
mirror.scrollTop = 9e4;
|
|
||||||
|
|
||||||
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
|
||||||
height = mirror.scrollTop;
|
|
||||||
|
|
||||||
if (maxHeight && height > maxHeight) {
|
|
||||||
height = maxHeight;
|
|
||||||
overflow = 'scroll';
|
|
||||||
} else if (height < minHeight) {
|
|
||||||
height = minHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
height += boxOffset;
|
|
||||||
ta.style.overflowY = overflow || hidden;
|
|
||||||
|
|
||||||
if (original !== height) {
|
|
||||||
ta.style.height = height + 'px';
|
|
||||||
if (callback) {
|
|
||||||
options.callback.call(ta,ta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onpropertychange in ta) {
|
|
||||||
if (oninput in ta) {
|
|
||||||
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
|
||||||
// so binding to onkeyup to catch most of those occassions. There is no way that I
|
|
||||||
// know of to detect something like 'cut' in IE9.
|
|
||||||
ta[oninput] = ta.onkeyup = adjust;
|
|
||||||
} else {
|
|
||||||
// IE7 / IE8
|
|
||||||
ta[onpropertychange] = function(){
|
|
||||||
if(event.propertyName === 'value'){
|
|
||||||
adjust();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Modern Browsers
|
|
||||||
ta[oninput] = adjust;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(window).on('resize', function(){
|
|
||||||
active = false;
|
|
||||||
adjust();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Allow for manual triggering if needed.
|
|
||||||
$ta.on('autosize', function(){
|
|
||||||
active = false;
|
|
||||||
adjust();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Call adjust in case the textarea already contains text.
|
|
||||||
adjust();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}(window.jQuery || window.Zepto));
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue