in progress on registerFileSet
This commit is contained in:
parent
b4ec07371b
commit
3bda56a55c
|
@ -1,5 +1,6 @@
|
||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +14,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-entry-app-2.0.0-SNAPSHOT">
|
<wb-module deploy-name="geoportal-data-entry-app-2.0.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +29,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +44,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +59,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +77,8 @@
|
||||||
<dependent-module archiveName="geoportal-data-common-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
<dependent-module archiveName="geoportal-data-common-1.2.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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +92,8 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +107,8 @@
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +122,8 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
@ -124,5 +125,6 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||||
GenericDatasetBean gDBean) throws Exception;
|
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||||
|
@ -71,5 +72,6 @@ public interface GeoportalDataEntryServiceAsync
|
||||||
|
|
||||||
|
|
||||||
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||||
GenericDatasetBean gDBean, AsyncCallback<ConcessioneDV> callback);
|
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean,
|
||||||
|
AsyncCallback<ConcessioneDV> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
addStyleNames="{style.button-save-style}"
|
addStyleNames="{style.button-save-style}"
|
||||||
ui:field="buttonJSONUpdate">UPDATE</b:Button>
|
ui:field="buttonJSONUpdate">UPDATE</b:Button>
|
||||||
</b:Tab>
|
</b:Tab>
|
||||||
<b:Tab icon="UPLOAD_ALT" heading="Update File/s"
|
<b:Tab icon="UPLOAD_ALT" heading="Manage File/s"
|
||||||
ui:field="tabUploadFiles">
|
ui:field="tabUploadFiles">
|
||||||
<b:Heading size="3">Manage the file/s</b:Heading>
|
<b:Heading size="3">Manage the file/s</b:Heading>
|
||||||
<b:Label type="INFO">You can choose a section (e.g. "piante") and
|
<b:Label type="INFO">You can choose a section (e.g. "piante") and
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -14,6 +15,9 @@ import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScav
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
|
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
|
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
|
||||||
|
@ -30,11 +34,13 @@ import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Document;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.dom.client.DomEvent;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
@ -103,6 +109,7 @@ public class UpdateFileset extends Composite {
|
||||||
private Integer pathIndex = null;
|
private Integer pathIndex = null;
|
||||||
|
|
||||||
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
|
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new update fileset.
|
* Instantiates a new update fileset.
|
||||||
|
@ -175,6 +182,71 @@ public class UpdateFileset extends Composite {
|
||||||
GWT.log("Content index selected: " + pathIndex);
|
GWT.log("Content index selected: " + pathIndex);
|
||||||
GWT.log("FileUploaded selected: " + gdb.getFilesUploaded());
|
GWT.log("FileUploaded selected: " + gdb.getFilesUploaded());
|
||||||
|
|
||||||
|
List<WorkspaceContentDV> listCurrentContent = new ArrayList<WorkspaceContentDV>();
|
||||||
|
if (mapForCCUploading != null) {
|
||||||
|
Collection<WorkspaceContentDV> currentContent = mapForCCUploading.values();
|
||||||
|
if (currentContent != null)
|
||||||
|
listCurrentContent.addAll(currentContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
String htmlMsg = "Going to update the section " + listBoxPaths.getSelectedItemText() + ":";
|
||||||
|
htmlMsg += "<ul>";
|
||||||
|
htmlMsg += "<li>keeping " + listCurrentContent.size() + " current file/s </li>";
|
||||||
|
htmlMsg += "<li>uploading " + listFilesUploaded.size() + " new file/s </li>";
|
||||||
|
htmlMsg += "</ul>";
|
||||||
|
htmlMsg += "<br>";
|
||||||
|
htmlMsg += "This operation cannot be undone. Would you like to proceed?";
|
||||||
|
|
||||||
|
GWT.log(htmlMsg);
|
||||||
|
|
||||||
|
final DialogConfirm dialogConfirm = new DialogConfirm(null, "Update Confirm?", htmlMsg);
|
||||||
|
dialogConfirm.getElement().getStyle().setZIndex(100000);
|
||||||
|
dialogConfirm.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
dialogConfirm.hide();
|
||||||
|
buttonUpdate.setEnabled(false);
|
||||||
|
|
||||||
|
final DialogInform dialogInf = new DialogInform(null, "Updating Project", "");
|
||||||
|
dialogInf.setZIndex(100000);
|
||||||
|
dialogInf.showLoader("updating file/s for project: "+fullConcessione.getNome());
|
||||||
|
//dialogInf.setWidth("400px");
|
||||||
|
dialogInf.center();
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord(
|
||||||
|
fullConcessione.getItemId(), fullConcessione.getRecordType(),
|
||||||
|
listBoxPaths.getSelectedItemText(), pathIndex, listCurrentContent, gdb,
|
||||||
|
new AsyncCallback<ConcessioneDV>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
dialogInf.hideLoader();
|
||||||
|
dialogInf.setMsg(
|
||||||
|
"Sorry error occurred during project update. Error reported: "
|
||||||
|
+ caught.getMessage());
|
||||||
|
buttonUpdate.setEnabled(true);
|
||||||
|
showUploadFileGUI();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ConcessioneDV result) {
|
||||||
|
dialogInf.hideLoader();
|
||||||
|
dialogInf.setText("Project updated!");
|
||||||
|
dialogInf.setMsg(result.getNome() + " updated correclty");
|
||||||
|
dialogInf.center();
|
||||||
|
fullConcessione = result;
|
||||||
|
buttonUpdate.setEnabled(true);
|
||||||
|
showUploadFileGUI();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialogInf.center();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialogConfirm.center();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Window.alert(errorMsg);
|
Window.alert(errorMsg);
|
||||||
}
|
}
|
||||||
|
@ -264,11 +336,12 @@ public class UpdateFileset extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
controlsContent.add(listBoxContentIndex);
|
controlsContent.add(listBoxContentIndex);
|
||||||
|
|
||||||
|
if (listBoxContentIndex.getItemCount() == 2) {
|
||||||
if(listBoxContentIndex.getItemCount()==1) {
|
// listBoxContentIndex.setSelectedIndex(1);
|
||||||
listBoxContentIndex.setSelectedIndex(0);
|
listBoxContentIndex.setSelectedValue(listBoxContentIndex.getItemText(1));
|
||||||
listBoxContentIndex.setSelectedValue(listBoxContentIndex.getItemText(0));
|
|
||||||
|
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBoxContentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -360,7 +433,7 @@ public class UpdateFileset extends Composite {
|
||||||
|
|
||||||
MetadataFieldWrapper uploadField = new MetadataFieldWrapper();
|
MetadataFieldWrapper uploadField = new MetadataFieldWrapper();
|
||||||
uploadField.setFieldName("File");
|
uploadField.setFieldName("File");
|
||||||
uploadField.setMandatory(true);
|
uploadField.setMandatory(false);
|
||||||
uploadField.setType(DataTypeWrapper.File);
|
uploadField.setType(DataTypeWrapper.File);
|
||||||
uploadField.setMaxOccurs(1000);
|
uploadField.setMaxOccurs(1000);
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||||
|
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
@ -22,12 +19,10 @@ import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DialogConfirm.
|
* The Class DialogConfirm.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015
|
||||||
* Feb 19, 2015
|
|
||||||
*/
|
*/
|
||||||
public class DialogConfirm extends DialogBox implements ClickHandler {
|
public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||||
|
|
||||||
|
@ -37,15 +32,16 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||||
private ImageResource loading = Images.ICONS.loading();
|
private ImageResource loading = Images.ICONS.loading();
|
||||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||||
private Button noButton;
|
private Button noButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new dialog confirm.
|
* Instantiates a new dialog confirm.
|
||||||
*
|
*
|
||||||
* @param img the img
|
* @param img the img
|
||||||
* @param caption the caption
|
* @param caption the caption
|
||||||
* @param text the text
|
* @param text the text
|
||||||
*/
|
*/
|
||||||
public DialogConfirm(Image img, String caption, String text) {
|
public DialogConfirm(Image img, String caption, String text) {
|
||||||
//getElement().setClassName("gwt-DialogBoxNew");
|
// getElement().setClassName("gwt-DialogBoxNew");
|
||||||
dock.setSpacing(4);
|
dock.setSpacing(4);
|
||||||
dock.setWidth("100%");
|
dock.setWidth("100%");
|
||||||
setText(caption);
|
setText(caption);
|
||||||
|
@ -81,7 +77,6 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||||
|
|
||||||
dock.add(vpContainer, DockPanel.CENTER);
|
dock.add(vpContainer, DockPanel.CENTER);
|
||||||
setWidget(dock);
|
setWidget(dock);
|
||||||
// add(dock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -101,10 +96,11 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||||
*
|
*
|
||||||
* @param message the message
|
* @param message the message
|
||||||
*/
|
*/
|
||||||
public void loader(String message){
|
public void loader(String message) {
|
||||||
try{
|
try {
|
||||||
dock.remove(hpButtons);
|
dock.remove(hpButtons);
|
||||||
}catch(Exception e){}
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
vpContainer.clear();
|
vpContainer.clear();
|
||||||
HorizontalPanel hpMask = new HorizontalPanel();
|
HorizontalPanel hpMask = new HorizontalPanel();
|
||||||
hpMask.add(new Image(loading));
|
hpMask.add(new Image(loading));
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||||
|
|
||||||
|
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.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.DialogBox;
|
||||||
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DialogInform.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Oct 5, 2021
|
||||||
|
*/
|
||||||
|
public class DialogInform extends DialogBox implements ClickHandler {
|
||||||
|
|
||||||
|
private DockPanel dock = new DockPanel();
|
||||||
|
private Button okButton;
|
||||||
|
private VerticalPanel vpContainer = new VerticalPanel();
|
||||||
|
private ImageResource loading = Images.ICONS.loading();
|
||||||
|
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||||
|
private HorizontalPanel hpMask = new HorizontalPanel();
|
||||||
|
private DialogInform instance = this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new dialog inform.
|
||||||
|
*
|
||||||
|
* @param img the img
|
||||||
|
* @param caption the caption
|
||||||
|
* @param msg the msg
|
||||||
|
*/
|
||||||
|
public DialogInform(Image img, String caption, String msg) {
|
||||||
|
// getElement().setClassName("gwt-DialogBoxNew");
|
||||||
|
dock.setSpacing(4);
|
||||||
|
dock.setWidth("100%");
|
||||||
|
setText(caption);
|
||||||
|
// setHeading(caption);
|
||||||
|
|
||||||
|
okButton = new Button("OK");
|
||||||
|
|
||||||
|
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
|
||||||
|
vpContainer.add(new HTML(msg));
|
||||||
|
hpButtons = new HorizontalPanel();
|
||||||
|
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
|
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
|
||||||
|
hpButtons.setSpacing(3);
|
||||||
|
okButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
|
||||||
|
hpButtons.add(okButton);
|
||||||
|
|
||||||
|
okButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
instance.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dock.add(hpButtons, DockPanel.SOUTH);
|
||||||
|
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
|
||||||
|
|
||||||
|
if (img != null)
|
||||||
|
dock.add(img, DockPanel.WEST);
|
||||||
|
|
||||||
|
vpContainer.add(hpMask);
|
||||||
|
dock.add(vpContainer, DockPanel.CENTER);
|
||||||
|
setWidget(dock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the msg.
|
||||||
|
*
|
||||||
|
* @param msg the new msg
|
||||||
|
*/
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
vpContainer.clear();
|
||||||
|
vpContainer.add(new HTML(msg));
|
||||||
|
hpButtons.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On click.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
|
||||||
|
* .dom.client.ClickEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
// hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide loader.
|
||||||
|
*/
|
||||||
|
public void hideLoader() {
|
||||||
|
hpMask.clear();
|
||||||
|
hpButtons.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
public void showLoader(String message) {
|
||||||
|
try {
|
||||||
|
hpButtons.setVisible(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
hpMask.clear();
|
||||||
|
hpMask.add(new Image(loading));
|
||||||
|
HTML html = new HTML(message);
|
||||||
|
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
|
||||||
|
hpMask.add(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the to center panel.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
*/
|
||||||
|
public void addToCenterPanel(Widget w) {
|
||||||
|
vpContainer.add(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dock.
|
||||||
|
*
|
||||||
|
* @return the dock
|
||||||
|
*/
|
||||||
|
public DockPanel getDock() {
|
||||||
|
return dock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the yes button.
|
||||||
|
*
|
||||||
|
* @return the yes button
|
||||||
|
*/
|
||||||
|
public Button getOKButton() {
|
||||||
|
return okButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the z index.
|
||||||
|
*
|
||||||
|
* @param value the new z index
|
||||||
|
*/
|
||||||
|
public void setZIndex(int value) {
|
||||||
|
this.getElement().getStyle().setZIndex(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||||
|
@ -649,7 +650,6 @@ 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the JSON record.
|
* Gets the JSON record.
|
||||||
|
@ -674,7 +674,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
Concessione concessione = clientMongo.getById(itemId);
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
return serviceUtil.toJSON(concessione);
|
return serviceUtil.toJSON(concessione);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -683,12 +683,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
"Error occurred on reading the JSON project with id: " + itemId + ". Error: " + e.getMessage());
|
"Error occurred on reading the JSON project with id: " + itemId + ". Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the record.
|
* Gets the record.
|
||||||
*
|
*
|
||||||
* @param itemId the item id
|
* @param itemId the item id
|
||||||
* @param recordType the record type
|
* @param recordType the record type
|
||||||
* @return the record
|
* @return the record
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
|
@ -708,7 +707,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
Concessione concessione = clientMongo.getById(itemId);
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
return ConvertToDataViewModel.toConcessione(concessione);
|
return ConvertToDataViewModel.toConcessione(concessione);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -730,78 +729,101 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
return ConvertToDataViewModel.getFileSetPaths();
|
return ConvertToDataViewModel.getFileSetPaths();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update record.
|
* Update record.
|
||||||
*
|
*
|
||||||
* @param itemId the item id
|
* @param itemId the item id
|
||||||
* @param jsonUpdate the json update
|
* @param recordType the record type
|
||||||
* @param recordType the record type
|
* @param section the section
|
||||||
|
* @param pathIndex the path index
|
||||||
|
* @param keepCurrentContent the keep current content
|
||||||
|
* @param gDBean the g D bean
|
||||||
* @return the updated JSON string representing the itemId
|
* @return the updated JSON string representing the itemId
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex, GenericDatasetBean gDBean) throws Exception {
|
public ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||||
LOG.info("updateSectionForRecord called with itemId: " + itemId + ", section: " + section+", pathIndex: " + pathIndex+", gDBean: " + gDBean, "");
|
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception {
|
||||||
|
LOG.info("updateSectionForRecord called with itemId: " + itemId + ", section: " + section + ", pathIndex: "
|
||||||
|
+ pathIndex + ", gDBean: " + gDBean, "");
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (itemId == null)
|
if (itemId == null)
|
||||||
throw new Exception("Item id is null");
|
throw new Exception("Item id is null");
|
||||||
|
|
||||||
if (recordType.equals(RECORD_TYPE.CONCESSIONE)) {
|
if (recordType.equalsIgnoreCase(RECORD_TYPE.CONCESSIONE.name())) {
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
|
||||||
String toEditPath = null;
|
String toEditPath = null;
|
||||||
AddSectionToConcessioneRequest request = null;
|
AddSectionToConcessioneRequest request = null;
|
||||||
|
List<TempFile> files = new ArrayList<TempFile>();
|
||||||
|
|
||||||
List<TempFile> files = serviceUtil.toTemFiles(gDBean.getFilesUploaded());
|
// Managing files already present as current content and kept by user
|
||||||
if(files==null || files.isEmpty())
|
List<TempFile> keepFiles = serviceUtil.toTemFilesFromWSC(keepCurrentContent);
|
||||||
throw new Exception("Sorry, an error occurred on reading temp files. Refresh and try again");
|
if (keepFiles != null) {
|
||||||
|
files.addAll(keepFiles);
|
||||||
|
LOG.debug(keepFiles.size() +" current corrent file/s has/have been added to list of files");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Managing new files uploaded by user
|
||||||
|
List<TempFile> newFiles = serviceUtil.toTemFiles(gDBean.getFilesUploaded());
|
||||||
|
if (newFiles != null) {
|
||||||
|
files.addAll(newFiles);
|
||||||
|
LOG.debug(newFiles.size() +" new file/s has/have been added to list of files");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (files == null || files.isEmpty())
|
||||||
|
// throw new Exception("Sorry, an error occurred on reading temp files. Refresh and try again");
|
||||||
|
|
||||||
if (section.contains("abstract_relazione")) {
|
if (section.contains("abstract_relazione")) {
|
||||||
|
|
||||||
toEditPath = Paths.ABSTRACT_RELAZIONE;
|
toEditPath = Paths.ABSTRACT_RELAZIONE;
|
||||||
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
||||||
|
|
||||||
} else if (section.contains("immagini")) {
|
} else if (section.contains("immagini")) {
|
||||||
toEditPath = Paths.imgByIndex(pathIndex);
|
toEditPath = Paths.imgByIndex(pathIndex);
|
||||||
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
||||||
|
|
||||||
} else if (section.contains("relazione")) {
|
} else if (section.contains("relazione")) {
|
||||||
toEditPath = Paths.RELAZIONE;
|
toEditPath = Paths.RELAZIONE;
|
||||||
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
||||||
|
|
||||||
} else if (section.contains("posizionamentoScavo")) {
|
} else if (section.contains("posizionamentoScavo")) {
|
||||||
toEditPath = Paths.POSIZIONAMENTO;
|
toEditPath = Paths.POSIZIONAMENTO;
|
||||||
request = new AddSectionToConcessioneRequest(toEditPath,
|
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
||||||
files);
|
|
||||||
|
|
||||||
} else if (section.contains("piante")) {
|
} else if (section.contains("piante")) {
|
||||||
toEditPath = Paths.piantaByIndex(pathIndex);
|
toEditPath = Paths.piantaByIndex(pathIndex);
|
||||||
request = new AddSectionToConcessioneRequest(
|
request = new AddSectionToConcessioneRequest(toEditPath, files);
|
||||||
toEditPath, files);
|
|
||||||
}
|
}
|
||||||
// Unpublish
|
// Unpublish
|
||||||
System.out.println("Unpublishing "+itemId);
|
LOG.info("Unpublishing " + itemId);
|
||||||
clientMongo.unPublish(itemId);
|
clientMongo.unPublish(itemId);
|
||||||
|
|
||||||
// update Fileset
|
// update Fileset
|
||||||
System.out.println("Removing old fileset.. ");
|
LOG.info("Removing old fileset.. ");
|
||||||
clientMongo.cleanFileSet(itemId,toEditPath);
|
Concessione concessione = clientMongo.cleanFileSet(itemId, toEditPath);
|
||||||
|
|
||||||
System.out.println("Sending new Fileset ..");
|
LOG.debug("Sending new Fileset ..");
|
||||||
|
if(files.size()>0) {
|
||||||
//StorageUtils storage=new StorageUtils();
|
// StorageUtils storage=new StorageUtils();
|
||||||
// Building TempFile
|
// Building TempFile
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
LOG.info("Registering FileSet into recordId " + itemId + " with request path: " +toEditPath + " and: " + files.size()
|
LOG.info("Registering FileSet into recordId " + itemId + " with request path: " + toEditPath + " and: "
|
||||||
+ " file/s");
|
+ files.size() + " file/s");
|
||||||
Concessione concessione = clientMongo.registerFileSet(itemId,request);
|
concessione = clientMongo.registerFileSet(itemId, request);
|
||||||
|
}else {
|
||||||
|
LOG.info("Fileset is empty, skipping registerFileSet");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("Publishings itemId: "+itemId);
|
||||||
concessione = clientMongo.publish(itemId);
|
concessione = clientMongo.publish(itemId);
|
||||||
|
|
||||||
return ConvertToDataViewModel.toConcessione(concessione);
|
LOG.trace("returning concessione: "+concessione);
|
||||||
|
return ConvertToDataViewModel.toConcessione(concessione);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -4,7 +4,9 @@ import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mon
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,18 +16,18 @@ import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||||
import org.gcube.application.geoportal.common.rest.TempFile;
|
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class MongoServiceUtil.
|
* The Class MongoServiceUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Sep 16, 2021
|
* Sep 16, 2021
|
||||||
*/
|
*/
|
||||||
public class MongoServiceUtil {
|
public class MongoServiceUtil {
|
||||||
|
|
||||||
|
@ -87,6 +89,33 @@ public class MongoServiceUtil {
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To tem files from WSC.
|
||||||
|
*
|
||||||
|
* @param listFiles the list files
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
public List<TempFile> toTemFilesFromWSC(List<WorkspaceContentDV> listFiles) {
|
||||||
|
LOG.debug("toTemFilesFromWSC called");
|
||||||
|
if (listFiles == null || listFiles.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Building TempFile
|
||||||
|
List<TempFile> files = new ArrayList<TempFile>(listFiles.size());
|
||||||
|
for (WorkspaceContentDV fileUploaded : listFiles) {
|
||||||
|
InputStream is;
|
||||||
|
try {
|
||||||
|
is = new URL(fileUploaded.getLink()).openStream();
|
||||||
|
// Creating TempFile
|
||||||
|
TempFile storageTempFile = createTempFileOnStorage(is, fileUploaded.getName());
|
||||||
|
files.add(storageTempFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.error("Error on creating temp file from URL: " + fileUploaded.getLink(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To JSON.
|
* To JSON.
|
||||||
*
|
*
|
||||||
|
@ -98,7 +127,7 @@ public class MongoServiceUtil {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// if (theObj instanceof Serializable) {
|
// if (theObj instanceof Serializable) {
|
||||||
return org.gcube.application.geoportal.client.utils.Serialization.write(theObj);
|
return org.gcube.application.geoportal.client.utils.Serialization.write(theObj);
|
||||||
// }
|
// }
|
||||||
// throw new Exception("The input object is not serializable");
|
// throw new Exception("The input object is not serializable");
|
||||||
|
|
||||||
|
@ -141,7 +170,7 @@ public class MongoServiceUtil {
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Sep 16, 2021
|
* Sep 16, 2021
|
||||||
*/
|
*/
|
||||||
public static class ConcessioneDVValidationReportStatusComparator implements Comparator<ConcessioneDV> {
|
public static class ConcessioneDVValidationReportStatusComparator implements Comparator<ConcessioneDV> {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue