Merge pull request 'feature_23390' (!7) from feature_23390 into master
Reviewed-on: #7
This commit is contained in:
commit
eefd49b00a
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.2.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"/>
|
||||||
|
@ -30,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.1.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.2.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.1.0-SNAPSHOT
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.2.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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,8 +22,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-entry-app-2.1.0-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="geoportal-data-entry-app-2.2.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +57,12 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +86,12 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,10 +115,15 @@
|
||||||
|
|
||||||
|
|
||||||
<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.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
<dependent-module archiveName="geoportal-data-common-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +147,12 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +176,12 @@
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,7 +205,12 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
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.2.0-SNAPSHOT] - 2022-05-25
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#23390] Implemented facility: "Clone Project"
|
||||||
|
- [#23457] Implemented the "Publish/UnPublish Project" facility
|
||||||
|
|
||||||
## [v2.1.0] - 2021-11-24
|
## [v2.1.0] - 2021-11-24
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
23
pom.xml
23
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.1.0</version>
|
<version>2.2.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>
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
<artifactId>gwt-bootstrap</artifactId>
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||||
|
@ -136,24 +137,40 @@
|
||||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>metadata-profile-discovery</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-data-common</artifactId>
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 1.5.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-client</artifactId>
|
<artifactId>geoportal-client</artifactId>
|
||||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
<version>[1.0.0, 1.0.7]</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>servlet-api</artifactId>
|
<artifactId>servlet-api</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- END FORCING -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
|
|
|
@ -24,16 +24,22 @@ import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEven
|
||||||
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.ActionPerformedOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CloneProjectEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CloneProjectEventHandler;
|
||||||
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.PublishUnPublishProjectEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.PublishUnPublishProjectEventHandler;
|
||||||
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.resource.Images;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.CloneOperationPanel;
|
||||||
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.ModalWindow;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.PublishUnPublishOperationPanel;
|
||||||
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;
|
||||||
|
@ -54,11 +60,13 @@ import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetada
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
import com.github.gwtbootstrap.client.ui.Modal;
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
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.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
|
@ -108,7 +116,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
private UserRights myRights = null;
|
private UserRights myRights = null;
|
||||||
|
|
||||||
private LoaderIcon loader = new LoaderIcon("Loading Application...");
|
private LoaderIcon loader = new LoaderIcon("Loading Application...");
|
||||||
|
|
||||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
||||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
||||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
||||||
|
@ -120,225 +128,114 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
||||||
|
|
||||||
/*GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new AsyncCallback<List<ItemField>>() {
|
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||||
|
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<ItemField> result) {
|
|
||||||
|
|
||||||
for (ItemField itemField : result) {
|
|
||||||
if(itemField.isDisplayAsResult()) {
|
|
||||||
displayFields.add(itemField);
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(
|
String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
||||||
"Sorry, an error occurrend when loading configurations. 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
|
@Override
|
||||||
public void onSuccess(GeonaISConfig result) {
|
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
||||||
|
|
||||||
if (result != null && result.getGenericResourceSecondaryType() != null
|
try {
|
||||||
&& result.getScope() != null) {
|
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||||
callGetMetadataProfiles(result.getScope(), result.getGenericResourceSecondaryType());
|
} 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
|
} else
|
||||||
Window.alert(
|
msg += "Member";
|
||||||
"Sorry, no configuration found in the context. Please, contact the support");
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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() {
|
private void initGUI() {
|
||||||
|
@ -657,7 +554,243 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
mainTabPanel.showListOfConcessioniView(grpw);
|
mainTabPanel.showListOfConcessioniView(grpw);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
appManagerBus.addHandler(PublishUnPublishProjectEvent.TYPE, new PublishUnPublishProjectEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPublishingUnPublishingOperation(PublishUnPublishProjectEvent publishUnPublishEvent) {
|
||||||
|
|
||||||
|
if (publishUnPublishEvent.getConcessione() != null) {
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true);
|
||||||
|
modal.setCloseVisible(false);
|
||||||
|
String title = publishUnPublishEvent.getOperation().getTitle() + " the project..";
|
||||||
|
String msg = "Trying to " + publishUnPublishEvent.getOperation().getTitle()
|
||||||
|
+ " the project, please wait...";
|
||||||
|
modal.setTitle(title);
|
||||||
|
modal.hide(false);
|
||||||
|
modal.setWidth(800);
|
||||||
|
modal.setMaxHeigth("650px");
|
||||||
|
AlertBlock alertConcessioneSource = new AlertBlock(AlertType.INFO);
|
||||||
|
alertConcessioneSource.setClose(false);
|
||||||
|
alertConcessioneSource.setHTML(publishUnPublishEvent.getConcessione().getNome());
|
||||||
|
alertConcessioneSource.getElement().getStyle().setMarginBottom(20, Unit.PX);
|
||||||
|
final VerticalPanel modalContainerPanel = new VerticalPanel();
|
||||||
|
final LoaderIcon loader = new LoaderIcon();
|
||||||
|
loader.setText(msg);
|
||||||
|
modalContainerPanel.add(alertConcessioneSource);
|
||||||
|
modalContainerPanel.add(loader);
|
||||||
|
modal.add(modalContainerPanel);
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().publishUpublishRecord(
|
||||||
|
publishUnPublishEvent.getConcessione().getItemId(), publishUnPublishEvent.getOperation(),
|
||||||
|
new AsyncCallback<CommitReport>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
modalContainerPanel.clear();
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
try {
|
||||||
|
modal.remove(loader);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
Alert alert = new Alert(caught.getMessage());
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
modal.add(alert);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommitReport result) {
|
||||||
|
modalContainerPanel.clear();
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
ValidationReportDV vr = result.getValidationReportDV();
|
||||||
|
|
||||||
|
HTML messageHTML = new HTML();
|
||||||
|
|
||||||
|
// here the record has been published
|
||||||
|
if (vr != null) {
|
||||||
|
|
||||||
|
switch (vr.getStatus()) {
|
||||||
|
case PASSED:
|
||||||
|
String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null,
|
||||||
|
"SUCCESS");
|
||||||
|
messageHTML.setHTML("Record Published with " + success);
|
||||||
|
projectSavedWithSuccess = true;
|
||||||
|
String msg = "Record published with success";
|
||||||
|
geoNaMainForm.showAlertOnSaveAction(msg, AlertType.SUCCESS, true);
|
||||||
|
purgeFileUploaded();
|
||||||
|
break;
|
||||||
|
case WARNING:
|
||||||
|
String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null,
|
||||||
|
"WARNING");
|
||||||
|
messageHTML.setHTML("Record Published with " + warning);
|
||||||
|
geoNaMainForm.enableButtonSave(true);
|
||||||
|
break;
|
||||||
|
case ERROR:
|
||||||
|
String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
|
||||||
|
"ERROR");
|
||||||
|
messageHTML.setHTML(error + " on publishing the Record");
|
||||||
|
geoNaMainForm.enableButtonSave(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
modalContainerPanel.add(messageHTML);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// here the record has been unpublished
|
||||||
|
messageHTML.setHTML(result.getMessageToDisplay());
|
||||||
|
modalContainerPanel.add(messageHTML);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.getMongoId() != null) {
|
||||||
|
modalContainerPanel.add(new HTML("Record id: " + (result.getMongoId())));
|
||||||
|
|
||||||
|
// Reloading list of Concessioni
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
|
mainTabPanel.getCurrentSortFilter()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// geoNaMainForm.enableButtonSave(true);
|
||||||
|
// resetUI();
|
||||||
|
|
||||||
|
if (vr.getAsJSONString() != null) {
|
||||||
|
modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString(), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
appManagerBus.addHandler(CloneProjectEvent.TYPE, new CloneProjectEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCloningProject(CloneProjectEvent cloneProject) {
|
||||||
|
|
||||||
|
if (cloneProject.getConcessione() != null) {
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true);
|
||||||
|
modal.setCloseVisible(false);
|
||||||
|
String title = "Cloning";
|
||||||
|
String msg = "Trying to clone";
|
||||||
|
if (cloneProject.isPublishProject()) {
|
||||||
|
title += " and Publishing";
|
||||||
|
msg += " and publish";
|
||||||
|
}
|
||||||
|
title += " the project..";
|
||||||
|
msg += " as new project, please wait...";
|
||||||
|
|
||||||
|
modal.setTitle(title);
|
||||||
|
modal.hide(false);
|
||||||
|
modal.setWidth(800);
|
||||||
|
modal.setMaxHeigth("650px");
|
||||||
|
AlertBlock alertConcessioneSource = new AlertBlock(AlertType.INFO);
|
||||||
|
alertConcessioneSource.setClose(false);
|
||||||
|
alertConcessioneSource.setHTML(cloneProject.getConcessione().getNome());
|
||||||
|
alertConcessioneSource.getElement().getStyle().setMarginBottom(20, Unit.PX);
|
||||||
|
final VerticalPanel modalContainerPanel = new VerticalPanel();
|
||||||
|
final LoaderIcon loader = new LoaderIcon();
|
||||||
|
loader.setText(msg);
|
||||||
|
modalContainerPanel.add(alertConcessioneSource);
|
||||||
|
modalContainerPanel.add(loader);
|
||||||
|
modal.add(modalContainerPanel);
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().cloneTheRecord(
|
||||||
|
cloneProject.getConcessione().getItemId(), cloneProject.getNewProjectName(),
|
||||||
|
cloneProject.isPublishProject(), new AsyncCallback<CommitReport>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
modalContainerPanel.clear();
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
try {
|
||||||
|
modal.remove(loader);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
Alert alert = new Alert(caught.getMessage());
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
modal.add(alert);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommitReport result) {
|
||||||
|
modalContainerPanel.clear();
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
ValidationReportDV vr = result.getValidationReportDV();
|
||||||
|
|
||||||
|
HTML messageHTML = new HTML();
|
||||||
|
|
||||||
|
// here the record has been cloned and published
|
||||||
|
if (vr != null) {
|
||||||
|
|
||||||
|
switch (vr.getStatus()) {
|
||||||
|
case PASSED:
|
||||||
|
String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null,
|
||||||
|
"SUCCESS");
|
||||||
|
messageHTML.setHTML("Record Cloned and Published with " + success);
|
||||||
|
projectSavedWithSuccess = true;
|
||||||
|
String msg = "Record published with success";
|
||||||
|
geoNaMainForm.showAlertOnSaveAction(msg, AlertType.SUCCESS, true);
|
||||||
|
purgeFileUploaded();
|
||||||
|
break;
|
||||||
|
case WARNING:
|
||||||
|
String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null,
|
||||||
|
"WARNING");
|
||||||
|
messageHTML.setHTML("Record Cloned and Published with " + warning);
|
||||||
|
geoNaMainForm.enableButtonSave(true);
|
||||||
|
break;
|
||||||
|
case ERROR:
|
||||||
|
String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
|
||||||
|
"ERROR");
|
||||||
|
messageHTML.setHTML(error + " on cloning and publishing the Record");
|
||||||
|
geoNaMainForm.enableButtonSave(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
modalContainerPanel.add(messageHTML);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// here the record has been just cloned (not published)
|
||||||
|
messageHTML.setHTML(result.getMessageToDisplay());
|
||||||
|
modalContainerPanel.add(messageHTML);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.getMongoId() != null) {
|
||||||
|
modalContainerPanel.add(new HTML("Record id: " + (result.getMongoId())));
|
||||||
|
|
||||||
|
// Reloading list of Concessioni
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
|
mainTabPanel.getCurrentSortFilter()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// geoNaMainForm.enableButtonSave(true);
|
||||||
|
// resetUI();
|
||||||
|
|
||||||
|
if (vr.getAsJSONString() != null) {
|
||||||
|
modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString(), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -731,40 +864,44 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
final ConcessioneDV concessione = (ConcessioneDV) item;
|
final ConcessioneDV concessione = (ConcessioneDV) item;
|
||||||
GWT.log("onDoActionFired item: " + concessione);
|
GWT.log("onDoActionFired item: " + concessione);
|
||||||
|
|
||||||
// Checking if the user is NOT authorized to perform this action in two ways:
|
// 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;
|
// 1. the map of actions allowed for the user does not contain the action;
|
||||||
RoleRights roleRights = myRights.getRoleRights();
|
RoleRights roleRights = myRights.getRoleRights();
|
||||||
OPERATION_TYPE operationType = roleRights.getListPermessions().get(action);
|
OPERATION_TYPE operationType = roleRights.getListPermessions().get(action);
|
||||||
boolean allowedOperationForUser = operationType != null? true:false;
|
boolean allowedOperationForUser = operationType != null ? true : false;
|
||||||
if (!allowedOperationForUser) {
|
if (!allowedOperationForUser) {
|
||||||
|
|
||||||
String msg = "You are not authorized to perform the action: "+ action.getLabel();
|
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);
|
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
|
||||||
|
"Forbidden: " + action, msg, AlertType.WARNING);
|
||||||
modalW.show();
|
modalW.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 2. the user cannot access to action (e.g. the user cannot write an item of another user)
|
// 2. the user cannot access to action (e.g. the user cannot write an item of
|
||||||
|
// another user)
|
||||||
// if so an error is shown
|
// if so an error is shown
|
||||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||||
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType, concessione);
|
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType,
|
||||||
|
concessione);
|
||||||
if (!allowedWriteActionOnItem) {
|
if (!allowedWriteActionOnItem) {
|
||||||
String title = "Forbidden: missing write access";
|
String title = "Forbidden: missing write access";
|
||||||
String msg = "You do not have write access to item: "+ concessione.getNome();
|
String msg = "You do not have write access to item: " + concessione.getNome();
|
||||||
if(!userRole.isWriteOwn()) {
|
if (!userRole.isWriteOwn()) {
|
||||||
msg = "You do not have write access to item: "+ concessione.getNome();
|
msg = "You do not have write access to item: " + concessione.getNome();
|
||||||
}else if (!userRole.isWriteAny()){
|
} else if (!userRole.isWriteAny()) {
|
||||||
title = "Forbidden: missing ownership";
|
title = "Forbidden: missing ownership";
|
||||||
msg = "You are not the creator of: "+ concessione.getNome() +". You cannot access to it";
|
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);
|
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), title, msg,
|
||||||
|
AlertType.WARNING);
|
||||||
modalW.show();
|
modalW.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VIEW_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();
|
||||||
|
@ -798,8 +935,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal.show();
|
modal.show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case VIEW_REPORT:
|
case VIEW_REPORT: {
|
||||||
|
|
||||||
final Modal modal2 = new Modal(true, true);
|
final Modal modal2 = new Modal(true, true);
|
||||||
modal2.setTitle(
|
modal2.setTitle(
|
||||||
|
@ -817,8 +955,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal2.show();
|
modal2.show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case EDIT_PROJECT:
|
case EDIT_PROJECT: {
|
||||||
final Modal modal3 = new Modal(true, true);
|
final Modal modal3 = new Modal(true, true);
|
||||||
modal3.setTitle(
|
modal3.setTitle(
|
||||||
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
|
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
|
||||||
|
@ -833,12 +972,48 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal3.add(emr);
|
modal3.add(emr);
|
||||||
modal3.show();
|
modal3.show();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// case UPDATED_PROJECT:
|
// case UPDATED_PROJECT:
|
||||||
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
// mainTabPanel.getCurrentSortFilter()));
|
// mainTabPanel.getCurrentSortFilter()));
|
||||||
// break;
|
// break;
|
||||||
case DELETE_PROJECT:
|
|
||||||
|
case CLONE_PROJECT: {
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true, true);
|
||||||
|
modal.setTitle("Creating a copy of the project...");
|
||||||
|
modal.setWidth(950);
|
||||||
|
// modal.setHeight("600px");
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
((Element) modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
|
||||||
|
|
||||||
|
CloneOperationPanel clonePanel = new CloneOperationPanel(appManagerBus, concessione);
|
||||||
|
|
||||||
|
modal.add(clonePanel);
|
||||||
|
modal.show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case PUBLISH_UNPUBLISH_PROJECT: {
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true, true);
|
||||||
|
modal.setTitle("Publishing or UnPublishing the project...");
|
||||||
|
modal.setWidth(950);
|
||||||
|
// modal.setHeight("600px");
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
((Element) modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
|
||||||
|
|
||||||
|
PublishUnPublishOperationPanel pubUnpubPanel = new PublishUnPublishOperationPanel(
|
||||||
|
appManagerBus, concessione);
|
||||||
|
|
||||||
|
modal.add(pubUnpubPanel);
|
||||||
|
modal.show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
case DELETE_PROJECT: {
|
||||||
|
|
||||||
String htmlMsg = "Going to delete the project with:";
|
String htmlMsg = "Going to delete the project with:";
|
||||||
htmlMsg += "<ul>";
|
htmlMsg += "<ul>";
|
||||||
|
@ -895,6 +1070,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal.show();
|
modal.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -907,8 +1083,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkAccessToOperationType(GcubeUserRole userRole, OPERATION_TYPE allowedAction, ConcessioneDV concessione) {
|
private boolean checkAccessToOperationType(GcubeUserRole userRole, OPERATION_TYPE allowedAction,
|
||||||
|
ConcessioneDV concessione) {
|
||||||
|
|
||||||
boolean writeAnyAPassed = false;
|
boolean writeAnyAPassed = false;
|
||||||
boolean writeOwnPassed = false;
|
boolean writeOwnPassed = false;
|
||||||
|
@ -924,37 +1101,37 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
String ownerUser = concessione.getCreationUser();
|
String ownerUser = concessione.getCreationUser();
|
||||||
if (ownerUser == null || ownerUser.isEmpty()) {
|
if (ownerUser == null || ownerUser.isEmpty()) {
|
||||||
writeOwnPassed = false;
|
writeOwnPassed = false;
|
||||||
}else if (ownerUser.compareTo(myRights.getMyUsername()) == 0) {
|
} else if (ownerUser.compareTo(myRights.getMyUsername()) == 0) {
|
||||||
// if my username is equal the owner of the concessione
|
// if my username is equal the owner of the concessione
|
||||||
writeOwnPassed = true;
|
writeOwnPassed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean operationAllowed = false;
|
boolean operationAllowed = false;
|
||||||
switch (allowedAction) {
|
switch (allowedAction) {
|
||||||
case READ:
|
case READ:
|
||||||
//Access to READ operation is allowed to everyone
|
// Access to READ operation is allowed to everyone
|
||||||
operationAllowed = true;
|
operationAllowed = true;
|
||||||
GWT.log(OPERATION_TYPE.READ+ " ALLOWED? "+operationAllowed);
|
GWT.log(OPERATION_TYPE.READ + " ALLOWED? " + operationAllowed);
|
||||||
break;
|
break;
|
||||||
case READ_WRITE:
|
case READ_WRITE:
|
||||||
//Access to READ_WRITE operation
|
// Access to READ_WRITE operation
|
||||||
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||||
GWT.log(OPERATION_TYPE.READ_WRITE+ " ALLOWED? "+operationAllowed);
|
GWT.log(OPERATION_TYPE.READ_WRITE + " ALLOWED? " + operationAllowed);
|
||||||
break;
|
break;
|
||||||
case WRITE:
|
case WRITE:
|
||||||
//Access to WRITE operation
|
// Access to WRITE operation
|
||||||
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||||
GWT.log(OPERATION_TYPE.WRITE+ " ALLOWED? "+operationAllowed);
|
GWT.log(OPERATION_TYPE.WRITE + " ALLOWED? " + operationAllowed);
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:
|
case UNKNOWN:
|
||||||
operationAllowed = false;
|
operationAllowed = false;
|
||||||
GWT.log(OPERATION_TYPE.UNKNOWN+ " ALLOWED? "+operationAllowed);
|
GWT.log(OPERATION_TYPE.UNKNOWN + " ALLOWED? " + operationAllowed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationAllowed;
|
return operationAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
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.PUBLISHING_UNPUBLISHING_OPERATION;
|
||||||
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;
|
||||||
|
@ -139,4 +140,27 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
|
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newProjectName the new project name
|
||||||
|
* @param publishTheProject the publish the project
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
CommitReport cloneTheRecord(String itemId, String newProjectName, boolean publishTheProject) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish upublish project.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newProjectName the new project name
|
||||||
|
* @param publishTheProject the publish the project
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
CommitReport publishUpublishRecord(String itemId, PUBLISHING_UNPUBLISHING_OPERATION operation) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
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.PUBLISHING_UNPUBLISHING_OPERATION;
|
||||||
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;
|
||||||
|
@ -63,4 +64,10 @@ public interface GeoportalDataEntryServiceAsync {
|
||||||
|
|
||||||
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
||||||
|
|
||||||
|
void cloneTheRecord(String itemId, String newProjectName, boolean publishTheProject,
|
||||||
|
AsyncCallback<CommitReport> callback);
|
||||||
|
|
||||||
|
void publishUpublishRecord(String itemId, PUBLISHING_UNPUBLISHING_OPERATION operation,
|
||||||
|
AsyncCallback<CommitReport> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CloneProjectEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 26, 2022
|
||||||
|
*/
|
||||||
|
public class CloneProjectEvent extends GwtEvent<CloneProjectEventHandler> {
|
||||||
|
|
||||||
|
/** The type. */
|
||||||
|
public static Type<CloneProjectEventHandler> TYPE = new Type<CloneProjectEventHandler>();
|
||||||
|
private ConcessioneDV concessione;
|
||||||
|
private String newProjectName;
|
||||||
|
private boolean publishProject;
|
||||||
|
|
||||||
|
public CloneProjectEvent(ConcessioneDV concessione, String newProjectName, boolean publishProject) {
|
||||||
|
this.concessione = concessione;
|
||||||
|
this.newProjectName = newProjectName;
|
||||||
|
this.publishProject = publishProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<CloneProjectEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(CloneProjectEventHandler handler) {
|
||||||
|
handler.onCloningProject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConcessioneDV getConcessione() {
|
||||||
|
return concessione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewProjectName() {
|
||||||
|
return newProjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPublishProject() {
|
||||||
|
return publishProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface CloneProjectEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2022
|
||||||
|
*/
|
||||||
|
public interface CloneProjectEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On cloning project.
|
||||||
|
*
|
||||||
|
* @param cloneProject the clone project
|
||||||
|
*/
|
||||||
|
void onCloningProject(CloneProjectEvent cloneProject);
|
||||||
|
}
|
|
@ -2,23 +2,18 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
|
||||||
/**
|
/**
|
||||||
* The Class CreateNewProjectEvent.
|
* The Class CreateNewProjectEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 13, 2020
|
* Oct 13, 2020
|
||||||
*/
|
*/
|
||||||
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
|
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
|
||||||
|
|
||||||
/** The type. */
|
/** The type. */
|
||||||
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new cancel upload event.
|
|
||||||
*/
|
|
||||||
public CreateNewProjectEvent() {
|
public CreateNewProjectEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +22,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
||||||
*
|
*
|
||||||
* @return the associated type
|
* @return the associated type
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,8 +37,12 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
||||||
*
|
*
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||||
|
* EventHandler)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(CreateNewProjectEventHandler handler) {
|
protected void dispatch(CreateNewProjectEventHandler handler) {
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.PUBLISHING_UNPUBLISHING_OPERATION;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
public class PublishUnPublishProjectEvent extends GwtEvent<PublishUnPublishProjectEventHandler> {
|
||||||
|
|
||||||
|
/** The type. */
|
||||||
|
public static Type<PublishUnPublishProjectEventHandler> TYPE = new Type<PublishUnPublishProjectEventHandler>();
|
||||||
|
private ConcessioneDV concessione;
|
||||||
|
private PUBLISHING_UNPUBLISHING_OPERATION operation;
|
||||||
|
|
||||||
|
public PublishUnPublishProjectEvent(ConcessioneDV concessione, PUBLISHING_UNPUBLISHING_OPERATION operation) {
|
||||||
|
this.concessione = concessione;
|
||||||
|
this.operation = operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<PublishUnPublishProjectEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(PublishUnPublishProjectEventHandler handler) {
|
||||||
|
handler.onPublishingUnPublishingOperation(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConcessioneDV getConcessione() {
|
||||||
|
return concessione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PUBLISHING_UNPUBLISHING_OPERATION getOperation() {
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface PublishUnPublishProjectEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2022
|
||||||
|
*/
|
||||||
|
public interface PublishUnPublishProjectEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On publishing un publishing operation.
|
||||||
|
*
|
||||||
|
* @param publishUnPublishProjectEvent the publish un publish project event
|
||||||
|
*/
|
||||||
|
void onPublishingUnPublishingOperation(PublishUnPublishProjectEvent publishUnPublishProjectEvent);
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CloneProjectEvent;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class CloneOperationPanel extends Composite {
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox projectNameTextBox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoBlock;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoProjectName;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button submitButton;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
CheckBox checkBoxPublish;
|
||||||
|
|
||||||
|
private static CloneOperationPanelUiBinder uiBinder = GWT.create(CloneOperationPanelUiBinder.class);
|
||||||
|
|
||||||
|
interface CloneOperationPanelUiBinder extends UiBinder<Widget, CloneOperationPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
public CloneOperationPanel(HandlerManager eventBus, ConcessioneDV concessione) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
GWT.log("Cloning the: " + concessione);
|
||||||
|
this.appManagerBus = eventBus;
|
||||||
|
this.selectedProject = concessione;
|
||||||
|
infoProjectName.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setEnabled(false);
|
||||||
|
|
||||||
|
submitButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
boolean isValid = checkIsValidForm();
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
appManagerBus.fireEvent(new CloneProjectEvent(selectedProject, projectNameTextBox.getText(), checkBoxPublish.getValue()));
|
||||||
|
submitButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkBoxPublish.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
if(checkBoxPublish.getValue()) {
|
||||||
|
submitButton.setText("Clone and Publish as New Project");
|
||||||
|
}else
|
||||||
|
submitButton.setText("Clone as New Project");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConcessioneDV selectedProject;
|
||||||
|
|
||||||
|
protected boolean checkIsValidForm() {
|
||||||
|
String text = projectNameTextBox.getText();
|
||||||
|
if (text == null || text.isEmpty()) {
|
||||||
|
infoBlock.setVisible(true);
|
||||||
|
infoBlock.setText("The Project's name cannot be empty!");
|
||||||
|
infoBlock.setType(AlertType.ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.form-main-style {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fieldset-border-style {
|
||||||
|
border: 1px groove #444 !important;
|
||||||
|
box-shadow: 0px 0px 0px 0px #000 !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
margin: 5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-style {
|
||||||
|
width: auto !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
border-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@external .form-horizontal .input-large;
|
||||||
|
.form-horizontal .input-large {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-alert-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-save-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-top-20 {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||||
|
ui:field="form">
|
||||||
|
<b:AlertBlock type="INFO" animation="true" close="false"
|
||||||
|
ui:field="infoProjectName" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||||
|
|
||||||
|
<b:Legend styleName="{style.legend-style}">
|
||||||
|
Clone Project
|
||||||
|
<small>
|
||||||
|
<span style="color:red;">*</span>
|
||||||
|
is required
|
||||||
|
</small>
|
||||||
|
</b:Legend>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel for="name" title="Item Name">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Name :
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE"
|
||||||
|
placeholder="Type the project name.." b:id="url"
|
||||||
|
title="Project's name" ui:field="projectNameTextBox" />
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel for="publish" title="Publish">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Publish :
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:CheckBox ui:field="checkBoxPublish">the Project in GNA</b:CheckBox>
|
||||||
|
</b:Controls>
|
||||||
|
<g:HTMLPanel styleName="{style.margin-top-20}">
|
||||||
|
<g:HTML>By selecting "Publish", the Project will be cloned and
|
||||||
|
published in GNA (the centroid of the layer/s will be
|
||||||
|
calculated
|
||||||
|
and
|
||||||
|
selectable by GNA (Map) Viewer). No otherwise, the
|
||||||
|
Project will
|
||||||
|
just be cloned and available for editing in the GNA
|
||||||
|
Data Entry.</g:HTML>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<!-- Alert blocks for info/errors -->
|
||||||
|
<b:AlertBlock type="INFO" animation="true"
|
||||||
|
visible="false" close="false" ui:field="infoBlock"
|
||||||
|
styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
|
||||||
|
<g:FlowPanel>
|
||||||
|
<b:Button title="Submit" ui:field="submitButton"
|
||||||
|
visible="true" type="PRIMARY"
|
||||||
|
addStyleNames="{style.button-save-style}">Clone as New Project</b:Button>
|
||||||
|
</g:FlowPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -125,6 +125,12 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
NavLink navEditMode;
|
NavLink navEditMode;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
NavLink navCloneProject;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
NavLink navPublishUnPublishProject;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
NavLink navDelete;
|
NavLink navDelete;
|
||||||
|
|
||||||
|
@ -133,7 +139,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button resetSearch;
|
Button resetSearch;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Label roleLabel;
|
Label roleLabel;
|
||||||
|
|
||||||
|
@ -173,7 +179,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
|
|
||||||
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
||||||
alertSortBy.setText(toLabelFilter((initialSortFilter.getOrderByFields().get(0)), initialSortFilter.getOrder()));
|
alertSortBy.setText(toLabelFilter((initialSortFilter.getOrderByFields().get(0)), initialSortFilter.getOrder()));
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||||
resetSearch.setType(ButtonType.LINK);
|
resetSearch.setType(ButtonType.LINK);
|
||||||
|
@ -310,6 +316,34 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
navCloneProject.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
List<ConcessioneDV> listConcessioni = null;
|
||||||
|
if (grpw != null && grpw.getSelectItems() != null) {
|
||||||
|
listConcessioni = grpw.getSelectItems();
|
||||||
|
}
|
||||||
|
appManagerBus
|
||||||
|
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.CLONE_PROJECT));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
navPublishUnPublishProject.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
List<ConcessioneDV> listConcessioni = null;
|
||||||
|
if (grpw != null && grpw.getSelectItems() != null) {
|
||||||
|
listConcessioni = grpw.getSelectItems();
|
||||||
|
}
|
||||||
|
appManagerBus.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni,
|
||||||
|
ACTION_ON_ITEM.PUBLISH_UNPUBLISH_PROJECT));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
navDelete.addClickHandler(new ClickHandler() {
|
navDelete.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -347,7 +381,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleLabel(String msg) {
|
public void setRoleLabel(String msg) {
|
||||||
roleLabel.setText(msg);
|
roleLabel.setText(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,11 @@
|
||||||
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
|
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
|
||||||
<b:NavLink ui:field="navEditMode" title="Edit"
|
<b:NavLink ui:field="navEditMode" title="Edit"
|
||||||
icon="PENCIL">Edit</b:NavLink>
|
icon="PENCIL">Edit</b:NavLink>
|
||||||
|
<b:NavLink ui:field="navCloneProject"
|
||||||
|
title="Clone Project" icon="COPY">Clone Project</b:NavLink>
|
||||||
|
<b:NavLink ui:field="navPublishUnPublishProject"
|
||||||
|
title="Publish or UnPublish Project" icon="STACKEXCHANGE">Publish/UnPublish
|
||||||
|
Project</b:NavLink>
|
||||||
<b:NavLink ui:field="navDelete" title="Delete Project"
|
<b:NavLink ui:field="navDelete" title="Delete Project"
|
||||||
icon="TRASH">Delete Project</b:NavLink>
|
icon="TRASH">Delete Project</b:NavLink>
|
||||||
</b:NavPills>
|
</b:NavPills>
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.PublishUnPublishProjectEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.shared.PUBLISHING_UNPUBLISHING_OPERATION;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class PublishUnPublishOperationPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2022
|
||||||
|
*/
|
||||||
|
public class PublishUnPublishOperationPanel extends Composite {
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox projectNameTextBox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoBlock;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoProjectName;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button submitButton;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ListBox listBoxPublisUnPublish;
|
||||||
|
|
||||||
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
private ConcessioneDV selectedProject;
|
||||||
|
|
||||||
|
private static PublishUnPublishOperationPanelUiBinder uiBinder = GWT
|
||||||
|
.create(PublishUnPublishOperationPanelUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface PublishUnPublishOperationPanelUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 1, 2022
|
||||||
|
*/
|
||||||
|
interface PublishUnPublishOperationPanelUiBinder extends UiBinder<Widget, PublishUnPublishOperationPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new publish un publish operation panel.
|
||||||
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
|
* @param concessione the concessione
|
||||||
|
*/
|
||||||
|
public PublishUnPublishOperationPanel(HandlerManager eventBus, ConcessioneDV concessione) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.appManagerBus = eventBus;
|
||||||
|
this.selectedProject = concessione;
|
||||||
|
infoProjectName.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setEnabled(false);
|
||||||
|
|
||||||
|
listBoxPublisUnPublish.addItem(PUBLISHING_UNPUBLISHING_OPERATION.PUBLISH.name(),
|
||||||
|
PUBLISHING_UNPUBLISHING_OPERATION.PUBLISH.getTitle());
|
||||||
|
listBoxPublisUnPublish.addItem(PUBLISHING_UNPUBLISHING_OPERATION.UNPUBLISH.name(),
|
||||||
|
PUBLISHING_UNPUBLISHING_OPERATION.UNPUBLISH.getTitle());
|
||||||
|
|
||||||
|
submitButton.setText("Confirm " + listBoxPublisUnPublish.getSelectedValue());
|
||||||
|
|
||||||
|
listBoxPublisUnPublish.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
submitButton.setText("Confirm " + listBoxPublisUnPublish.getSelectedValue());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
submitButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
appManagerBus.fireEvent(new PublishUnPublishProjectEvent(selectedProject,
|
||||||
|
PUBLISHING_UNPUBLISHING_OPERATION.valueOf(listBoxPublisUnPublish.getSelectedValue().toUpperCase())));
|
||||||
|
submitButton.setEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.form-main-style {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fieldset-border-style {
|
||||||
|
border: 1px groove #444 !important;
|
||||||
|
box-shadow: 0px 0px 0px 0px #000 !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
margin: 5px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-style {
|
||||||
|
width: auto !important;
|
||||||
|
padding: 10px !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
border-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@external .form-horizontal .input-large;
|
||||||
|
.form-horizontal .input-large {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-alert-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-save-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-top-20 {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||||
|
ui:field="form">
|
||||||
|
<b:AlertBlock type="INFO" animation="true" close="false"
|
||||||
|
ui:field="infoProjectName" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||||
|
|
||||||
|
<b:Legend styleName="{style.legend-style}">
|
||||||
|
Publish/UnPublish Project
|
||||||
|
<small>
|
||||||
|
<span style="color:red;">*</span>
|
||||||
|
is required
|
||||||
|
</small>
|
||||||
|
</b:Legend>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel for="name" title="Item Name">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Name :
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE" b:id="name"
|
||||||
|
title="Project's name" ui:field="projectNameTextBox" />
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel for="publish" title="Publish">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Operation :
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:ListBox ui:field="listBoxPublisUnPublish"></b:ListBox>
|
||||||
|
</b:Controls>
|
||||||
|
<g:HTMLPanel styleName="{style.margin-top-20}">
|
||||||
|
<g:HTML>By selecting "Publish", the Project will
|
||||||
|
be published in
|
||||||
|
GNA
|
||||||
|
(the centroid of the layer/s will be
|
||||||
|
calculated
|
||||||
|
and
|
||||||
|
selectable by
|
||||||
|
GNA
|
||||||
|
(Map) Viewer)</g:HTML>
|
||||||
|
<g:HTML>By selecting "UnPublish"
|
||||||
|
the Project will be
|
||||||
|
unpublished
|
||||||
|
from
|
||||||
|
GNA and the centroid of the layer/s will be
|
||||||
|
removed and not
|
||||||
|
selectable by GNA
|
||||||
|
(Map) Viewer</g:HTML>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<!-- Alert blocks for info/errors -->
|
||||||
|
<b:AlertBlock type="INFO" animation="true"
|
||||||
|
visible="false" close="false" ui:field="infoBlock"
|
||||||
|
styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
|
||||||
|
<g:FlowPanel>
|
||||||
|
<b:Button title="Submit" ui:field="submitButton"
|
||||||
|
visible="true" type="PRIMARY"
|
||||||
|
addStyleNames="{style.button-save-style}">Confirm</b:Button>
|
||||||
|
</g:FlowPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.ConcessioniUtils;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
||||||
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.legacy.Concessione.Paths;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
|
||||||
|
@ -40,6 +41,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtConfigProfile;
|
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.PUBLISHING_UNPUBLISHING_OPERATION;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
|
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
|
||||||
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;
|
||||||
|
@ -66,6 +68,7 @@ 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);
|
||||||
|
// private String mongoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA data entry config profile.
|
* Gets the GNA data entry config profile.
|
||||||
|
@ -78,7 +81,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
GNADataEntryConfigProfile profile = SessionUtil.getGNADataEntryConfigProfile(getThreadLocalRequest());
|
GNADataEntryConfigProfile profile = SessionUtil.getGNADataEntryConfigProfile(getThreadLocalRequest());
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
||||||
//to be sure
|
// to be sure
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GeoportalCommon gCommon = new GeoportalCommon();
|
GeoportalCommon gCommon = new GeoportalCommon();
|
||||||
profile = gCommon.readGNADataEntryConfig();
|
profile = gCommon.readGNADataEntryConfig();
|
||||||
|
@ -381,6 +384,129 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newProjectName the new project name
|
||||||
|
* @param publishTheProject the publish the project
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommitReport cloneTheRecord(String itemId, String newProjectName, boolean publishTheProject)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
LOG.info("cloneTheRecord called with itemId: " + itemId + ", newProjectName: " + newProjectName
|
||||||
|
+ ", publishTheProject: " + publishTheProject);
|
||||||
|
|
||||||
|
Concessione concessioneNew = null;
|
||||||
|
// to client
|
||||||
|
CommitReport cRep = null;
|
||||||
|
try {
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
// TO be sure
|
||||||
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
|
concessioneNew = ConcessioniUtils.clone(clientMongo, concessione.getMongo_id());
|
||||||
|
LOG.info("Project with id: " + concessioneNew.getMongo_id() + " cloned");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error occurred during cloning the project with id: " + itemId, e);
|
||||||
|
throw new Exception("Sorry an error occurred during cloning the Project. Refresh and try again");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
cRep = new CommitReport();
|
||||||
|
cRep.setMongoId(concessioneNew.getMongo_id());
|
||||||
|
|
||||||
|
if (publishTheProject) {
|
||||||
|
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
// Publishing cloned Concessione
|
||||||
|
concessioneNew = clientMongo.publish(concessioneNew.getMongo_id());
|
||||||
|
LOG.info("Project with id: " + concessioneNew.getMongo_id() + " published");
|
||||||
|
cRep.setMessageToDisplay("The project " + concessioneNew.getNome() + " has been cloned and published");
|
||||||
|
// server report
|
||||||
|
ValidationReport report = concessioneNew.getReport();
|
||||||
|
LOG.info("ValidationReport: " + report);
|
||||||
|
// cRep.setRecordId(concessione.getId());
|
||||||
|
cRep.setMongoId(concessioneNew.getMongo_id());
|
||||||
|
ValidationReportDV vr = ConvertToDataViewModel.toValidationReport(report);
|
||||||
|
cRep.setValidationReportDV(vr);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cRep.setMessageToDisplay("The project " + concessioneNew.getNome() + " has been cloned correctly");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cRep;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error occurred during publishing the project with id: " + itemId, e);
|
||||||
|
throw new Exception("Sorry an error occurred during publishing the Project. Refresh and try again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish upublish record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param operation the operation
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommitReport publishUpublishRecord(String itemId, PUBLISHING_UNPUBLISHING_OPERATION operation)
|
||||||
|
throws Exception {
|
||||||
|
LOG.info("publishUpublishRecord called with itemId: " + itemId + ", operation: " + operation);
|
||||||
|
|
||||||
|
// to client
|
||||||
|
CommitReport cRep = new CommitReport();
|
||||||
|
|
||||||
|
try {
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
// TO be sure
|
||||||
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
|
|
||||||
|
switch (operation) {
|
||||||
|
|
||||||
|
case PUBLISH: {
|
||||||
|
Concessione concessioneNew = clientMongo.publish(concessione.getMongo_id());
|
||||||
|
cRep.setMessageToDisplay("The project " + concessioneNew.getNome() + " has been Published correctly");
|
||||||
|
ValidationReport report = concessioneNew.getReport();
|
||||||
|
LOG.info("ValidationReport: " + report);
|
||||||
|
// cRep.setRecordId(concessione.getId());
|
||||||
|
cRep.setMongoId(concessioneNew.getMongo_id());
|
||||||
|
ValidationReportDV vr = ConvertToDataViewModel.toValidationReport(report);
|
||||||
|
cRep.setValidationReportDV(vr);
|
||||||
|
LOG.info(operation + "of the project with id: " + concessione.getMongo_id() + ", done!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case UNPUBLISH: {
|
||||||
|
clientMongo.unPublish(concessione.getMongo_id());
|
||||||
|
cRep.setMessageToDisplay("The project " + concessione.getNome() + " has been UnPublished correctly");
|
||||||
|
LOG.info(operation + "of the project with id: " + concessione.getMongo_id() + ", done!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cRep;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error occurred during cloning the project with id: " + itemId, e);
|
||||||
|
throw new Exception("Sorry an error occurred during cloning the Project. Refresh and try again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the geona init config.
|
* Gets the geona init config.
|
||||||
*
|
*
|
||||||
|
@ -748,7 +874,13 @@ 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data viewer config.
|
||||||
|
*
|
||||||
|
* @return the GNA data entry ext config profile
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
||||||
LOG.info("readDataViewerConfig called");
|
LOG.info("readDataViewerConfig called");
|
||||||
|
@ -768,7 +900,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
// DEV MODE
|
// DEV MODE
|
||||||
if (!SessionUtil.isIntoPortal()) {
|
if (!SessionUtil.isIntoPortal()) {
|
||||||
LOG.warn("OUT OF PORTAL - DEV MODE detected");
|
LOG.warn("OUT OF PORTAL - DEV MODE detected");
|
||||||
GcubeUserRole myRole = GcubeUserRole.DATA_EDITOR;
|
GcubeUserRole myRole = GcubeUserRole.DATA_MANAGER;
|
||||||
|
|
||||||
for (RoleRights roleRight : listUserRightsForRole) {
|
for (RoleRights roleRight : listUserRightsForRole) {
|
||||||
if (roleRight.getUserRole().equals(myRole)) {
|
if (roleRight.getUserRole().equals(myRole)) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class CommitReport implements Serializable {
|
||||||
|
|
||||||
public Long recordId;
|
public Long recordId;
|
||||||
public String mongoId;
|
public String mongoId;
|
||||||
|
private String messageToDisplay;
|
||||||
public ValidationReportDV validationReportDV;
|
public ValidationReportDV validationReportDV;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,10 +30,11 @@ public class CommitReport implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommitReport(Long recordId, String mongoId, ValidationReportDV validationReportDV) {
|
public CommitReport(Long recordId, String mongoId, String messageToDisplay, ValidationReportDV validationReportDV) {
|
||||||
super();
|
super();
|
||||||
this.recordId = recordId;
|
this.recordId = recordId;
|
||||||
this.mongoId = mongoId;
|
this.mongoId = mongoId;
|
||||||
|
this.messageToDisplay = messageToDisplay;
|
||||||
this.validationReportDV = validationReportDV;
|
this.validationReportDV = validationReportDV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +62,14 @@ public class CommitReport implements Serializable {
|
||||||
this.validationReportDV = validationReportDV;
|
this.validationReportDV = validationReportDV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMessageToDisplay() {
|
||||||
|
return messageToDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageToDisplay(String messageToDisplay) {
|
||||||
|
this.messageToDisplay = messageToDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -67,6 +77,8 @@ public class CommitReport implements Serializable {
|
||||||
builder.append(recordId);
|
builder.append(recordId);
|
||||||
builder.append(", mongoId=");
|
builder.append(", mongoId=");
|
||||||
builder.append(mongoId);
|
builder.append(mongoId);
|
||||||
|
builder.append(", messageToDisplay=");
|
||||||
|
builder.append(messageToDisplay);
|
||||||
builder.append(", validationReportDV=");
|
builder.append(", validationReportDV=");
|
||||||
builder.append(validationReportDV);
|
builder.append(validationReportDV);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||||
|
|
||||||
|
public enum PUBLISHING_UNPUBLISHING_OPERATION {
|
||||||
|
|
||||||
|
PUBLISH("Publish"), UNPUBLISH("UnPublish");
|
||||||
|
|
||||||
|
String title;
|
||||||
|
|
||||||
|
PUBLISHING_UNPUBLISHING_OPERATION(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue