diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..cc81385
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ConstantsMPFormBuilder.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ConstantsMPFormBuilder.java
index ee6685b..c51f849 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ConstantsMPFormBuilder.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ConstantsMPFormBuilder.java
@@ -10,6 +10,7 @@ public class ConstantsMPFormBuilder {
//public static final String CURR_USER_ID = "currUserId";
public static final String IS_OVERWRITE = "isOverwrite";
public static final String UPLOAD_TYPE = "uploadType";
+ public static final String FIELD_NAME = "fieldName";
public static enum THE_UPLOAD_TYPE {File, Archive};
public static final String ID_FOLDER = "idFolder";
public static final String UPLOAD_FORM_ELEMENT = "uploadFormElement";
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java
index 4a512df..1a8a42f 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java
@@ -384,7 +384,7 @@ public class MetaDataFieldSkeleton extends Composite {
case File:
- holder = new MultipleDilaogUpload();
+ holder = new MultipleDilaogUpload(field.getFieldName());
break;
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/DialogUpload.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/DialogUpload.java
index 39ba43b..8bd7c97 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/DialogUpload.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/DialogUpload.java
@@ -1,6 +1,5 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
-
import java.util.ArrayList;
import java.util.List;
@@ -25,58 +24,56 @@ import com.google.gwt.user.client.ui.Hidden;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
-
// TODO: Auto-generated Javadoc
/**
* The Class DialogUploadStream.
*
- * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
- * Sep 24, 2015
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Sep 24, 2015
*/
-public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotificationListener{
+public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotificationListener {
/** The file upload. */
- //protected final FormPanel formPanel = new FormPanel();
+ // protected final FormPanel formPanel = new FormPanel();
protected FileUpload fileUpload;
-
+
/** The json client keys. */
protected Hidden jsonClientKeys;
-
+
/** The fake uploaders. */
protected List fakeUploaders = new ArrayList();
-
+
/** The controller. */
protected WorkspaceUploaderListenerController controller = new WorkspaceUploaderListenerController();
-
+
/** The timer. */
protected TimerUpload timer;
+ private String fieldName;
+
/**
* The Enum UPLOAD_TYPE.
*
- * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
- * Sep 11, 2015
+ * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Sep 11, 2015
*/
private HTML UPLOADING = new HTML("Uploading...");
-
+
/** The vertical main panel. */
protected VerticalPanel verticalMainPanel;
// private MonitorPanel monitorPanel;
- //protected String clientUploadKey;
-
+ // protected String clientUploadKey;
+
/** The purged uploading file name. */
private String purgedUploadingFileName;
-
+
/** The upv. */
private UploaderProgressView upv;
/**
* Instantiates a new dialog upload stream.
*/
- public DialogUpload(){
- //setWidth("400px");
+ public DialogUpload() {
fileUpload = new FileUpload();
- //fileUpload.getElement().setAttribute("multiple", "multiple");
+ // fileUpload.getElement().setAttribute("multiple", "multiple");
setAction(ConstantsMPFormBuilder.METADATA_FORM_BUILDER_UPLOADING_SERVLET);
setEncoding(FormPanel.ENCODING_MULTIPART);
setMethod(FormPanel.METHOD_POST);
@@ -89,8 +86,12 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
fileUpload.setName(ConstantsMPFormBuilder.UPLOAD_FORM_ELEMENT);
// Add hidden parameters
- verticalMainPanel.add(new Hidden(ConstantsMPFormBuilder.CURR_GROUP_ID, GCubeClientContext.getCurrentContextId()));
- verticalMainPanel.add(new Hidden(ConstantsMPFormBuilder.UPLOAD_TYPE, ConstantsMPFormBuilder.THE_UPLOAD_TYPE.File.name()));
+ verticalMainPanel
+ .add(new Hidden(ConstantsMPFormBuilder.CURR_GROUP_ID, GCubeClientContext.getCurrentContextId()));
+ verticalMainPanel.add(
+ new Hidden(ConstantsMPFormBuilder.UPLOAD_TYPE, ConstantsMPFormBuilder.THE_UPLOAD_TYPE.File.name()));
+
+ verticalMainPanel.add(new Hidden(ConstantsMPFormBuilder.FIELD_NAME, fieldName));
initJsonClientKeys();
verticalMainPanel.add(jsonClientKeys);
@@ -105,6 +106,24 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
verticalMainPanel.add(hp);
}
+ /**
+ * Sets the field name.
+ *
+ * @param fieldName the new field name
+ */
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * Gets the field name.
+ *
+ * @return the field name
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
/**
* Gets the panel.
*
@@ -117,14 +136,14 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
/**
* Inits the json client keys.
*/
- protected void initJsonClientKeys(){
- jsonClientKeys = new Hidden(ConstantsMPFormBuilder.CLIENT_UPLOAD_KEYS,"");
+ protected void initJsonClientKeys() {
+ jsonClientKeys = new Hidden(ConstantsMPFormBuilder.CLIENT_UPLOAD_KEYS, "");
}
/**
* Bind events.
*/
- public void bindEvents(){
+ public void bindEvents() {
this.addHandlers();
// this.addListeners();
}
@@ -143,10 +162,11 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
// isStatusCompleted = true;
String result = event.getResults();
- if (result == null) {
+ if (result == null) {
removeLoading();
Window.alert("An error occurred during file upload");
- //new DialogResult(null, "Error during upload", "An error occurred during file upload.").center();
+ // new DialogResult(null, "Error during upload", "An error occurred during file
+ // upload.").center();
return;
}
String strippedResult = new HTML(result).getText();
@@ -155,25 +175,25 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
switch (resultMessage.getStatus()) {
case ERROR:
removeLoading();
- //timer.cancel();
- GWT.log("Error during upload "+resultMessage.getMessage());
+ // timer.cancel();
+ GWT.log("Error during upload " + resultMessage.getMessage());
break;
case UNKNOWN:
removeLoading();
- //timer.cancel();
- GWT.log("Error during upload "+resultMessage.getMessage());
+ // timer.cancel();
+ GWT.log("Error during upload " + resultMessage.getMessage());
break;
case WARN: {
- GWT.log("Upload completed with warnings "+resultMessage.getMessage());
+ GWT.log("Upload completed with warnings " + resultMessage.getMessage());
removeLoading();
- //timer.cancel();
+ // timer.cancel();
break;
}
- case SESSION_EXPIRED:{
- GWT.log("Upload aborted due to session expired: "+ resultMessage.getMessage());
+ case SESSION_EXPIRED: {
+ GWT.log("Upload aborted due to session expired: " + resultMessage.getMessage());
Window.alert("Session expired, please reload the page");
removeLoading();
- //timer.cancel();
+ // timer.cancel();
break;
}
case OK: {
@@ -193,7 +213,7 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
}
});
- //TODO NEVER USED, WE ARE USING MULTIPLE DIALOG UPLOAD
+ // TODO NEVER USED, WE ARE USING MULTIPLE DIALOG UPLOAD
addSubmitHandler(new SubmitHandler() {
@Override
@@ -209,41 +229,45 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
public void onChange(ChangeEvent event) {
GWT.log("btnSubmit click");
- if (fileUpload.getFilename()==null || !(fileUpload.getFilename().length()>2)) {
+ if (fileUpload.getFilename() == null || !(fileUpload.getFilename().length() > 2)) {
GWT.log("No file specified ");
return;
}
- GWT.log("fileUpload.getFilename() "+fileUpload.getFilename());
+ GWT.log("fileUpload.getFilename() " + fileUpload.getFilename());
/*
- * TODO: recall: Some browser would write in fileUploadField.getValue() C:\fakepath\$fileName
+ * TODO: recall: Some browser would write in fileUploadField.getValue()
+ * C:\fakepath\$fileName
*/
String normalizedFileName = fileUpload.getFilename();
if (normalizedFileName.contains("\\")) {
- normalizedFileName = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\")+1); //remove C:\fakepath\ if exists
+ normalizedFileName = normalizedFileName.substring(normalizedFileName.lastIndexOf("\\") + 1); // remove
+ // C:\fakepath\
+ // if
+ // exists
}
-
+
purgedUploadingFileName = normalizedFileName;
submitForm();
}
});
}
-
+
/**
* On submit action.
*/
protected void onSubmitAction() {
GWT.log("SubmitEvent");
try {
- if(upv!=null)
+ if (upv != null)
verticalMainPanel.remove(upv.getPanel());
- }catch (Exception e) {
+ } catch (Exception e) {
// TODO: handle exception
}
addLoading();
enableButtons(false);
- //Only the first, just to manage single uploading
- FileUploadingState workspaceUploaderItem = fakeUploaders.get(0);
+ // Only the first, just to manage single uploading
+ FileUploadingState workspaceUploaderItem = fakeUploaders.get(0);
upv = new UploaderProgressView(workspaceUploaderItem, workspaceUploaderItem.getFile().getFileName(), null);
verticalMainPanel.add(upv.getPanel());
removeLoading();
@@ -252,33 +276,32 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
fakeUploaders.clear();
}
-
/**
* Gets the file uploading state.
*
* @return the file uploading state
*/
public FileUploadingState getFileUploadingState() {
- if(timer!=null)
+ if (timer != null)
return timer.getLastWorkspaceUploader();
-
+
return null;
}
/**
* Adds the loading.
*/
- protected void addLoading(){
+ protected void addLoading() {
verticalMainPanel.add(UPLOADING);
}
/**
* Removes the loading.
*/
- protected void removeLoading(){
- try{
+ protected void removeLoading() {
+ try {
verticalMainPanel.remove(UPLOADING);
- }catch(Exception e){
+ } catch (Exception e) {
}
}
@@ -288,7 +311,7 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
*
* @param bool the bool
*/
- protected void enableButtons(boolean bool){
+ protected void enableButtons(boolean bool) {
// btnUpload.setEnabled(bool);
// btnCancel.setEnabled(bool);
// upload.setEnabled(bool);
@@ -297,37 +320,33 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
/**
* Submit form.
*/
- public void submitForm(){
+ public void submitForm() {
submit();
}
-
/**
* Removes the item and submit form.
*
* @param itemId the item id
*/
- protected void removeItemAndSubmitForm(String itemId){
+ protected void removeItemAndSubmitForm(String itemId) {
/*
- AppControllerExplorer.rpcWorkspaceService.removeItem(itemId, new AsyncCallback() {
-
- @Override
- public void onFailure(Throwable caught) {
- Info.display("Error", caught.getMessage());
-
-
- }
-
- @Override
- public void onSuccess(Boolean result) {
- if(result){
- hiddenOverwrite.setValue("true");
- submitForm();
- }
-
- }
-
- });*/
+ * AppControllerExplorer.rpcWorkspaceService.removeItem(itemId, new
+ * AsyncCallback() {
+ *
+ * @Override public void onFailure(Throwable caught) { Info.display("Error",
+ * caught.getMessage());
+ *
+ *
+ * }
+ *
+ * @Override public void onSuccess(Boolean result) { if(result){
+ * hiddenOverwrite.setValue("true"); submitForm(); }
+ *
+ * }
+ *
+ * });
+ */
}
/**
@@ -335,8 +354,8 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
*
* @param itemId the item id
*/
- protected void updateItemSubmitForm(String itemId){
- //hiddenOverwrite.setValue("true");
+ protected void updateItemSubmitForm(String itemId) {
+ // hiddenOverwrite.setValue("true");
submitForm();
}
@@ -345,8 +364,14 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
*
* @param handler the handler
*/
- /* (non-Javadoc)
- * @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#addWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.gcube.portlets.widgets.workspaceuploader.client.
+ * WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#
+ * addWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.
+ * workspaceuploader.client.WorkspaceUploadNotification.
+ * WorskpaceUploadNotificationListener)
*/
@Override
public void addWorkspaceUploadNotificationListener(WorskpaceUploadNotificationListener handler) {
@@ -358,22 +383,26 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
*
* @param handler the handler
*/
- /* (non-Javadoc)
- * @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#removeWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.gcube.portlets.widgets.workspaceuploader.client.
+ * WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener#
+ * removeWorkspaceUploadNotificationListener(org.gcube.portlets.widgets.
+ * workspaceuploader.client.WorkspaceUploadNotification.
+ * WorskpaceUploadNotificationListener)
*/
@Override
public void removeWorkspaceUploadNotificationListener(WorskpaceUploadNotificationListener handler) {
controller.removeWorkspaceUploadListener(handler);
}
-
-
+
/**
* Enable upload.
*
* @param bool the bool
*/
- public void enableUpload(boolean bool){
+ public void enableUpload(boolean bool) {
fileUpload.setEnabled(bool);
}
}
-
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/FileUpload.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/FileUpload.java
index a4ef1f0..b823537 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/FileUpload.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/FileUpload.java
@@ -16,9 +16,9 @@ public class FileUpload extends Composite {
@UiField HTMLPanel fileUploadPanel;
- public FileUpload() {
+ public FileUpload(String fielName) {
initWidget(uiBinder.createAndBindUi(this));
- fileUploadPanel.add(new MultipleDilaogUpload());
+ fileUploadPanel.add(new MultipleDilaogUpload(fielName));
}
}
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/MultipleDilaogUpload.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/MultipleDilaogUpload.java
index 642b9eb..4a6bc95 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/MultipleDilaogUpload.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/upload/MultipleDilaogUpload.java
@@ -49,9 +49,10 @@ public class MultipleDilaogUpload extends DialogUpload {
/**
* Instantiates a new multiple dilaog upload.
*/
- public MultipleDilaogUpload() {
- fileUploadID = GenerateUUID.get(10, 16); // is tagID
- fileUpload.getElement().setId(fileUploadID);
+ public MultipleDilaogUpload(String fieldName) {
+ this.fileUploadID = GenerateUUID.get(10, 16); // is tagID
+ this.fileUpload.getElement().setId(fileUploadID);
+ super.setFieldName(fieldName);
this.addHandlers();
}
@@ -165,7 +166,7 @@ public class MultipleDilaogUpload extends DialogUpload {
@Override
public void onChange(ChangeEvent event) {
- GWT.log("file upload change handler, browse return...");
+ GWT.log("file upload change handler, browse returns...");
if (fileUpload.getFilename() == null || fileUpload.getFilename().isEmpty()) {
GWT.log("No file specified ");
//MultipleDilaogUpload.this.hide();
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/server/MetadataProfileFormBuilderUploadServlet.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/server/MetadataProfileFormBuilderUploadServlet.java
index ddcb5a3..be41981 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/server/MetadataProfileFormBuilderUploadServlet.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/server/MetadataProfileFormBuilderUploadServlet.java
@@ -33,6 +33,7 @@ import org.gcube.common.portal.PortalContext;
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
import org.gcube.portlets.widgets.mpformbuilder.server.util.WsUtil;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.AbstractUploadProgressListener;
+import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FilePath;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState.UPLOAD_STATUS;
@@ -54,9 +55,9 @@ import org.slf4j.LoggerFactory;
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it at ISTI-CNR
*
- * Oct 5, 2020
+ * Oct 5, 2020
*/
-public class MetadataProfileFormBuilderUploadServlet extends HttpServlet implements Servlet{
+public class MetadataProfileFormBuilderUploadServlet extends HttpServlet implements Servlet {
/** The Constant UNKNOWN_UNKNOWN. */
public static final String UNKNOWN_UNKNOWN = "unknown/unknown";
@@ -69,11 +70,12 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
/** The Constant VRE_ID_ATTR_NAME. */
public static final String VRE_ID_ATTR_NAME = "gcube-vreid";
-
+
/** The Constant CURR_GROUP_ID. */
public static final String CURR_GROUP_ID = ConstantsMPFormBuilder.CURR_GROUP_ID;
- //public static final String CURR_USER_ID = ConstantsWorkspaceUploader.CURR_USER_ID;
+ // public static final String CURR_USER_ID =
+ // ConstantsWorkspaceUploader.CURR_USER_ID;
/** The Constant UPLOAD_FORM_ELEMENT. */
public static final String UPLOAD_FORM_ELEMENT = ConstantsMPFormBuilder.UPLOAD_FORM_ELEMENT;
@@ -90,12 +92,14 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
/** The Constant UPLOAD_TYPE. */
public static final String UPLOAD_TYPE = ConstantsMPFormBuilder.UPLOAD_TYPE;
+ public static final String FIELD_NAME = ConstantsMPFormBuilder.FIELD_NAME;
+
/** The logger. */
public static Logger logger = LoggerFactory.getLogger(MetadataProfileFormBuilderUploadServlet.class);
/** The app engine. */
private static boolean appEngine = false;
-
+
public static final String JAVA_IO_TMPDIR = System.getProperty("java.io.tmpdir");
/**
@@ -119,7 +123,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
appEngine = isAppEngine();
}
- logger.debug("init: appEngine is "+appEngine);
+ logger.debug("init: appEngine is " + appEngine);
}
/**
@@ -127,32 +131,32 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
*/
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- logger.debug("GET method in "+MetadataProfileFormBuilderUploadServlet.class.getName()+" is running");
+ logger.debug("GET method in " + MetadataProfileFormBuilderUploadServlet.class.getName() + " is running");
String clientUploadKey = request.getParameter(CLIENT_UPLOAD_KEYS);
- if (clientUploadKey == null){
- sendError(response, "Internal error: UPLOAD KEY NOT FOUND");
- return;
- }
- logger.debug("GET method CLIENT_UPLOAD_KEY "+clientUploadKey);
+ if (clientUploadKey == null) {
+ sendError(response, "Internal error: UPLOAD KEY NOT FOUND");
+ return;
+ }
+ logger.debug("GET method CLIENT_UPLOAD_KEY " + clientUploadKey);
- boolean cancelUpload = Boolean.parseBoolean(request.getParameter(CANCEL_UPLOAD));
- logger.debug("GET method CANCEL_UPLOAD "+cancelUpload);
- if (cancelUpload) {
- boolean cancelled = cancelUpload(request.getSession(), clientUploadKey);
- if(cancelled){
- sendMessage(response, "Upload aborted "+clientUploadKey);
+ boolean cancelUpload = Boolean.parseBoolean(request.getParameter(CANCEL_UPLOAD));
+ logger.debug("GET method CANCEL_UPLOAD " + cancelUpload);
+ if (cancelUpload) {
+ boolean cancelled = cancelUpload(request.getSession(), clientUploadKey);
+ if (cancelled) {
+ sendMessage(response, "Upload aborted " + clientUploadKey);
// try {
//// removeCurrentListener(request.getSession(), clientUploadKey);
// WsUtil.eraseWorkspaceUploaderInSession(request.getSession(), clientUploadKey);
// }catch (Exception e) {
// logger.warn("An error occurred during removing cancelled upload from session ");
// }
- }
- else
- sendWarnMessage(response, "Upload aborted for id: "+clientUploadKey +" has skipped, already aborted or completed?");
- }else
- logger.debug(CANCEL_UPLOAD + " param not found");
- return;
+ } else
+ sendWarnMessage(response,
+ "Upload aborted for id: " + clientUploadKey + " has skipped, already aborted or completed?");
+ } else
+ logger.debug(CANCEL_UPLOAD + " param not found");
+ return;
}
/**
@@ -160,8 +164,9 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
logger.info("POST on UploadServlet");
- boolean requestIsNull = request==null;
- logger.trace("[1] HttpServletRequest is: null? "+requestIsNull+", URI: "+request.getRequestURI() +", ServerName: "+request.getServerName());
+ boolean requestIsNull = request == null;
+ logger.trace("[1] HttpServletRequest is: null? " + requestIsNull + ", URI: " + request.getRequestURI()
+ + ", ServerName: " + request.getServerName());
if (!ServletFileUpload.isMultipartContent(request)) {
logger.error("ERROR: multipart request not found");
@@ -172,41 +177,46 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
try {
logger.info("UPLOAD-SERVLET starting");
- HttpSession session = request.getSession();
- logger.info("UPLOAD-SERVLET session: "+session);
- logger.debug("UPLOAD-SERVLET (" + session.getId() + ") new upload request received.");
+ HttpSession session = request.getSession();
+ logger.info("UPLOAD-SERVLET session: " + session);
+ logger.debug("UPLOAD-SERVLET (" + session.getId() + ") new upload request received.");
- if(WsUtil.isSessionExpired(request)){
- logger.error("SESSION_EXPIRED: session is expired");
- sendSessionExpired(response, "SESSION_EXPIRED: session is expired");
- return;
- }
+ if (WsUtil.isSessionExpired(request)) {
+ logger.error("SESSION_EXPIRED: session is expired");
+ sendSessionExpired(response, "SESSION_EXPIRED: session is expired");
+ return;
+ }
String uploadType = null;
- // String clientUploadKey = null;
+ String fieldName = null;
+ // String clientUploadKey = null;
FileItemStream uploadItem = null;
ArrayList listClientUploadKeys = null;
-
+
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(request);
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload servletFileUpload = new ServletFileUpload(factory);
/**
- * An iterator to instances of FileItemStream
- * parsed from the request, in the order that they were
- *transmitted.
+ * An iterator to instances of FileItemStream
parsed from the
+ * request, in the order that they were transmitted.
*/
FileItemIterator fileItemIterator = servletFileUpload.getItemIterator(request);
int uploadItemsCnt = 0;
String scopeGroupId = "";
- //GET FILE STREAM
+ // GET FILE STREAM
while (fileItemIterator.hasNext()) {
FileItemStream item = fileItemIterator.next();
- if (item.isFormField() && UPLOAD_TYPE.equals(item.getFieldName())){
+ if (item.isFormField() && UPLOAD_TYPE.equals(item.getFieldName())) {
uploadType = Streams.asString(item.openStream());
- logger.debug("UPLOAD_TYPE OK " +uploadType);
+ logger.debug(UPLOAD_TYPE + " OK " + uploadType);
+ }
+
+ if (item.isFormField() && FIELD_NAME.equals(item.getFieldName())) {
+ fieldName = Streams.asString(item.openStream());
+ logger.debug(FIELD_NAME + " OK " + fieldName);
}
// if (item.isFormField() && IS_OVERWRITE.equals(item.getFieldName())){
@@ -218,24 +228,27 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
// }
// }
- if(item.isFormField() && CLIENT_UPLOAD_KEYS.equals(item.getFieldName())){
+ if (item.isFormField() && CLIENT_UPLOAD_KEYS.equals(item.getFieldName())) {
String jsonClientUploadKey = Streams.asString(item.openStream());
- logger.debug("CLIENT_UPLOAD_KEY OK "+jsonClientUploadKey);
+ logger.debug(CLIENT_UPLOAD_KEYS + " OK " + jsonClientUploadKey);
LinkedHashMap mapKeys = parseJSONClientUploadKeys(jsonClientUploadKey);
listClientUploadKeys = new ArrayList(mapKeys.keySet());
removeListenersIfDone(session, listClientUploadKeys);
for (String clientUploadKey : listClientUploadKeys) {
String fileName = mapKeys.get(clientUploadKey);
- FileUploadingState workspaceUploader = createNewWorkspaceUploader(clientUploadKey,fileName, user.getUsername());
- logger.debug("created "+workspaceUploader);
- saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.WAIT, "Uploading "+fileName+" at 0%", request.getSession());
+ FileUploadingState workspaceUploader = createNewWorkspaceUploader(clientUploadKey, fileName,
+ user.getUsername(), fieldName);
+ logger.debug("created " + workspaceUploader);
+ saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.WAIT,
+ "Uploading " + fileName + " at 0%", request.getSession());
}
}
- if (item.isFormField() && CURR_GROUP_ID.equals(item.getFieldName())){
+ if (item.isFormField() && CURR_GROUP_ID.equals(item.getFieldName())) {
scopeGroupId = Streams.asString(item.openStream());
logger.debug("currentGroupId passed as parameter = " + scopeGroupId);
- logger.debug("currentGroupId into PortalContext scope= " + PortalContext.getConfiguration().getCurrentScope(scopeGroupId));
+ logger.debug("currentGroupId into PortalContext scope= "
+ + PortalContext.getConfiguration().getCurrentScope(scopeGroupId));
}
// if (item.isFormField() && CURR_USER_ID.equals(item.getFieldName())){
@@ -244,12 +257,13 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
// logger.debug("currUserinto PortalContext = " + PortalContext.getConfiguration().getCurrentUser(request));
// }
- //MUST BE THE LAST PARAMETER TRASMITTED
- if (UPLOAD_FORM_ELEMENT.equals(item.getFieldName())){
+ // MUST BE THE LAST PARAMETER TRASMITTED
+ if (UPLOAD_FORM_ELEMENT.equals(item.getFieldName())) {
uploadItem = item;
- logger.debug("UPLOAD_FORM_ELEMENT OK "+uploadItem.getName() + " scopeGroupId="+scopeGroupId);
+ logger.debug("UPLOAD_FORM_ELEMENT OK " + uploadItem.getName() + " scopeGroupId=" + scopeGroupId);
// break;
- uploadData(user, scopeGroupId, request, response, uploadItem, uploadType, listClientUploadKeys.get(uploadItemsCnt));
+ uploadData(user, scopeGroupId, request, response, uploadItem, uploadType,
+ listClientUploadKeys.get(uploadItemsCnt), fieldName);
uploadItemsCnt++;
}
}
@@ -265,26 +279,25 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
}
}
-
/**
* Removes the listener if done.
*
* @param session the session
- * @param keys the keys
+ * @param keys the keys
*/
- private void removeListenersIfDone(HttpSession session, List keys){
+ private void removeListenersIfDone(HttpSession session, List keys) {
for (String key : keys) {
- AbstractUploadProgressListener listener = getCurrentListener(session, key);
- if (listener != null) {
- logger.debug("Listener found");
- if (listener.isCanceled() || listener.getPercentage() >= 100){
- logger.debug("Listener isCanceled or 100%, removing");
- removeCurrentListener(session, key);
- }
- }else
- logger.debug("Session id: "+session.getId() +" - "+key+" - Listener not found");
+ AbstractUploadProgressListener listener = getCurrentListener(session, key);
+ if (listener != null) {
+ logger.debug("Listener found");
+ if (listener.isCanceled() || listener.getPercentage() >= 100) {
+ logger.debug("Listener isCanceled or 100%, removing");
+ removeCurrentListener(session, key);
+ }
+ } else
+ logger.debug("Session id: " + session.getId() + " - " + key + " - Listener not found");
}
}
@@ -297,7 +310,8 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
* @throws FileUploadException the file upload exception
*/
@SuppressWarnings("rawtypes")
- private static LinkedHashMap parseJSONClientUploadKeys(final String jsonClientUploadKeys) throws FileUploadException{
+ private static LinkedHashMap parseJSONClientUploadKeys(final String jsonClientUploadKeys)
+ throws FileUploadException {
JSONTokener tokener = new JSONTokener(jsonClientUploadKeys);
JSONObject root;
LinkedHashMap keyFiles = null;
@@ -306,147 +320,157 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
root = new JSONObject(tokener);
JSONArray jsonArray = root.getJSONArray(JSON_CLIENT_KEYS);
keyFiles = new LinkedHashMap(jsonArray.length());
- logger.debug("jsonArray :"+jsonArray.toString());
- for (int i=0; i listFiles = (List) httpSession.getAttribute(ConstantsMPFormBuilder.FILE_UPLOADED_SESSION_ATTR);
-
- if(listFiles==null)
+ if (fileUploaded != null) {
+ List listFiles = (List) httpSession
+ .getAttribute(ConstantsMPFormBuilder.FILE_UPLOADED_SESSION_ATTR);
+
+ if (listFiles == null)
listFiles = new ArrayList();
-
+
listFiles.add(fileUploaded);
httpSession.setAttribute(ConstantsMPFormBuilder.FILE_UPLOADED_SESSION_ATTR, listFiles);
- logger.info("Added: "+fileUploaded +" in session");
+ logger.info("Added: " + fileUploaded + " in session");
}
}
- //TEST TIME
+ // TEST TIME
/**
* Prints the start time.
*
* @return the long
*/
- public static Long printStartTime(){
- Long startTime = System.currentTimeMillis();
- logger.debug("Start time: "+startTime);
+ public static Long printStartTime() {
+ Long startTime = System.currentTimeMillis();
+ logger.debug("Start time: " + startTime);
return startTime;
}
- //TEST TIME
+
+ // TEST TIME
/**
* Prints the elapsed time.
*
* @param startTime the start time
*/
- public static void printElapsedTime(long startTime){
+ public static void printElapsedTime(long startTime) {
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
- logger.debug("Elapsed Time: "+time);
+ logger.debug("Elapsed Time: " + time);
}
/**
* Send error.
*
* @param response the response
- * @param message the message
+ * @param message the message
* @throws IOException Signals that an I/O exception has occurred.
*/
- protected void sendError(HttpServletResponse response, String message) throws IOException{
+ protected void sendError(HttpServletResponse response, String message) throws IOException {
try {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
HandlerResultMessage resultMessage = HandlerResultMessage.errorResult(message);
response.getWriter().write(resultMessage.toString());
- //5.6 Closure of Response Object:
- //When a response is closed, the container must immediately flush all remaining content in the response buffer to the client
+ // 5.6 Closure of Response Object:
+ // When a response is closed, the container must immediately flush all remaining
+ // content in the response buffer to the client
// response.flushBuffer();
- } catch (IOException e){
- logger.warn("IOException class name: "+e.getClass().getSimpleName());
+ } catch (IOException e) {
+ logger.warn("IOException class name: " + e.getClass().getSimpleName());
if (e.getClass().getSimpleName().equals("ClientAbortException"))
- logger.warn("Skipping ClientAbortException: "+e.getMessage());
+ logger.warn("Skipping ClientAbortException: " + e.getMessage());
else
- throw e; //Sending Exceptions
+ throw e; // Sending Exceptions
}
}
-
/**
* Send session expired.
*
* @param response the response
- * @param message the message
+ * @param message the message
* @throws IOException Signals that an I/O exception has occurred.
*/
- protected void sendSessionExpired(HttpServletResponse response, String message) throws IOException{
+ protected void sendSessionExpired(HttpServletResponse response, String message) throws IOException {
try {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
HandlerResultMessage resultMessage = HandlerResultMessage.sessionExpiredResult(message);
response.getWriter().write(resultMessage.toString());
- //5.6 Closure of Response Object:
- //When a response is closed, the container must immediately flush all remaining content in the response buffer to the client
+ // 5.6 Closure of Response Object:
+ // When a response is closed, the container must immediately flush all remaining
+ // content in the response buffer to the client
// response.flushBuffer();
- } catch (IOException e){
- logger.warn("IOException class name: "+e.getClass().getSimpleName());
+ } catch (IOException e) {
+ logger.warn("IOException class name: " + e.getClass().getSimpleName());
if (e.getClass().getSimpleName().equals("ClientAbortException"))
- logger.warn("Skipping ClientAbortException: "+e.getMessage());
+ logger.warn("Skipping ClientAbortException: " + e.getMessage());
else
- throw e; //Sending Exceptions
+ throw e; // Sending Exceptions
}
}
@@ -643,24 +674,25 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
* Send message.
*
* @param response the response
- * @param message the message
+ * @param message the message
* @throws IOException Signals that an I/O exception has occurred.
*/
- protected void sendMessage(HttpServletResponse response, String message) throws IOException{
+ protected void sendMessage(HttpServletResponse response, String message) throws IOException {
try {
response.setStatus(HttpServletResponse.SC_ACCEPTED);
message = message.replaceAll(":", "");
HandlerResultMessage resultMessage = HandlerResultMessage.okResult(message);
response.getWriter().write(resultMessage.toString());
- //5.6 Closure of Response Object:
- //When a response is closed, the container must immediately flush all remaining content in the response buffer to the client
+ // 5.6 Closure of Response Object:
+ // When a response is closed, the container must immediately flush all remaining
+ // content in the response buffer to the client
// response.flushBuffer();
- } catch (IOException e){
- logger.warn("IOException class name: "+e.getClass().getSimpleName());
+ } catch (IOException e) {
+ logger.warn("IOException class name: " + e.getClass().getSimpleName());
if (e.getClass().getSimpleName().equals("ClientAbortException"))
- logger.warn("Skipping ClientAbortException: "+e.getMessage());
+ logger.warn("Skipping ClientAbortException: " + e.getMessage());
else
- throw e; //Sending Exceptions
+ throw e; // Sending Exceptions
}
}
@@ -668,41 +700,42 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
* Send warn message.
*
* @param response the response
- * @param message the message
+ * @param message the message
* @throws IOException Signals that an I/O exception has occurred.
*/
- protected void sendWarnMessage(HttpServletResponse response, String message) throws IOException{
+ protected void sendWarnMessage(HttpServletResponse response, String message) throws IOException {
try {
response.setStatus(HttpServletResponse.SC_ACCEPTED);
HandlerResultMessage resultMessage = HandlerResultMessage.warnResult(message);
response.getWriter().write(resultMessage.toString());
- //5.6 Closure of Response Object:
- //When a response is closed, the container must immediately flush all remaining content in the response buffer to the client
+ // 5.6 Closure of Response Object:
+ // When a response is closed, the container must immediately flush all remaining
+ // content in the response buffer to the client
// response.flushBuffer();
- } catch (IOException e){
- logger.warn("IOException class name: "+e.getClass().getSimpleName());
+ } catch (IOException e) {
+ logger.warn("IOException class name: " + e.getClass().getSimpleName());
if (e.getClass().getSimpleName().equals("ClientAbortException"))
- logger.warn("Skipping ClientAbortException: "+e.getMessage());
+ logger.warn("Skipping ClientAbortException: " + e.getMessage());
else
- throw e; //Sending Exceptions
+ throw e; // Sending Exceptions
}
}
/**
* Mark the current upload process to be canceled.
*
- * @param session the session
+ * @param session the session
* @param clientUploadKey the client upload key
* @return true, if successful
*/
public boolean cancelUpload(HttpSession session, String clientUploadKey) {
- logger.debug("UPLOAD-SERVLET (" + session.getId()+ ") cancelling Upload: "+clientUploadKey);
+ logger.debug("UPLOAD-SERVLET (" + session.getId() + ") cancelling Upload: " + clientUploadKey);
AbstractUploadProgressListener listener = getCurrentListener(session, clientUploadKey);
if (listener != null && !listener.isCanceled()) {
- logger.info("CancelUpload listener is "+listener.toString());
+ logger.info("CancelUpload listener is " + listener.toString());
listener.setException(new UploadCanceledException());
return true;
- }else{
+ } else {
logger.info("Skipping cancel upload: listener is null or is cancel");
return false;
}
@@ -711,7 +744,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
/**
* Get the listener active in this session.
*
- * @param session the session
+ * @param session the session
* @param clientUploadKey the client upload key
* @return the listener active
*/
@@ -724,8 +757,8 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
}
/**
- * Just a method to detect whether the web container is running with
- * appengine restrictions.
+ * Just a method to detect whether the web container is running with appengine
+ * restrictions.
*
* @return true if the case of the application is running in appengine
*/
@@ -736,7 +769,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
/**
* Create a new listener for this session.
*
- * @param session the session
+ * @param session the session
* @param clientUploadKey the client upload key
* @return the appropriate listener
*/
@@ -748,7 +781,6 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
}
}
-
/**
* Gets the content length.
*
@@ -758,8 +790,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
private long getContentLength(HttpServletRequest request) {
long size = -1;
try {
- size = Long.parseLong(request
- .getHeader(FileUploadBase.CONTENT_LENGTH));
+ size = Long.parseLong(request.getHeader(FileUploadBase.CONTENT_LENGTH));
} catch (NumberFormatException e) {
}
return size;
@@ -768,17 +799,17 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
/**
* Remove the listener active in this session.
*
- * @param session the session
+ * @param session the session
* @param clientUploadKey the client upload key
*/
protected void removeCurrentListener(HttpSession session, String clientUploadKey) {
- logger.debug("RemoveCurrentListener: "+clientUploadKey);
+ logger.debug("RemoveCurrentListener: " + clientUploadKey);
AbstractUploadProgressListener listener = getCurrentListener(session, clientUploadKey);
if (listener != null) {
- logger.debug("Removing listener: "+listener.getClientUploadKey());
+ logger.debug("Removing listener: " + listener.getClientUploadKey());
listener.remove();
- }else
- logger.warn("Listener "+clientUploadKey+ "is null");
+ } else
+ logger.warn("Listener " + clientUploadKey + "is null");
}
}
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/GenericDatasetBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/GenericDatasetBean.java
index b3ed0c6..fa4a3e6 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/GenericDatasetBean.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/GenericDatasetBean.java
@@ -3,7 +3,6 @@ package org.gcube.portlets.widgets.mpformbuilder.shared;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java
index 1094a4b..a406b78 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java
@@ -38,7 +38,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
}
/**
- * Instantiates a new metadata field.
+ * Instantiates a new metadata field wrapper.
*
* @param fieldName the field name
* @param mandatory the mandatory
@@ -83,7 +83,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
/**
* Gets the field name.
*
- * @return the fieldName
+ * @return the serviceFieldName
*/
public String getFieldName() {
@@ -143,7 +143,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
/**
* Sets the field name.
*
- * @param fieldName the fieldName to set
+ * @param fieldName the new field name
*/
public void setFieldName(String fieldName) {
@@ -339,7 +339,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
*/
@Override
public String toString() {
- return "MetadataFieldWrapper [" + (fieldName != null ? "fieldName=" + fieldName + ", " : "")
+ return "MetadataFieldWrapper [" + (fieldName != null ? "serviceFieldName=" + fieldName + ", " : "")
+ (fieldNameFromCategory != null ? "fieldNameFromCategory=" + fieldNameFromCategory + ", " : "")
+ (mandatory != null ? "mandatory=" + mandatory + ", " : "")
+ (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FilePath.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FilePath.java
new file mode 100644
index 0000000..22d0d2a
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FilePath.java
@@ -0,0 +1,67 @@
+package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
+
+import java.io.Serializable;
+
+/**
+ * The Class FilePath.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
+ *
+ * Mar 21, 2022
+ */
+public class FilePath implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5321133561716734223L;
+ String formFieldLabel; // is the gcubeProfileFieldName in the UCD of Geoportal
+
+ /**
+ * Instantiates a new file paths.
+ */
+ public FilePath() {
+ }
+
+ /**
+ * Instantiates a new file path.
+ *
+ * @param formFieldLabel the form field label
+ */
+ public FilePath(String formFieldLabel) {
+ this.formFieldLabel = formFieldLabel;
+ }
+
+ /**
+ * Gets the form field label.
+ *
+ * @return the form field label
+ */
+ public String getFormFieldLabel() {
+ return formFieldLabel;
+ }
+
+ /**
+ * Sets the form field label.
+ *
+ * @param formFieldLabel the new form field label
+ */
+ public void setFormFieldLabel(String formFieldLabel) {
+ this.formFieldLabel = formFieldLabel;
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("FilePath [formFieldLabel=");
+ builder.append(formFieldLabel);
+ builder.append("]");
+ return builder.toString();
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FileUploaded.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FileUploaded.java
index 65cf9e4..38ce12d 100644
--- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FileUploaded.java
+++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/upload/FileUploaded.java
@@ -7,49 +7,50 @@ import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
-
/**
* The Class FileUploaded.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Oct 8, 2020
+ * Oct 8, 2020
*/
-public class FileUploaded implements Serializable, IsSerializable{
-
+public class FileUploaded implements Serializable, IsSerializable {
/**
*
*/
- private static final long serialVersionUID = -7869956386977214114L;
+ private static final long serialVersionUID = -6666006742990360875L;
/** The file name. */
private String fileName;
-
+
/** The item id. */
private String tempSystemPath;
-
+
private String createdByUser;
+ private FilePath filePath;
+
/**
* Instantiates a new workspace upload file.
*/
public FileUploaded() {
}
-
-
+
/**
- * Instantiates a new workspace upload file.
+ * Instantiates a new file uploaded.
*
- * @param fileName the file name
+ * @param fileName the file name
* @param tempSystemPath the temp system path
- * @param createdByUser the created by user
+ * @param createdByUser the created by user
+ * @param filePath the file path
*/
- public FileUploaded(String fileName, String tempSystemPath, String createdByUser) {
+ public FileUploaded(String fileName, String tempSystemPath, String createdByUser, FilePath filePath) {
super();
this.fileName = fileName;
this.tempSystemPath = tempSystemPath;
this.createdByUser = createdByUser;
+ this.filePath = filePath;
}
/**
@@ -61,8 +62,6 @@ public class FileUploaded implements Serializable, IsSerializable{
return fileName;
}
-
-
/**
* Sets the file name.
*
@@ -72,8 +71,6 @@ public class FileUploaded implements Serializable, IsSerializable{
this.fileName = fileName;
}
-
-
/**
* Gets the temp system path.
*
@@ -83,8 +80,6 @@ public class FileUploaded implements Serializable, IsSerializable{
return tempSystemPath;
}
-
-
/**
* Sets the temp system path.
*
@@ -94,8 +89,6 @@ public class FileUploaded implements Serializable, IsSerializable{
this.tempSystemPath = tempSystemPath;
}
-
-
/**
* Gets the created by user.
*
@@ -105,8 +98,6 @@ public class FileUploaded implements Serializable, IsSerializable{
return createdByUser;
}
-
-
/**
* Sets the created by user.
*
@@ -116,7 +107,29 @@ public class FileUploaded implements Serializable, IsSerializable{
this.createdByUser = createdByUser;
}
+ /**
+ * Gets the file paths.
+ *
+ * @return the file paths
+ */
+ public FilePath getFilePath() {
+ return filePath;
+ }
+ /**
+ * Sets the file paths.
+ *
+ * @param filePaths the new file paths
+ */
+ public void setFilePaths(FilePath filePaths) {
+ this.filePath = filePaths;
+ }
+
+ /**
+ * To string.
+ *
+ * @return the string
+ */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@@ -126,8 +139,10 @@ public class FileUploaded implements Serializable, IsSerializable{
builder.append(tempSystemPath);
builder.append(", createdByUser=");
builder.append(createdByUser);
+ builder.append(", filePath=");
+ builder.append(filePath);
builder.append("]");
return builder.toString();
}
-
+
}