refactoring
This commit is contained in:
parent
e1ec07b807
commit
b657ec4670
|
@ -3,7 +3,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
@ -18,5 +18,5 @@ public interface MetadataProfileFormBuilderService extends RemoteService {
|
|||
|
||||
MetaDataProfileBean getProfileForMetadata(String metadata) throws Exception;
|
||||
|
||||
WorkspaceUploaderItem getUploadStatus(String clientUploadKey) throws Exception;
|
||||
FileUploadingState getUploadStatus(String clientUploadKey) throws Exception;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -39,5 +39,5 @@ public interface MetadataProfileFormBuilderServiceAsync {
|
|||
}
|
||||
}
|
||||
|
||||
void getUploadStatus(String clientUploadKey, AsyncCallback<WorkspaceUploaderItem> asyncCallback);
|
||||
void getUploadStatus(String clientUploadKey, AsyncCallback<FileUploadingState> asyncCallback);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import com.github.gwtbootstrap.client.ui.Button;
|
|||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Form;
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.Legend;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
|
@ -269,7 +268,6 @@ public class CreateMetadataForm extends Composite{
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show choose profile form.
|
||||
*
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
|||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.WorkspaceUploadNotification.HasWorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.HandlerResultMessage;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
|
@ -43,7 +43,7 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
|
|||
protected Hidden jsonClientKeys;
|
||||
|
||||
/** The fake uploaders. */
|
||||
protected List<WorkspaceUploaderItem> fakeUploaders = new ArrayList<WorkspaceUploaderItem>();
|
||||
protected List<FileUploadingState> fakeUploaders = new ArrayList<FileUploadingState>();
|
||||
|
||||
/** The controller. */
|
||||
protected WorkspaceUploaderListenerController controller = new WorkspaceUploaderListenerController();
|
||||
|
@ -239,7 +239,7 @@ private String purgedUploadingFileName;
|
|||
addLoading();
|
||||
enableButtons(false);
|
||||
//Only the first, just to manage single uploading
|
||||
WorkspaceUploaderItem workspaceUploaderItem = fakeUploaders.get(0);
|
||||
FileUploadingState workspaceUploaderItem = fakeUploaders.get(0);
|
||||
upv = new UploaderProgressView(workspaceUploaderItem, workspaceUploaderItem.getFile().getFileName(), null);
|
||||
verticalMainPanel.add(upv.getPanel());
|
||||
removeLoading();
|
||||
|
@ -254,7 +254,7 @@ private String purgedUploadingFileName;
|
|||
*
|
||||
* @return the uploaded info
|
||||
*/
|
||||
public WorkspaceUploaderItem getUploadedInfo() {
|
||||
public FileUploadingState getUploadedInfo() {
|
||||
if(timer!=null)
|
||||
return timer.getLastWorkspaceUploader();
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
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;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.HandlerResultMessage;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploadFile;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem.UPLOAD_STATUS;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
|
@ -77,12 +77,12 @@ public class MultipleDilaogUpload extends DialogUpload {
|
|||
}
|
||||
|
||||
GWT.log("generating fake uploaders on: "+Arrays.asList(files.toString()));
|
||||
fakeUploaders = new ArrayList<WorkspaceUploaderItem>(files.length);
|
||||
fakeUploaders = new ArrayList<FileUploadingState>(files.length);
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
WorkspaceUploaderItem fakeItem = new WorkspaceUploaderItem();
|
||||
FileUploadingState fakeItem = new FileUploadingState();
|
||||
fakeItem.setClientUploadKey(GenerateUUID.get());
|
||||
fakeItem.setUploadStatus(UPLOAD_STATUS.WAIT);
|
||||
WorkspaceUploadFile fakeFile = new WorkspaceUploadFile();
|
||||
FileUploaded fakeFile = new FileUploaded();
|
||||
fakeFile.setFileName(files[i]);
|
||||
fakeItem.setFile(fakeFile);
|
||||
fakeUploaders.add(fakeItem);
|
||||
|
@ -251,7 +251,7 @@ public class MultipleDilaogUpload extends DialogUpload {
|
|||
// GWT.log("Creating json keys on fakeUploaders: "+fakeUploaders.toString());
|
||||
|
||||
for (int i = 0; i < fakeUploaders.size(); i++) {
|
||||
WorkspaceUploaderItem file = fakeUploaders.get(i);
|
||||
FileUploadingState file = fakeUploaders.get(i);
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put(file.getClientUploadKey(), new JSONString(file.getFile().getFileName()));
|
||||
jsonArray.set(i, obj);
|
||||
|
|
|
@ -5,8 +5,8 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
|||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem.UPLOAD_STATUS;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState.UPLOAD_STATUS;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
|
@ -24,10 +24,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
public class TimerUpload extends Timer{
|
||||
|
||||
/** The workspace uploader. */
|
||||
private WorkspaceUploaderItem initWorkspaceUploader;
|
||||
private FileUploadingState initWorkspaceUploader;
|
||||
|
||||
/** The last workspace uploader. */
|
||||
private WorkspaceUploaderItem lastWorkspaceUploader;
|
||||
private FileUploadingState lastWorkspaceUploader;
|
||||
|
||||
/** The instance. */
|
||||
private TimerUpload INSTANCE = this;
|
||||
|
@ -41,7 +41,7 @@ public class TimerUpload extends Timer{
|
|||
* @param workspaceUploader the workspace uploader
|
||||
* @param upv the upv
|
||||
*/
|
||||
public TimerUpload(WorkspaceUploaderItem workspaceUploader, UploaderProgressView upv) {
|
||||
public TimerUpload(FileUploadingState workspaceUploader, UploaderProgressView upv) {
|
||||
this.initWorkspaceUploader = workspaceUploader;
|
||||
this.upv = upv;
|
||||
|
||||
|
@ -58,10 +58,10 @@ public class TimerUpload extends Timer{
|
|||
|
||||
final SingleUploadMonitor monitor = SingleUploadMonitor.getInstance();
|
||||
|
||||
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getUploadStatus(initWorkspaceUploader.getClientUploadKey(), new AsyncCallback<WorkspaceUploaderItem>() {
|
||||
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getUploadStatus(initWorkspaceUploader.getClientUploadKey(), new AsyncCallback<FileUploadingState>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(final WorkspaceUploaderItem result) {
|
||||
public void onSuccess(final FileUploadingState result) {
|
||||
try{
|
||||
synchronized(this){
|
||||
lastWorkspaceUploader = result;
|
||||
|
@ -144,11 +144,11 @@ public class TimerUpload extends Timer{
|
|||
super.cancel();
|
||||
}
|
||||
|
||||
public WorkspaceUploaderItem getInitWorkspaceUploader() {
|
||||
public FileUploadingState getInitWorkspaceUploader() {
|
||||
return initWorkspaceUploader;
|
||||
}
|
||||
|
||||
public WorkspaceUploaderItem getLastWorkspaceUploader() {
|
||||
public FileUploadingState getLastWorkspaceUploader() {
|
||||
return lastWorkspaceUploader;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.upload;
|
|||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.StringUtil;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
@ -32,7 +32,7 @@ public class UploaderProgressView {
|
|||
private HandlerManager eventBus;
|
||||
private boolean cancel = false;
|
||||
private Image cancelImg = new Image(Images.ICONS.delete());
|
||||
private WorkspaceUploaderItem lastUploaderLoaded;
|
||||
private FileUploadingState lastUploaderLoaded;
|
||||
|
||||
/**
|
||||
* Instantiates a new uploader progress view.
|
||||
|
@ -41,7 +41,7 @@ public class UploaderProgressView {
|
|||
* @param fileName the file name
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
public UploaderProgressView(WorkspaceUploaderItem uploader, final String fileName, HandlerManager eventBus) {
|
||||
public UploaderProgressView(FileUploadingState uploader, final String fileName, HandlerManager eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
cancelImg.setTitle("Cancel upload");
|
||||
cancelImg.addStyleName("cancel-upload");
|
||||
|
@ -84,7 +84,7 @@ public class UploaderProgressView {
|
|||
*
|
||||
* @param uploader the uploader
|
||||
*/
|
||||
public void update(WorkspaceUploaderItem uploader){
|
||||
public void update(FileUploadingState uploader){
|
||||
String text;
|
||||
try{
|
||||
this.lastUploaderLoaded = uploader;
|
||||
|
|
|
@ -12,9 +12,9 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderService;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.server.util.WsUtil;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState.UPLOAD_STATUS;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.UploadProgress;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem.UPLOAD_STATUS;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class MetadataProfileFormBuilderServiceImpl extends RemoteServiceServlet
|
|||
* @see org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploaderService#getUploadStatus(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public WorkspaceUploaderItem getUploadStatus(String identifier) throws Exception {
|
||||
public FileUploadingState getUploadStatus(String identifier) throws Exception {
|
||||
LOG.debug("Called getUploadStatus for id: "+identifier);
|
||||
|
||||
if (identifier == null || identifier.isEmpty()) {
|
||||
|
@ -92,10 +92,10 @@ public class MetadataProfileFormBuilderServiceImpl extends RemoteServiceServlet
|
|||
throw new Exception(exception);
|
||||
}
|
||||
|
||||
WorkspaceUploaderItem uploader = WsUtil.getWorkspaceUploaderInSession(getThreadLocalRequest(), identifier);
|
||||
FileUploadingState uploader = WsUtil.getWorkspaceUploaderInSession(getThreadLocalRequest(), identifier);
|
||||
|
||||
if (uploader == null) {
|
||||
WorkspaceUploaderItem waitingUpload = new WorkspaceUploaderItem(identifier, null, UPLOAD_STATUS.WAIT, "Upload waiting..", new UploadProgress());
|
||||
FileUploadingState waitingUpload = new FileUploadingState(identifier, null, UPLOAD_STATUS.WAIT, "Upload waiting..", new UploadProgress());
|
||||
waitingUpload.setClientUploadKey(identifier);
|
||||
return waitingUpload;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class MetadataProfileFormBuilderServiceImpl extends RemoteServiceServlet
|
|||
* @param httpRequest the http request
|
||||
* @param uploader the uploader
|
||||
*/
|
||||
private void checkUploaderErasable(final HttpServletRequest httpRequest, final WorkspaceUploaderItem uploader){
|
||||
private void checkUploaderErasable(final HttpServletRequest httpRequest, final FileUploadingState uploader){
|
||||
LOG.debug("Called check Uploader erasable...");
|
||||
|
||||
if(uploader==null){
|
||||
|
|
|
@ -33,14 +33,14 @@ 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.FileUploaded;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState.UPLOAD_STATUS;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.HandlerResultMessage;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.MemoryUploadListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.UploadCanceledException;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.UploadProgressInputStream;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.UploadProgressListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploadFile;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem.UPLOAD_STATUS;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
@ -228,7 +228,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
removeListenersIfDone(session, listClientUploadKeys);
|
||||
for (String clientUploadKey : listClientUploadKeys) {
|
||||
String fileName = mapKeys.get(clientUploadKey);
|
||||
WorkspaceUploaderItem workspaceUploader = createNewWorkspaceUploader(clientUploadKey,fileName, user.getUsername());
|
||||
FileUploadingState workspaceUploader = createNewWorkspaceUploader(clientUploadKey,fileName, user.getUsername());
|
||||
logger.debug("created "+workspaceUploader);
|
||||
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.WAIT, "Uploading "+fileName+" at 0%", request.getSession());
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
|
||||
//RETRIVE WORKSPACE UPLOADER FROM SESSION
|
||||
|
||||
WorkspaceUploaderItem workspaceUploader = null;
|
||||
FileUploadingState workspaceUploader = null;
|
||||
try {
|
||||
workspaceUploader = WsUtil.getWorkspaceUploaderInSession(request, clientUploadKey);
|
||||
} catch (Exception e) {
|
||||
|
@ -448,7 +448,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
* @param session the session
|
||||
* @return the workspace uploader item
|
||||
*/
|
||||
private synchronized WorkspaceUploaderItem saveWorkspaceUploaderStatus(WorkspaceUploaderItem workspaceUploader, UPLOAD_STATUS status, String description, HttpSession session){
|
||||
private synchronized FileUploadingState saveWorkspaceUploaderStatus(FileUploadingState workspaceUploader, UPLOAD_STATUS status, String description, HttpSession session){
|
||||
workspaceUploader.setUploadStatus(status);
|
||||
workspaceUploader.setStatusDescription(description);
|
||||
try {
|
||||
|
@ -467,12 +467,12 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
* @param fileName the file name
|
||||
* @return the workspace uploader item
|
||||
*/
|
||||
private WorkspaceUploaderItem createNewWorkspaceUploader(String clientUploadKey, String fileName, String user){
|
||||
private FileUploadingState createNewWorkspaceUploader(String clientUploadKey, String fileName, String user){
|
||||
//CLIENT UPLOAD IS THE KEY
|
||||
WorkspaceUploaderItem workspaceUploader = new WorkspaceUploaderItem(clientUploadKey);
|
||||
FileUploadingState workspaceUploader = new FileUploadingState(clientUploadKey);
|
||||
workspaceUploader.setClientUploadKey(clientUploadKey);
|
||||
//Create File
|
||||
WorkspaceUploadFile wsUploadFile = new WorkspaceUploadFile(fileName, null, user);
|
||||
FileUploaded wsUploadFile = new FileUploaded(fileName, null, user);
|
||||
workspaceUploader.setFile(wsUploadFile);
|
||||
return workspaceUploader;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
* @return the workspace uploader item
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void saveWorkspaceUploaderInSession(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession) throws Exception {
|
||||
public static void saveWorkspaceUploaderInSession(FileUploadingState workspaceUploader, HttpSession httpSession) throws Exception {
|
||||
|
||||
if(workspaceUploader!=null){
|
||||
try {
|
||||
|
@ -512,7 +512,7 @@ public class MetadataProfileFormBuilderUploadServlet extends HttpServlet impleme
|
|||
* @return the workspace uploader item
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public WorkspaceUploaderItem createStreamToTempFile(HttpServletRequest request, WorkspaceUploaderItem workspaceUploader, InputStream in, String username, String clientUploadKey, String fileName, String fileExtension) throws IOException{
|
||||
public FileUploadingState createStreamToTempFile(HttpServletRequest request, FileUploadingState workspaceUploader, InputStream in, String username, String clientUploadKey, String fileName, String fileExtension) throws IOException{
|
||||
|
||||
if (fileExtension == null)
|
||||
fileExtension = "";
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.WorkspaceUploaderItem;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadingState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class WsUtil {
|
|||
* @param uploader the uploader
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void putWorkspaceUploaderInSession(final HttpSession httpSession, WorkspaceUploaderItem uploader) throws Exception {
|
||||
public static void putWorkspaceUploaderInSession(final HttpSession httpSession, FileUploadingState uploader) throws Exception {
|
||||
logger.trace("Put workspace uploader in session: "+uploader.getIdentifier() + ", STATUS: "+uploader.getUploadStatus());
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class WsUtil {
|
|||
* @param uploader the uploader
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void forceEraseWorkspaceUploaderInSession(final HttpSession httpSession, WorkspaceUploaderItem uploader) throws Exception {
|
||||
public static void forceEraseWorkspaceUploaderInSession(final HttpSession httpSession, FileUploadingState uploader) throws Exception {
|
||||
logger.trace("Force Erase WorkspaceUploader workspace uploader in session: "+uploader.getIdentifier());
|
||||
|
||||
if(uploader==null || uploader.getIdentifier()==null || uploader.getIdentifier().isEmpty())
|
||||
|
@ -105,7 +105,7 @@ public class WsUtil {
|
|||
* @param uploader the uploader
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void eraseWorkspaceUploaderInSession(final HttpSession httpSession, WorkspaceUploaderItem uploader) throws Exception
|
||||
public static void eraseWorkspaceUploaderInSession(final HttpSession httpSession, FileUploadingState uploader) throws Exception
|
||||
{
|
||||
logger.trace("Erase WorkspaceUploader workspace uploader in session: "+uploader.getIdentifier() + ", erasable? "+uploader.isErasable());
|
||||
|
||||
|
@ -127,13 +127,13 @@ public class WsUtil {
|
|||
* @return the workspace uploader in session
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static WorkspaceUploaderItem getWorkspaceUploaderInSession(final HttpServletRequest request, String uploaderIdentifier) throws Exception {
|
||||
public static FileUploadingState getWorkspaceUploaderInSession(final HttpServletRequest request, String uploaderIdentifier) throws Exception {
|
||||
HttpSession httpSession = request.getSession();
|
||||
|
||||
if(uploaderIdentifier==null || uploaderIdentifier.isEmpty())
|
||||
throw new Exception("Invalid uploader");
|
||||
|
||||
return (WorkspaceUploaderItem) httpSession.getAttribute(uploaderIdentifier);
|
||||
return (FileUploadingState) httpSession.getAttribute(uploaderIdentifier);
|
||||
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class WsUtil {
|
|||
public static boolean setErasableWorkspaceUploaderInSession(final HttpServletRequest request, String uploaderIdentifier) throws Exception {
|
||||
|
||||
HttpSession httpSession = request.getSession();
|
||||
WorkspaceUploaderItem uploader = getWorkspaceUploaderInSession(request, uploaderIdentifier);
|
||||
FileUploadingState uploader = getWorkspaceUploaderInSession(request, uploaderIdentifier);
|
||||
|
||||
if(uploader!=null){
|
||||
/*TODO REMOVE SESSION KEY FROM SESSION MUST BE MANAGED IN ANOTHER WAY IN ORDER TO AVOID THATH IT'S REMOVED FROM SESSION BEFORE THAT
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* FieldVerifier validates that the name the user enters is valid.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is in the <code>shared</code> packing because we use it in both
|
||||
* the client code and on the server. On the client, we verify that the name is
|
||||
* valid before sending an RPC request so the user doesn't have to wait for a
|
||||
* network round trip to get feedback. On the server, we verify that the name is
|
||||
* correct to ensure that the input is correct regardless of where the RPC
|
||||
* originates.
|
||||
* </p>
|
||||
* <p>
|
||||
* When creating a class that is used on both the client and the server, be sure
|
||||
* that all code is translatable and does not use native JavaScript. Code that
|
||||
* is note translatable (such as code that interacts with a database or the file
|
||||
* system) cannot be compiled into client side JavaScript. Code that uses native
|
||||
* JavaScript (such as Widgets) cannot be run on the server.
|
||||
* </p>
|
||||
*/
|
||||
public class FieldVerifier {
|
||||
|
||||
/**
|
||||
* Verifies that the specified name is valid for our service.
|
||||
*
|
||||
* In this example, we only require that the name is at least four
|
||||
* characters. In your application, you can use more complex checks to ensure
|
||||
* that usernames, passwords, email addresses, URLs, and other fields have the
|
||||
* proper syntax.
|
||||
*
|
||||
* @param name the name to validate
|
||||
* @return true if valid, false if invalid
|
||||
*/
|
||||
public static boolean isValidName(String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
return name.length() > 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.widgets.mpformbuilder.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
|
||||
|
||||
/**
|
||||
* The Class GenericDatasetBean.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 8, 2020
|
||||
*/
|
||||
public class GenericDatasetBean implements Serializable {
|
||||
|
||||
private List<MetaDataProfileBean> metadataList;
|
||||
private Map<String, List<String>> customFields;
|
||||
|
||||
/**
|
||||
* Instantiates a new generic dataset bean.
|
||||
*/
|
||||
public GenericDatasetBean(){
|
||||
}
|
||||
|
||||
public GenericDatasetBean(List<MetaDataProfileBean> metadataList, Map<String, List<String>> customFields) {
|
||||
super();
|
||||
this.metadataList = metadataList;
|
||||
this.customFields = customFields;
|
||||
}
|
||||
|
||||
public List<MetaDataProfileBean> getMetadataList() {
|
||||
return metadataList;
|
||||
}
|
||||
|
||||
public void setMetadataList(List<MetaDataProfileBean> metadataList) {
|
||||
this.metadataList = metadataList;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getCustomFields() {
|
||||
return customFields;
|
||||
}
|
||||
|
||||
public void setCustomFields(Map<String, List<String>> customFields) {
|
||||
this.customFields = customFields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GenericDatasetBean [metadataList=");
|
||||
builder.append(metadataList);
|
||||
builder.append(", customFields=");
|
||||
builder.append(customFields);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* The Class FileUploaded.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 8, 2020
|
||||
*/
|
||||
public class FileUploaded implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3849355202624924112L;
|
||||
|
||||
/** The file name. */
|
||||
private String fileName;
|
||||
|
||||
/** The item id. */
|
||||
private String tempSystemPath;
|
||||
|
||||
private String createdByUser;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*/
|
||||
public FileUploaded() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*
|
||||
* @param fileName the file name
|
||||
* @param tempSystemPath the temp system path
|
||||
* @param createdByUser the created by user
|
||||
*/
|
||||
public FileUploaded(String fileName, String tempSystemPath, String createdByUser) {
|
||||
super();
|
||||
this.fileName = fileName;
|
||||
this.tempSystemPath = tempSystemPath;
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file name.
|
||||
*
|
||||
* @return the file name
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the file name.
|
||||
*
|
||||
* @param fileName the new file name
|
||||
*/
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the temp system path.
|
||||
*
|
||||
* @return the temp system path
|
||||
*/
|
||||
public String getTempSystemPath() {
|
||||
return tempSystemPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the temp system path.
|
||||
*
|
||||
* @param tempSystemPath the new temp system path
|
||||
*/
|
||||
public void setTempSystemPath(String tempSystemPath) {
|
||||
this.tempSystemPath = tempSystemPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the created by user.
|
||||
*
|
||||
* @return the created by user
|
||||
*/
|
||||
public String getCreatedByUser() {
|
||||
return createdByUser;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the created by user.
|
||||
*
|
||||
* @param createdByUser the new created by user
|
||||
*/
|
||||
public void setCreatedByUser(String createdByUser) {
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FileUploaded [fileName=");
|
||||
builder.append(fileName);
|
||||
builder.append(", tempSystemPath=");
|
||||
builder.append(tempSystemPath);
|
||||
builder.append(", createdByUser=");
|
||||
builder.append(createdByUser);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -8,18 +8,27 @@ import java.io.Serializable;
|
|||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
|
||||
public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
||||
/**
|
||||
* The Class FileUploadingState.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 8, 2020
|
||||
*/
|
||||
public class FileUploadingState implements Serializable, IsSerializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2858520729654840274L;
|
||||
|
||||
|
||||
/**
|
||||
* The Enum UPLOAD_STATUS.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Aug 6, 2015
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 8, 2020
|
||||
*/
|
||||
public static enum UPLOAD_STATUS{
|
||||
|
||||
|
@ -45,18 +54,17 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
}
|
||||
|
||||
private String identifier;
|
||||
private WorkspaceUploadFile file;
|
||||
private FileUploaded file;
|
||||
private UPLOAD_STATUS uploadStatus;
|
||||
private String statusDescription;
|
||||
private String clientUploadKey;
|
||||
private UploadProgress uploadProgress;
|
||||
// private Long threadId;
|
||||
private Boolean erasable;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace uploader item.
|
||||
*/
|
||||
public WorkspaceUploaderItem() {
|
||||
public FileUploadingState() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,7 +72,7 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
*
|
||||
* @param identifier the identifier
|
||||
*/
|
||||
public WorkspaceUploaderItem(String identifier) {
|
||||
public FileUploadingState(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
|
@ -77,7 +85,7 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
* @param statusDescription the status description
|
||||
* @param uploadProgress the upload progress
|
||||
*/
|
||||
public WorkspaceUploaderItem(String identifier, WorkspaceUploadFile file, UPLOAD_STATUS status, String statusDescription, UploadProgress uploadProgress) {
|
||||
public FileUploadingState(String identifier, FileUploaded file, UPLOAD_STATUS status, String statusDescription, UploadProgress uploadProgress) {
|
||||
super();
|
||||
this.identifier = identifier;
|
||||
this.file = file;
|
||||
|
@ -122,7 +130,7 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
*
|
||||
* @return the file
|
||||
*/
|
||||
public WorkspaceUploadFile getFile() {
|
||||
public FileUploaded getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -141,7 +149,7 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
*
|
||||
* @param file the file to set
|
||||
*/
|
||||
public void setFile(WorkspaceUploadFile file) {
|
||||
public void setFile(FileUploaded file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
@ -216,14 +224,10 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
return erasable;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WorkspaceUploaderItem [identifier=");
|
||||
builder.append("FileUploadingState [identifier=");
|
||||
builder.append(identifier);
|
||||
builder.append(", file=");
|
||||
builder.append(file);
|
||||
|
@ -233,14 +237,10 @@ public class WorkspaceUploaderItem implements Serializable, IsSerializable{
|
|||
builder.append(statusDescription);
|
||||
builder.append(", clientUploadKey=");
|
||||
builder.append(clientUploadKey);
|
||||
// builder.append(", uploadProgress=");
|
||||
// builder.append(uploadProgress);
|
||||
builder.append(", erasable=");
|
||||
builder.append(erasable);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.mpformbuilder.shared.upload;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class WorkspaceUploadFile.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it at ISTI-CNR
|
||||
*
|
||||
* Oct 5, 2020
|
||||
*/
|
||||
public class WorkspaceUploadFile implements Serializable{
|
||||
|
||||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = 4693939404459889859L;
|
||||
|
||||
/** The file name. */
|
||||
private String fileName;
|
||||
|
||||
/** The item id. */
|
||||
private String tempSystemPath;
|
||||
|
||||
private String createdByUser;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*/
|
||||
public WorkspaceUploadFile() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace upload file.
|
||||
*
|
||||
* @param fileName the file name
|
||||
* @param tempSystemPath the temp system path
|
||||
* @param createdByUser the created by user
|
||||
*/
|
||||
public WorkspaceUploadFile(String fileName, String tempSystemPath, String createdByUser) {
|
||||
super();
|
||||
this.fileName = fileName;
|
||||
this.tempSystemPath = tempSystemPath;
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getTempSystemPath() {
|
||||
return tempSystemPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setTempSystemPath(String tempSystemPath) {
|
||||
this.tempSystemPath = tempSystemPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCreatedByUser() {
|
||||
return createdByUser;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCreatedByUser(String createdByUser) {
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WorkspaceUploadFile [fileName=" + fileName + ", tempSystemPath=" + tempSystemPath + ", createdByUser="
|
||||
+ createdByUser + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue