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"?>
|
||||
<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>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -30,5 +30,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
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
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -22,7 +22,17 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-2.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-2.2.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -63,6 +73,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -87,6 +102,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -95,7 +115,7 @@
|
|||
|
||||
|
||||
<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>
|
||||
</dependent-module>
|
||||
|
||||
|
@ -114,6 +134,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -138,6 +163,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -162,6 +192,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -185,6 +220,11 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
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).
|
||||
|
||||
## [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
|
||||
|
||||
#### Enhancements
|
||||
|
|
23
pom.xml
23
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-entry-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.1.0</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<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>
|
||||
<scm>
|
||||
|
@ -98,6 +98,7 @@
|
|||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
|
@ -136,24 +137,40 @@
|
|||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</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>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<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>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[1.0.0, 1.0.7]</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- END FORCING -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<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.ActionPerformedOnItemEvent;
|
||||
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.CreateNewProjectEventHandler;
|
||||
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.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.SaveGeonaDataFormsHandler;
|
||||
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.GeonaRecordsPaginatedView;
|
||||
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.edit.EditModeRecord;
|
||||
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 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.constants.AlertType;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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.ClickHandler;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
|
@ -120,48 +128,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
||||
|
||||
/*GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new AsyncCallback<List<ItemField>>() {
|
||||
|
||||
@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>() {
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -203,14 +171,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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)));
|
||||
initialSortFilter.setOrderByFields(
|
||||
Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||
|
||||
displayFields = itemFields;
|
||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields,
|
||||
initialSortFilter);
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
|
||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||
|
@ -222,15 +191,16 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
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());
|
||||
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);
|
||||
boolean canCreateNewItem = roleRights.getListPermessions().keySet()
|
||||
.contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||
|
||||
if (!canCreateNewItem) {
|
||||
// removing Tab "Create New Project"
|
||||
|
@ -241,7 +211,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
return;
|
||||
}
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||
.getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -254,7 +225,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
if (result != null && result.getGenericResourceSecondaryType() != null
|
||||
&& result.getScope() != null) {
|
||||
callGetMetadataProfiles(result.getScope(), result.getGenericResourceSecondaryType());
|
||||
callGetMetadataProfiles(result.getScope(),
|
||||
result.getGenericResourceSecondaryType());
|
||||
} else
|
||||
Window.alert(
|
||||
"Sorry, no configuration found in the context. Please, contact the support");
|
||||
|
@ -264,81 +236,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 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() {
|
||||
|
@ -658,6 +555,242 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
});
|
||||
|
||||
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() {
|
||||
|
||||
@Override
|
||||
|
@ -740,14 +873,17 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
if (!allowedOperationForUser) {
|
||||
|
||||
String msg = "You are not authorized to perform the action: " + action.getLabel();
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), "Forbidden: "+action, msg, AlertType.WARNING);
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
|
||||
"Forbidden: " + action, msg, AlertType.WARNING);
|
||||
modalW.show();
|
||||
return;
|
||||
}
|
||||
// 2. the user cannot access to action (e.g. the user cannot write an item of another user)
|
||||
// 2. the user cannot access to action (e.g. the user cannot write an item of
|
||||
// another user)
|
||||
// if so an error is shown
|
||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType, concessione);
|
||||
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType,
|
||||
concessione);
|
||||
if (!allowedWriteActionOnItem) {
|
||||
String title = "Forbidden: missing write access";
|
||||
String msg = "You do not have write access to item: " + concessione.getNome();
|
||||
|
@ -755,16 +891,17 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
msg = "You do not have write access to item: " + concessione.getNome();
|
||||
} else if (!userRole.isWriteAny()) {
|
||||
title = "Forbidden: missing ownership";
|
||||
msg = "You are not the creator of: "+ concessione.getNome() +". You cannot access to it";
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (action) {
|
||||
case VIEW_ON_MAP:
|
||||
case VIEW_ON_MAP: {
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setCloseVisible(true);
|
||||
final HorizontalPanel hpGetLink = new HorizontalPanel();
|
||||
|
@ -798,8 +935,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal.show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VIEW_REPORT:
|
||||
case VIEW_REPORT: {
|
||||
|
||||
final Modal modal2 = new Modal(true, true);
|
||||
modal2.setTitle(
|
||||
|
@ -817,8 +955,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal2.show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EDIT_PROJECT:
|
||||
case EDIT_PROJECT: {
|
||||
final Modal modal3 = new Modal(true, true);
|
||||
modal3.setTitle(
|
||||
"<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.show();
|
||||
break;
|
||||
}
|
||||
|
||||
// case UPDATED_PROJECT:
|
||||
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
// mainTabPanel.getCurrentSortFilter()));
|
||||
// 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:";
|
||||
htmlMsg += "<ul>";
|
||||
|
@ -895,6 +1070,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -908,7 +1084,8 @@ 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 writeOwnPassed = false;
|
||||
|
|
|
@ -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.GeoNaFormDataObject;
|
||||
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 com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
@ -139,4 +140,27 @@ public interface GeoportalDataEntryService extends RemoteService {
|
|||
*/
|
||||
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.GeoNaFormDataObject;
|
||||
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 com.google.gwt.core.client.GWT;
|
||||
|
@ -63,4 +64,10 @@ public interface GeoportalDataEntryServiceAsync {
|
|||
|
||||
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,8 +2,6 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
|||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CreateNewProjectEvent.
|
||||
*
|
||||
|
@ -16,9 +14,6 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
/** The type. */
|
||||
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
||||
|
||||
/**
|
||||
* Instantiates a new cancel upload event.
|
||||
*/
|
||||
public CreateNewProjectEvent() {
|
||||
}
|
||||
|
||||
|
@ -27,7 +22,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
|
@ -40,8 +37,12 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
*
|
||||
* @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
|
||||
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
|
||||
NavLink navEditMode;
|
||||
|
||||
@UiField
|
||||
NavLink navCloneProject;
|
||||
|
||||
@UiField
|
||||
NavLink navPublishUnPublishProject;
|
||||
|
||||
@UiField
|
||||
NavLink navDelete;
|
||||
|
||||
|
@ -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() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -90,6 +90,11 @@
|
|||
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
|
||||
<b:NavLink ui:field="navEditMode" title="Edit"
|
||||
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"
|
||||
icon="TRASH">Delete Project</b:NavLink>
|
||||
</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.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.Concessione;
|
||||
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.GeoNaFormDataObject;
|
||||
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.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
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";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
||||
// private String mongoId;
|
||||
|
||||
/**
|
||||
* Gets the GNA data entry config profile.
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -749,6 +875,12 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data viewer config.
|
||||
*
|
||||
* @return the GNA data entry ext config profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
||||
LOG.info("readDataViewerConfig called");
|
||||
|
@ -768,7 +900,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
// DEV MODE
|
||||
if (!SessionUtil.isIntoPortal()) {
|
||||
LOG.warn("OUT OF PORTAL - DEV MODE detected");
|
||||
GcubeUserRole myRole = GcubeUserRole.DATA_EDITOR;
|
||||
GcubeUserRole myRole = GcubeUserRole.DATA_MANAGER;
|
||||
|
||||
for (RoleRights roleRight : listUserRightsForRole) {
|
||||
if (roleRight.getUserRole().equals(myRole)) {
|
||||
|
|
|
@ -20,6 +20,7 @@ public class CommitReport implements Serializable {
|
|||
|
||||
public Long recordId;
|
||||
public String mongoId;
|
||||
private String messageToDisplay;
|
||||
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();
|
||||
this.recordId = recordId;
|
||||
this.mongoId = mongoId;
|
||||
this.messageToDisplay = messageToDisplay;
|
||||
this.validationReportDV = validationReportDV;
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,14 @@ public class CommitReport implements Serializable {
|
|||
this.validationReportDV = validationReportDV;
|
||||
}
|
||||
|
||||
public String getMessageToDisplay() {
|
||||
return messageToDisplay;
|
||||
}
|
||||
|
||||
public void setMessageToDisplay(String messageToDisplay) {
|
||||
this.messageToDisplay = messageToDisplay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -67,6 +77,8 @@ public class CommitReport implements Serializable {
|
|||
builder.append(recordId);
|
||||
builder.append(", mongoId=");
|
||||
builder.append(mongoId);
|
||||
builder.append(", messageToDisplay=");
|
||||
builder.append(messageToDisplay);
|
||||
builder.append(", validationReportDV=");
|
||||
builder.append(validationReportDV);
|
||||
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