429: Workspace: uploading big files

Task-Url: https://support.d4science.org/issues/429

Managed case of overwrite

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@119833 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-16 12:27:45 +00:00
parent bbe8e42109
commit 76d330be0d
3 changed files with 60 additions and 27 deletions

View File

@ -27,8 +27,6 @@ import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEventHandler; import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEventHandler;
import org.gcube.portlets.user.workspace.client.event.CreateUrlEvent; import org.gcube.portlets.user.workspace.client.event.CreateUrlEvent;
import org.gcube.portlets.user.workspace.client.event.CreateUrlEventHandler; import org.gcube.portlets.user.workspace.client.event.CreateUrlEventHandler;
import org.gcube.portlets.user.workspace.client.event.DeleteBulkEvent;
import org.gcube.portlets.user.workspace.client.event.DeleteBulkEventHandler;
import org.gcube.portlets.user.workspace.client.event.DeleteItemEvent; import org.gcube.portlets.user.workspace.client.event.DeleteItemEvent;
import org.gcube.portlets.user.workspace.client.event.DeleteItemEventHandler; import org.gcube.portlets.user.workspace.client.event.DeleteItemEventHandler;
import org.gcube.portlets.user.workspace.client.event.DeleteMessageEvent; import org.gcube.portlets.user.workspace.client.event.DeleteMessageEvent;
@ -1102,24 +1100,23 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onUploadCompleted(String parentId, String itemId) { public void onUploadCompleted(String parentId, String itemId) {
GWT.log("Upload completed: [parentID: "+parentId+", itemId: "+itemId+", uploadType: "+fileUploadEvent.getUploadType()+"]"); GWT.log("Upload completed: [parentID: "+parentId+", itemId: "+itemId+", uploadType: "+fileUploadEvent.getUploadType()+"]");
eventBus.fireEvent(new CompletedFileUploadEvent(parentId, itemId, fileUploadEvent.getUploadType())); eventBus.fireEvent(new CompletedFileUploadEvent(parentId, itemId, fileUploadEvent.getUploadType(), false));
} }
@Override @Override
public void onUploadAborted(String parentId, String itemId) { public void onUploadAborted(String parentId, String itemId) {
GWT.log("Upload Aborted: [parentID: "+parentId+", itemId: "+itemId+"]"); GWT.log("Upload Aborted: [parentID: "+parentId+", itemId: "+itemId+"]");
} }
@Override @Override
public void onError(String parentId, String itemId, Throwable throwable) { public void onError(String parentId, String itemId, Throwable throwable) {
GWT.log("Upload Aborted: [parentID: "+parentId+", itemId: "+itemId+"]"); GWT.log("Upload Error: [parentID: "+parentId+", itemId: "+itemId+"]");
} }
@Override @Override
public void onOverwriteCompleted(String parentId, String itemId) { public void onOverwriteCompleted(String parentId, String itemId) {
GWT.log("Upload Override Completed: [parentID: "+parentId+", itemId: "+itemId+"]"); GWT.log("Upload Override Completed: [parentID: "+parentId+", itemId: "+itemId+"]");
eventBus.fireEvent(new CompletedFileUploadEvent(parentId, itemId, fileUploadEvent.getUploadType(), true));
} }
}; };
@ -1919,13 +1916,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
CompletedFileUploadEvent fileUpEvent = (CompletedFileUploadEvent) event; CompletedFileUploadEvent fileUpEvent = (CompletedFileUploadEvent) event;
sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentId(), fileUpEvent.getUploadType()); sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentId(), fileUpEvent.getUploadType(), fileUpEvent.isOverwrite());
}else if(event instanceof CreateUrlEvent){ }else if(event instanceof CreateUrlEvent){
CreateUrlEvent createUrlEvent = (CreateUrlEvent) event; CreateUrlEvent createUrlEvent = (CreateUrlEvent) event;
sub.addedFile(createUrlEvent.getItemIdentifier(), createUrlEvent.getParentFileModel().getIdentifier(), WS_UPLOAD_TYPE.File); sub.addedFile(createUrlEvent.getItemIdentifier(), createUrlEvent.getParentFileModel().getIdentifier(), WS_UPLOAD_TYPE.File, false);
}else if(event instanceof MoveItemEvent){ }else if(event instanceof MoveItemEvent){

View File

@ -6,34 +6,44 @@ import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
/** /**
* The Class CompletedFileUploadEvent. * The Class CompletedFileUploadEvent.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Oct 6, 2015
* Oct 6, 2015
*/ */
public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventHandler> implements GuiEventInterface{ public class CompletedFileUploadEvent extends
GwtEvent<CompletedFileUploadEventHandler> implements GuiEventInterface {
public static Type<CompletedFileUploadEventHandler> TYPE = new Type<CompletedFileUploadEventHandler>(); public static Type<CompletedFileUploadEventHandler> TYPE = new Type<CompletedFileUploadEventHandler>();
private String itemIdentifier; private String itemIdentifier;
private String parentId; private String parentId;
/** The upload type. */
private WS_UPLOAD_TYPE uploadType; private WS_UPLOAD_TYPE uploadType;
private boolean isOverwrite;
/** /**
* Instantiates a new completed file upload event. * Instantiates a new completed file upload event.
* *
* @param parentId the parent id * @param parentId
* @param itemIdentifier the item identifier * the parent id
* @param uploadType the upload type * @param itemIdentifier
* the item identifier
* @param uploadType
* the upload type
* @param isOverwrite
*/ */
public CompletedFileUploadEvent(String parentId, String itemIdentifier, WS_UPLOAD_TYPE uploadType) { public CompletedFileUploadEvent(String parentId, String itemIdentifier,
WS_UPLOAD_TYPE uploadType, boolean isOverwrite) {
this.parentId = parentId; this.parentId = parentId;
this.itemIdentifier = itemIdentifier; this.itemIdentifier = itemIdentifier;
this.uploadType = uploadType; this.uploadType = uploadType;
this.isOverwrite = isOverwrite;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/ */
@Override @Override
@ -41,16 +51,24 @@ public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventH
return TYPE; return TYPE;
} }
/* (non-Javadoc) /*
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) * (non-Javadoc)
*
* @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared
* .EventHandler)
*/ */
@Override @Override
protected void dispatch(CompletedFileUploadEventHandler handler) { protected void dispatch(CompletedFileUploadEventHandler handler) {
handler.onCompletedFileUploadEvent(this); handler.onCompletedFileUploadEvent(this);
} }
/* (non-Javadoc) /*
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey() * (non-Javadoc)
*
* @see
* org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface
* #getKey()
*/ */
@Override @Override
public EventsTypeEnum getKey() { public EventsTypeEnum getKey() {
@ -78,7 +96,8 @@ public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventH
/** /**
* Sets the item identifier. * Sets the item identifier.
* *
* @param itemIdentifier the itemIdentifier to set * @param itemIdentifier
* the itemIdentifier to set
*/ */
public void setItemIdentifier(String itemIdentifier) { public void setItemIdentifier(String itemIdentifier) {
this.itemIdentifier = itemIdentifier; this.itemIdentifier = itemIdentifier;
@ -87,17 +106,33 @@ public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventH
/** /**
* Sets the parent id. * Sets the parent id.
* *
* @param parentId the parentId to set * @param parentId
* the parentId to set
*/ */
public void setParentId(String parentId) { public void setParentId(String parentId) {
this.parentId = parentId; this.parentId = parentId;
} }
/** /**
* @return the uploadType * @return the uploadType
*/ */
public WS_UPLOAD_TYPE getUploadType() { public WS_UPLOAD_TYPE getUploadType() {
return uploadType; return uploadType;
} }
/**
* @return the isOverwrite
*/
public boolean isOverwrite() {
return isOverwrite;
}
/**
* @param isOverwrite
* the isOverwrite to set
*/
public void setOverwrite(boolean isOverwrite) {
this.isOverwrite = isOverwrite;
}
} }

View File

@ -27,8 +27,9 @@ public interface SubscriberInterface {
* @param itemIdentifier the item identifier * @param itemIdentifier the item identifier
* @param parentId the parent * @param parentId the parent
* @param file the file * @param file the file
* @param isOverwrite
*/ */
void addedFile(String itemIdentifier, String parentId, WS_UPLOAD_TYPE file); void addedFile(String itemIdentifier, String parentId, WS_UPLOAD_TYPE file, boolean isOverwrite);
/** /**
* Selected item. * Selected item.