diff --git a/distro/changelog.xml b/distro/changelog.xml index 2384c3f..044bbbe 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,13 +1,19 @@ + + Integrated with Task Executor Widget + - Managed case of Exception in order to avoid failure on checkItemLocked + Managed case of Exception in order to avoid failure on + checkItemLocked [Task #11127] Porting to new ws-thredds engine [Feature #11325] Workspace: add New URL feature in the context - menu of right pane + menu of right pane + diff --git a/pom.xml b/pom.xml index a52d53d..f4785ee 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.portlets.user workspace-tree-widget - 6.20.1-SNAPSHOT + 6.21.0-SNAPSHOT gCube Workspace Tree Widget gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace @@ -203,6 +203,12 @@ + + org.gcube.portlets.widgets + ws-task-executor-widget + [0.0.1-SNAPSHOT, 2.0.0-SNAPSHOT) + + commons-httpclient commons-httpclient diff --git a/src/main/java/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml b/src/main/java/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml index 9fd1bf5..a28b9dc 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml +++ b/src/main/java/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml @@ -32,6 +32,10 @@ + + + diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index d31c8ba..8326cc4 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -35,6 +35,8 @@ import org.gcube.portlets.user.workspace.client.event.DeleteSmartFolderEvent; import org.gcube.portlets.user.workspace.client.event.DeleteSmartFolderEventHandler; import org.gcube.portlets.user.workspace.client.event.EditUserPermissionEvent; import org.gcube.portlets.user.workspace.client.event.EditUserPermissionEventHandler; +import org.gcube.portlets.user.workspace.client.event.ExecuteDataMinerTaskEvent; +import org.gcube.portlets.user.workspace.client.event.ExecuteDataMinerTaskEventHandler; import org.gcube.portlets.user.workspace.client.event.ExpandFolderEvent; import org.gcube.portlets.user.workspace.client.event.ExpandFolderEventHandler; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; @@ -154,6 +156,8 @@ import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.mul import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener; 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.wstaskexecutor.client.WsTaskExecutorWidget; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import org.gcube.portlets.widgets.wsthreddssync.client.SyncCompletedNotification.SyncCompletedNotificationListner; import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget; import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder; @@ -201,6 +205,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt private Map msgFolderSynched = new HashMap(); private WsThreddsWidget wsThreddsWidget = new WsThreddsWidget(); + private WsTaskExecutorWidget taskExecutor = new WsTaskExecutorWidget(); /** * Instantiates a new app controller explorer. @@ -437,6 +442,24 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } }); + eventBus.addHandler(ExecuteDataMinerTaskEvent.TYPE, new ExecuteDataMinerTaskEventHandler() { + + @Override + public void onExecuteDMTask(ExecuteDataMinerTaskEvent executeDataMinerTaskEvent) { + + if(executeDataMinerTaskEvent.getTargetFileModel()!=null){ + WSItem wsItem = new WSItem(executeDataMinerTaskEvent.getTargetFileModel().getIdentifier(), executeDataMinerTaskEvent.getTargetFileModel().getName()); + try { + taskExecutor.showTaskConfigurations(wsItem); + } + catch (Exception e) { + Window.alert(e.getMessage()); + } + } + } + }); + + eventBus.addHandler(UpdateWorkspaceSizeEvent.TYPE, new UpdateWorkspaceSizeEventHandler() { @Override diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java index da1dd35..e0a2a67 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java @@ -72,6 +72,7 @@ public class ConstantsExplorer { public static final String MESSAGE_ADD_SUBJECT = "Add Subject"; public static final String HISTORY = "History"; public static final String ACCREAD = "Read"; + public static final String MESSAGE_EXECUTE_DM_TASK = "Execute DM Task"; public static final String MESSAGE_ERROR_OCCURED = "Sorry an error has occurred while processing your request"; public static final String INFO = "Info"; public static final String MESSAGE_SEND_TO_OK = "Your message has been successfully delivered"; @@ -259,6 +260,7 @@ public static enum WS_UPLOAD_TYPE {File, Archive}; public static final String MSG_FOLDER_LOCKED_BY_SYNC= "is under synchronization process.\nPlease be aware that some operations are not currently available and that the content might change during this process."; + /** * Log. * diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java b/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java index d66534b..3d8ef6d 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/constant/WorkspaceOperation.java @@ -1,63 +1,62 @@ + package org.gcube.portlets.user.workspace.client.constant; public enum WorkspaceOperation { - - INSERT_FOLDER("INS", "INS"), // Insert Folder - ADD_ITEM("ADD", "ADD"), // Add Folder - REMOVE("REM", "REM"), - UPLOAD_FILE("UPL", "UPL"), - DOWNLOAD("DWL", "DWL"), - PREVIEW("PRW", "PRW"), - RENAME("RNM", "RNM"), - INSERT_SHARED_FOLDER("ISHF", "ASHF"), // Insert shared Folder - PUBLISH_ON_DATA_CATALOGUE("PODC", "PODC"), - PUBLISH_ON_THREDDS("POTD", "POTD"), - SHARE("SHR", "SHR"), // SHARE - UNSHARE("USHR", "USHR"), // UNSHARE - UPLOAD_ARCHIVE("UPA", "UPA"), // Upload Archive - LINK("LNK", "LNK"), - SHOW("SHW", "SHW"), // SHOW - ADD_URL("CLK", "CLK"), // Add Url -// OPEN_REPORT_TEMPLATE("ORT", "ORT"), // Open report template -// OPEN_REPORT("ORP", "ORP"), // Open report - SENDTO("SDT", "SDT"), // Send to - GET_NEW_MESSAGES("DWM", "DWM"), // Get all new messages - CREATE_NEW_MESSAGE("CNM", "CNM"), // Create new message - MARK_AS_READ("MKR", "MKR"), // Mark as read - MARK_AS_UNREAD("MKNR", "MKNR"), // Mark as not read - DELETE_MESSAGE("DLM", "DLM"), // Delete message - FORWARD_MESSAGE("FWM", "FWM"), // Forward message - COPY("CPI", "CPI"), // copy item - PASTE("PSI", "PSI"), // paste - REFRESH_FOLDER("RFH", "RFH"), // Refresh - WEBDAV_URL("WDV", "WDV"), // WebDav - GET_INFO("GTI", "GTI"), // GET INFO - HISTORY("HST", "HST"), //HISTORY - ACCREAD("ACR", "ACR"), //ACCOUNTING READ - SHARE_LINK("SLK", "SLK"), //SHARE URL LINK - PUBLIC_LINK("PLK", "PLK"), //PUBLIC LINK -// ADD_ADMINISTRATOR("AAD", "AAD"), // ADD_ADMINISTRATOR - VRE_CHANGE_PERIMISSIONS("CHP", "CHP"), - EDIT_PERMISSIONS("EDP", "EDP"), //EDIT PERMISSIONS - FOLDER_LINK("FRL", "FRL"), //FOLDER LINK - FOLDER_LINK_REMOVE("FPR","FPR"), - VERSIONING("VRN", "VRN"); //VERSIONING - + INSERT_FOLDER("INS", "INS"), // Insert Folder + ADD_ITEM("ADD", "ADD"), // Add Folder + REMOVE("REM", "REM"), UPLOAD_FILE("UPL", "UPL"), + DOWNLOAD("DWL", "DWL"), PREVIEW("PRW", "PRW"), RENAME("RNM", "RNM"), + INSERT_SHARED_FOLDER("ISHF", "ASHF"), // Insert shared Folder + PUBLISH_ON_DATA_CATALOGUE("PODC", "PODC"), + PUBLISH_ON_THREDDS("POTD", "POTD"), + SHARE("SHR", "SHR"), // SHARE + UNSHARE("USHR", "USHR"), // UNSHARE + UPLOAD_ARCHIVE("UPA", "UPA"), // Upload Archive + LINK("LNK", "LNK"), + SHOW("SHW", "SHW"), // SHOW + ADD_URL("CLK", "CLK"), // Add Url + // OPEN_REPORT_TEMPLATE("ORT", "ORT"), // Open report template + // OPEN_REPORT("ORP", "ORP"), // Open report + SENDTO("SDT", "SDT"), // Send to + GET_NEW_MESSAGES("DWM", "DWM"), // Get all new messages + CREATE_NEW_MESSAGE("CNM", "CNM"), // Create new message + MARK_AS_READ("MKR", "MKR"), // Mark as read + MARK_AS_UNREAD("MKNR", "MKNR"), // Mark as not read + DELETE_MESSAGE("DLM", "DLM"), // Delete message + FORWARD_MESSAGE("FWM", "FWM"), // Forward message + COPY("CPI", "CPI"), // copy item + PASTE("PSI", "PSI"), // paste + REFRESH_FOLDER("RFH", "RFH"), // Refresh + WEBDAV_URL("WDV", "WDV"), // WebDav + GET_INFO("GTI", "GTI"), // GET INFO + HISTORY("HST", "HST"), // HISTORY + ACCREAD("ACR", "ACR"), // ACCOUNTING READ + SHARE_LINK("SLK", "SLK"), // SHARE URL LINK + PUBLIC_LINK("PLK", "PLK"), // PUBLIC LINK + // ADD_ADMINISTRATOR("AAD", "AAD"), // ADD_ADMINISTRATOR + VRE_CHANGE_PERIMISSIONS("CHP", "CHP"), + EDIT_PERMISSIONS("EDP", "EDP"), // EDIT PERMISSIONS + FOLDER_LINK("FRL", "FRL"), // FOLDER LINK + FOLDER_LINK_REMOVE("FPR", "FPR"), + VERSIONING("VRN", "VRN"), // VERSIONING + EXECUTE_DM_TASK("EDT", "EDT"); //EXECUTE DM TASK private String id; // ID CONTEXT MENU private String name; WorkspaceOperation(String id, String name) { + this.id = id; this.name = name; } public String getId() { + return id; } public String getName() { + return name; } - } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEvent.java new file mode 100644 index 0000000..011ae66 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEvent.java @@ -0,0 +1,63 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileModel; + +import com.google.gwt.event.shared.GwtEvent; + + +/** + * The Class ExecuteDataMinerTaskEvent. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * May 25, 2018 + */ +public class ExecuteDataMinerTaskEvent extends + GwtEvent { + public static Type TYPE = new Type(); + private FileModel targetFileModel; + + /** + * Instantiates a new execute data miner task event. + * + * @param target the target + */ + public ExecuteDataMinerTaskEvent(FileModel target) { + this.setTargetFileModel(target); + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() + */ + @Override + public Type getAssociatedType() { + return TYPE; + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) + */ + @Override + protected void dispatch(ExecuteDataMinerTaskEventHandler handler) { + handler.onExecuteDMTask(this); + } + + /** + * Gets the target file model. + * + * @return the targetFileModel + */ + public FileModel getTargetFileModel() { + return targetFileModel; + } + + /** + * Sets the target file model. + * + * @param targetFileModel the targetFileModel to set + */ + public void setTargetFileModel(FileModel targetFileModel) { + this.targetFileModel = targetFileModel; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEventHandler.java new file mode 100644 index 0000000..dd44412 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ExecuteDataMinerTaskEventHandler.java @@ -0,0 +1,20 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + + +/** + * The Interface ExecuteDataMinerTaskEventHandler. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * May 25, 2018 + */ +public interface ExecuteDataMinerTaskEventHandler extends EventHandler { + + /** + * On execute dm task. + * + * @param executeDataMinerTaskEvent the execute data miner task event + */ + void onExecuteDMTask(ExecuteDataMinerTaskEvent executeDataMinerTaskEvent); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java index 3087a76..02f3f9d 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java @@ -16,6 +16,7 @@ import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent; import org.gcube.portlets.user.workspace.client.event.CreateUrlEvent; import org.gcube.portlets.user.workspace.client.event.DeleteItemEvent; import org.gcube.portlets.user.workspace.client.event.EditUserPermissionEvent; +import org.gcube.portlets.user.workspace.client.event.ExecuteDataMinerTaskEvent; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType; import org.gcube.portlets.user.workspace.client.event.FileUploadEvent; @@ -391,6 +392,24 @@ public class ContextMenuTree { publishOnThredds.setVisible(false); contextMenu.add(publishOnThredds); + // publish on data catalogue + MenuItem executeDMTask = new MenuItem(); + executeDMTask.setId(WorkspaceOperation.EXECUTE_DM_TASK.getId()); + executeDMTask.setText(ConstantsExplorer.MESSAGE_EXECUTE_DM_TASK); + executeDMTask.setIcon(Resources.getIconShell()); + + executeDMTask.addSelectionListener(new SelectionListener() { + public void componentSelected(MenuEvent ce) { + + FileModel sourceFileModel = listSelectedItems.get(0); + if (sourceFileModel != null) { + eventBus.fireEvent(new ExecuteDataMinerTaskEvent(sourceFileModel)); + } + } + }); + executeDMTask.setVisible(false); + contextMenu.add(executeDMTask); + MenuItem editPermissions = new MenuItem(); editPermissions.setId(WorkspaceOperation.EDIT_PERMISSIONS.getId()); @@ -834,6 +853,7 @@ public class ContextMenuTree { contextMenu.getItemByItemId(WorkspaceOperation.SENDTO.getId()).setVisible(true); //send to contextMenu.getItemByItemId(WorkspaceOperation.DOWNLOAD.getId()).setVisible(true); //DOWNLOAD contextMenu.getItemByItemId(WorkspaceOperation.COPY.getId()).setEnabled(true); + contextMenu.getItemByItemId(WorkspaceOperation.EXECUTE_DM_TASK.getId()).setVisible(false); contextMenu.getItemByItemId(WorkspaceOperation.PREVIEW.getId()).setVisible(false); //preview image contextMenu.getItemByItemId(WorkspaceOperation.LINK.getId()).setVisible(false); //open link @@ -933,6 +953,7 @@ public class ContextMenuTree { } else{ contextMenu.getItemByItemId(WorkspaceOperation.SHOW.getId()).setVisible(true); + contextMenu.getItemByItemId(WorkspaceOperation.EXECUTE_DM_TASK.getId()).setVisible(true); switch(selectedItem.getGXTFolderItemType()){ diff --git a/src/main/resources/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml b/src/main/resources/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml index 9fd1bf5..a28b9dc 100644 --- a/src/main/resources/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/workspace/WorkspaceTree.gwt.xml @@ -32,6 +32,10 @@ + + +