Merge pull request 'feature_22286' (!6) from feature_22286 into master
Reviewed-on: #6
This commit is contained in:
commit
d8d34ac827
|
@ -1,16 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/geoportal-data-entry-app-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
@ -35,5 +30,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.1-SNAPSHOT
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.1.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,16 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-entry-app-2.0.1-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="geoportal-data-entry-app-2.1.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +45,11 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +68,11 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +91,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
<dependent-module archiveName="geoportal-data-common-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,27 +112,16 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,7 +140,11 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +163,11 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v2.1.0-SNAPSHOT] - 2021-11-24
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#22455] Integrated with roles: (Data-Member as default), Data-Manager, Data-Editor
|
||||||
|
- [#22287] Integrated with base search, ordering and filtering facility provided by MongoDB
|
||||||
|
- [#22506] Re-engineered the common utilities
|
||||||
|
|
||||||
|
|
||||||
## [v2.0.1] - 2021-11-17
|
## [v2.0.1] - 2021-11-17
|
||||||
|
|
||||||
- [#22369] Just to include the bug fix for Policy and LicenseID in the geoportal-common
|
- [#22369] Just to include the bug fix for Policy and LicenseID in the geoportal-common
|
||||||
|
|
18
pom.xml
18
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-entry-app</artifactId>
|
<artifactId>geoportal-data-entry-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.0.1</version>
|
<version>2.1.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Entry App</name>
|
<name>GeoPortal Data Entry App</name>
|
||||||
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description>
|
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -209,6 +209,22 @@
|
||||||
update them in DevMode -->
|
update them in DevMode -->
|
||||||
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.csv</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
|
||||||
|
<!-- <resource> -->
|
||||||
|
<!-- <directory>src/main/resources</directory> -->
|
||||||
|
<!-- <includes> -->
|
||||||
|
<!-- <include>**/*.*</include> -->
|
||||||
|
<!-- </includes> -->
|
||||||
|
<!-- </resource> -->
|
||||||
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<!-- GWT Maven Plugin -->
|
<!-- GWT Maven Plugin -->
|
||||||
|
|
|
@ -17,8 +17,6 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
|
|
||||||
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
||||||
|
|
||||||
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum RECORD_TYPE.
|
* The Enum RECORD_TYPE.
|
||||||
*
|
*
|
||||||
|
@ -31,49 +29,13 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum ACTION_ON_ITEM.
|
* The Enum ACTION_PERFORMED_ON_ITEM.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Aug 6, 2021
|
* Nov 25, 2021
|
||||||
*/
|
*/
|
||||||
public enum ACTION_ON_ITEM {
|
public enum ACTION_PERFORMED_ON_ITEM {
|
||||||
SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, SHOW_EDIT_MODE, DELETE_RECORD, UPDATED_RECORD
|
UPDATED_PROJECT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The Enum RECORD_FIELD.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Sep 2, 2021
|
|
||||||
*/
|
|
||||||
public static enum RECORD_FIELD {
|
|
||||||
NAME("name", "Name"), INTRODUCTION("introduction", "Introduction"), AUTHOR("author", "Author/s"),
|
|
||||||
PROJECT_START_END_DATE("", "Project Start/End Date"), RECORD_STATUS("recordStatus", "Published with"), CREATED("created", "Created"),
|
|
||||||
CREATED_BY("createdBy", "Created by");
|
|
||||||
|
|
||||||
String jsonFieldName;
|
|
||||||
String displayName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new record field.
|
|
||||||
*
|
|
||||||
* @param jsonFieldName the json field name
|
|
||||||
* @param displayName the display name
|
|
||||||
*/
|
|
||||||
RECORD_FIELD(String jsonFieldName, String displayName) {
|
|
||||||
this.jsonFieldName = jsonFieldName;
|
|
||||||
this.displayName = displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJsonFieldName() {
|
|
||||||
return jsonFieldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return displayName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,32 @@ import java.util.List;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.EditModeRecord;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.EditModeRecord;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||||
|
@ -35,10 +45,10 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.NewBrowserWindow;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.NewBrowserWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter.ORDER;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
@ -58,6 +68,7 @@ import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
|
||||||
|
@ -82,7 +93,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
private LinkedHashMap<String, GeoNaFormCardModel> mapForms = new LinkedHashMap<String, GeoNaFormCardModel>();
|
private LinkedHashMap<String, GeoNaFormCardModel> mapForms = new LinkedHashMap<String, GeoNaFormCardModel>();
|
||||||
|
|
||||||
private GeonaDataEntryMainForm geoNaMainForm;
|
private GeonaDataEntryMainForm geoNaMainForm = null;
|
||||||
|
|
||||||
private Collection<GeoNaFormCardModel> orderedCards;
|
private Collection<GeoNaFormCardModel> orderedCards;
|
||||||
|
|
||||||
|
@ -94,44 +105,245 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
private GeonaRecordsPaginatedView grpw = null;
|
private GeonaRecordsPaginatedView grpw = null;
|
||||||
|
|
||||||
|
private UserRights myRights = null;
|
||||||
|
|
||||||
|
private LoaderIcon loader = new LoaderIcon("Loading Application...");
|
||||||
|
|
||||||
|
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
||||||
|
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
||||||
|
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
RECORD_FIELD[] sortByOptions = new RECORD_FIELD[] { RECORD_FIELD.NAME, RECORD_FIELD.PROJECT_START_END_DATE,
|
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
||||||
RECORD_FIELD.CREATED, RECORD_FIELD.CREATED_BY, RECORD_FIELD.RECORD_STATUS };
|
|
||||||
|
|
||||||
SortFilter initialSortFilter = new SortFilter(RECORD_FIELD.NAME, ORDER.ASC);
|
/*GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new AsyncCallback<List<ItemField>>() {
|
||||||
|
|
||||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, sortByOptions, initialSortFilter);
|
|
||||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
|
||||||
|
|
||||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
|
||||||
|
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(ConstantsGeoPortalDataEntryApp.ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT);
|
Window.alert(caught.getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(GeonaISConfig result) {
|
public void onSuccess(List<ItemField> result) {
|
||||||
|
|
||||||
if (result != null && result.getgRSecondaryType() != null && result.getScope() != null) {
|
for (ItemField itemField : result) {
|
||||||
callGetMetadataProfiles(result.getScope(), result.getgRSecondaryType());
|
if(itemField.isDisplayAsResult()) {
|
||||||
} else
|
displayFields.add(itemField);
|
||||||
Window.alert(
|
}
|
||||||
ConstantsGeoPortalDataEntryApp.ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT);
|
|
||||||
|
if(itemField.isSearchable()) {
|
||||||
|
searchByFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(itemField.isSortable()) {
|
||||||
|
sortByFields.add(itemField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GWT.log("List display fields: "+result);
|
||||||
|
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||||
|
initialSortFilter.setOrder(ORDER.ASC);
|
||||||
|
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||||
|
|
||||||
|
displayFields = result;
|
||||||
|
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||||
|
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||||
|
|
||||||
|
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||||
|
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||||
|
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
||||||
|
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).add(alert);
|
||||||
|
Window.alert(errorMsg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ItemField> itemFields = gNADataEntryConfig.getListItemFields();
|
||||||
|
|
||||||
|
for (ItemField itemField : itemFields) {
|
||||||
|
if(itemField.isDisplayAsResult()) {
|
||||||
|
displayFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(itemField.isSearchable()) {
|
||||||
|
searchByFields.add(itemField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(itemField.isSortable()) {
|
||||||
|
sortByFields.add(itemField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GWT.log("List display fields: "+itemFields);
|
||||||
|
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||||
|
initialSortFilter.setOrder(ORDER.ASC);
|
||||||
|
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||||
|
|
||||||
|
displayFields = itemFields;
|
||||||
|
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||||
|
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||||
|
|
||||||
|
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||||
|
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||||
|
|
||||||
|
//PERMISSIONS
|
||||||
|
myRights = gNADataEntryConfig.getUserRights();
|
||||||
|
initGUI();
|
||||||
|
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||||
|
String msg = "Logged in as ";
|
||||||
|
if(userRole != null && userRole.getName()!=null) {
|
||||||
|
msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
|
||||||
|
}else
|
||||||
|
msg+="Member";
|
||||||
|
|
||||||
|
mainTabPanel.setRoleLabel(msg);
|
||||||
|
|
||||||
|
|
||||||
|
RoleRights roleRights = myRights.getRoleRights();
|
||||||
|
boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||||
|
|
||||||
|
if (!canCreateNewItem) {
|
||||||
|
// removing Tab "Create New Project"
|
||||||
|
mainTabPanel.removeTab(0);
|
||||||
|
// activating Tab "List of Project"
|
||||||
|
mainTabPanel.setTabActive(0);
|
||||||
|
mainTabPanel.instanceAndShowListOfConcessioni();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert(
|
||||||
|
"Sorry, an error occurrend when loading configurations. Please, contact the support");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(GeonaISConfig result) {
|
||||||
|
|
||||||
|
if (result != null && result.getGenericResourceSecondaryType() != null
|
||||||
|
&& result.getScope() != null) {
|
||||||
|
callGetMetadataProfiles(result.getScope(), result.getGenericResourceSecondaryType());
|
||||||
|
} else
|
||||||
|
Window.alert(
|
||||||
|
"Sorry, no configuration found in the context. Please, contact the support");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bindEvents();
|
|
||||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel);
|
|
||||||
|
|
||||||
|
// GeoportalDataEntryServiceAsync.Util.getInstance().getMyRightsInTheContext(new AsyncCallback<UserRights>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
// String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
||||||
|
// Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||||
|
// alert.setClose(false);
|
||||||
|
// try {
|
||||||
|
// RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// RootPanel.get(DIV_PORTLET_ID).add(alert);
|
||||||
|
// Window.alert(errorMsg);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(UserRights result) {
|
||||||
|
// try {
|
||||||
|
// RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// myRights = result;
|
||||||
|
// initGUI();
|
||||||
|
// GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||||
|
// String msg = "Logged in as ";
|
||||||
|
// if(userRole != null && userRole.getName()!=null) {
|
||||||
|
// msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
|
||||||
|
// }else
|
||||||
|
// msg+="Member";
|
||||||
|
//
|
||||||
|
// mainTabPanel.setRoleLabel(msg);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// RoleRights roleRights = myRights.getRoleRights();
|
||||||
|
// boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||||
|
//
|
||||||
|
// if (!canCreateNewItem) {
|
||||||
|
// // removing Tab "Create New Project"
|
||||||
|
// mainTabPanel.removeTab(0);
|
||||||
|
// // activating Tab "List of Project"
|
||||||
|
// mainTabPanel.setTabActive(0);
|
||||||
|
// mainTabPanel.instanceAndShowListOfConcessioni();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
// Window.alert(
|
||||||
|
// "Sorry, an error occurrend when loading configurations. Please, contact the support");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(GeonaISConfig result) {
|
||||||
|
//
|
||||||
|
// if (result != null && result.getgRSecondaryType() != null
|
||||||
|
// && result.getScope() != null) {
|
||||||
|
// callGetMetadataProfiles(result.getScope(), result.getgRSecondaryType());
|
||||||
|
// } else
|
||||||
|
// Window.alert(
|
||||||
|
// "Sorry, no configuration found in the context. Please, contact the support");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initGUI() {
|
||||||
|
bindEvents();
|
||||||
|
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel);
|
||||||
Window.addResizeHandler(new ResizeHandler() {
|
Window.addResizeHandler(new ResizeHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onResize(ResizeEvent event) {
|
public void onResize(ResizeEvent event) {
|
||||||
|
@ -143,21 +355,29 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static native void click(Element element)/*-{
|
||||||
|
element.click();
|
||||||
|
}-*/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update window size
|
* Update window size
|
||||||
*/
|
*/
|
||||||
public void updateSize() {
|
public void updateSize() {
|
||||||
|
|
||||||
RootPanel workspace = RootPanel.get(DIV_PORTLET_ID);
|
try {
|
||||||
int topBorder = workspace.getAbsoluteTop();
|
RootPanel workspace = RootPanel.get(DIV_PORTLET_ID);
|
||||||
int footer = 85; // footer is bottombar + sponsor
|
int topBorder = workspace.getAbsoluteTop();
|
||||||
int headerSize = 90;
|
int footer = 85; // footer is bottombar + sponsor
|
||||||
// int headerSize = 30;
|
int headerSize = 90;
|
||||||
int rootHeight = Window.getClientHeight() - topBorder - headerSize - footer;// - ((footer ==
|
// int headerSize = 30;
|
||||||
// null)?0:(footer.getOffsetHeight()-15));
|
int rootHeight = Window.getClientHeight() - topBorder - headerSize - footer;// - ((footer ==
|
||||||
|
// null)?0:(footer.getOffsetHeight()-15));
|
||||||
|
|
||||||
GWT.log("New workspace dimension Height: " + rootHeight);
|
GWT.log("New workspace dimension Height: " + rootHeight);
|
||||||
mainTabPanel.setInternalHeight(rootHeight);
|
mainTabPanel.setInternalHeight(rootHeight);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
// appController.getMainPanel().setHeight(rootHeight);
|
// appController.getMainPanel().setHeight(rootHeight);
|
||||||
// appController.getMainPanel().setWidth(rootWidth);
|
// appController.getMainPanel().setWidth(rootWidth);
|
||||||
|
|
||||||
|
@ -429,15 +649,55 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||||
|
|
||||||
SortFilter sortFilter = getListOfRecordsEvent.getSortFilter();
|
SearchingFilter sortFilter = getListOfRecordsEvent.getSortFilter();
|
||||||
if(sortFilter==null){
|
if (sortFilter == null) {
|
||||||
sortFilter = mainTabPanel.getCurrentSortFilter();
|
sortFilter = mainTabPanel.getCurrentSortFilter();
|
||||||
}
|
}
|
||||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null,
|
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, displayFields, sortFilter);
|
||||||
sortFilter);
|
|
||||||
mainTabPanel.showListOfConcessioniView(grpw);
|
mainTabPanel.showListOfConcessioniView(grpw);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends RecordDV> void onDoActionPerformedFired(
|
||||||
|
ActionPerformedOnItemEvent<T> actionPerformedOnItemEvent) {
|
||||||
|
if (actionPerformedOnItemEvent != null) {
|
||||||
|
|
||||||
|
ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction();
|
||||||
|
List<T> items = actionPerformedOnItemEvent.getSelectItems();
|
||||||
|
|
||||||
|
if (items == null) {
|
||||||
|
if (grpw != null) {
|
||||||
|
items = (List<T>) grpw.getSelectItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items == null || items.size() == 0) {
|
||||||
|
Window.alert("No item selected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
T item = items.get(0);
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (item instanceof ConcessioneDV) {
|
||||||
|
final ConcessioneDV concessione = (ConcessioneDV) item;
|
||||||
|
GWT.log("onDoActionPerformedFired item: " + concessione);
|
||||||
|
switch (action) {
|
||||||
|
case UPDATED_PROJECT:
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
|
mainTabPanel.getCurrentSortFilter()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
appManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
|
appManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
|
||||||
|
|
||||||
|
@ -470,10 +730,41 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
if (item instanceof ConcessioneDV) {
|
if (item instanceof ConcessioneDV) {
|
||||||
|
|
||||||
final ConcessioneDV concessione = (ConcessioneDV) item;
|
final ConcessioneDV concessione = (ConcessioneDV) item;
|
||||||
GWT.log("ActionOnItemEvente item: " + concessione);
|
GWT.log("onDoActionFired item: " + concessione);
|
||||||
|
|
||||||
|
// Checking if the user is NOT authorized to perform this action in two ways:
|
||||||
|
// 1. the map of actions allowed for the user does not contain the action;
|
||||||
|
RoleRights roleRights = myRights.getRoleRights();
|
||||||
|
OPERATION_TYPE operationType = roleRights.getListPermessions().get(action);
|
||||||
|
boolean allowedOperationForUser = operationType != null? true:false;
|
||||||
|
if (!allowedOperationForUser) {
|
||||||
|
|
||||||
|
String msg = "You are not authorized to perform the action: "+ action.getLabel();
|
||||||
|
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), "Forbidden: "+action, msg, AlertType.WARNING);
|
||||||
|
modalW.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 2. the user cannot access to action (e.g. the user cannot write an item of another user)
|
||||||
|
// if so an error is shown
|
||||||
|
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||||
|
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType, concessione);
|
||||||
|
if (!allowedWriteActionOnItem) {
|
||||||
|
String title = "Forbidden: missing write access";
|
||||||
|
String msg = "You do not have write access to item: "+ concessione.getNome();
|
||||||
|
if(!userRole.isWriteOwn()) {
|
||||||
|
msg = "You do not have write access to item: "+ concessione.getNome();
|
||||||
|
}else if (!userRole.isWriteAny()){
|
||||||
|
title = "Forbidden: missing ownership";
|
||||||
|
msg = "You are not the creator of: "+ concessione.getNome() +". You cannot access to it";
|
||||||
|
}
|
||||||
|
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), title, msg, AlertType.WARNING);
|
||||||
|
modalW.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SHOW_ON_MAP:
|
case VIEW_ON_MAP:
|
||||||
final Modal modal = new Modal(true, true);
|
final Modal modal = new Modal(true, true);
|
||||||
modal.setCloseVisible(true);
|
modal.setCloseVisible(true);
|
||||||
final HorizontalPanel hpGetLink = new HorizontalPanel();
|
final HorizontalPanel hpGetLink = new HorizontalPanel();
|
||||||
|
@ -508,10 +799,12 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_REPORT:
|
case VIEW_REPORT:
|
||||||
|
|
||||||
final Modal modal2 = new Modal(true, true);
|
final Modal modal2 = new Modal(true, true);
|
||||||
modal2.setTitle("<span style='font-size:20px;'>Report: <span style='color:#555; font-size:20px;'>" + concessione.getNome()
|
modal2.setTitle(
|
||||||
+ "</span></span>");
|
"<span style='font-size:20px;'>Report: <span style='color:#555; font-size:20px;'>"
|
||||||
|
+ concessione.getNome() + "</span></span>");
|
||||||
modal2.setWidth(800);
|
modal2.setWidth(800);
|
||||||
modal2.setCloseVisible(true);
|
modal2.setCloseVisible(true);
|
||||||
if (concessione.getValidationReport() == null) {
|
if (concessione.getValidationReport() == null) {
|
||||||
|
@ -525,10 +818,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_EDIT_MODE:
|
case EDIT_PROJECT:
|
||||||
final Modal modal3 = new Modal(true, true);
|
final Modal modal3 = new Modal(true, true);
|
||||||
modal3.setTitle("<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>" + concessione.getNome()
|
modal3.setTitle(
|
||||||
+ "</span></span>");
|
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
|
||||||
|
+ concessione.getNome() + "</span></span>");
|
||||||
modal3.setWidth(950);
|
modal3.setWidth(950);
|
||||||
modal3.setHeight("700px");
|
modal3.setHeight("700px");
|
||||||
modal3.setCloseVisible(true);
|
modal3.setCloseVisible(true);
|
||||||
|
@ -540,12 +834,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal3.show();
|
modal3.show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPDATED_RECORD:
|
// case UPDATED_PROJECT:
|
||||||
appManagerBus.fireEvent(
|
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
// mainTabPanel.getCurrentSortFilter()));
|
||||||
mainTabPanel.getCurrentSortFilter()));
|
// break;
|
||||||
break;
|
case DELETE_PROJECT:
|
||||||
case DELETE_RECORD:
|
|
||||||
|
|
||||||
String htmlMsg = "Going to delete the project with:";
|
String htmlMsg = "Going to delete the project with:";
|
||||||
htmlMsg += "<ul>";
|
htmlMsg += "<ul>";
|
||||||
|
@ -614,6 +907,56 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkAccessToOperationType(GcubeUserRole userRole, OPERATION_TYPE allowedAction, ConcessioneDV concessione) {
|
||||||
|
|
||||||
|
boolean writeAnyAPassed = false;
|
||||||
|
boolean writeOwnPassed = false;
|
||||||
|
|
||||||
|
// Case ADMIN
|
||||||
|
if (userRole.isWriteAny()) {
|
||||||
|
writeAnyAPassed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Case EDITOR
|
||||||
|
// Going to check if the user can RW the record is owner of.
|
||||||
|
if (userRole.isWriteOwn()) {
|
||||||
|
String ownerUser = concessione.getCreationUser();
|
||||||
|
if (ownerUser == null || ownerUser.isEmpty()) {
|
||||||
|
writeOwnPassed = false;
|
||||||
|
}else if (ownerUser.compareTo(myRights.getMyUsername()) == 0) {
|
||||||
|
// if my username is equal the owner of the concessione
|
||||||
|
writeOwnPassed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean operationAllowed = false;
|
||||||
|
switch (allowedAction) {
|
||||||
|
case READ:
|
||||||
|
//Access to READ operation is allowed to everyone
|
||||||
|
operationAllowed = true;
|
||||||
|
GWT.log(OPERATION_TYPE.READ+ " ALLOWED? "+operationAllowed);
|
||||||
|
break;
|
||||||
|
case READ_WRITE:
|
||||||
|
//Access to READ_WRITE operation
|
||||||
|
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||||
|
GWT.log(OPERATION_TYPE.READ_WRITE+ " ALLOWED? "+operationAllowed);
|
||||||
|
break;
|
||||||
|
case WRITE:
|
||||||
|
//Access to WRITE operation
|
||||||
|
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||||
|
GWT.log(OPERATION_TYPE.WRITE+ " ALLOWED? "+operationAllowed);
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
operationAllowed = false;
|
||||||
|
GWT.log(OPERATION_TYPE.UNKNOWN+ " ALLOWED? "+operationAllowed);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return operationAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
private void purgeFileUploaded() {
|
private void purgeFileUploaded() {
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,16 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
@ -63,7 +64,7 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
* @return the list concessioni
|
* @return the list concessioni
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SortFilter filter,
|
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||||
boolean reloadFromService) throws Exception;
|
boolean reloadFromService) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,13 +119,24 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Update record.
|
* Update record.
|
||||||
*
|
*
|
||||||
* @param itemId the item id
|
* @param itemId the item id
|
||||||
* @param jsonUpdate the json update
|
* @param recordType the record type
|
||||||
* @param recordType the record type
|
* @param section the section
|
||||||
|
* @param pathIndex the path index
|
||||||
|
* @param keepCurrentContent the keep current content
|
||||||
|
* @param gDBean the g D bean
|
||||||
* @return the updated JSON string representing the itemId
|
* @return the updated JSON string representing the itemId
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||||
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception;
|
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data viewer config.
|
||||||
|
*
|
||||||
|
* @return the GNA data entry ext config profile
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,75 +3,64 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
public interface GeoportalDataEntryServiceAsync
|
public interface GeoportalDataEntryServiceAsync {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class to get the RPC Async interface from client-side code
|
* Utility class to get the RPC Async interface from client-side code
|
||||||
*/
|
*/
|
||||||
public static final class Util
|
public static final class Util {
|
||||||
{
|
private static GeoportalDataEntryServiceAsync instance;
|
||||||
private static GeoportalDataEntryServiceAsync instance;
|
|
||||||
|
|
||||||
public static final GeoportalDataEntryServiceAsync getInstance()
|
public static final GeoportalDataEntryServiceAsync getInstance() {
|
||||||
{
|
if (instance == null) {
|
||||||
if ( instance == null )
|
instance = (GeoportalDataEntryServiceAsync) GWT.create(GeoportalDataEntryService.class);
|
||||||
{
|
}
|
||||||
instance = (GeoportalDataEntryServiceAsync) GWT.create( GeoportalDataEntryService.class );
|
return instance;
|
||||||
}
|
}
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Util()
|
|
||||||
{
|
|
||||||
// Utility class should not be instantiated
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private Util() {
|
||||||
|
// Utility class should not be instantiated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
|
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
|
||||||
|
|
||||||
|
|
||||||
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
||||||
|
|
||||||
|
|
||||||
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
||||||
|
|
||||||
|
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||||
void getListConcessioni(Integer start, Integer limit, SortFilter filter, boolean reloadFromService,
|
|
||||||
AsyncCallback<ResultSetPaginatedData> callback);
|
AsyncCallback<ResultSetPaginatedData> callback);
|
||||||
|
|
||||||
|
|
||||||
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
|
||||||
void getJSONRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<String> callback);
|
void getJSONRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
|
||||||
void updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
void updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||||
|
|
||||||
|
|
||||||
void readFileSetPaths(AsyncCallback<FileSetPathsDV> callback);
|
void readFileSetPaths(AsyncCallback<FileSetPathsDV> callback);
|
||||||
|
|
||||||
|
|
||||||
void getRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
void getRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||||
|
|
||||||
|
|
||||||
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||||
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean,
|
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean,
|
||||||
AsyncCallback<ConcessioneDV> callback);
|
AsyncCallback<ConcessioneDV> callback);
|
||||||
|
|
||||||
|
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ActionOnItemEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 15, 2021
|
||||||
|
* @param <T> the generic type
|
||||||
|
*/
|
||||||
|
public class ActionPerformedOnItemEvent<T extends RecordDV> extends GwtEvent<ActionPerformedOnItemEventHandler> {
|
||||||
|
public static Type<ActionPerformedOnItemEventHandler> TYPE = new Type<ActionPerformedOnItemEventHandler>();
|
||||||
|
private List<T> selectItems;
|
||||||
|
private ACTION_PERFORMED_ON_ITEM action;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new action performed on item event.
|
||||||
|
*
|
||||||
|
* @param selectItems the select items
|
||||||
|
* @param doAction the do action
|
||||||
|
*/
|
||||||
|
public ActionPerformedOnItemEvent(List<T> selectItems, ACTION_PERFORMED_ON_ITEM doAction) {
|
||||||
|
this.selectItems = selectItems;
|
||||||
|
this.action = doAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<ActionPerformedOnItemEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||||
|
* EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(ActionPerformedOnItemEventHandler handler) {
|
||||||
|
handler.onDoActionPerformedFired(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the select items.
|
||||||
|
*
|
||||||
|
* @return the select items
|
||||||
|
*/
|
||||||
|
public List<T> getSelectItems() {
|
||||||
|
return selectItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the action.
|
||||||
|
*
|
||||||
|
* @return the action
|
||||||
|
*/
|
||||||
|
public ACTION_PERFORMED_ON_ITEM getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface ActionPerformedOnItemEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 25, 2021
|
||||||
|
*/
|
||||||
|
public interface ActionPerformedOnItemEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On do action performed fired.
|
||||||
|
* @param <T>
|
||||||
|
*
|
||||||
|
* @param actionPerformedOnItemEvent the action performed on item event
|
||||||
|
*/
|
||||||
|
<T extends RecordDV> void onDoActionPerformedFired(ActionPerformedOnItemEvent<T> actionPerformedOnItemEvent);
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
/** The type. */
|
/** The type. */
|
||||||
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
||||||
private RECORD_TYPE recordType;
|
private RECORD_TYPE recordType;
|
||||||
private SortFilter sortFilter;
|
private SearchingFilter sortFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new cancel upload event.
|
* Instantiates a new cancel upload event.
|
||||||
*/
|
*/
|
||||||
public GetListOfRecordsEvent(ConstantsGeoPortalDataEntryApp.RECORD_TYPE recordType, SortFilter sortFilter) {
|
public GetListOfRecordsEvent(ConstantsGeoPortalDataEntryApp.RECORD_TYPE recordType, SearchingFilter sortFilter) {
|
||||||
this.recordType = recordType;
|
this.recordType = recordType;
|
||||||
this.sortFilter = sortFilter;
|
this.sortFilter = sortFilter;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
||||||
return recordType;
|
return recordType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortFilter getSortFilter() {
|
public SearchingFilter getSortFilter() {
|
||||||
return sortFilter;
|
return sortFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,7 @@ public interface Images extends ClientBundle {
|
||||||
|
|
||||||
@Source("loading.gif")
|
@Source("loading.gif")
|
||||||
ImageResource loading();
|
ImageResource loading();
|
||||||
|
|
||||||
|
@Source("access_denied.png")
|
||||||
|
ImageResource accessDenied();
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 962 B |
|
@ -1,31 +1,46 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter.ORDER;
|
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Dropdown;
|
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||||
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.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||||
|
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
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.Window;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -42,6 +57,8 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||||
|
|
||||||
|
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||||
|
|
||||||
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +95,9 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
NavLink buttonReloadConcessioni;
|
NavLink buttonReloadConcessioni;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TabPanel tabPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Tab tabNewProject;
|
Tab tabNewProject;
|
||||||
|
|
||||||
|
@ -88,7 +108,13 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
Dropdown dropdownSortBy;
|
Dropdown dropdownSortBy;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
TextBox textBoxSortBy;
|
Dropdown dropdownSearchFor;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Alert alertSortBy;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Alert alertSearchFor;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
NavLink navShowOnMap;
|
NavLink navShowOnMap;
|
||||||
|
@ -102,14 +128,27 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
NavLink navDelete;
|
NavLink navDelete;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox searchField;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button resetSearch;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Label roleLabel;
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
private RECORD_FIELD[] sortByFields;
|
private List<ItemField> sortByFields;
|
||||||
|
|
||||||
private SortFilter currentSortFilter;
|
private List<ItemField> searchForFields;
|
||||||
|
|
||||||
|
private SearchingFilter currentSortFilter;
|
||||||
|
|
||||||
private GeonaRecordsPaginatedView grpw = null;
|
private GeonaRecordsPaginatedView grpw = null;
|
||||||
|
|
||||||
|
private List<ItemField> displayFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona main tab panel.
|
* Instantiates a new geona main tab panel.
|
||||||
*
|
*
|
||||||
|
@ -117,13 +156,27 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
* @param sortByFields the sort by fields
|
* @param sortByFields the sort by fields
|
||||||
* @param initialSortFilter
|
* @param initialSortFilter
|
||||||
*/
|
*/
|
||||||
public GeonaMainTabPanel(HandlerManager appManagerBus, RECORD_FIELD[] sortByFields, SortFilter initialSortFilter) {
|
public GeonaMainTabPanel(HandlerManager appManagerBus, List<ItemField> displayFields, List<ItemField> sortByFields,
|
||||||
|
List<ItemField> searchForFields, SearchingFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
this.sortByFields = sortByFields;
|
this.sortByFields = sortByFields;
|
||||||
setCurrentSortFilter(initialSortFilter);
|
this.displayFields = displayFields;
|
||||||
bindEvents();
|
this.currentSortFilter = initialSortFilter;
|
||||||
|
this.searchForFields = searchForFields;
|
||||||
|
|
||||||
|
alertSortBy.setType(AlertType.INFO);
|
||||||
|
alertSortBy.setClose(false);
|
||||||
|
|
||||||
|
alertSearchFor.setType(AlertType.INFO);
|
||||||
|
alertSearchFor.setClose(false);
|
||||||
|
|
||||||
|
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
||||||
|
alertSortBy.setText(toLabelFilter((initialSortFilter.getOrderByFields().get(0)), initialSortFilter.getOrder()));
|
||||||
|
|
||||||
|
bindEvents();
|
||||||
|
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||||
|
resetSearch.setType(ButtonType.LINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInternalHeight(int height) {
|
public void setInternalHeight(int height) {
|
||||||
|
@ -159,17 +212,17 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null, currentSortFilter);
|
instanceAndShowListOfConcessioni();
|
||||||
showListOfConcessioniView(grpw);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (RECORD_FIELD record_FIELD : sortByFields) {
|
for (ItemField record_FIELD : sortByFields) {
|
||||||
|
|
||||||
|
// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
|
||||||
|
// continue;
|
||||||
|
|
||||||
// ASC
|
// ASC
|
||||||
SortFilter sortFilter = new SortFilter(record_FIELD, ORDER.ASC);
|
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||||
String labelASC = toLabelFilter(sortFilter);
|
|
||||||
NavLink nav = new NavLink(labelASC);
|
NavLink nav = new NavLink(labelASC);
|
||||||
dropdownSortBy.add(nav);
|
dropdownSortBy.add(nav);
|
||||||
|
|
||||||
|
@ -177,29 +230,45 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
GWT.log("Sort by: " + sortFilter);
|
alertSortBy.setText(labelASC);
|
||||||
setCurrentSortFilter(sortFilter);
|
|
||||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// //DESC
|
// //DESC
|
||||||
SortFilter sortFilter2 = new SortFilter(record_FIELD, ORDER.DESC);
|
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||||
String labelASC2 = toLabelFilter(sortFilter2);
|
NavLink nav2 = new NavLink(labelDESC);
|
||||||
NavLink nav2 = new NavLink(labelASC2);
|
|
||||||
dropdownSortBy.add(nav2);
|
dropdownSortBy.add(nav2);
|
||||||
|
|
||||||
nav2.addClickHandler(new ClickHandler() {
|
nav2.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
GWT.log("Sort by: " + sortFilter2);
|
alertSortBy.setText(labelDESC);
|
||||||
setCurrentSortFilter(sortFilter2);
|
|
||||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (ItemField record_FIELD : searchForFields) {
|
||||||
|
|
||||||
|
NavLink nav = new NavLink(record_FIELD.getDisplayName());
|
||||||
|
dropdownSearchFor.add(nav);
|
||||||
|
|
||||||
|
nav.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
alertSearchFor.setText(record_FIELD.getDisplayName());
|
||||||
|
|
||||||
|
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||||
|
doSearchEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
navShowOnMap.addClickHandler(new ClickHandler() {
|
navShowOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -209,7 +278,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
listConcessioni = grpw.getSelectItems();
|
listConcessioni = grpw.getSelectItems();
|
||||||
}
|
}
|
||||||
appManagerBus
|
appManagerBus
|
||||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_ON_MAP));
|
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.VIEW_ON_MAP));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -223,7 +292,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
listConcessioni = grpw.getSelectItems();
|
listConcessioni = grpw.getSelectItems();
|
||||||
}
|
}
|
||||||
appManagerBus
|
appManagerBus
|
||||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_REPORT));
|
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.VIEW_REPORT));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -237,7 +306,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
listConcessioni = grpw.getSelectItems();
|
listConcessioni = grpw.getSelectItems();
|
||||||
}
|
}
|
||||||
appManagerBus
|
appManagerBus
|
||||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_EDIT_MODE));
|
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.EDIT_PROJECT));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -249,11 +318,54 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
if (grpw != null && grpw.getSelectItems() != null) {
|
if (grpw != null && grpw.getSelectItems() != null) {
|
||||||
listConcessioni = grpw.getSelectItems();
|
listConcessioni = grpw.getSelectItems();
|
||||||
}
|
}
|
||||||
appManagerBus
|
appManagerBus.fireEvent(
|
||||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.DELETE_RECORD));
|
new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.DELETE_PROJECT));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyPress(KeyPressEvent event) {
|
||||||
|
GWT.log("CHAR CODE: " + event.getCharCode());
|
||||||
|
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||||
|
GWT.log(searchField.getText());
|
||||||
|
doSearchEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
resetSearch.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
searchField.setText("");
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
resetSearch.setVisible(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleLabel(String msg) {
|
||||||
|
roleLabel.setText(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doSearchEvent() {
|
||||||
|
String searchText = searchField.getText();
|
||||||
|
if (searchText.length() < MIN_LENGHT_SERCHING_STRING) {
|
||||||
|
Window.alert("Please enter at least " + MIN_LENGHT_SERCHING_STRING + " characters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSearch.setVisible(true);
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toLabelFilter(ItemField itemField, ORDER direction) {
|
||||||
|
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
||||||
|
return labelFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,49 +402,74 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
loader.setVisible(visible);
|
loader.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCurrentSortFilter(SortFilter sortFilter) {
|
public SearchingFilter toSortFilter(String labelFilter) {
|
||||||
this.currentSortFilter = sortFilter;
|
GWT.log("toSortFilter for label " + labelFilter);
|
||||||
this.textBoxSortBy.setText(toLabelFilter(sortFilter));
|
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||||
|
|
||||||
|
SearchingFilter sortFilter = null;
|
||||||
|
try {
|
||||||
|
ItemField recordField = null;
|
||||||
|
for (ItemField value : sortByFields) {
|
||||||
|
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||||
|
recordField = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ORDER orderField = ORDER.valueOf(array[1]);
|
||||||
|
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
GWT.log("toSortFilter Got " + sortFilter);
|
||||||
|
return sortFilter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private SearchingFilter builtSearchingFilter() {
|
||||||
* To label filter.
|
SearchingFilter searchingFilter = toSortFilter(alertSortBy.getText());
|
||||||
*
|
String searchText = searchField.getText();
|
||||||
* @param sortFilter the sort filter
|
if (searchText != null && !searchText.isEmpty()) {
|
||||||
* @return the string
|
Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||||
*/
|
|
||||||
public String toLabelFilter(SortFilter sortFilter) {
|
|
||||||
|
|
||||||
String labelFilter = sortFilter.getOrderByField().getDisplayName() + LABEL_FILTER_SEPARATOR
|
String searchForField = "";
|
||||||
+ sortFilter.getOrder().name();
|
|
||||||
GWT.log("Got " + sortFilter);
|
for (ItemField recordField : searchForFields) {
|
||||||
return labelFilter;
|
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
|
||||||
|
searchForField = recordField.getJsonFields().get(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
searchInto.put(searchForField, searchText);
|
||||||
|
WhereClause where = new WhereClause();
|
||||||
|
where.setSearchInto(searchInto);
|
||||||
|
where.setOperator(LOGICAL_OP.OR);
|
||||||
|
searchingFilter.setConditions(Arrays.asList(where));
|
||||||
|
}
|
||||||
|
return searchingFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public SearchingFilter getCurrentSortFilter() {
|
||||||
* To sort filter.
|
currentSortFilter = builtSearchingFilter();
|
||||||
*
|
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||||
* @param labelFilter the label filter
|
|
||||||
* @return the sort filter
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* public SortFilter toSortFilter(String labelFilter) {
|
|
||||||
*
|
|
||||||
* String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
|
||||||
*
|
|
||||||
* SortFilter sortFilter = null; try { RECORD_FIELD recordField =
|
|
||||||
* RECORD_FIELD.valueOf(array[0]); ORDER orderField = ORDER.valueOf(array[1]);
|
|
||||||
* sortFilter = new SortFilter(recordField, orderField); } catch (Exception e) {
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* GWT.log("Got " + sortFilter); return sortFilter;
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
public SortFilter getCurrentSortFilter() {
|
|
||||||
return currentSortFilter;
|
return currentSortFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeTab(int index) {
|
||||||
|
tabPanel.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTabActive(int index) {
|
||||||
|
tabPanel.selectTab(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dirty solution. I created this one because I had problem on firing click
|
||||||
|
* event for Tab element
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void instanceAndShowListOfConcessioni() {
|
||||||
|
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, displayFields, currentSortFilter);
|
||||||
|
showListOfConcessioniView(grpw);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,34 @@
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.display-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.max-height-300 {
|
.max-height-300 {
|
||||||
max-height: auto;
|
max-height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.margin-botttom-5 {
|
.margin-bottom-5 {
|
||||||
margin-bottom: 5px !important;
|
margin-bottom: 5px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
padding-top: 6px;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<b:PageHeader subtext="data entry facility"
|
<b:PageHeader subtext="data entry facility"
|
||||||
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
|
styleName="{style.custom-page-header}">GNA</b:PageHeader>
|
||||||
|
<g:Label ui:field="roleLabel"
|
||||||
|
addStyleNames="{style.display-right}"></g:Label>
|
||||||
<b:TabPanel tabPosition="above" ui:field="tabPanel">
|
<b:TabPanel tabPosition="above" ui:field="tabPanel">
|
||||||
<b:Tab icon="FILE_TEXT" heading="New Project" active="true"
|
<b:Tab icon="FILE_TEXT" heading="New Project" active="true"
|
||||||
ui:field="tabNewProject">
|
ui:field="tabNewProject">
|
||||||
<g:ScrollPanel>
|
<g:ScrollPanel>
|
||||||
<g:HTMLPanel ui:field="contTabNewProject">
|
<g:HTMLPanel ui:field="contTabNewProject">
|
||||||
<b:Navbar addStyleNames="{style.margin-botttom-5}">
|
<b:Navbar addStyleNames="{style.margin-bottom-5}">
|
||||||
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
|
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:NavLink ui:field="buttCreateNewProject"
|
<b:NavLink ui:field="buttCreateNewProject"
|
||||||
|
@ -85,20 +96,37 @@
|
||||||
</g:FlowPanel>
|
</g:FlowPanel>
|
||||||
<g:ScrollPanel>
|
<g:ScrollPanel>
|
||||||
<g:HTMLPanel ui:field="contTabGetListOfProjects">
|
<g:HTMLPanel ui:field="contTabGetListOfProjects">
|
||||||
<b:Navbar addStyleNames="{style.margin-botttom-5}">
|
<b:Navbar addStyleNames="nav-toolbar-style">
|
||||||
<b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand>
|
<b:Brand>List of Projects</b:Brand>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||||
</b:Dropdown>
|
</b:Dropdown>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:TextBox ui:field="textBoxSortBy" readOnly="true"
|
<b:Alert ui:field="alertSortBy"
|
||||||
addStyleNames="{style.margin-top-8}"></b:TextBox>
|
addStyleNames="alert_box_nav"></b:Alert>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
<b:Nav>
|
<b:Nav>
|
||||||
<b:NavLink ui:field="buttonReloadConcessioni"
|
<b:NavLink ui:field="buttonReloadConcessioni"
|
||||||
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
|
|
||||||
|
<g:HTMLPanel addStyleNames="{style.display-right}">
|
||||||
|
<b:Nav>
|
||||||
|
<b:Dropdown text="Search for"
|
||||||
|
ui:field="dropdownSearchFor">
|
||||||
|
</b:Dropdown>
|
||||||
|
</b:Nav>
|
||||||
|
<b:Nav>
|
||||||
|
<b:Alert ui:field="alertSearchFor"
|
||||||
|
addStyleNames="alert_box_nav"></b:Alert>
|
||||||
|
</b:Nav>
|
||||||
|
|
||||||
|
<b:TextBox ui:field="searchField"
|
||||||
|
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
|
||||||
|
<b:Button icon="REMOVE_CIRCLE" ui:field="resetSearch"
|
||||||
|
title="Reset the search" visible="false"></b:Button>
|
||||||
|
</g:HTMLPanel>
|
||||||
</b:Navbar>
|
</b:Navbar>
|
||||||
|
|
||||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||||
|
|
|
@ -2,15 +2,15 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -47,10 +47,10 @@ public class GeonaRecordsPaginatedView {
|
||||||
private MyCustomDataProvider<ConcessioneDV> dataProvider = new MyCustomDataProvider<ConcessioneDV>();
|
private MyCustomDataProvider<ConcessioneDV> dataProvider = new MyCustomDataProvider<ConcessioneDV>();
|
||||||
protected Widget orginalLoadingIndicator = null;
|
protected Widget orginalLoadingIndicator = null;
|
||||||
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
||||||
private int serverStartIndex;
|
//private int serverStartIndex;
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
private RECORD_TYPE recordType;
|
private RECORD_TYPE recordType;
|
||||||
private SortFilter currentSortFilter;
|
private SearchingFilter currentSortFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona records paginated view.
|
* Instantiates a new geona records paginated view.
|
||||||
|
@ -61,12 +61,12 @@ public class GeonaRecordsPaginatedView {
|
||||||
* @param currentSortFilter the sort by field
|
* @param currentSortFilter the sort by field
|
||||||
*/
|
*/
|
||||||
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType,
|
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType,
|
||||||
RECORD_FIELD[] displayFields, SortFilter currentSortFilter) {
|
List<ItemField> displayFields, SearchingFilter currentSortFilter) {
|
||||||
this.recordType = recordType;
|
this.recordType = recordType;
|
||||||
this.currentSortFilter = currentSortFilter;
|
this.currentSortFilter = currentSortFilter;
|
||||||
this.initClassFirstRangeChanged = true;
|
this.initClassFirstRangeChanged = true;
|
||||||
this.eventBus = eventbus;
|
this.eventBus = eventbus;
|
||||||
itemsTable = new ItemsTable<ConcessioneDV>(eventbus, displayFields, currentSortFilter);
|
itemsTable = new ItemsTable<ConcessioneDV>(eventbus, displayFields);
|
||||||
itemsTable.initTable(null, null, dataProvider);
|
itemsTable.initTable(null, null, dataProvider);
|
||||||
|
|
||||||
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
|
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
|
||||||
|
@ -120,7 +120,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
* @param invalidCache the invalid cache
|
* @param invalidCache the invalid cache
|
||||||
*/
|
*/
|
||||||
private void loadNewPage(final int startIdx, final int limit, final boolean resetStore,
|
private void loadNewPage(final int startIdx, final int limit, final boolean resetStore,
|
||||||
final SortFilter currentSortFilter, final boolean invalidCache) {
|
final SearchingFilter currentSortFilter, final boolean invalidCache) {
|
||||||
// initFirstRangeChanged = resetStore;
|
// initFirstRangeChanged = resetStore;
|
||||||
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
|
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
|
||||||
+ resetStore + "]");
|
+ resetStore + "]");
|
||||||
|
@ -131,12 +131,12 @@ public class GeonaRecordsPaginatedView {
|
||||||
if (resetStore) {
|
if (resetStore) {
|
||||||
GWT.log("Cleaning all data...");
|
GWT.log("Cleaning all data...");
|
||||||
newStartIndex = 0;
|
newStartIndex = 0;
|
||||||
serverStartIndex = 0;
|
//serverStartIndex = 0;
|
||||||
GWT.log("Store reset performed start index is: " + newStartIndex);
|
GWT.log("Store reset performed start index is: " + newStartIndex);
|
||||||
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadConcessioni(newStartIndex, limit, serverStartIndex, currentSortFilter, invalidCache);
|
loadConcessioni(newStartIndex, limit, currentSortFilter, invalidCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -157,7 +157,7 @@ public class GeonaRecordsPaginatedView {
|
||||||
*/
|
*/
|
||||||
private void setNewPageResult(ResultSetPaginatedData result) {
|
private void setNewPageResult(ResultSetPaginatedData result) {
|
||||||
GWT.log("setNewPageResult: " + result);
|
GWT.log("setNewPageResult: " + result);
|
||||||
serverStartIndex = result.getServerEndIndex();
|
//serverStartIndex = result.getServerEndIndex();
|
||||||
SelectionModel<? super ConcessioneDV> sm = getCellTable().getSelectionModel();
|
SelectionModel<? super ConcessioneDV> sm = getCellTable().getSelectionModel();
|
||||||
|
|
||||||
if (sm instanceof SingleSelectionModel) {
|
if (sm instanceof SingleSelectionModel) {
|
||||||
|
@ -197,12 +197,11 @@ public class GeonaRecordsPaginatedView {
|
||||||
* @param limit the limit
|
* @param limit the limit
|
||||||
* @param serverIndex the server index
|
* @param serverIndex the server index
|
||||||
*/
|
*/
|
||||||
private <T> void loadConcessioni(int newStartIndex, int limit, int serverIndex, SortFilter sortFilter,
|
private <T> void loadConcessioni(int newStartIndex, int limit, SearchingFilter sortFilter,
|
||||||
boolean invalidCache) {
|
boolean invalidCache) {
|
||||||
showLoading(true);
|
showLoading(true);
|
||||||
|
|
||||||
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit+ ", sortFilter: " + sortFilter + "]");
|
||||||
+ ", serverIndex:" + serverIndex + ", sortFilter: " + sortFilter + "]");
|
|
||||||
GeoPortalDataEntryApp.geoportalDataEntryService.getListConcessioni(newStartIndex, limit, sortFilter, invalidCache,
|
GeoPortalDataEntryApp.geoportalDataEntryService.getListConcessioni(newStartIndex, limit, sortFilter, invalidCache,
|
||||||
new AsyncCallback<ResultSetPaginatedData>() {
|
new AsyncCallback<ResultSetPaginatedData>() {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
|
||||||
|
public class ModalWindow {
|
||||||
|
|
||||||
|
private HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
private Modal modal;
|
||||||
|
|
||||||
|
public ModalWindow(Image icon, String title, String msg, AlertType alertType) {
|
||||||
|
|
||||||
|
modal = new Modal(true,true);
|
||||||
|
modal.hide(false);
|
||||||
|
modal.setTitle(title);
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
|
||||||
|
|
||||||
|
Alert alert = new Alert();
|
||||||
|
alert.setType(alertType);
|
||||||
|
alert.setClose(false);
|
||||||
|
alert.setText(msg);
|
||||||
|
alert.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
|
|
||||||
|
|
||||||
|
if (icon != null)
|
||||||
|
hp.add(icon);
|
||||||
|
hp.add(alert);
|
||||||
|
|
||||||
|
ModalFooter modalFooter = new ModalFooter();
|
||||||
|
final Button buttClose = new Button("Close");
|
||||||
|
modalFooter.add(buttClose);
|
||||||
|
|
||||||
|
buttClose.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
modal.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.add(hp);
|
||||||
|
modal.add(modalFooter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show() {
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,11 +7,11 @@ import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
|
@ -66,7 +66,7 @@ public class EditModeRecord extends Composite {
|
||||||
private JSONEditorWrapper jsEditor;
|
private JSONEditorWrapper jsEditor;
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
private final HandlerManager editorManagerBus = new HandlerManager(null);
|
private final HandlerManager editorManagerBus = new HandlerManager(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,7 @@ public class EditModeRecord extends Composite {
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
buttonJSONUpdate.addClickHandler(new ClickHandler() {
|
buttonJSONUpdate.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -181,8 +181,8 @@ public class EditModeRecord extends Composite {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
editorManagerBus.fireEvent(
|
editorManagerBus.fireEvent(new ActionPerformedOnItemEvent<ConcessioneDV>(null,
|
||||||
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
|
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,38 +195,38 @@ public class EditModeRecord extends Composite {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogInform di = new DialogInform(null, "Project updated!", "Project '" + result.getNome() + "' updated correctly");
|
DialogInform di = new DialogInform(null, "Project updated!",
|
||||||
|
"Project '" + result.getNome() + "' updated correctly");
|
||||||
di.setZIndex(100000);
|
di.setZIndex(100000);
|
||||||
di.center();
|
di.center();
|
||||||
editorManagerBus.fireEvent(
|
editorManagerBus.fireEvent(new ActionPerformedOnItemEvent<ConcessioneDV>(
|
||||||
new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(result), ACTION_ON_ITEM.UPDATED_RECORD));
|
Arrays.asList(result), ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
editorManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
|
editorManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent) {
|
public <T extends RecordDV> void onDoActionPerformedFired(
|
||||||
|
ActionPerformedOnItemEvent<T> actionPerformedOnItemEvent) {
|
||||||
ACTION_ON_ITEM action = showItemEvent.getAction();
|
ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction();
|
||||||
List<T> items = showItemEvent.getSelectItems();
|
List<T> items = actionPerformedOnItemEvent.getSelectItems();
|
||||||
|
|
||||||
if(items!=null) {
|
if (items != null) {
|
||||||
selectedConcessione = (BaseConcessioneDV) items.get(0);
|
selectedConcessione = (BaseConcessioneDV) items.get(0);
|
||||||
instanceJSONEditor();
|
instanceJSONEditor();
|
||||||
|
|
||||||
if(action.equals(ACTION_ON_ITEM.UPDATED_RECORD)) {
|
if (action.equals(ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT)) {
|
||||||
appManagerBus.fireEvent(
|
appManagerBus.fireEvent(new ActionPerformedOnItemEvent<ConcessioneDV>(
|
||||||
new ActionOnItemEvent<ConcessioneDV>((List<ConcessioneDV>) items, ACTION_ON_ITEM.UPDATED_RECORD));
|
(List<ConcessioneDV>) items, ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelaz
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
|
||||||
|
@ -262,7 +262,7 @@ public class UpdateFileset extends Composite {
|
||||||
buttonUpdate.setEnabled(true);
|
buttonUpdate.setEnabled(true);
|
||||||
showUploadFileGUI();
|
showUploadFileGUI();
|
||||||
editorManagerBus.fireEvent(
|
editorManagerBus.fireEvent(
|
||||||
new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(fullConcessione), ACTION_ON_ITEM.UPDATED_RECORD));
|
new ActionPerformedOnItemEvent<ConcessioneDV>(Arrays.asList(fullConcessione), ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,22 +5,18 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.ButtonCell;
|
import com.github.gwtbootstrap.client.ui.ButtonCell;
|
||||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
import com.google.gwt.cell.client.Cell.Context;
|
|
||||||
import com.google.gwt.cell.client.DateCell;
|
|
||||||
import com.google.gwt.core.shared.GWT;
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -53,22 +49,10 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
|
|
||||||
private static final int ITEMS_PER_PAGE = 10;
|
private static final int ITEMS_PER_PAGE = 10;
|
||||||
private static final String NO_DATA = "No data";
|
private static final String NO_DATA = "No data";
|
||||||
private TextColumn<T> name;
|
|
||||||
private TextColumn<T> introduction;
|
|
||||||
private TextColumn<T> author;
|
|
||||||
public static DateTimeFormat dtformat = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
public static DateTimeFormat dtformat = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
||||||
|
|
||||||
private AbstractDataProvider<T> dataProvider;
|
private AbstractDataProvider<T> dataProvider;
|
||||||
|
private List<ItemField> displayFields;
|
||||||
private List<RECORD_FIELD> displayFields;
|
|
||||||
private TextColumn<T> startEndProjectColumn;
|
|
||||||
private TextColumn<T> statusColumn;
|
|
||||||
// private Column<T, Date> startProjectDateColumn;
|
|
||||||
// private Column<T, Date> endProjectDateColumn;
|
|
||||||
private boolean isAsyncronusTable;
|
private boolean isAsyncronusTable;
|
||||||
private TextColumn<T> insertedBy;
|
|
||||||
private Column<T, Date> createdColumn;
|
|
||||||
private SortFilter currentSortFilter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new items table.
|
* Instantiates a new items table.
|
||||||
|
@ -77,10 +61,9 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
* @param displayFields the display fields
|
* @param displayFields the display fields
|
||||||
* @param startSortByColumn the start sort by column
|
* @param startSortByColumn the start sort by column
|
||||||
*/
|
*/
|
||||||
public ItemsTable(HandlerManager eventBus, RECORD_FIELD[] displayFields, SortFilter currentSortFilter) {
|
public ItemsTable(HandlerManager eventBus, List<ItemField> displayFields) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.currentSortFilter = currentSortFilter;
|
this.displayFields = displayFields;
|
||||||
setDisplayFields(displayFields);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,15 +92,66 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
||||||
setEmptyTableMessage(NO_DATA);
|
setEmptyTableMessage(NO_DATA);
|
||||||
|
|
||||||
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
int i = 0;
|
||||||
|
|
||||||
|
for (ItemField itemField : displayFields) {
|
||||||
|
String displayName = itemField.getDisplayName();
|
||||||
// NAME
|
// NAME
|
||||||
name = new TextColumn<T>() {
|
TextColumn<T> col = new TextColumn<T>() {
|
||||||
@Override
|
@Override
|
||||||
public String getValue(T object) {
|
public String getValue(T object) {
|
||||||
|
|
||||||
if (object == null)
|
if (object == null)
|
||||||
return "";
|
return "";
|
||||||
return ((ConcessioneDV) object).getNome();
|
|
||||||
|
if (displayName.equalsIgnoreCase("Name")) {
|
||||||
|
return ((ConcessioneDV) object).getNome();
|
||||||
|
} else if (displayName.equalsIgnoreCase("Introduction")) {
|
||||||
|
return ((ConcessioneDV) object).getIntroduzione();
|
||||||
|
} else if (displayName.equalsIgnoreCase("Author/s")) {
|
||||||
|
|
||||||
|
String toDisplay = "";
|
||||||
|
if (object.getAuthors() != null) {
|
||||||
|
toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
||||||
|
}
|
||||||
|
return toDisplay;
|
||||||
|
} else if (displayName.equalsIgnoreCase("Project Start/End Date")) {
|
||||||
|
|
||||||
|
Date dS = null;
|
||||||
|
Date dE = null;
|
||||||
|
if (object.getDataInizioProgetto() != null) {
|
||||||
|
dS = (((ConcessioneDV) object).getDataInizioProgetto());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (object.getDataFineProgetto() != null) {
|
||||||
|
dE = (((ConcessioneDV) object).getDataFineProgetto());
|
||||||
|
}
|
||||||
|
|
||||||
|
String dateFormat = "";
|
||||||
|
if (dS != null) {
|
||||||
|
dateFormat += dtformat.format(dS);
|
||||||
|
}
|
||||||
|
|
||||||
|
dateFormat += " / ";
|
||||||
|
|
||||||
|
if (dE != null) {
|
||||||
|
dateFormat += dtformat.format(dE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateFormat;
|
||||||
|
} else if (displayName.equalsIgnoreCase("Published with")) {
|
||||||
|
ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport();
|
||||||
|
if (vr != null && vr.getStatus() != null)
|
||||||
|
return vr.getStatus().getLabel();
|
||||||
|
return "";
|
||||||
|
} else if (displayName.equalsIgnoreCase("Created")) {
|
||||||
|
Date cd = ((ConcessioneDV) object).getCreationTime();
|
||||||
|
return dtformat.format(cd);
|
||||||
|
} else if (displayName.equalsIgnoreCase("Created by")) {
|
||||||
|
return ((ConcessioneDV) object).getCreationUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ADDING TOOLTIP
|
// ADDING TOOLTIP
|
||||||
|
@ -125,304 +159,224 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||||
if (object == null)
|
if (object == null)
|
||||||
return;
|
return;
|
||||||
sb.appendHtmlConstant("<div introduction=\"" + ((ConcessioneDV) object).getNome() + "\">");
|
|
||||||
super.render(context, object, sb);
|
if (displayName.equalsIgnoreCase("Published with")) {
|
||||||
sb.appendHtmlConstant("</div>");
|
String value = getValue(object);
|
||||||
|
String color = "#000";
|
||||||
|
if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
||||||
|
color = "#32CD32";
|
||||||
|
} else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
||||||
|
color = "#FF8000";
|
||||||
|
} else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
||||||
|
color = "red";
|
||||||
|
}
|
||||||
|
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||||
|
super.render(context, object, sb);
|
||||||
|
sb.appendHtmlConstant("</span>");
|
||||||
|
} else
|
||||||
|
super.render(context, object, sb);
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sortedCellTable.addColumn(name, RECORD_FIELD.NAME.getDisplayName(), true);
|
if(i==0) {
|
||||||
|
//name
|
||||||
if (!isAsyncronusTable) {
|
sortedCellTable.setColumnWidth(col, 20, Unit.PCT);
|
||||||
Comparator<T> c = new Comparator<T>() {
|
}else if (i == 1) {
|
||||||
@Override
|
// intro
|
||||||
public int compare(T o1, T o2) {
|
sortedCellTable.setColumnWidth(col, 30, Unit.PCT);
|
||||||
return ((ConcessioneDV) o1).getNome().compareTo(((ConcessioneDV) o2).getNome());
|
} else if (i == 2) {
|
||||||
}
|
sortedCellTable.setColumnWidth(col, 15, Unit.PCT);
|
||||||
};
|
}else if(i==displayFields.size()-1) {
|
||||||
|
sortedCellTable.setColumnWidth(col, 120, Unit.PX);
|
||||||
sortedCellTable.setComparator(name, c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortedCellTable.addColumn(col, itemField.getDisplayName(), true);
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
/*
|
||||||
|
* if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
||||||
introduction = new TextColumn<T>() {
|
*
|
||||||
@Override
|
* // NAME name = new TextColumn<T>() {
|
||||||
public String getValue(T object) {
|
*
|
||||||
if (object == null)
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
return "";
|
* return ((ConcessioneDV) object).getNome(); }
|
||||||
return ((ConcessioneDV) object).getIntroduzione() != null
|
*
|
||||||
? ((ConcessioneDV) object).getIntroduzione()
|
* // ADDING TOOLTIP
|
||||||
: "";
|
*
|
||||||
}
|
* @Override public void render(com.google.gwt.cell.client.Cell.Context context,
|
||||||
};
|
* T object, SafeHtmlBuilder sb) { if (object == null) return;
|
||||||
|
* sb.appendHtmlConstant("<div introduction=\"" + ((ConcessioneDV)
|
||||||
sortedCellTable.addColumn(introduction, RECORD_FIELD.INTRODUCTION.getDisplayName(), true);
|
* object).getNome() + "\">"); super.render(context, object, sb);
|
||||||
|
* sb.appendHtmlConstant("</div>"); }; };
|
||||||
if (!isAsyncronusTable) {
|
*
|
||||||
Comparator<T> c = new Comparator<T>() {
|
* sortedCellTable.addColumn(name, RECORD_FIELD.NAME.getDisplayName(), true);
|
||||||
@Override
|
*
|
||||||
public int compare(T o1, T o2) {
|
* if (!isAsyncronusTable) { Comparator<T> c = new Comparator<T>() {
|
||||||
return ((ConcessioneDV) o1).getIntroduzione().compareTo(((ConcessioneDV) o2).getIntroduzione());
|
*
|
||||||
}
|
* @Override public int compare(T o1, T o2) { return ((ConcessioneDV)
|
||||||
};
|
* o1).getNome().compareTo(((ConcessioneDV) o2).getNome()); } };
|
||||||
sortedCellTable.setComparator(introduction, c);
|
*
|
||||||
}
|
* sortedCellTable.setComparator(name, c); }
|
||||||
|
*
|
||||||
// sortedCellTable.setColumnWidth(introduction, 100, Unit.PCT);
|
* }
|
||||||
|
*
|
||||||
}
|
* if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
||||||
|
*
|
||||||
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
* introduction = new TextColumn<T>() {
|
||||||
|
*
|
||||||
author = new TextColumn<T>() {
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
@Override
|
* return ((ConcessioneDV) object).getIntroduzione() != null ? ((ConcessioneDV)
|
||||||
public String getValue(T object) {
|
* object).getIntroduzione() : ""; } };
|
||||||
if (object == null)
|
*
|
||||||
return "";
|
* sortedCellTable.addColumn(introduction,
|
||||||
|
* RECORD_FIELD.INTRODUCTION.getDisplayName(), true);
|
||||||
String toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
*
|
||||||
return toDisplay;
|
* if (!isAsyncronusTable) { Comparator<T> c = new Comparator<T>() {
|
||||||
}
|
*
|
||||||
};
|
* @Override public int compare(T o1, T o2) { return ((ConcessioneDV)
|
||||||
|
* o1).getIntroduzione().compareTo(((ConcessioneDV) o2).getIntroduzione()); } };
|
||||||
sortedCellTable.addColumn(author, RECORD_FIELD.AUTHOR.getDisplayName(), true);
|
* sortedCellTable.setComparator(introduction, c); }
|
||||||
|
*
|
||||||
if (!isAsyncronusTable) {
|
* // sortedCellTable.setColumnWidth(introduction, 100, Unit.PCT);
|
||||||
Comparator<T> c = new Comparator<T>() {
|
*
|
||||||
@Override
|
* }
|
||||||
public int compare(T o1, T o2) {
|
*
|
||||||
String toDisplay1 = toDisplayAuthors(((ConcessioneDV) o1).getAuthors());
|
* if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
||||||
String toDisplay2 = toDisplayAuthors(((ConcessioneDV) o2).getAuthors());
|
*
|
||||||
return toDisplay1.compareTo(toDisplay2);
|
* author = new TextColumn<T>() {
|
||||||
}
|
*
|
||||||
};
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
sortedCellTable.setComparator(author, c);
|
*
|
||||||
}
|
* String toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
||||||
|
* return toDisplay; } };
|
||||||
sortedCellTable.setColumnWidth(author, 220, Unit.PX);
|
*
|
||||||
|
* sortedCellTable.addColumn(author, RECORD_FIELD.AUTHOR.getDisplayName(),
|
||||||
}
|
* true);
|
||||||
|
*
|
||||||
if (this.displayFields.contains(RECORD_FIELD.PROJECT_START_END_DATE)) {
|
* if (!isAsyncronusTable) { Comparator<T> c = new Comparator<T>() {
|
||||||
|
*
|
||||||
startEndProjectColumn = new TextColumn<T>() {
|
* @Override public int compare(T o1, T o2) { String toDisplay1 =
|
||||||
@Override
|
* toDisplayAuthors(((ConcessioneDV) o1).getAuthors()); String toDisplay2 =
|
||||||
public String getValue(T object) {
|
* toDisplayAuthors(((ConcessioneDV) o2).getAuthors()); return
|
||||||
if (object == null)
|
* toDisplay1.compareTo(toDisplay2); } }; sortedCellTable.setComparator(author,
|
||||||
return "";
|
* c); }
|
||||||
|
*
|
||||||
Date dS = (((ConcessioneDV) object).getDataInizioProgetto());
|
* sortedCellTable.setColumnWidth(author, 220, Unit.PX);
|
||||||
Date dE = (((ConcessioneDV) object).getDataFineProgetto());
|
*
|
||||||
return dtformat.format(dS) + " / " + dtformat.format(dE);
|
* }
|
||||||
}
|
*
|
||||||
};
|
* if (this.displayFields.contains(RECORD_FIELD.PROJECT_START_END_DATE)) {
|
||||||
|
*
|
||||||
sortedCellTable.addColumn(startEndProjectColumn, RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(),
|
* startEndProjectColumn = new TextColumn<T>() {
|
||||||
false);
|
*
|
||||||
sortedCellTable.setColumnWidth(startEndProjectColumn, 180, Unit.PX);
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
|
*
|
||||||
}
|
* Date dS = null; Date dE = null; if(object.getDataInizioProgetto()!=null) { dS
|
||||||
|
* = (((ConcessioneDV) object).getDataInizioProgetto()); }
|
||||||
if (this.displayFields.contains(RECORD_FIELD.CREATED)) {
|
*
|
||||||
|
* if(object.getDataFineProgetto()!=null) { dE = (((ConcessioneDV)
|
||||||
DateCell date = new DateCell(DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT+" "+ConvertToDataViewModel.TIME_FORMAT));
|
* object).getDataFineProgetto()); }
|
||||||
createdColumn = new Column<T, Date>(date) {
|
*
|
||||||
|
* String dateFormat = ""; if(dS!=null) { dateFormat+=dtformat.format(dS); }
|
||||||
@Override
|
*
|
||||||
public Date getValue(T object) {
|
* dateFormat+=" / ";
|
||||||
if (object == null)
|
*
|
||||||
return null;
|
* if(dE!=null) { dateFormat+=dtformat.format(dE); }
|
||||||
|
*
|
||||||
return (((ConcessioneDV) object).getCreationTime());
|
* return dateFormat; } };
|
||||||
}
|
*
|
||||||
};
|
* sortedCellTable.addColumn(startEndProjectColumn,
|
||||||
sortedCellTable.addColumn(createdColumn, RECORD_FIELD.CREATED.getDisplayName(), true);
|
* RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(), false);
|
||||||
|
* sortedCellTable.setColumnWidth(startEndProjectColumn, 180, Unit.PX);
|
||||||
if (!isAsyncronusTable) {
|
*
|
||||||
Comparator<T> c = new Comparator<T>() {
|
* }
|
||||||
@Override
|
*
|
||||||
public int compare(T o1, T o2) {
|
* if (this.displayFields.contains(RECORD_FIELD.CREATED)) {
|
||||||
if (o1 == null)
|
*
|
||||||
return -1;
|
* DateCell date = new
|
||||||
|
* DateCell(DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT+" "
|
||||||
if (o2 == null)
|
* +ConvertToDataViewModel.TIME_FORMAT)); createdColumn = new Column<T,
|
||||||
return 1;
|
* Date>(date) {
|
||||||
|
*
|
||||||
Date d1 = (((ConcessioneDV) o1).getCreationTime());
|
* @Override public Date getValue(T object) { if (object == null) return null;
|
||||||
Date d2 = (((ConcessioneDV) o2).getCreationTime());
|
*
|
||||||
|
* return (((ConcessioneDV) object).getCreationTime()); } };
|
||||||
// GWT.log(d1.toString() + "is after "+d2.toString() +" ? "+d2.after(d1));
|
* sortedCellTable.addColumn(createdColumn,
|
||||||
|
* RECORD_FIELD.CREATED.getDisplayName(), true);
|
||||||
if (d1.after(d2))
|
*
|
||||||
return 1;
|
* if (!isAsyncronusTable) { Comparator<T> c = new Comparator<T>() {
|
||||||
else
|
*
|
||||||
return -1;
|
* @Override public int compare(T o1, T o2) { if (o1 == null) return -1;
|
||||||
}
|
*
|
||||||
};
|
* if (o2 == null) return 1;
|
||||||
GWT.log("date colum sortable");
|
*
|
||||||
sortedCellTable.setComparator(createdColumn, c);
|
* Date d1 = (((ConcessioneDV) o1).getCreationTime()); Date d2 =
|
||||||
}
|
* (((ConcessioneDV) o2).getCreationTime());
|
||||||
|
*
|
||||||
sortedCellTable.setColumnWidth(createdColumn, 150, Unit.PX);
|
* // GWT.log(d1.toString() + "is after "+d2.toString() +" ? "+d2.after(d1));
|
||||||
|
*
|
||||||
}
|
* if (d1.after(d2)) return 1; else return -1; } };
|
||||||
|
* GWT.log("date colum sortable"); sortedCellTable.setComparator(createdColumn,
|
||||||
if (this.displayFields.contains(RECORD_FIELD.CREATED_BY)) {
|
* c); }
|
||||||
|
*
|
||||||
// NAME
|
* sortedCellTable.setColumnWidth(createdColumn, 150, Unit.PX);
|
||||||
insertedBy = new TextColumn<T>() {
|
*
|
||||||
@Override
|
* }
|
||||||
public String getValue(T object) {
|
*
|
||||||
if (object == null)
|
* if (this.displayFields.contains(RECORD_FIELD.CREATED_BY)) {
|
||||||
return "";
|
*
|
||||||
return ((ConcessioneDV) object).getCreationUser();
|
* // NAME insertedBy = new TextColumn<T>() {
|
||||||
}
|
*
|
||||||
};
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
|
* return ((ConcessioneDV) object).getCreationUser(); } };
|
||||||
sortedCellTable.addColumn(insertedBy, RECORD_FIELD.CREATED_BY.getDisplayName(), true);
|
*
|
||||||
|
* sortedCellTable.addColumn(insertedBy,
|
||||||
if (!isAsyncronusTable) {
|
* RECORD_FIELD.CREATED_BY.getDisplayName(), true);
|
||||||
Comparator<T> c = new Comparator<T>() {
|
*
|
||||||
@Override
|
* if (!isAsyncronusTable) { Comparator<T> c = new Comparator<T>() {
|
||||||
public int compare(T o1, T o2) {
|
*
|
||||||
return ((ConcessioneDV) o1).getCreationUser().compareTo(((ConcessioneDV) o2).getCreationUser());
|
* @Override public int compare(T o1, T o2) { return ((ConcessioneDV)
|
||||||
}
|
* o1).getCreationUser().compareTo(((ConcessioneDV) o2).getCreationUser()); } };
|
||||||
};
|
*
|
||||||
|
* sortedCellTable.setComparator(insertedBy, c); }
|
||||||
sortedCellTable.setComparator(insertedBy, c);
|
* sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX); }
|
||||||
}
|
*
|
||||||
sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX);
|
* if (this.displayFields.contains(RECORD_FIELD.RECORD_STATUS)) {
|
||||||
}
|
*
|
||||||
|
* statusColumn = new TextColumn<T>() {
|
||||||
if (this.displayFields.contains(RECORD_FIELD.RECORD_STATUS)) {
|
*
|
||||||
|
* @Override public String getValue(T object) { if (object == null) return "";
|
||||||
statusColumn = new TextColumn<T>() {
|
*
|
||||||
@Override
|
* ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport(); if
|
||||||
public String getValue(T object) {
|
* (vr != null && vr.getStatus() != null) return vr.getStatus().getLabel();
|
||||||
if (object == null)
|
* return ""; }
|
||||||
return "";
|
*
|
||||||
|
* @Override public void render(Context context, T object, SafeHtmlBuilder sb) {
|
||||||
ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport();
|
* // TODO Auto-generated method stub
|
||||||
if (vr != null && vr.getStatus() != null)
|
*
|
||||||
return vr.getStatus().getLabel();
|
* String value = getValue(object); String color = "#000"; if
|
||||||
return "";
|
* (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) { color =
|
||||||
}
|
* "#32CD32"; } else if (value.compareTo(ValidationStatus.WARNING.getLabel()) ==
|
||||||
|
* 0) { color = "#FF8000"; } else if
|
||||||
@Override
|
* (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) { color = "red"; }
|
||||||
public void render(Context context, T object, SafeHtmlBuilder sb) {
|
* sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||||
// TODO Auto-generated method stub
|
* super.render(context, object, sb); sb.appendHtmlConstant("</span>");
|
||||||
|
*
|
||||||
String value = getValue(object);
|
* } };
|
||||||
String color = "#000";
|
*
|
||||||
if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
* sortedCellTable.addColumn(statusColumn,
|
||||||
color = "#32CD32";
|
* RECORD_FIELD.RECORD_STATUS.getDisplayName(), false);
|
||||||
} else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
* sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX);
|
||||||
color = "#FF8000";
|
*
|
||||||
} else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
* }
|
||||||
color = "red";
|
*/
|
||||||
}
|
|
||||||
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
|
||||||
super.render(context, object, sb);
|
|
||||||
sb.appendHtmlConstant("</span>");
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sortedCellTable.addColumn(statusColumn, RECORD_FIELD.RECORD_STATUS.getDisplayName(), false);
|
|
||||||
sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ButtonCell showOnMapButton = new ButtonCell();
|
|
||||||
// showOnMapButton.setIcon(IconType.MAP_MARKER);
|
|
||||||
//
|
|
||||||
// MyToolTipColumn<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public String getValue(T object) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// showOnMapColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
|
||||||
// @Override
|
|
||||||
// public void update(int index, T object, String value) {
|
|
||||||
// GWT.log("clicked show");
|
|
||||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// sortedCellTable.addColumn(showOnMapColumn);
|
|
||||||
// sortedCellTable.setColumnWidth(showOnMapColumn, 50, Unit.PX);
|
|
||||||
//
|
|
||||||
// ButtonCell showReportRecordButton = new ButtonCell();
|
|
||||||
// showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT);
|
|
||||||
// MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton,
|
|
||||||
// "Show Publication Report") {
|
|
||||||
// public String getValue(T object) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// showReportRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
|
||||||
// @Override
|
|
||||||
// public void update(int index, T object, String value) {
|
|
||||||
//
|
|
||||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// sortedCellTable.addColumn(showReportRecordColumn);
|
|
||||||
// sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX);
|
|
||||||
//
|
|
||||||
// ButtonCell deleteRecordButton = new ButtonCell();
|
|
||||||
// deleteRecordButton.setIcon(IconType.TRASH);
|
|
||||||
// MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton,
|
|
||||||
// "Delete Project") {
|
|
||||||
// public String getValue(T object) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// deleteRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
|
||||||
// @Override
|
|
||||||
// public void update(int index, T object, String value) {
|
|
||||||
//
|
|
||||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.DELETE_RECORD));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// sortedCellTable.addColumn(deleteRecordColumn);
|
|
||||||
// sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX);
|
|
||||||
|
|
||||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
|
||||||
|
|
||||||
if (currentSortFilter != null)
|
|
||||||
switch (currentSortFilter.getOrderByField()) {
|
|
||||||
case NAME:
|
|
||||||
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
|
||||||
sortedCellTable.setInitialSortColumn(name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case INTRODUCTION:
|
|
||||||
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
|
||||||
sortedCellTable.setInitialSortColumn(introduction);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case AUTHOR:
|
|
||||||
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
|
||||||
sortedCellTable.setInitialSortColumn(author);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void enableWriteOperations() {
|
public void enableWriteOperations() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,15 +419,15 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Sets the display fields.
|
// * Sets the display fields.
|
||||||
*
|
// *
|
||||||
* @param fields the new display fields
|
// * @param fields the new display fields
|
||||||
*/
|
// */
|
||||||
public void setDisplayFields(RECORD_FIELD[] fields) {
|
// public void setDisplayFields(List<ItemField> fields) {
|
||||||
this.displayFields = fields != null && fields.length > 0 ? Arrays.asList(fields)
|
// this.displayFields = fields != null && fields.size() > 0 ? Arrays.asList(fields)
|
||||||
: Arrays.asList(RECORD_FIELD.values());
|
// : Arrays.asList(RECORD_FIELD.values());
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset columns table.
|
* Reset columns table.
|
||||||
|
@ -491,7 +445,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
||||||
*
|
*
|
||||||
* @return the displayFields
|
* @return the displayFields
|
||||||
*/
|
*/
|
||||||
public List<RECORD_FIELD> getDisplayFields() {
|
public List<ItemField> getDisplayFields() {
|
||||||
return displayFields;
|
return displayFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.server;
|
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -19,25 +17,37 @@ import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
import org.gcube.application.geoportal.common.rest.TempFile;
|
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.server.MongoServiceUtil.ConcessioneValidationReportStatusComparator;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter.ORDER;
|
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||||
|
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -57,6 +67,29 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the GNA data entry config profile.
|
||||||
|
*
|
||||||
|
* @return the GNA data entry config profile
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
private GNADataEntryConfigProfile getGNADataEntryConfigProfile() throws Exception {
|
||||||
|
|
||||||
|
GNADataEntryConfigProfile profile = SessionUtil.getGNADataEntryConfigProfile(getThreadLocalRequest());
|
||||||
|
if (profile == null) {
|
||||||
|
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
||||||
|
//to be sure
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
GeoportalCommon gCommon = new GeoportalCommon();
|
||||||
|
profile = gCommon.readGNADataEntryConfig();
|
||||||
|
SessionUtil.setGNADataEntryConfigProfile(getThreadLocalRequest(), profile);
|
||||||
|
} else {
|
||||||
|
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " read from session");
|
||||||
|
}
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save geona data forms.
|
* Save geona data forms.
|
||||||
*
|
*
|
||||||
|
@ -362,8 +395,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
try {
|
try {
|
||||||
theSecondaryType = this.getServletContext().getInitParameter(GEONA_GENERIC_RESOURCE_SECONDARY_TYPE);
|
theSecondaryType = this.getServletContext().getInitParameter(GEONA_GENERIC_RESOURCE_SECONDARY_TYPE);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("I cannot read the init parameter for: " + GEONA_GENERIC_RESOURCE_SECONDARY_TYPE, e);
|
LOG.warn("I cannot read the init parameter for: " + GEONA_GENERIC_RESOURCE_SECONDARY_TYPE, e);
|
||||||
theSecondaryType = "GeoNaMetadata";
|
theSecondaryType = "GeoNaMetadata";
|
||||||
|
LOG.warn("Using default SecondaryType: " + theSecondaryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG.warn("\n\n\nHARD-CABLING THE SCOPE, PLEASE REMOTE IT!!!!\n\n\n");
|
// LOG.warn("\n\n\nHARD-CABLING THE SCOPE, PLEASE REMOTE IT!!!!\n\n\n");
|
||||||
|
@ -387,7 +421,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
LOG.info("getLinksFor called");
|
LOG.info("getLinksFor called");
|
||||||
|
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GeoNaDataViewerProfile grViewerProfile = SessionUtil.getGeportalViewerResourceProfile(getThreadLocalRequest());
|
GNADataViewerConfigProfile grViewerProfile = SessionUtil
|
||||||
|
.getGeportalViewerResourceProfile(getThreadLocalRequest());
|
||||||
GeoportalCommon gc = new GeoportalCommon(grViewerProfile);
|
GeoportalCommon gc = new GeoportalCommon(grViewerProfile);
|
||||||
GeoNaItemRef item = new GeoNaItemRef(itemId, recordType.toString().toLowerCase());
|
GeoNaItemRef item = new GeoNaItemRef(itemId, recordType.toString().toLowerCase());
|
||||||
item = gc.getPublicLinksFor(item, false);
|
item = gc.getPublicLinksFor(item, false);
|
||||||
|
@ -406,147 +441,26 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SortFilter filter,
|
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||||
boolean reloadFromService) throws Exception {
|
boolean reloadFromService) throws Exception {
|
||||||
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||||
|
|
||||||
|
// TODO MUST BE REPLACED BY COUNT
|
||||||
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||||
reloadFromService);
|
reloadFromService);
|
||||||
int listConcessioniSize = listOfConcessioni.size();
|
int listConcessioniSize = listOfConcessioni.size();
|
||||||
|
|
||||||
List<Concessione> toReturn = new ArrayList<Concessione>();
|
ResultSetPaginatedData searchedData = serviceCommon.queryOnMongo(listConcessioniSize, start, limit, filter,
|
||||||
int startIndex;
|
"concessione");
|
||||||
int limitIndex = 0;
|
|
||||||
if (start == null && limit == null) {
|
|
||||||
startIndex = 0;
|
|
||||||
limitIndex = listConcessioniSize;
|
|
||||||
} else {
|
|
||||||
startIndex = start;
|
|
||||||
limitIndex = start + limit;
|
|
||||||
if (limitIndex > listConcessioniSize) {
|
|
||||||
limitIndex = listConcessioniSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start, limit, startIndex, false);
|
|
||||||
searchedData.setTotalItems(listConcessioniSize);
|
|
||||||
|
|
||||||
RECORD_FIELD orderBy = null;
|
|
||||||
ORDER order = null;
|
|
||||||
ConcessioneValidationReportStatusComparator statusComparator = null;
|
|
||||||
|
|
||||||
if (filter == null) {
|
|
||||||
// unsorted list of records
|
|
||||||
toReturn = listOfConcessioni.subList(startIndex, limitIndex);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
orderBy = filter.getOrderByField();
|
|
||||||
order = filter.getOrder();
|
|
||||||
|
|
||||||
if (orderBy == null)
|
|
||||||
orderBy = RECORD_FIELD.NAME;
|
|
||||||
|
|
||||||
if (order == null)
|
|
||||||
order = ORDER.ASC;
|
|
||||||
|
|
||||||
// CASE INSENSITIVE COMPARATOR
|
|
||||||
Comparator<Concessione> comparator = null;
|
|
||||||
|
|
||||||
switch (orderBy) {
|
|
||||||
case NAME:
|
|
||||||
if (order.equals(ORDER.ASC)) {
|
|
||||||
comparator = Comparator.comparing(Concessione::getNome,
|
|
||||||
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
|
|
||||||
} else {
|
|
||||||
comparator = Comparator
|
|
||||||
.comparing(Concessione::getNome, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER))
|
|
||||||
.reversed();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case CREATED:
|
|
||||||
if (order.equals(ORDER.ASC)) {
|
|
||||||
comparator = Comparator.comparing(Concessione::getCreationTime,
|
|
||||||
Comparator.nullsLast(Comparator.naturalOrder()));
|
|
||||||
} else {
|
|
||||||
comparator = Comparator.comparing(Concessione::getCreationTime,
|
|
||||||
Comparator.nullsLast(Comparator.naturalOrder())).reversed();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CREATED_BY:
|
|
||||||
if (order.equals(ORDER.ASC)) {
|
|
||||||
comparator = Comparator.comparing(Concessione::getCreationUser,
|
|
||||||
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
|
|
||||||
} else {
|
|
||||||
comparator = Comparator.comparing(Concessione::getCreationUser,
|
|
||||||
Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)).reversed();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// TODO is buggy must be performed by service
|
|
||||||
case PROJECT_START_END_DATE:
|
|
||||||
if (order.equals(ORDER.ASC)) {
|
|
||||||
comparator = Comparator.comparing(Concessione::getDataInizioProgetto,
|
|
||||||
Comparator.nullsLast(Comparator.naturalOrder()));
|
|
||||||
} else {
|
|
||||||
comparator = Comparator.comparing(Concessione::getDataInizioProgetto,
|
|
||||||
Comparator.nullsLast(Comparator.naturalOrder())).reversed();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RECORD_STATUS:
|
|
||||||
statusComparator = new ConcessioneValidationReportStatusComparator();
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// sorting with nullsLast
|
|
||||||
if (comparator != null)
|
|
||||||
listOfConcessioni.sort(Comparator.nullsLast(comparator));
|
|
||||||
|
|
||||||
// solution quick&dirty
|
|
||||||
try {
|
|
||||||
if (statusComparator != null) {
|
|
||||||
if (order.equals(ORDER.ASC)) {
|
|
||||||
listOfConcessioni.sort(Comparator.nullsLast(statusComparator));
|
|
||||||
} else {
|
|
||||||
Collections.sort(listOfConcessioni, Comparator.nullsLast(
|
|
||||||
Collections.reverseOrder(new ConcessioneValidationReportStatusComparator())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("comparator Exception: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG.trace("sorted list: " + listOfConcessioni);
|
|
||||||
// pagination
|
|
||||||
toReturn = listOfConcessioni.subList(startIndex, limitIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ConcessioneDV> toReturnList = new ArrayList<ConcessioneDV>(toReturn.size());
|
|
||||||
|
|
||||||
for (Concessione concessione : toReturn) {
|
|
||||||
ConcessioneDV concessioneDV = ConvertToDataViewModel.toMetadataConcessione(concessione, true);
|
|
||||||
toReturnList.add(concessioneDV);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchedData.setData(toReturnList);
|
|
||||||
|
|
||||||
if (listConcessioniSize == limit || listConcessioniSize == 0) {
|
|
||||||
LOG.debug("Page completed returning " + listConcessioniSize + " items");
|
|
||||||
int newOffset = startIndex + start;
|
|
||||||
searchedData.setServerSearchFinished(newOffset > listConcessioniSize || listConcessioniSize == 0);
|
|
||||||
LOG.debug("is Search finished: " + searchedData.isServerSearchFinished());
|
|
||||||
return searchedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG.debug("Returning: " + toReturnList);
|
|
||||||
LOG.info("Returning list of concessioni with size: " + toReturnList.size());
|
|
||||||
return searchedData;
|
return searchedData;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on loading list of concessioni: ", e);
|
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
||||||
throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
|
throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,19 +674,19 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
String toEditPath = null;
|
String toEditPath = null;
|
||||||
AddSectionToConcessioneRequest request = null;
|
AddSectionToConcessioneRequest request = null;
|
||||||
List<TempFile> files = new ArrayList<TempFile>();
|
List<TempFile> files = new ArrayList<TempFile>();
|
||||||
|
|
||||||
// Managing files already present as current content and kept by user
|
// Managing files already present as current content and kept by user
|
||||||
List<TempFile> keepFiles = serviceUtil.toTemFilesFromWSC(keepCurrentContent);
|
List<TempFile> keepFiles = serviceUtil.toTemFilesFromWSC(keepCurrentContent);
|
||||||
if (keepFiles != null) {
|
if (keepFiles != null) {
|
||||||
files.addAll(keepFiles);
|
files.addAll(keepFiles);
|
||||||
LOG.debug(keepFiles.size() +" current corrent file/s has/have been added to list of files");
|
LOG.debug(keepFiles.size() + " current corrent file/s has/have been added to list of files");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Managing new files uploaded by user
|
// Managing new files uploaded by user
|
||||||
List<TempFile> newFiles = serviceUtil.toTemFiles(gDBean.getFilesUploaded());
|
List<TempFile> newFiles = serviceUtil.toTemFiles(gDBean.getFilesUploaded());
|
||||||
if (newFiles != null) {
|
if (newFiles != null) {
|
||||||
files.addAll(newFiles);
|
files.addAll(newFiles);
|
||||||
LOG.debug(newFiles.size() +" new file/s has/have been added to list of files");
|
LOG.debug(newFiles.size() + " new file/s has/have been added to list of files");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (files == null || files.isEmpty())
|
// if (files == null || files.isEmpty())
|
||||||
|
@ -808,21 +722,21 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
Concessione concessione = clientMongo.cleanFileSet(itemId, toEditPath);
|
Concessione concessione = clientMongo.cleanFileSet(itemId, toEditPath);
|
||||||
|
|
||||||
LOG.debug("Sending new Fileset ..");
|
LOG.debug("Sending new Fileset ..");
|
||||||
if(files.size()>0) {
|
if (files.size() > 0) {
|
||||||
// StorageUtils storage=new StorageUtils();
|
// StorageUtils storage=new StorageUtils();
|
||||||
// Building TempFile
|
// Building TempFile
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
LOG.info("Registering FileSet into recordId " + itemId + " with request path: " + toEditPath + " and: "
|
LOG.info("Registering FileSet into recordId " + itemId + " with request path: " + toEditPath
|
||||||
+ files.size() + " file/s");
|
+ " and: " + files.size() + " file/s");
|
||||||
concessione = clientMongo.registerFileSet(itemId, request);
|
concessione = clientMongo.registerFileSet(itemId, request);
|
||||||
}else {
|
} else {
|
||||||
LOG.info("Fileset is empty, skipping registerFileSet");
|
LOG.info("Fileset is empty, skipping registerFileSet");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("Publishings itemId: "+itemId);
|
LOG.info("Publishings itemId: " + itemId);
|
||||||
concessione = clientMongo.publish(itemId);
|
concessione = clientMongo.publish(itemId);
|
||||||
|
|
||||||
LOG.debug("returning concessione: "+concessione);
|
LOG.debug("returning concessione: " + concessione);
|
||||||
return ConvertToDataViewModel.toConcessione(concessione);
|
return ConvertToDataViewModel.toConcessione(concessione);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,5 +748,94 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
"Error occurred on updating the project with id: " + itemId + ". Error: " + e.getMessage());
|
"Error occurred on updating the project with id: " + itemId + ". Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
||||||
|
LOG.info("readDataViewerConfig called");
|
||||||
|
|
||||||
|
GCubeUser user = null;
|
||||||
|
GNADataEntryExtConfigProfile gnaDEExtConfig = new GNADataEntryExtConfigProfile();
|
||||||
|
try {
|
||||||
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
user = pContext.getCurrentUser(this.getThreadLocalRequest());
|
||||||
|
String scope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
|
||||||
|
GNADataEntryConfigProfile config = getGNADataEntryConfigProfile();
|
||||||
|
List<RoleRights> listUserRightsForRole = config.getPermissionsForRole();
|
||||||
|
gnaDEExtConfig.setListItemFields(config.getListItemFields());
|
||||||
|
gnaDEExtConfig.setPermissionsForRole(listUserRightsForRole);
|
||||||
|
|
||||||
|
// DEV MODE
|
||||||
|
if (!SessionUtil.isIntoPortal()) {
|
||||||
|
LOG.warn("OUT OF PORTAL - DEV MODE detected");
|
||||||
|
GcubeUserRole myRole = GcubeUserRole.DATA_EDITOR;
|
||||||
|
|
||||||
|
for (RoleRights roleRight : listUserRightsForRole) {
|
||||||
|
if (roleRight.getUserRole().equals(myRole)) {
|
||||||
|
UserRights userRights = new UserRights(user.getUsername(), roleRight);
|
||||||
|
LOG.warn("DEV MODE returning: " + userRights);
|
||||||
|
gnaDEExtConfig.setUserRights(userRights);
|
||||||
|
return gnaDEExtConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
long groupId = pContext.getCurrentGroupId(this.getThreadLocalRequest());
|
||||||
|
|
||||||
|
if (user == null || scope == null) {
|
||||||
|
LOG.warn("called getMyRightsInTheContext with invalid parameter user: " + user + ", in the scope: "
|
||||||
|
+ scope, ", returning null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("reading GcubeUserRole for user: " + user.getUsername() + ", in the scope: " + scope);
|
||||||
|
// The following snippet should pass in the service-side
|
||||||
|
RoleManager roleManager = new LiferayRoleManager();
|
||||||
|
List<GCubeRole> roles = roleManager.listRolesByUserAndGroup(user.getUserId(), groupId);
|
||||||
|
List<GcubeUserRole> listMyRoles = new ArrayList<GcubeUserRole>();
|
||||||
|
for (GCubeRole gCubeRole : roles) {
|
||||||
|
if (gCubeRole.getRoleName().equalsIgnoreCase(GcubeUserRole.DATA_EDITOR.getName())) {
|
||||||
|
listMyRoles.add(GcubeUserRole.DATA_EDITOR);
|
||||||
|
}
|
||||||
|
if (gCubeRole.getRoleName().equalsIgnoreCase(GcubeUserRole.DATA_MANAGER.getName())) {
|
||||||
|
listMyRoles.add(GcubeUserRole.DATA_MANAGER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapping to roles "known"
|
||||||
|
LOG.info(
|
||||||
|
"For user: " + user.getUsername() + " in the scope: " + scope + " read the role/s: " + listMyRoles);
|
||||||
|
|
||||||
|
GcubeUserRole myRole = null;
|
||||||
|
if (listMyRoles.contains(GcubeUserRole.DATA_MANAGER))
|
||||||
|
myRole = GcubeUserRole.DATA_MANAGER;
|
||||||
|
else if (listMyRoles.contains(GcubeUserRole.DATA_EDITOR))
|
||||||
|
myRole = GcubeUserRole.DATA_EDITOR;
|
||||||
|
else
|
||||||
|
myRole = GcubeUserRole.DATA_MEMBER;
|
||||||
|
|
||||||
|
LOG.info("using highest role: " + myRole);
|
||||||
|
|
||||||
|
RoleRights toRoleRight = null;
|
||||||
|
for (RoleRights roleRight : listUserRightsForRole) {
|
||||||
|
if (roleRight.getUserRole().equals(myRole)) {
|
||||||
|
toRoleRight = roleRight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UserRights userRights = new UserRights(user.getUsername(), toRoleRight);
|
||||||
|
LOG.info("returning: " + userRights);
|
||||||
|
gnaDEExtConfig.setUserRights(userRights);
|
||||||
|
return gnaDEExtConfig;
|
||||||
|
} catch (UserRetrievalFault | GroupRetrievalFault | GNAConfigException e) {
|
||||||
|
LOG.error("An error occurred during getMyRightsInTheContext: " + user, e);
|
||||||
|
|
||||||
|
Map<ACTION_ON_ITEM, OPERATION_TYPE> permissions = new HashMap<ACTION_ON_ITEM, RoleRights.OPERATION_TYPE>();
|
||||||
|
RoleRights roleRights = new RoleRights(permissions, GcubeUserRole.DATA_MEMBER);
|
||||||
|
UserRights ur = new UserRights(user.getUsername(), roleRights);
|
||||||
|
LOG.warn("Returning default user rights: " + ur);
|
||||||
|
gnaDEExtConfig.setUserRights(ur);
|
||||||
|
return gnaDEExtConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class MongoServiceUtil.
|
* The Class MongoServiceCommon.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,7 +13,8 @@ import javax.servlet.http.HttpSession;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
@ -38,6 +39,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
*/
|
*/
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
|
||||||
|
private static final String GNA_DATAENTRY_CONFIG_PROFILE = "GNA_DATAENTRY_CONFIG_PROFILE";
|
||||||
|
private static final String LATEST_RESULT_SET_SORTED = "LATEST_RESULT_SET_SORTED";
|
||||||
private static final String GEONA_DATAVIEWER_PROFILE = "GEONA_DATAVIEWER_PROFILE";
|
private static final String GEONA_DATAVIEWER_PROFILE = "GEONA_DATAVIEWER_PROFILE";
|
||||||
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI";
|
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI";
|
||||||
/** The log. */
|
/** The log. */
|
||||||
|
@ -173,15 +176,15 @@ public class SessionUtil {
|
||||||
* @return the geportal viewer resource profile
|
* @return the geportal viewer resource profile
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static GeoNaDataViewerProfile getGeportalViewerResourceProfile(HttpServletRequest httpServletRequest)
|
public static GNADataViewerConfigProfile getGeportalViewerResourceProfile(HttpServletRequest httpServletRequest)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
GeoNaDataViewerProfile geoNaDataViewerProfile = (GeoNaDataViewerProfile) session
|
GNADataViewerConfigProfile geoNaDataViewerProfile = (GNADataViewerConfigProfile) session
|
||||||
.getAttribute(GEONA_DATAVIEWER_PROFILE);
|
.getAttribute(GEONA_DATAVIEWER_PROFILE);
|
||||||
|
|
||||||
if (geoNaDataViewerProfile == null) {
|
if (geoNaDataViewerProfile == null) {
|
||||||
GeoportalCommon gc = new GeoportalCommon();
|
GeoportalCommon gc = new GeoportalCommon();
|
||||||
geoNaDataViewerProfile = gc.getGeoNaDataViewProfile(null);
|
geoNaDataViewerProfile = gc.readGNADataViewerConfig(null);
|
||||||
session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,18 +200,41 @@ public class SessionUtil {
|
||||||
*/
|
*/
|
||||||
public static ResultSetSorted getLatestResultSetSorted(HttpServletRequest httpServletRequest) {
|
public static ResultSetSorted getLatestResultSetSorted(HttpServletRequest httpServletRequest) {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
return (ResultSetSorted) session.getAttribute("LATEST_RESULT_SET_SORTED");
|
return (ResultSetSorted) session.getAttribute(LATEST_RESULT_SET_SORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the latest sort filter.
|
* Gets the latest sort filter.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param rsSorted the rs sorted
|
||||||
* @return the latest sort filter
|
* @return the latest sort filter
|
||||||
*/
|
*/
|
||||||
public static void setLatestResultSetSorted(HttpServletRequest httpServletRequest, ResultSetSorted rsSorted) {
|
public static void setLatestResultSetSorted(HttpServletRequest httpServletRequest, ResultSetSorted rsSorted) {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
session.setAttribute("LATEST_RESULT_SET_SORTED", rsSorted);
|
session.setAttribute(LATEST_RESULT_SET_SORTED, rsSorted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the GNA data entry config profile.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @return the GNA data entry config profile
|
||||||
|
*/
|
||||||
|
public static GNADataEntryConfigProfile getGNADataEntryConfigProfile(HttpServletRequest httpServletRequest) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (GNADataEntryConfigProfile) session.getAttribute(GNA_DATAENTRY_CONFIG_PROFILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the GNA data entry config profile.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param gNADEConfigProfile the g NADE config profile
|
||||||
|
*/
|
||||||
|
public static void setGNADataEntryConfigProfile(HttpServletRequest httpServletRequest,
|
||||||
|
GNADataEntryConfigProfile gNADEConfigProfile) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute(GNA_DATAENTRY_CONFIG_PROFILE, gNADEConfigProfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GNADataEntryExtConfigProfile.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Dec 21, 2021
|
||||||
|
*/
|
||||||
|
public class GNADataEntryExtConfigProfile extends GNADataEntryConfigProfile implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3185317083819447952L;
|
||||||
|
private UserRights userRights = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new GNA data entry config profile.
|
||||||
|
*/
|
||||||
|
public GNADataEntryExtConfigProfile() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserRights getUserRights() {
|
||||||
|
return userRights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserRights(UserRights userRights) {
|
||||||
|
this.userRights = userRights;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GNADataEntryExtConfigProfile [userRights=");
|
||||||
|
builder.append(userRights);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,39 +2,73 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class GeonaISConfig implements Serializable{
|
/**
|
||||||
|
* The Class GeonaISConfig.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Dec 22, 2021
|
||||||
|
*/
|
||||||
|
public class GeonaISConfig implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6700506811708315617L;
|
private static final long serialVersionUID = 4187839053354198268L;
|
||||||
|
private String genericResSecondaryType;
|
||||||
String gRSecondaryType;
|
private String scope;
|
||||||
String scope;
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new geona IS config.
|
||||||
|
*/
|
||||||
public GeonaISConfig() {
|
public GeonaISConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new geona IS config.
|
||||||
|
*
|
||||||
|
* @param gRSecondaryType the g R secondary type
|
||||||
|
* @param scope the scope
|
||||||
|
*/
|
||||||
public GeonaISConfig(String gRSecondaryType, String scope) {
|
public GeonaISConfig(String gRSecondaryType, String scope) {
|
||||||
super();
|
super();
|
||||||
this.gRSecondaryType = gRSecondaryType;
|
this.genericResSecondaryType = gRSecondaryType;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public String getgRSecondaryType() {
|
* Gets the generic resource secondary type.
|
||||||
return gRSecondaryType;
|
*
|
||||||
|
* @return the generic resource secondary type
|
||||||
|
*/
|
||||||
|
public String getGenericResourceSecondaryType() {
|
||||||
|
return genericResSecondaryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setgRSecondaryType(String gRSecondaryType) {
|
/**
|
||||||
this.gRSecondaryType = gRSecondaryType;
|
* Sets the generic resource secondary type.
|
||||||
|
*
|
||||||
|
* @param gRSecondaryType the new generic resource secondary type
|
||||||
|
*/
|
||||||
|
public void setGenericResourceSecondaryType(String gRSecondaryType) {
|
||||||
|
this.genericResSecondaryType = gRSecondaryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the scope.
|
||||||
|
*
|
||||||
|
* @return the scope
|
||||||
|
*/
|
||||||
public String getScope() {
|
public String getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the scope.
|
||||||
|
*
|
||||||
|
* @param scope the new scope
|
||||||
|
*/
|
||||||
public void setScope(String scope) {
|
public void setScope(String scope) {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
@ -42,14 +76,12 @@ public class GeonaISConfig implements Serializable{
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("GeonaISConfig [gRSecondaryType=");
|
builder.append("GeonaISConfig [genericResSecondaryType=");
|
||||||
builder.append(gRSecondaryType);
|
builder.append(genericResSecondaryType);
|
||||||
builder.append(", scope=");
|
builder.append(", scope=");
|
||||||
builder.append(scope);
|
builder.append(scope);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,189 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class ResultSetPaginatedData.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Aug 6, 2021
|
|
||||||
*/
|
|
||||||
public class ResultSetPaginatedData implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 6800997954077785719L;
|
|
||||||
private List<ConcessioneDV> data;
|
|
||||||
private int clientStartIndex = 0;
|
|
||||||
private int limit;
|
|
||||||
private int serverEndIndex = 0;
|
|
||||||
private boolean isServerSearchFinished = false;
|
|
||||||
private long totalItems;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new searched folder.
|
|
||||||
*/
|
|
||||||
public ResultSetPaginatedData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new result set paginated data.
|
|
||||||
*
|
|
||||||
* @param clientStartIndex the client start index
|
|
||||||
* @param limit the limit
|
|
||||||
* @param serverEndIndex the server end index
|
|
||||||
* @param isServerSearchFinished the is server search finished
|
|
||||||
*/
|
|
||||||
public ResultSetPaginatedData(int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
|
||||||
|
|
||||||
this.clientStartIndex = clientStartIndex;
|
|
||||||
this.limit = limit;
|
|
||||||
this.serverEndIndex = serverEndIndex;
|
|
||||||
this.isServerSearchFinished = isServerSearchFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the data.
|
|
||||||
*
|
|
||||||
* @return the data
|
|
||||||
*/
|
|
||||||
public List<ConcessioneDV> getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the client start index.
|
|
||||||
*
|
|
||||||
* @return the client start index
|
|
||||||
*/
|
|
||||||
public int getClientStartIndex() {
|
|
||||||
return clientStartIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the limit.
|
|
||||||
*
|
|
||||||
* @return the limit
|
|
||||||
*/
|
|
||||||
public int getLimit() {
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the server end index.
|
|
||||||
*
|
|
||||||
* @return the server end index
|
|
||||||
*/
|
|
||||||
public int getServerEndIndex() {
|
|
||||||
return serverEndIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is server search finished.
|
|
||||||
*
|
|
||||||
* @return true, if is server search finished
|
|
||||||
*/
|
|
||||||
public boolean isServerSearchFinished() {
|
|
||||||
return isServerSearchFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the data.
|
|
||||||
*
|
|
||||||
* @param data the new data
|
|
||||||
*/
|
|
||||||
public void setData(List<ConcessioneDV> data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the client start index.
|
|
||||||
*
|
|
||||||
* @param clientStartIndex the new client start index
|
|
||||||
*/
|
|
||||||
public void setClientStartIndex(int clientStartIndex) {
|
|
||||||
this.clientStartIndex = clientStartIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the limit.
|
|
||||||
*
|
|
||||||
* @param limit the new limit
|
|
||||||
*/
|
|
||||||
public void setLimit(int limit) {
|
|
||||||
this.limit = limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the server end index.
|
|
||||||
*
|
|
||||||
* @param serverEndIndex the new server end index
|
|
||||||
*/
|
|
||||||
public void setServerEndIndex(int serverEndIndex) {
|
|
||||||
this.serverEndIndex = serverEndIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the server search finished.
|
|
||||||
*
|
|
||||||
* @param isServerSearchFinished the new server search finished
|
|
||||||
*/
|
|
||||||
public void setServerSearchFinished(boolean isServerSearchFinished) {
|
|
||||||
this.isServerSearchFinished = isServerSearchFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the total items.
|
|
||||||
*
|
|
||||||
* @return the total items
|
|
||||||
*/
|
|
||||||
public long getTotalItems() {
|
|
||||||
return totalItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the total items.
|
|
||||||
*
|
|
||||||
* @param totalItems the new total items
|
|
||||||
*/
|
|
||||||
public void setTotalItems(long totalItems) {
|
|
||||||
this.totalItems = totalItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("ResultSetPaginatedData [data=");
|
|
||||||
builder.append(data);
|
|
||||||
builder.append(", clientStartIndex=");
|
|
||||||
builder.append(clientStartIndex);
|
|
||||||
builder.append(", limit=");
|
|
||||||
builder.append(limit);
|
|
||||||
builder.append(", serverEndIndex=");
|
|
||||||
builder.append(serverEndIndex);
|
|
||||||
builder.append(", isServerSearchFinished=");
|
|
||||||
builder.append(isServerSearchFinished);
|
|
||||||
builder.append(", totalItems=");
|
|
||||||
builder.append(totalItems);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
|
||||||
public class ResultSetSorted implements Serializable {
|
public class ResultSetSorted implements Serializable {
|
||||||
|
|
||||||
|
@ -12,7 +13,7 @@ public class ResultSetSorted implements Serializable {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 889420364685643758L;
|
private static final long serialVersionUID = 889420364685643758L;
|
||||||
|
|
||||||
private SortFilter searchFilter;
|
private SearchingFilter searchFilter;
|
||||||
|
|
||||||
private List<Concessione> data;
|
private List<Concessione> data;
|
||||||
|
|
||||||
|
@ -20,13 +21,13 @@ public class ResultSetSorted implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultSetSorted(SortFilter searchFilter, List<Concessione> data) {
|
public ResultSetSorted(SearchingFilter searchFilter, List<Concessione> data) {
|
||||||
super();
|
super();
|
||||||
this.searchFilter = searchFilter;
|
this.searchFilter = searchFilter;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortFilter getSearchFilter() {
|
public SearchingFilter getSearchFilter() {
|
||||||
return searchFilter;
|
return searchFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ public class ResultSetSorted implements Serializable {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchFilter(SortFilter searchFilter) {
|
public void setSearchFilter(SearchingFilter searchFilter) {
|
||||||
this.searchFilter = searchFilter;
|
this.searchFilter = searchFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class SortFilter.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Aug 6, 2021
|
|
||||||
*/
|
|
||||||
public class SortFilter implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Enum ORDER.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Aug 6, 2021
|
|
||||||
*/
|
|
||||||
public static enum ORDER {
|
|
||||||
ASC("ASCENDING"), DESC("DESCENDING");
|
|
||||||
|
|
||||||
String label;
|
|
||||||
|
|
||||||
ORDER(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -4004094263090373626L;
|
|
||||||
|
|
||||||
private RECORD_FIELD orderByField;
|
|
||||||
|
|
||||||
private ORDER order;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new sort filter.
|
|
||||||
*/
|
|
||||||
public SortFilter() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new sort filter.
|
|
||||||
*
|
|
||||||
* @param orderByField the order by field
|
|
||||||
* @param order the order
|
|
||||||
*/
|
|
||||||
public SortFilter(RECORD_FIELD orderByField, ORDER order) {
|
|
||||||
this.orderByField = orderByField;
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the order by field.
|
|
||||||
*
|
|
||||||
* @return the order by field
|
|
||||||
*/
|
|
||||||
public RECORD_FIELD getOrderByField() {
|
|
||||||
return orderByField;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the order.
|
|
||||||
*
|
|
||||||
* @return the order
|
|
||||||
*/
|
|
||||||
public ORDER getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the order by field.
|
|
||||||
*
|
|
||||||
* @param orderByField the new order by field
|
|
||||||
*/
|
|
||||||
public void setOrderByField(RECORD_FIELD orderByField) {
|
|
||||||
this.orderByField = orderByField;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the order.
|
|
||||||
*
|
|
||||||
* @param order the new order
|
|
||||||
*/
|
|
||||||
public void setOrder(ORDER order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("SortFilter [orderByField=");
|
|
||||||
builder.append(orderByField);
|
|
||||||
builder.append(", order=");
|
|
||||||
builder.append(order);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class UserRights.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 24, 2021
|
||||||
|
*/
|
||||||
|
public class UserRights implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -304157165851633221L;
|
||||||
|
|
||||||
|
private String myUsername;
|
||||||
|
|
||||||
|
private RoleRights roleRights;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new user rights.
|
||||||
|
*/
|
||||||
|
public UserRights() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserRights(String myUsername, RoleRights roleRights) {
|
||||||
|
super();
|
||||||
|
this.myUsername = myUsername;
|
||||||
|
this.roleRights = roleRights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMyUsername() {
|
||||||
|
return myUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleRights getRoleRights() {
|
||||||
|
return roleRights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyUsername(String myUsername) {
|
||||||
|
this.myUsername = myUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleRights(RoleRights roleRights) {
|
||||||
|
this.roleRights = roleRights;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("UserRights [myUsername=");
|
||||||
|
builder.append(myUsername);
|
||||||
|
builder.append(", roleRights=");
|
||||||
|
builder.append(roleRights);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -119,3 +119,30 @@ h1 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-toolbar-style {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-toolbar-style .container {
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-textbox {
|
||||||
|
padding: 4px 14px !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
font-weight: normal !important;
|
||||||
|
-webkit-border-radius: 15px;
|
||||||
|
-moz-border-radius: 15px;
|
||||||
|
border-radius: 15px !important;
|
||||||
|
width: 250px !important;
|
||||||
|
margin-top: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert_box_nav {
|
||||||
|
padding: 4px 10px !important;
|
||||||
|
margin-top: 8px !important;
|
||||||
|
margin-bottom: 10px !important;
|
||||||
|
}
|
||||||
|
|
|
@ -3,42 +3,40 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest;
|
||||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
|
||||||
|
import com.mongodb.BasicDBList;
|
||||||
|
import com.mongodb.BasicDBObject;
|
||||||
|
import com.mongodb.BasicDBObjectBuilder;
|
||||||
|
|
||||||
public class TestClass {
|
public class TestClass {
|
||||||
|
|
||||||
|
|
||||||
private static String TOKEN = "";
|
private static String TOKEN = "";
|
||||||
private static String CONTEXT ="/gcube/devsec/devVRE";
|
private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||||
|
private static String USERNAME = "francesco.mangiacrapa";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
//@Before
|
||||||
|
public void init() {
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
// LocalDateTime ldt = ConvertToServiceModel.toLocalDateTime("2020-10-01 10:20");
|
|
||||||
// System.out.println(ldt.toString());
|
|
||||||
//
|
|
||||||
// String latitudine = "-899.2986";
|
|
||||||
// // System.out.println(latitudine.matches("^[-]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
|
|
||||||
//
|
|
||||||
// String longitude = "0";
|
|
||||||
// System.out.println(longitude.matches("\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
|
|
||||||
//
|
|
||||||
// GeoportalDataEntryServiceImpl g = new GeoportalDataEntryServiceImpl();
|
|
||||||
// g.getLinksFor("", ConstantsGeoPortalDataEntryApp.RECORD_TYPE.CONCESSIONE.toString());
|
|
||||||
|
|
||||||
getListOfConcessioni();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getListOfConcessioni() throws Exception {
|
// @Test
|
||||||
|
public void getListConcessioniTest() throws Exception {
|
||||||
MongoConcessioni clientMongo = mongoConcessioni().build();
|
MongoConcessioni clientMongo = mongoConcessioni().build();
|
||||||
Iterator<Concessione> concessioni = clientMongo.getList();
|
Iterator<Concessione> concessioni = clientMongo.getList();
|
||||||
List<Concessione> listOfConcessioni = new ArrayList<Concessione>();
|
List<Concessione> listOfConcessioni = new ArrayList<Concessione>();
|
||||||
|
@ -46,13 +44,138 @@ public class TestClass {
|
||||||
while (concessioni.hasNext()) {
|
while (concessioni.hasNext()) {
|
||||||
Concessione concessione = (Concessione) concessioni.next();
|
Concessione concessione = (Concessione) concessioni.next();
|
||||||
listOfConcessioni.add(concessione);
|
listOfConcessioni.add(concessione);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Concessione concessione : listOfConcessioni) {
|
for (Concessione concessione : listOfConcessioni) {
|
||||||
System.out.println(++i+" "+concessione);
|
System.out.println(++i + " " + concessione);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void queryConcessioniTest() throws Exception {
|
||||||
|
try {
|
||||||
|
MongoConcessioni clientMongo = mongoConcessioni().build();
|
||||||
|
int offsetIndex = 0;
|
||||||
|
int limitIndex = 25;
|
||||||
|
Direction sDirection = Direction.ASCENDING;
|
||||||
|
List<String> orderByFields = Arrays.asList("nome");
|
||||||
|
|
||||||
|
Map<String, Object> searchFields = new HashMap<String, Object>();
|
||||||
|
searchFields.put("nome", "test");
|
||||||
|
searchFields.put("authors", "fra");
|
||||||
|
|
||||||
|
QueryRequest request = new QueryRequest();
|
||||||
|
PagedRequest paging = new PagedRequest();
|
||||||
|
paging.setOffset(offsetIndex);
|
||||||
|
paging.setLimit(limitIndex);
|
||||||
|
request.setPaging(paging);
|
||||||
|
|
||||||
|
OrderedRequest ordering = new OrderedRequest();
|
||||||
|
|
||||||
|
ordering.setDirection(sDirection);
|
||||||
|
|
||||||
|
ordering.setFields(orderByFields);
|
||||||
|
request.setOrdering(ordering);
|
||||||
|
|
||||||
|
Document query = null;
|
||||||
|
|
||||||
|
if (searchFields != null) {
|
||||||
|
|
||||||
|
BasicDBObjectBuilder builder = BasicDBObjectBuilder.start();
|
||||||
|
|
||||||
|
query = new Document();
|
||||||
|
|
||||||
|
for (String key : searchFields.keySet()) {
|
||||||
|
// builder.append(key, new BasicDBObject("$eq", searchFields.get(key)));
|
||||||
|
BasicDBObject bs = new BasicDBObject();
|
||||||
|
bs.append("$regex", searchFields.get(key));
|
||||||
|
bs.append("$options", "i");
|
||||||
|
builder.append(key, bs);
|
||||||
|
// query.put(key, new BasicDBObject("$eq", searchFields.get(key)));
|
||||||
|
// query = new Document(key, searchFields.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
// query.putAll(builder.get().toMap());
|
||||||
|
// request.setFilter(query);
|
||||||
|
|
||||||
|
BasicDBList list = new BasicDBList();
|
||||||
|
list.add(builder.get().toMap());
|
||||||
|
query.put("$or", list);
|
||||||
|
// or(query);
|
||||||
|
request.setFilter(query);
|
||||||
|
|
||||||
|
// ************************************************ AND
|
||||||
|
// query = new Document();
|
||||||
|
// for (String key : searchFields.keySet()) {
|
||||||
|
// //AND
|
||||||
|
// BasicDBObject bs = new BasicDBObject();
|
||||||
|
// bs.append("$regex", searchFields.get(key));
|
||||||
|
// bs.append("$options", "i");
|
||||||
|
// query.put(key, bs);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// request.setFilter(query);
|
||||||
|
// ******************************************** END AND
|
||||||
|
}
|
||||||
|
|
||||||
|
// OR
|
||||||
|
/*
|
||||||
|
* query = new Document(); BasicDBObject container = new BasicDBObject();
|
||||||
|
* BsonArray bArray = new BsonArray(); for (String key : searchFields.keySet())
|
||||||
|
* { //AND BasicDBObject bs = new BasicDBObject(); bs.append("$regex",
|
||||||
|
* searchFields.get(key)); bs.append("$options", "i"); query.put(key, bs);
|
||||||
|
*
|
||||||
|
* //container.put(key, bs);
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // BasicDBObject bs2 = new BasicDBObject(); // bs2.append("$regex",
|
||||||
|
* searchFields.get(key)); // bs2.append("$options", "i"); // BsonDocument bsK =
|
||||||
|
* new BsonDocument(); // bsK.append(key, new BsonString(bs2.toJson())); //
|
||||||
|
* bArray.add(bsK);
|
||||||
|
*
|
||||||
|
* } // query.put("$or", bArray);
|
||||||
|
*
|
||||||
|
* BasicDBList list = new BasicDBList(); list.add(query);
|
||||||
|
*
|
||||||
|
* Document orDocument = new Document(); orDocument.put("$or", list); // query =
|
||||||
|
* orDocument; request.setFilter(query);
|
||||||
|
*/
|
||||||
|
|
||||||
|
System.out.println("Paging offset: " + offsetIndex + ", limit: " + limitIndex);
|
||||||
|
System.out.println("Direction: " + sDirection);
|
||||||
|
System.out.println("Order by Fields: " + orderByFields);
|
||||||
|
System.out.println("Search for: " + query);
|
||||||
|
System.out.println("Search for Query to JSON: " + query.toJson());
|
||||||
|
|
||||||
|
Iterator<Concessione> concessioni = clientMongo.query(request);
|
||||||
|
|
||||||
|
if (concessioni.hasNext()) {
|
||||||
|
System.out.println("Found concessioni, printing them...");
|
||||||
|
} else
|
||||||
|
System.out.println("No concessione found");
|
||||||
|
|
||||||
|
if (concessioni != null) {
|
||||||
|
while (concessioni.hasNext()) {
|
||||||
|
Concessione concessione = (Concessione) concessioni.next();
|
||||||
|
System.out.println(concessione.getNome());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
// public void readUserRights() throws Exception {
|
||||||
|
// new GNARoleRitghtsConfigReader();
|
||||||
|
// List<RoleRights> listUserRights = GNARoleRitghtsConfigReader.readRoleRightsConfig();
|
||||||
|
// System.out.println(listUserRights);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue