4055: Workspace Uploder enhancement: work with multiple-instances of DnD Workspace Uploader in the DOM
Task-Url: https://support.d4science.org/issues/4055 ProgressListener and WorkspaceUploader removed after last read from client git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@128685 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c6bf3b0660
commit
efea5d3c8f
|
@ -1,112 +1,112 @@
|
||||||
package org.gcube.portlets.widgets.workspaceuploader.client;
|
//package org.gcube.portlets.widgets.workspaceuploader.client;
|
||||||
|
//
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
//import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload;
|
//import org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
//import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
||||||
|
//
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
//import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.ScriptInjector;
|
//import com.google.gwt.core.client.ScriptInjector;
|
||||||
import com.google.gwt.core.shared.GWT;
|
//import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
//import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
//import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.user.client.Window;
|
//import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
//import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
//import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
//import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
// * Entry point classes define <code>onModuleLoad()</code>.
|
||||||
*/
|
// */
|
||||||
public class WorkspaceUploader implements EntryPoint {
|
//public class WorkspaceUploader implements EntryPoint {
|
||||||
|
//
|
||||||
String headerTitle = "Upload in your Workspace";
|
// String headerTitle = "Upload in your Workspace";
|
||||||
String parentId;
|
// String parentId;
|
||||||
private Button buttonUploader;
|
// private Button buttonUploader;
|
||||||
private Button buttonDirect;
|
// private Button buttonDirect;
|
||||||
|
//
|
||||||
public void onModuleLoad() {
|
// public void onModuleLoad() {
|
||||||
|
//
|
||||||
boolean jQueryLoaded = isjQueryLoaded();
|
// boolean jQueryLoaded = isjQueryLoaded();
|
||||||
GWT.log("jQueryLoaded: "+jQueryLoaded);
|
// GWT.log("jQueryLoaded: "+jQueryLoaded);
|
||||||
|
//
|
||||||
GWT.log("Injected : http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js");
|
// GWT.log("Injected : http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js");
|
||||||
|
//
|
||||||
if (!jQueryLoaded) {
|
// if (!jQueryLoaded) {
|
||||||
ScriptInjector.fromUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js")
|
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW)
|
|
||||||
.inject();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScriptInjector.fromUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js")
|
// ScriptInjector.fromUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js")
|
||||||
// .setWindow(ScriptInjector.TOP_WINDOW)
|
// .setWindow(ScriptInjector.TOP_WINDOW)
|
||||||
// .inject();
|
// .inject();
|
||||||
|
// }
|
||||||
buttonUploader = new Button("Upload in your Workspace");
|
//
|
||||||
buttonDirect = new Button("Upload (Stream) in your Workspace");
|
//// ScriptInjector.fromUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js")
|
||||||
enableUpload(false);
|
//// .setWindow(ScriptInjector.TOP_WINDOW)
|
||||||
|
//// .inject();
|
||||||
WorkspaceUploaderServiceAsync.Util.getInstance().getWorkspaceId(
|
//
|
||||||
new AsyncCallback<String>() {
|
// buttonUploader = new Button("Upload in your Workspace");
|
||||||
|
// buttonDirect = new Button("Upload (Stream) in your Workspace");
|
||||||
@Override
|
// enableUpload(false);
|
||||||
public void onSuccess(String result) {
|
//
|
||||||
|
// WorkspaceUploaderServiceAsync.Util.getInstance().getWorkspaceId(
|
||||||
if (result != null) {
|
// new AsyncCallback<String>() {
|
||||||
parentId = result;
|
//
|
||||||
enableUpload(true);
|
// @Override
|
||||||
} else {
|
// public void onSuccess(String result) {
|
||||||
Window.alert("An error occurred on recovering workspace, try again later");
|
//
|
||||||
enableUpload(true);
|
// if (result != null) {
|
||||||
}
|
// parentId = result;
|
||||||
}
|
// enableUpload(true);
|
||||||
|
// } else {
|
||||||
@Override
|
// Window.alert("An error occurred on recovering workspace, try again later");
|
||||||
public void onFailure(Throwable caught) {
|
// enableUpload(true);
|
||||||
Window.alert("An error occurred on recovering workspace, try again later");
|
// }
|
||||||
enableUpload(true);
|
// }
|
||||||
}
|
//
|
||||||
});
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
buttonDirect.addClickHandler(new ClickHandler() {
|
// Window.alert("An error occurred on recovering workspace, try again later");
|
||||||
|
// enableUpload(true);
|
||||||
@Override
|
// }
|
||||||
public void onClick(ClickEvent event) {
|
// });
|
||||||
MultipleDilaogUpload uploadStream = new MultipleDilaogUpload(headerTitle, parentId, org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE.File);
|
//
|
||||||
uploadStream.initFileReader();
|
// buttonDirect.addClickHandler(new ClickHandler() {
|
||||||
uploadStream.center();
|
//
|
||||||
|
// @Override
|
||||||
}
|
// public void onClick(ClickEvent event) {
|
||||||
});
|
|
||||||
|
|
||||||
final MultipleDNDUpload dnd = new MultipleDNDUpload();
|
|
||||||
|
|
||||||
buttonDirect.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
// MultipleDilaogUpload uploadStream = new MultipleDilaogUpload(headerTitle, parentId, org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE.File);
|
// MultipleDilaogUpload uploadStream = new MultipleDilaogUpload(headerTitle, parentId, org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE.File);
|
||||||
// uploadStream.initFileReader();
|
// uploadStream.initFileReader();
|
||||||
// uploadStream.center();
|
// uploadStream.center();
|
||||||
dnd.setParameters(parentId, UPLOAD_TYPE.File);
|
//
|
||||||
|
// }
|
||||||
}
|
// });
|
||||||
});
|
//
|
||||||
|
// final MultipleDNDUpload dnd = new MultipleDNDUpload();
|
||||||
RootPanel.get("workspace-uploader").add(dnd);
|
//
|
||||||
RootPanel.get("workspace-uploader").add(buttonDirect);
|
// buttonDirect.addClickHandler(new ClickHandler() {
|
||||||
}
|
//
|
||||||
|
// @Override
|
||||||
private void enableUpload(boolean bool){
|
// public void onClick(ClickEvent event) {
|
||||||
buttonUploader.setEnabled(bool);
|
//// MultipleDilaogUpload uploadStream = new MultipleDilaogUpload(headerTitle, parentId, org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE.File);
|
||||||
buttonDirect.setEnabled(bool);
|
//// uploadStream.initFileReader();
|
||||||
}
|
//// uploadStream.center();
|
||||||
|
// dnd.setParameters(parentId, UPLOAD_TYPE.File);
|
||||||
/**
|
//
|
||||||
* Checks if is j query loaded.
|
// }
|
||||||
*
|
// });
|
||||||
* @return true, if is j query loaded
|
//
|
||||||
*/
|
// RootPanel.get("workspace-uploader").add(dnd);
|
||||||
private native boolean isjQueryLoaded() /*-{
|
// RootPanel.get("workspace-uploader").add(buttonDirect);
|
||||||
return (typeof $wnd['jQuery'] !== 'undefined');
|
// }
|
||||||
}-*/;
|
//
|
||||||
}
|
// private void enableUpload(boolean bool){
|
||||||
|
// buttonUploader.setEnabled(bool);
|
||||||
|
// buttonDirect.setEnabled(bool);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Checks if is j query loaded.
|
||||||
|
// *
|
||||||
|
// * @return true, if is j query loaded
|
||||||
|
// */
|
||||||
|
// private native boolean isjQueryLoaded() /*-{
|
||||||
|
// return (typeof $wnd['jQuery'] !== 'undefined');
|
||||||
|
// }-*/;
|
||||||
|
//}
|
||||||
|
|
|
@ -66,6 +66,22 @@ public class MultipleDilaogUpload extends DialogUpload {
|
||||||
this.addHandlers();
|
this.addHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.user.client.ui.DialogBox#show()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.user.client.ui.PopupPanel#center()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void center() {
|
||||||
|
super.center();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate new upload client keys.
|
* Generate new upload client keys.
|
||||||
*
|
*
|
||||||
|
@ -377,8 +393,7 @@ public class MultipleDilaogUpload extends DialogUpload {
|
||||||
* the file delimiter
|
* the file delimiter
|
||||||
* @return the files selected
|
* @return the files selected
|
||||||
*/
|
*/
|
||||||
public static native String getFilesSelected(final String tagId,
|
public static native String getFilesSelected(final String tagId, final String fileDelimiter) /*-{
|
||||||
final String fileDelimiter) /*-{
|
|
||||||
var count = $wnd.$("#" + tagId)[0].files.length;
|
var count = $wnd.$("#" + tagId)[0].files.length;
|
||||||
console.log(count);
|
console.log(count);
|
||||||
var out = "";
|
var out = "";
|
||||||
|
@ -392,150 +407,150 @@ public class MultipleDilaogUpload extends DialogUpload {
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Inits the file reader.
|
// * Inits the file reader.
|
||||||
*/
|
// */
|
||||||
public void initFileReader() {
|
// public void initFileReader() {
|
||||||
initW3CFileReader(instance, MultipleDilaogUpload.FILE_DELEMITER);
|
// initW3CFileReader(instance, MultipleDilaogUpload.FILE_DELEMITER);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Gets the files selected.
|
// * Gets the files selected.
|
||||||
*
|
// *
|
||||||
* @param instance the instance
|
// * @param instance the instance
|
||||||
* @param fileDelimiter the file delimiter
|
// * @param fileDelimiter the file delimiter
|
||||||
* @return the files selected
|
// * @return the files selected
|
||||||
*/
|
// */
|
||||||
public static native String initW3CFileReader(MultipleDilaogUpload instance, String fileDelimiter) /*-{
|
// public static native String initW3CFileReader(MultipleDilaogUpload instance, String fileDelimiter) /*-{
|
||||||
console.log("initW3CFileReader");
|
// console.log("initW3CFileReader");
|
||||||
|
//
|
||||||
if (window.FileReader) {
|
// if (window.FileReader) {
|
||||||
console.log("before load");
|
// console.log("before load");
|
||||||
var drop = $wnd.$('#drop_target')[0];
|
// var drop = $wnd.$('#drop_target')[0];
|
||||||
console.log("drop is " + drop);
|
// console.log("drop is " + drop);
|
||||||
|
//
|
||||||
function cancel(e) {
|
// function cancel(e) {
|
||||||
if (e.preventDefault) {
|
// if (e.preventDefault) {
|
||||||
e.preventDefault();
|
// e.preventDefault();
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
function addEventHandler(obj, evt, handler) {
|
// function addEventHandler(obj, evt, handler) {
|
||||||
if (obj.addEventListener) {
|
// if (obj.addEventListener) {
|
||||||
// W3C method
|
// // W3C method
|
||||||
obj.addEventListener(evt, handler, false);
|
// obj.addEventListener(evt, handler, false);
|
||||||
} else if (obj.attachEvent) {
|
// } else if (obj.attachEvent) {
|
||||||
// IE method.
|
// // IE method.
|
||||||
obj.attachEvent('on' + evt, handler);
|
// obj.attachEvent('on' + evt, handler);
|
||||||
} else {
|
// } else {
|
||||||
// Old school method.
|
// // Old school method.
|
||||||
obj['on' + evt] = handler;
|
// obj['on' + evt] = handler;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
addEventHandler(drop, 'drop', function(e) {
|
// addEventHandler(drop, 'drop', function(e) {
|
||||||
e = e || window.event; // get window.event if e argument missing (in IE)
|
// e = e || window.event; // get window.event if e argument missing (in IE)
|
||||||
if (e.preventDefault) {
|
// if (e.preventDefault) {
|
||||||
e.preventDefault();
|
// e.preventDefault();
|
||||||
} // stops the browser from redirecting off to the image.
|
// } // stops the browser from redirecting off to the image.
|
||||||
|
//
|
||||||
var servlet = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::servlet;
|
// var servlet = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::servlet;
|
||||||
|
//
|
||||||
var opts = {
|
// var opts = {
|
||||||
url : servlet,
|
// url : servlet,
|
||||||
type : "POST",
|
// type : "POST",
|
||||||
processData : false
|
// processData : false
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
var idfolder = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::idFolder;
|
// var idfolder = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::idFolder;
|
||||||
console.log("idfolder: " + idfolder);
|
// console.log("idfolder: " + idfolder);
|
||||||
|
//
|
||||||
var uploadType = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::type;
|
// var uploadType = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::type;
|
||||||
console.log("uploadType: " + uploadType);
|
// console.log("uploadType: " + uploadType);
|
||||||
|
//
|
||||||
var dt = e.dataTransfer;
|
// var dt = e.dataTransfer;
|
||||||
var files = dt.files;
|
// var files = dt.files;
|
||||||
|
//
|
||||||
var filesSelected = "";
|
// var filesSelected = "";
|
||||||
|
//
|
||||||
for (i = 0; i < files.length; i++) {
|
// for (i = 0; i < files.length; i++) {
|
||||||
filesSelected += files[i].name + fileDelimiter;
|
// filesSelected += files[i].name + fileDelimiter;
|
||||||
}
|
// }
|
||||||
console.log("filesSelected: " + filesSelected);
|
// console.log("filesSelected: " + filesSelected);
|
||||||
|
//
|
||||||
// var files = filese
|
//// var files = filese
|
||||||
// var files = filesSelected.split(fileDelimiter);
|
//// var files = filesSelected.split(fileDelimiter);
|
||||||
console.log("files: " + files);
|
// console.log("files: " + files);
|
||||||
|
//
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::isLimitExceeded(I)(files.length);
|
// instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::isLimitExceeded(I)(files.length);
|
||||||
|
//
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::generateFakeUploaders(Ljava/lang/String;Ljava/lang/String;)(filesSelected,idfolder);
|
// instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::generateFakeUploaders(Ljava/lang/String;Ljava/lang/String;)(filesSelected,idfolder);
|
||||||
|
//
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::createJsonKeyForFiles()();
|
// instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::createJsonKeyForFiles()();
|
||||||
|
//
|
||||||
var jsonKeys = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::jsonKeys;
|
// var jsonKeys = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::jsonKeys;
|
||||||
console.log("jsonKeys: " + jsonKeys);
|
// console.log("jsonKeys: " + jsonKeys);
|
||||||
|
//
|
||||||
for (var i = 0; i < files.length; i++) {
|
// for (var i = 0; i < files.length; i++) {
|
||||||
var file = files[i];
|
// var file = files[i];
|
||||||
// var reader = new FileReader();
|
//// var reader = new FileReader();
|
||||||
|
//
|
||||||
var xhr = new XMLHttpRequest();
|
// var xhr = new XMLHttpRequest();
|
||||||
// var upload = xhr.upload;
|
//// var upload = xhr.upload;
|
||||||
|
//
|
||||||
// upload.fileIndex = i;
|
//// upload.fileIndex = i;
|
||||||
// upload.fileObj = file;
|
//// upload.fileObj = file;
|
||||||
// upload.downloadStartTime = new Date().getTime();
|
//// upload.downloadStartTime = new Date().getTime();
|
||||||
// upload.currentStart = upload.downloadStartTime;
|
//// upload.currentStart = upload.downloadStartTime;
|
||||||
// upload.currentProgress = 0;
|
//// upload.currentProgress = 0;
|
||||||
// upload.startData = 0;
|
//// upload.startData = 0;
|
||||||
|
//
|
||||||
// console.log("upload: " + upload.toString());
|
//// console.log("upload: " + upload.toString());
|
||||||
// add listeners
|
// // add listeners
|
||||||
|
//
|
||||||
// upload.addEventListener("progress", progress, false);
|
//// upload.addEventListener("progress", progress, false);
|
||||||
// upload.addEventListener("load", load, false);
|
//// upload.addEventListener("load", load, false);
|
||||||
|
//
|
||||||
xhr.open(opts.type, opts.url, true);
|
// xhr.open(opts.type, opts.url, true);
|
||||||
// var boundary = "AJAX--------------" + (new Date).getTime();
|
//// var boundary = "AJAX--------------" + (new Date).getTime();
|
||||||
// var contentType = "multipart/form-data; boundary=" + boundary;
|
//// var contentType = "multipart/form-data; boundary=" + boundary;
|
||||||
// xhr.setRequestHeader("Content-Type", contentType);
|
//// xhr.setRequestHeader("Content-Type", contentType);
|
||||||
// Use native function(Chrome 5+ ,Safari 5+ and Firefox 4+), for dealing
|
// // Use native function(Chrome 5+ ,Safari 5+ and Firefox 4+), for dealing
|
||||||
// with multipart/form-data and boundray generation
|
// // with multipart/form-data and boundray generation
|
||||||
|
//
|
||||||
var formdata = new FormData(); // see
|
// var formdata = new FormData(); // see
|
||||||
// https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects
|
// // https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects
|
||||||
// 'file' can be any string which you would like to associte with
|
// // 'file' can be any string which you would like to associte with
|
||||||
// uploaded file even for example file.type eg:
|
// // uploaded file even for example file.type eg:
|
||||||
// formdata.append(file.type, file);
|
// // formdata.append(file.type, file);
|
||||||
// formdata.append(file.fileName, file);
|
// // formdata.append(file.fileName, file);
|
||||||
|
//
|
||||||
formdata.append("isOverwrite", "false");
|
// formdata.append("isOverwrite", "false");
|
||||||
|
//
|
||||||
// $wnd.exportCreateJsonKeyForFiles();
|
// // $wnd.exportCreateJsonKeyForFiles();
|
||||||
//
|
// //
|
||||||
// $wnd.exportAddNewSubmitToMonitor();
|
// // $wnd.exportAddNewSubmitToMonitor();
|
||||||
|
//
|
||||||
formdata.append("client_upload_keys", jsonKeys);
|
// formdata.append("client_upload_keys", jsonKeys);
|
||||||
formdata.append("uploadType", uploadType);
|
// formdata.append("uploadType", uploadType);
|
||||||
formdata.append("idFolder", idfolder);
|
// formdata.append("idFolder", idfolder);
|
||||||
formdata.append('uploadFormElement', file);
|
// formdata.append('uploadFormElement', file);
|
||||||
|
//
|
||||||
xhr.send(formdata);
|
// xhr.send(formdata);
|
||||||
|
//
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::addNewSubmitToMonitor()();
|
// instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.MultipleDilaogUpload::addNewSubmitToMonitor()();
|
||||||
|
//
|
||||||
// reader.readAsText(file);
|
//// reader.readAsText(file);
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
})
|
// })
|
||||||
|
//
|
||||||
// Tells the browser that we *can* drop on this target
|
// // Tells the browser that we *can* drop on this target
|
||||||
addEventHandler(drop, 'dragover', cancel);
|
// addEventHandler(drop, 'dragover', cancel);
|
||||||
addEventHandler(drop, 'dragenter', cancel);
|
// addEventHandler(drop, 'dragenter', cancel);
|
||||||
} else {
|
// } else {
|
||||||
$wnd.$('#drop_target')[0].innerHTML = 'Your browser does not support the HTML5 FileReader.';
|
// $wnd.$('#drop_target')[0].innerHTML = 'Your browser does not support the HTML5 FileReader.';
|
||||||
}
|
// }
|
||||||
}-*/;
|
// }-*/;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package org.gcube.portlets.widgets.workspaceuploader.client.uploader;
|
package org.gcube.portlets.widgets.workspaceuploader.client.uploader;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.ConstantsWorkspaceUploader;
|
import org.gcube.portlets.widgets.workspaceuploader.client.ConstantsWorkspaceUploader;
|
||||||
|
@ -120,7 +121,7 @@ public class WorkspaceFieldsUploadManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("generating fake uploaders on: "+files.toString());
|
GWT.log("generating fake uploaders on: "+Arrays.asList(files).toString());
|
||||||
fakeUploaders = new ArrayList<WorkspaceUploaderItem>(files.length);
|
fakeUploaders = new ArrayList<WorkspaceUploaderItem>(files.length);
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
WorkspaceUploaderItem fakeItem = new WorkspaceUploaderItem();
|
WorkspaceUploaderItem fakeItem = new WorkspaceUploaderItem();
|
||||||
|
|
|
@ -161,13 +161,14 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
initW3CFileReader(this, FILE_DELEMITER);
|
initW3CFileReader(this, FILE_DELEMITER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the workspace fields.
|
* New workspace fields manager for uuid.
|
||||||
*
|
*
|
||||||
* @param uploadUUID
|
* @param uploadUUID the upload uuid
|
||||||
* the upload uuid
|
|
||||||
*/
|
*/
|
||||||
private void initWorkspaceFields(String uploadUUID) {
|
private void newWorkspaceFieldsManagerForUUID(String uploadUUID) {
|
||||||
fields.put(uploadUUID, new WorkspaceFieldsUploadManager());
|
fields.put(uploadUUID, new WorkspaceFieldsUploadManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +207,7 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
* the upload uuid
|
* the upload uuid
|
||||||
*/
|
*/
|
||||||
private void addNewSubmitToMonitor(String uploadUUID) {
|
private void addNewSubmitToMonitor(String uploadUUID) {
|
||||||
WorkspaceFieldsUploadManager field = getField(uploadUUID);
|
WorkspaceFieldsUploadManager field = getFieldsUploadManager(uploadUUID);
|
||||||
field.addNewSubmitToMonitor();
|
field.addNewSubmitToMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +218,7 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
* the upload uuid
|
* the upload uuid
|
||||||
*/
|
*/
|
||||||
private void createJsonKeyForFiles(String uploadUUID) {
|
private void createJsonKeyForFiles(String uploadUUID) {
|
||||||
WorkspaceFieldsUploadManager field = getField(uploadUUID);
|
WorkspaceFieldsUploadManager field = getFieldsUploadManager(uploadUUID);
|
||||||
field.createJsonKeyForFiles();
|
field.createJsonKeyForFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,20 +232,19 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
* @param uploadUUID
|
* @param uploadUUID
|
||||||
* the upload uuid
|
* the upload uuid
|
||||||
*/
|
*/
|
||||||
private void generateFakeUploaders(String filesSelected, String parentId,
|
private void generateFakeUploaders(String filesSelected, String parentId, String uploadUUID) {
|
||||||
String uploadUUID) {
|
WorkspaceFieldsUploadManager field = getFieldsUploadManager(uploadUUID);
|
||||||
WorkspaceFieldsUploadManager field = getField(uploadUUID);
|
|
||||||
field.generateFakeUploaders(filesSelected, parentId);
|
field.generateFakeUploaders(filesSelected, parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the fields.
|
* Gets the field upload manager.
|
||||||
*
|
*
|
||||||
* @param uploadUUID
|
* @param uploadUUID the upload uuid
|
||||||
* the upload uuid
|
* @return the field upload manager
|
||||||
* @return the fields
|
|
||||||
*/
|
*/
|
||||||
private WorkspaceFieldsUploadManager getField(String uploadUUID) {
|
private WorkspaceFieldsUploadManager getFieldsUploadManager(String uploadUUID) {
|
||||||
return fields.get(uploadUUID);
|
return fields.get(uploadUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
* the upload uuid
|
* the upload uuid
|
||||||
*/
|
*/
|
||||||
private void updateJsonKeys(String uploadUUID) {
|
private void updateJsonKeys(String uploadUUID) {
|
||||||
WorkspaceFieldsUploadManager field = getField(uploadUUID);
|
WorkspaceFieldsUploadManager field = getFieldsUploadManager(uploadUUID);
|
||||||
jsonKeys.put(uploadUUID, field.getJsonKeys());
|
jsonKeys.put(uploadUUID, field.getJsonKeys());
|
||||||
// this.jsonKeys = field.getJsonKeys();
|
// this.jsonKeys = field.getJsonKeys();
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
var uploadUUID = generateUUID();
|
var uploadUUID = generateUUID();
|
||||||
console.log("uploadKey: " + uploadUUID);
|
console.log("uploadKey: " + uploadUUID);
|
||||||
//NEW WORKSPACE FIELDS
|
//NEW WORKSPACE FIELDS
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::initWorkspaceFields(Ljava/lang/String;)(uploadUUID);
|
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::newWorkspaceFieldsManagerForUUID(Ljava/lang/String;)(uploadUUID);
|
||||||
|
|
||||||
var servlet = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::servlet;
|
var servlet = instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::servlet;
|
||||||
|
|
||||||
|
@ -584,12 +584,12 @@ public class MultipleDNDUpload extends LayoutPanel implements HasWorskpaceUpload
|
||||||
var numFolder = 0;
|
var numFolder = 0;
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
var file = files[i];
|
var file = files[i];
|
||||||
var filesSelected = files[i].name + fileDelimiter;
|
var fileSelected = files[i].name + fileDelimiter;
|
||||||
if (!isFolder(file)) {
|
if (!isFolder(file)) {
|
||||||
|
|
||||||
console.log("filesSelected: " + filesSelected);
|
console.log("fileSelected: " + fileSelected);
|
||||||
console.log("files: " + files);
|
console.log("files: " + files);
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::generateFakeUploaders(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(filesSelected,idfolder,uploadUUID);
|
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::generateFakeUploaders(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(fileSelected,idfolder,uploadUUID);
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::createJsonKeyForFiles(Ljava/lang/String;)(uploadUUID);
|
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::createJsonKeyForFiles(Ljava/lang/String;)(uploadUUID);
|
||||||
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::updateJsonKeys(Ljava/lang/String;)(uploadUUID);
|
instance.@org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload::updateJsonKeys(Ljava/lang/String;)(uploadUUID);
|
||||||
|
|
||||||
|
|
|
@ -741,7 +741,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
// StreamUtils.deleteTempFile(file);
|
// StreamUtils.deleteTempFile(file);
|
||||||
WsUtil.eraseWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
WsUtil.setErasableWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
// StreamUtils.deleteTempFile(fileInputStream);
|
// StreamUtils.deleteTempFile(fileInputStream);
|
||||||
WsUtil.eraseWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
WsUtil.setErasableWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.widgets.workspaceuploader.server;
|
package org.gcube.portlets.widgets.workspaceuploader.server;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
@ -37,6 +39,7 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
|
||||||
}
|
}
|
||||||
logger.trace("Get UploadStatus for id: "+identifier);
|
logger.trace("Get UploadStatus for id: "+identifier);
|
||||||
WorkspaceUploaderItem uploader = WsUtil.getWorkspaceUploaderInSession(getThreadLocalRequest().getSession(), identifier);
|
WorkspaceUploaderItem uploader = WsUtil.getWorkspaceUploaderInSession(getThreadLocalRequest().getSession(), identifier);
|
||||||
|
logger.trace("Uploader status for id: "+identifier +" returns "+uploader);
|
||||||
|
|
||||||
if (uploader == null) {
|
if (uploader == null) {
|
||||||
WorkspaceUploaderItem waitingUpload = new WorkspaceUploaderItem(identifier, null, UPLOAD_STATUS.WAIT, "Upload waiting..", new UploadProgress());
|
WorkspaceUploaderItem waitingUpload = new WorkspaceUploaderItem(identifier, null, UPLOAD_STATUS.WAIT, "Upload waiting..", new UploadProgress());
|
||||||
|
@ -56,10 +59,42 @@ public class WorkspaceUploaderServiceImpl extends RemoteServiceServlet implement
|
||||||
progress = "upload progress is null or last event is null";
|
progress = "upload progress is null or last event is null";
|
||||||
|
|
||||||
logger.info("returning uploader: "+uploader.getClientUploadKey() +" status: "+uploader.getUploadStatus() +", file: "+uploader.getFile().toString() +", progress: "+progress);
|
logger.info("returning uploader: "+uploader.getClientUploadKey() +" status: "+uploader.getUploadStatus() +", file: "+uploader.getFile().toString() +", progress: "+progress);
|
||||||
|
|
||||||
|
checkUploaderErasable(getThreadLocalRequest().getSession(), uploader);
|
||||||
return uploader;
|
return uploader;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check uploader erasable.
|
||||||
|
*
|
||||||
|
* @param httpSession the http session
|
||||||
|
* @param uploader the uploader
|
||||||
|
*/
|
||||||
|
private void checkUploaderErasable(final HttpSession httpSession, final WorkspaceUploaderItem uploader){
|
||||||
|
logger.trace("Checking Uploader erasable...");
|
||||||
|
|
||||||
|
if(uploader==null){
|
||||||
|
logger.error("Uploader is null, returning..");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Thread(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
logger.trace("Uploader: "+uploader.getClientUploadKey() +"is erasable?");
|
||||||
|
WsUtil.eraseWorkspaceUploaderInSession(httpSession, uploader);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
logger.warn("Error during checkUploaderErasable: ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploaderService#getWorkspaceId()
|
* @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploaderService#getWorkspaceId()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -175,6 +175,9 @@ public class UploadProgressListener extends AbstractUploadProgressListener {
|
||||||
public void remove() {
|
public void remove() {
|
||||||
logger.debug(sessionKey + " removing: " + toString());
|
logger.debug(sessionKey + " removing: " + toString());
|
||||||
if (getSession() != null) {
|
if (getSession() != null) {
|
||||||
|
// logger.debug(sessionKey + " skipping remove. A TODO must be realized");
|
||||||
|
// /*TODO REMOVE SESSION KEY FROM SESSION MUST BE MANAGED IN ANOTHER WAY IN ORDER TO AVOID THAT
|
||||||
|
// * IT'S REMOVED FROM SESSION BEFORE THAT POLLING RETRIEVES STATUS, USE A FLAG REMOVED?*/
|
||||||
getSession().removeAttribute(sessionKey);
|
getSession().removeAttribute(sessionKey);
|
||||||
logger.info("Removed from session: " + toString());
|
logger.info("Removed from session: " + toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class WorkspaceUploaderMng {
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
// StreamUtils.deleteTempFile(uploadFile);
|
// StreamUtils.deleteTempFile(uploadFile);
|
||||||
WsUtil.eraseWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
WsUtil.setErasableWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public class WorkspaceUploaderMng {
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
// StreamUtils.deleteTempFile(uploadFile);
|
// StreamUtils.deleteTempFile(uploadFile);
|
||||||
WsUtil.eraseWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
WsUtil.setErasableWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier());
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class WsUtil {
|
||||||
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl";
|
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl";
|
||||||
//IN DEV
|
//IN DEV
|
||||||
public static final String TEST_SCOPE = "/gcube/devsec";
|
public static final String TEST_SCOPE = "/gcube/devsec";
|
||||||
public static String TEST_USER = "test.user";
|
public static String TEST_USER = "francesco.mangiacrapa";
|
||||||
public static String TEST_USER_FULL_NAME = "Test User";
|
public static String TEST_USER_FULL_NAME = "Test User";
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,6 +222,27 @@ public class WsUtil {
|
||||||
logger.debug("Added uploader: "+uploader.getIdentifier() +" in session");
|
logger.debug("Added uploader: "+uploader.getIdentifier() +" in session");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erase workspace uploader in session.
|
||||||
|
*
|
||||||
|
* @param httpSession the http session
|
||||||
|
* @param uploader the uploader
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public static void eraseWorkspaceUploaderInSession(final HttpSession httpSession, WorkspaceUploaderItem uploader) throws Exception
|
||||||
|
{
|
||||||
|
logger.trace("Erase WorkspaceUploader workspace uploader in session: "+uploader.getIdentifier() + ", erasable? "+uploader.isErasable());
|
||||||
|
final ASLSession session = getAslSession(httpSession);
|
||||||
|
|
||||||
|
if(uploader==null || uploader.getIdentifier()==null || uploader.getIdentifier().isEmpty())
|
||||||
|
throw new Exception("Invalid uploader");
|
||||||
|
|
||||||
|
if(uploader.isErasable()){
|
||||||
|
session.setAttribute(uploader.getIdentifier(), null);
|
||||||
|
logger.info("Erased uploader: "+uploader.getIdentifier() +" with null value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workspace uploader in session.
|
* Gets the workspace uploader in session.
|
||||||
|
@ -244,20 +265,23 @@ public class WsUtil {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erase workspace uploader in session.
|
* Sets the erasable workspace uploader in session.
|
||||||
*
|
*
|
||||||
* @param httpSession the http session
|
* @param httpSession the http session
|
||||||
* @param uploaderIdentifier the uploader identifier
|
* @param uploaderIdentifier the uploader identifier
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static boolean eraseWorkspaceUploaderInSession(final HttpSession httpSession, String uploaderIdentifier) throws Exception
|
public static boolean setErasableWorkspaceUploaderInSession(final HttpSession httpSession, String uploaderIdentifier) throws Exception
|
||||||
{
|
{
|
||||||
WorkspaceUploaderItem uploader = getWorkspaceUploaderInSession(httpSession, uploaderIdentifier);
|
WorkspaceUploaderItem uploader = getWorkspaceUploaderInSession(httpSession, uploaderIdentifier);
|
||||||
|
|
||||||
if(uploader!=null){
|
if(uploader!=null){
|
||||||
logger.debug("Erasing uploader: "+uploader.getIdentifier() +" in session, adding null value");
|
/*TODO REMOVE SESSION KEY FROM SESSION MUST BE MANAGED IN ANOTHER WAY IN ORDER TO AVOID THATH IT'S REMOVED FROM SESSION BEFORE THAT
|
||||||
uploader = null;
|
* POLLING RETRIEVES STATUS, USE A FLAG REMOVED?*/
|
||||||
|
logger.debug("Set erasable uploader: "+uploader.getIdentifier() +" in session");
|
||||||
|
// uploader = null;
|
||||||
|
uploader.setErasable(true);
|
||||||
putWorkspaceUploaderInSession(httpSession, uploader);
|
putWorkspaceUploaderInSession(httpSession, uploader);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.widgets.workspaceuploader.shared;
|
package org.gcube.portlets.widgets.workspaceuploader.shared;
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ import java.io.Serializable;
|
||||||
* Aug 3, 2015
|
* Aug 3, 2015
|
||||||
*/
|
*/
|
||||||
public class WorkspaceUploaderItem implements Serializable{
|
public class WorkspaceUploaderItem implements Serializable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7657531873615480050L;
|
private static final long serialVersionUID = -7657531873615480050L;
|
||||||
|
|
||||||
|
@ -26,16 +26,16 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
* Aug 6, 2015
|
* Aug 6, 2015
|
||||||
*/
|
*/
|
||||||
public static enum UPLOAD_STATUS{
|
public static enum UPLOAD_STATUS{
|
||||||
|
|
||||||
WAIT("WAIT", "wait"),
|
WAIT("WAIT", "wait"),
|
||||||
IN_PROGRESS("IN_PROGRESS", "in progress"),
|
IN_PROGRESS("IN_PROGRESS", "in progress"),
|
||||||
FAILED("FAILED", "failed"),
|
FAILED("FAILED", "failed"),
|
||||||
ABORTED("ABORTED", "aborted"),
|
ABORTED("ABORTED", "aborted"),
|
||||||
COMPLETED("COMPLETED", "completed");
|
COMPLETED("COMPLETED", "completed");
|
||||||
|
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String label;
|
protected String label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new upload status.
|
* Instantiates a new upload status.
|
||||||
*
|
*
|
||||||
|
@ -47,7 +47,7 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String identifier;
|
private String identifier;
|
||||||
private WorkspaceUploadFile file;
|
private WorkspaceUploadFile file;
|
||||||
private UPLOAD_STATUS uploadStatus;
|
private UPLOAD_STATUS uploadStatus;
|
||||||
|
@ -56,6 +56,7 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
private UploadProgress uploadProgress;
|
private UploadProgress uploadProgress;
|
||||||
private Boolean isOverwrite;
|
private Boolean isOverwrite;
|
||||||
// private Long threadId;
|
// private Long threadId;
|
||||||
|
private boolean erasable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace uploader item.
|
* Instantiates a new workspace uploader item.
|
||||||
|
@ -158,7 +159,7 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
public void setUploadStatus(UPLOAD_STATUS uploadStatus) {
|
public void setUploadStatus(UPLOAD_STATUS uploadStatus) {
|
||||||
this.uploadStatus = uploadStatus;
|
this.uploadStatus = uploadStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the client upload key.
|
* Gets the client upload key.
|
||||||
|
@ -178,7 +179,7 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
public void setClientUploadKey(String clientUploadKey) {
|
public void setClientUploadKey(String clientUploadKey) {
|
||||||
this.clientUploadKey = clientUploadKey;
|
this.clientUploadKey = clientUploadKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the upload progress.
|
* Gets the upload progress.
|
||||||
*
|
*
|
||||||
|
@ -211,11 +212,32 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
this.isOverwrite = isOverwrite;
|
this.isOverwrite = isOverwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the erasable.
|
||||||
|
*
|
||||||
|
* @param b the new erasable
|
||||||
|
*/
|
||||||
|
public void setErasable(boolean b) {
|
||||||
|
this.erasable = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is erasable.
|
||||||
|
*
|
||||||
|
* @return the erasable
|
||||||
|
*/
|
||||||
|
public boolean isErasable() {
|
||||||
|
|
||||||
|
return erasable;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("WorkspaceUploaderItem [identifier=");
|
builder.append("WorkspaceUploaderItem [identifier=");
|
||||||
builder.append(identifier);
|
builder.append(identifier);
|
||||||
|
@ -227,11 +249,16 @@ public class WorkspaceUploaderItem implements Serializable{
|
||||||
builder.append(statusDescription);
|
builder.append(statusDescription);
|
||||||
builder.append(", clientUploadKey=");
|
builder.append(", clientUploadKey=");
|
||||||
builder.append(clientUploadKey);
|
builder.append(clientUploadKey);
|
||||||
builder.append(", uploadProgress=");
|
// builder.append(", uploadProgress=");
|
||||||
builder.append(uploadProgress);
|
// builder.append(uploadProgress);
|
||||||
builder.append(", isOverwrite=");
|
builder.append(", isOverwrite=");
|
||||||
builder.append(isOverwrite);
|
builder.append(isOverwrite);
|
||||||
|
builder.append(", erasable=");
|
||||||
|
builder.append(erasable);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue