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.CreateUrlEvent;
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.DeleteItemEventHandler;
import org.gcube.portlets.user.workspace.client.event.DeleteMessageEvent;
@ -1102,24 +1100,23 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onUploadCompleted(String parentId, String itemId) {
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
public void onUploadAborted(String parentId, String itemId) {
GWT.log("Upload Aborted: [parentID: "+parentId+", itemId: "+itemId+"]");
}
@Override
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
public void onOverwriteCompleted(String parentId, String 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;
sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentId(), fileUpEvent.getUploadType());
sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentId(), fileUpEvent.getUploadType(), fileUpEvent.isOverwrite());
}else if(event instanceof CreateUrlEvent){
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){

View File

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