Fixed #19786. Moved to 1.4.0-SNAPSHOT
This commit is contained in:
parent
c5cf953461
commit
eea656ff8f
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/workspace-explorer-app-1.3.1/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/workspace-explorer-app-1.3.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/workspace-explorer-app-1.3.1/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/workspace-explorer-app-1.3.2-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/workspace-explorer-app-1.3.1/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/workspace-explorer-app-1.3.2-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/home/francesco-mangiacrapa/git/workspace-explorer-app/target/workspace-explorer-app-1.3.1
|
lastWarOutDir=/home/francescomangiacrapa/git/workspace-explorer-app/target/workspace-explorer-app-1.3.2-SNAPSHOT
|
||||||
launchConfigExternalUrlPrefix=
|
launchConfigExternalUrlPrefix=
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,10 +1,40 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
<wb-module deploy-name="workspace-explorer-app-1.3.1">
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="workspace-explorer-app-1.3.2-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
<dependent-module archiveName="storagehub-client-wrapper-1.1.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/storagehub-client-wrapper/storagehub-client-wrapper">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="workspace-explorer-app"/>
|
<property name="context-root" value="workspace-explorer-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/workspace-explorer-app/target/workspace-explorer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/workspace-explorer-app/target/workspace-explorer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.4.0-SNAPSHOT] - 2021-12-03
|
||||||
|
|
||||||
|
[#19786] Integrated items of type "URL"
|
||||||
|
|
||||||
## [v1.3.1] - 2020-09-25
|
## [v1.3.1] - 2020-09-25
|
||||||
|
|
||||||
[#19317] Just to include the storagehub-client-wrapper at 1.0.0 version
|
[#19317] Just to include the storagehub-client-wrapper at 1.0.0 version
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-explorer-app</artifactId>
|
<artifactId>workspace-explorer-app</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.4.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.gcube.portlets.user.workspaceexplorerapp.client.view.WorkspaceExplore
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
|
||||||
import com.google.gwt.core.shared.GWT;
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.http.client.RequestBuilder;
|
import com.google.gwt.http.client.RequestBuilder;
|
||||||
|
@ -46,25 +45,25 @@ import gwt.material.design.client.ui.MaterialToast;
|
||||||
/**
|
/**
|
||||||
* The Class WorkspaceResourcesExplorerPanel.
|
* The Class WorkspaceResourcesExplorerPanel.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
* Dec 3, 2015
|
*
|
||||||
|
* Dec 3, 2021
|
||||||
*/
|
*/
|
||||||
public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWorskpaceExplorerSelectNotificationListener{
|
public class WorkspaceResourcesExplorerPanel extends DockPanel
|
||||||
|
implements HasWorskpaceExplorerSelectNotificationListener {
|
||||||
|
|
||||||
public HandlerManager eventBus;
|
public HandlerManager eventBus;
|
||||||
private Breadcrumbs breadcrumbs;
|
private Breadcrumbs breadcrumbs;
|
||||||
private boolean isSelect = false;
|
private boolean isSelect = false;
|
||||||
private String captionTxt;
|
private String captionTxt;
|
||||||
// private WorkspaceExplorerController controller;
|
|
||||||
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
|
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
|
||||||
private VerticalPanel mainVP = new VerticalPanel();
|
private VerticalPanel mainVP = new VerticalPanel();
|
||||||
// private HorizontalPanel footerHP = new HorizontalPanel();
|
|
||||||
private WorkspaceExplorer wsExplorer;
|
private WorkspaceExplorer wsExplorer;
|
||||||
private ScrollPanel centerScrollable = new ScrollPanel();
|
private ScrollPanel centerScrollable = new ScrollPanel();
|
||||||
// private ScrollPanel southPanel = new ScrollPanel();
|
|
||||||
private String folderName;
|
private String folderName;
|
||||||
private Item baseFolder;
|
private Item baseFolder;
|
||||||
public static final DisplayField[] displayFields = new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
|
public static final DisplayField[] displayFields = new DisplayField[] { DisplayField.ICON, DisplayField.NAME,
|
||||||
|
DisplayField.OWNER, DisplayField.CREATION_DATE };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace folder explorer select panel.
|
* Instantiates a new workspace folder explorer select panel.
|
||||||
|
@ -74,7 +73,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
* @param folderName the folder name
|
* @param folderName the folder name
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, String folderName) throws Exception {
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, String folderName)
|
||||||
|
throws Exception {
|
||||||
initExplorer(eventBus, folderId, folderName, ItemType.values(), ItemType.values());
|
initExplorer(eventBus, folderId, folderName, ItemType.values(), ItemType.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
* @param showableTypes the showable types
|
* @param showableTypes the showable types
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
private void initExplorer(HandlerManager eventBus, String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes) throws Exception{
|
private void initExplorer(HandlerManager eventBus, String folderId, String folderName, ItemType[] selectableTypes,
|
||||||
|
ItemType[] showableTypes) throws Exception {
|
||||||
this.folderName = folderName;
|
this.folderName = folderName;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.breadcrumbs = new Breadcrumbs(eventBus);
|
this.breadcrumbs = new Breadcrumbs(eventBus);
|
||||||
|
@ -106,11 +107,13 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer select panel.
|
* Instantiates a new workspace explorer select panel.
|
||||||
*
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
* @param folderId the folder id
|
* @param folderId the folder id
|
||||||
* @param showOnlyFolders the show only folders
|
* @param showOnlyFolders the show only folders
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, boolean showOnlyFolders) throws Exception {
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, boolean showOnlyFolders)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
if (showOnlyFolders) {
|
if (showOnlyFolders) {
|
||||||
ItemType[] itemsType = new ItemType[1];
|
ItemType[] itemsType = new ItemType[1];
|
||||||
|
@ -121,7 +124,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
|
@ -182,13 +184,9 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
public void onOrderDataBy(OrderDataByEvent orderDataByEvent) {
|
public void onOrderDataBy(OrderDataByEvent orderDataByEvent) {
|
||||||
|
|
||||||
wsExplorer.getItTables().sortDataBy(orderDataByEvent.getLabel());
|
wsExplorer.getItTables().sortDataBy(orderDataByEvent.getLabel());
|
||||||
|
|
||||||
/*ArrayList<Item> items = ItemComparatorUtility.sortItems(DisplayField.NAME, true, wsExplorer.getItTables().getDataProvider().getList());
|
|
||||||
wsExplorer.updateExplorer(items);*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
eventBus.addHandler(RightClickItemEvent.TYPE, new RightClickItemEventHandler() {
|
eventBus.addHandler(RightClickItemEvent.TYPE, new RightClickItemEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -197,7 +195,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
if (rightClickItemEvent.getItem() != null && rightClickItemEvent.getItem().getId() != null) {
|
if (rightClickItemEvent.getItem() != null && rightClickItemEvent.getItem().getId() != null) {
|
||||||
|
|
||||||
PopupContextMenu popupCM = new PopupContextMenu(true, eventBus, rightClickItemEvent.getItem());
|
PopupContextMenu popupCM = new PopupContextMenu(true, eventBus, rightClickItemEvent.getItem());
|
||||||
popupCM.showPopup(rightClickItemEvent.getXPos(), Window.getScrollTop()+rightClickItemEvent.getYPos());
|
popupCM.showPopup(rightClickItemEvent.getXPos(),
|
||||||
|
Window.getScrollTop() + rightClickItemEvent.getYPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -225,7 +224,10 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
case DOWNLOAD:
|
case DOWNLOAD:
|
||||||
MaterialToast.fireToast("Download...");
|
MaterialToast.fireToast("Download...");
|
||||||
try {
|
try {
|
||||||
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds, "_self", downloadHandlerCallback);
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
||||||
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
||||||
|
WorkspaceExplorerAppConstants.IDS + "=" + itemIds, "_self",
|
||||||
|
downloadHandlerCallback);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Window.alert("Sorry, an error occurred while contacting server, try again");
|
Window.alert("Sorry, an error occurred while contacting server, try again");
|
||||||
}
|
}
|
||||||
|
@ -234,8 +236,45 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
// break;
|
// break;
|
||||||
case OPEN:
|
case OPEN:
|
||||||
MaterialToast.fireToast("Showing...");
|
MaterialToast.fireToast("Showing...");
|
||||||
|
|
||||||
|
if (downloadItemEvent.getItem().getType().equals(ItemType.URL_DOCUMENT)) {
|
||||||
|
|
||||||
|
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", "");
|
||||||
|
|
||||||
|
final String theItemIds = itemIds;
|
||||||
|
|
||||||
|
WorkspaceExplorerAppConstants.workspaceNavigatorService
|
||||||
|
.getUrlById(downloadItemEvent.getItem().getId(), new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
newBrowserWindow.setUrl(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
try {
|
try {
|
||||||
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET, WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds+"&viewContent=true", "_blank", downloadHandlerCallback);
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
||||||
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
||||||
|
WorkspaceExplorerAppConstants.IDS + "=" + theItemIds
|
||||||
|
+ "&viewContent=true",
|
||||||
|
"_blank", downloadHandlerCallback);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Window.alert(
|
||||||
|
"Sorry, an error occurred while contacting server, try again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
||||||
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
||||||
|
WorkspaceExplorerAppConstants.IDS + "=" + itemIds + "&viewContent=true", "_blank",
|
||||||
|
downloadHandlerCallback);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Window.alert("Sorry, an error occurred while contacting server, try again");
|
Window.alert("Sorry, an error occurred while contacting server, try again");
|
||||||
|
@ -249,7 +288,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To list.
|
* To list.
|
||||||
*
|
*
|
||||||
|
@ -265,7 +303,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load parent breadcrumb by item id.
|
* Load parent breadcrumb by item id.
|
||||||
*
|
*
|
||||||
|
@ -276,7 +313,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
|
|
||||||
GWT.log("Reload Parent Breadcrumb: [Item id: " + itemIdentifier + "]");
|
GWT.log("Reload Parent Breadcrumb: [Item id: " + itemIdentifier + "]");
|
||||||
|
|
||||||
WorkspaceExplorerAppConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, baseFolder.getId(), includeItemAsParent, new AsyncCallback<List<Item>>() {
|
WorkspaceExplorerAppConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(
|
||||||
|
itemIdentifier, baseFolder.getId(), includeItemAsParent, new AsyncCallback<List<Item>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -293,7 +331,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
public void onSuccess(List<Item> result) {
|
public void onSuccess(List<Item> result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
breadcrumbs.setPath(result);
|
breadcrumbs.setPath(result);
|
||||||
// clearMoreInfo();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -307,7 +344,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
eventBus.fireEvent(new LoadFolderEvent(baseFolder));
|
eventBus.fireEvent(new LoadFolderEvent(baseFolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the panel.
|
* Inits the panel.
|
||||||
*
|
*
|
||||||
|
@ -351,7 +387,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify not valid selection.
|
* Notify not valid selection.
|
||||||
*/
|
*/
|
||||||
|
@ -393,8 +428,19 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
return isSelect;
|
return isSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
* Adds the workspace explorer select notification listener.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.
|
||||||
|
* WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#
|
||||||
|
* addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.
|
||||||
|
* wsexplorer.client.notification.WorskpaceExplorerNotification.
|
||||||
|
* WorskpaceExplorerNotificationListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
||||||
|
@ -402,8 +448,19 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
listeners.add(handler);
|
listeners.add(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
* Removes the workspace explorer select notification listener.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.
|
||||||
|
* WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#
|
||||||
|
* removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.
|
||||||
|
* wsexplorer.client.notification.WorskpaceExplorerNotification.
|
||||||
|
* WorskpaceExplorerNotificationListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
||||||
|
@ -429,8 +486,9 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the ws explorer.
|
||||||
|
*
|
||||||
* @return the wsExplorer
|
* @return the wsExplorer
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorer getWsExplorer() {
|
public WorkspaceExplorer getWsExplorer() {
|
||||||
|
@ -460,7 +518,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
if (params.length() > 1)
|
if (params.length() > 1)
|
||||||
params += "&";
|
params += "&";
|
||||||
params += WorkspaceExplorerAppConstants.REDIRECTONERROR + "=" + windowOpenParam.isRedirectOnError();
|
params += WorkspaceExplorerAppConstants.REDIRECTONERROR + "=" + windowOpenParam.isRedirectOnError();
|
||||||
windowOpenParam.getBrowserWindow().setUrl(WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE+params);
|
windowOpenParam.getBrowserWindow()
|
||||||
|
.setUrl(WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE + params);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
|
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ClickItemEvent.
|
* The Class ClickItemEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 6, 2015
|
||||||
* Jul 6, 2015
|
|
||||||
*/
|
*/
|
||||||
public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
||||||
public static Type<DownloadItemEventHandler> TYPE = new Type<DownloadItemEventHandler>();
|
public static Type<DownloadItemEventHandler> TYPE = new Type<DownloadItemEventHandler>();
|
||||||
private ItemInterface item;
|
private Item item;
|
||||||
private DownloadType type;
|
private DownloadType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +21,7 @@ public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
||||||
* @param itemDownload the item download
|
* @param itemDownload the item download
|
||||||
* @param type the type
|
* @param type the type
|
||||||
*/
|
*/
|
||||||
public DownloadItemEvent(ItemInterface itemDownload, DownloadType type) {
|
public DownloadItemEvent(Item itemDownload, DownloadType type) {
|
||||||
this.item = itemDownload;
|
this.item = itemDownload;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +34,9 @@ public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,8 +44,12 @@ public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
||||||
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(DownloadItemEventHandler handler) {
|
protected void dispatch(DownloadItemEventHandler handler) {
|
||||||
|
@ -57,7 +61,7 @@ public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
|
||||||
*
|
*
|
||||||
* @return the item
|
* @return the item
|
||||||
*/
|
*/
|
||||||
public ItemInterface getItem() {
|
public Item getItem() {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
@ -42,7 +42,7 @@ public class MenuMoreOptionsOnItem extends Composite {
|
||||||
|
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
|
|
||||||
private ItemInterface itemToDownload;
|
private Item itemToDownload;
|
||||||
|
|
||||||
private Command commandOnClick;
|
private Command commandOnClick;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class MenuMoreOptionsOnItem extends Composite {
|
||||||
* @param itemToDownload the item to download
|
* @param itemToDownload the item to download
|
||||||
* @param commandOnClick the command on click
|
* @param commandOnClick the command on click
|
||||||
*/
|
*/
|
||||||
public void initOnItem(ItemInterface itemToDownload, Command commandOnClick){
|
public void initOnItem(Item itemToDownload, Command commandOnClick){
|
||||||
this.itemToDownload = itemToDownload;
|
this.itemToDownload = itemToDownload;
|
||||||
this.commandOnClick = commandOnClick;
|
this.commandOnClick = commandOnClick;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,18 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Gets the folder.
|
* Gets the folder.
|
||||||
*
|
*
|
||||||
* @param folder the folder @param showableTypes the showable types @param
|
* @param folder the folder @param showableTypes the showable
|
||||||
* purgeEmpyFolders the purge empy folders @param filterCriteria
|
* types @param purgeEmpyFolders the purge empy
|
||||||
* the filter criteria @return the folder @throws
|
* folders @param filterCriteria the filter
|
||||||
* WorkspaceNavigatorServiceException the workspace navigator
|
* criteria @return the folder @throws
|
||||||
* service exception @throws
|
* WorkspaceNavigatorServiceException the workspace
|
||||||
|
* navigator service exception @throws
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
|
* @return the folder
|
||||||
|
* @throws WorkspaceNavigatorServiceException the workspace navigator service
|
||||||
|
* exception
|
||||||
*/
|
*/
|
||||||
Item getFolder(Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
Item getFolder(Item folder, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
||||||
throws WorkspaceNavigatorServiceException;
|
throws WorkspaceNavigatorServiceException;
|
||||||
|
@ -71,12 +78,12 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Gets the breadcrumbs by item identifier.
|
* Gets the breadcrumbs by item identifier.
|
||||||
*
|
*
|
||||||
* @param itemIdentifier the item identifier
|
* @param itemId the item id
|
||||||
* @param includeItemAsParent the include item as parent
|
|
||||||
* @return the breadcrumbs by item identifier
|
* @return the breadcrumbs by item identifier
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
//List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception;
|
// List<Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean
|
||||||
|
// includeItemAsParent) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the public link for item id.
|
* Gets the public link for item id.
|
||||||
|
@ -96,4 +103,13 @@ public interface WorkspaceExplorerAppService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
String getFolderIdFromEncrypted(String encryptedFolderId) throws Exception;
|
String getFolderIdFromEncrypted(String encryptedFolderId) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the url by id.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @return the url by id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
String getUrlById(String itemId) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,12 +64,14 @@ public interface WorkspaceExplorerAppServiceAsync {
|
||||||
/**
|
/**
|
||||||
* Gets the breadcrumbs by item identifier.
|
* Gets the breadcrumbs by item identifier.
|
||||||
*
|
*
|
||||||
* @param itemIdentifier the item identifier
|
* @param showableTypes the showable types
|
||||||
* @param includeItemAsParent the include item as parent
|
* @param purgeEmpyFolders the purge empy folders
|
||||||
|
* @param filterCriteria the filter criteria
|
||||||
* @param asyncCallback the async callback
|
* @param asyncCallback the async callback
|
||||||
* @return the breadcrumbs by item identifier
|
* @return the breadcrumbs by item identifier
|
||||||
*/
|
*/
|
||||||
//public void getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent, AsyncCallback<List<Item>> asyncCallback);
|
// public void getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean
|
||||||
|
// includeItemAsParent, AsyncCallback<List<Item>> asyncCallback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my special folder.
|
* Gets the my special folder.
|
||||||
|
@ -95,4 +97,13 @@ public interface WorkspaceExplorerAppServiceAsync {
|
||||||
void getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit,
|
void getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit,
|
||||||
boolean includeItemAsParent, AsyncCallback<List<Item>> callback);
|
boolean includeItemAsParent, AsyncCallback<List<Item>> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the url by id.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param callback the callback
|
||||||
|
* @return the url by id
|
||||||
|
*/
|
||||||
|
void getUrlById(String itemId, AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client.view;
|
package org.gcube.portlets.user.workspaceexplorerapp.client.view;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.MenuMoreOptionsOnItem;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.MenuMoreOptionsOnItem;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
|
|
||||||
import com.google.gwt.core.shared.GWT;
|
import com.google.gwt.core.shared.GWT;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -30,7 +30,7 @@ public class PopupContextMenu extends PopupPanel{
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
* @param itemToDownload the item to download
|
* @param itemToDownload the item to download
|
||||||
*/
|
*/
|
||||||
public PopupContextMenu(boolean autohide, HandlerManager eventBus, ItemInterface itemToDownload) {
|
public PopupContextMenu(boolean autohide, HandlerManager eventBus, Item itemToDownload) {
|
||||||
super(autohide);
|
super(autohide);
|
||||||
GWT.log("PopupContextMenu opened");
|
GWT.log("PopupContextMenu opened");
|
||||||
menuOpts = new MenuMoreOptionsOnItem(eventBus);
|
menuOpts = new MenuMoreOptionsOnItem(eventBus);
|
||||||
|
|
|
@ -15,6 +15,8 @@ import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.FileItem;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLFileItem;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLItem;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.ItemBuilder;
|
import org.gcube.portlets.user.workspaceexplorerapp.server.workspace.ItemBuilder;
|
||||||
|
@ -462,4 +464,33 @@ public class WorkspaceExplorerAppServiceImpl extends RemoteServiceServlet implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUrlById(String itemId) throws Exception {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (itemId == null)
|
||||||
|
throw new Exception("Workspace itemId is null");
|
||||||
|
|
||||||
|
logger.debug("get URL by id: " + itemId);
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
WorkspaceItem wsItem = workspace.getItemForExplorer(itemId, false, false, false);
|
||||||
|
// workspace
|
||||||
|
|
||||||
|
if (wsItem instanceof org.gcube.common.storagehubwrapper.shared.tohl.impl.URLFileItem) {
|
||||||
|
URLFileItem fileItem = (URLFileItem) wsItem;
|
||||||
|
return WsInstanceUtil.getUrl(workspace, fileItem);
|
||||||
|
} else if (wsItem instanceof URLItem) {
|
||||||
|
URLItem urlFile = (URLItem) wsItem;
|
||||||
|
return urlFile.getValue().toString();
|
||||||
|
} else {
|
||||||
|
throw new Exception("The itemId " + itemId + " is not a URLFileItem or a URLItem");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error occurred in getUrlById: ", e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,8 @@ public class ItemBuilder {
|
||||||
|
|
||||||
else
|
else
|
||||||
return ItemType.UNKNOWN_TYPE;
|
return ItemType.UNKNOWN_TYPE;
|
||||||
|
case URL_ITEM:
|
||||||
|
return ItemType.URL_DOCUMENT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -3,18 +3,24 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.server.workspace;
|
package org.gcube.portlets.user.workspaceexplorerapp.server.workspace;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
||||||
|
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLFileItem;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WsUtil.
|
* The Class WsUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
|
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy) Apr 9, 2020
|
||||||
* Apr 9, 2020
|
|
||||||
*/
|
*/
|
||||||
public class WsInstanceUtil {
|
public class WsInstanceUtil {
|
||||||
|
|
||||||
|
@ -54,7 +60,8 @@ public class WsInstanceUtil {
|
||||||
* @return the workpace
|
* @return the workpace
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static org.gcube.common.storagehubwrapper.server.tohl.Workspace getWorkspace(HttpSession httpSession) throws Exception {
|
public static org.gcube.common.storagehubwrapper.server.tohl.Workspace getWorkspace(HttpSession httpSession)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StorageHubWrapper wrapper = getStorageHubWrapper(httpSession);
|
StorageHubWrapper wrapper = getStorageHubWrapper(httpSession);
|
||||||
|
@ -89,7 +96,6 @@ public class WsInstanceUtil {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the application token.
|
* Gets the application token.
|
||||||
*
|
*
|
||||||
|
@ -102,8 +108,7 @@ public class WsInstanceUtil {
|
||||||
String appTokenEnvVarName = null;
|
String appTokenEnvVarName = null;
|
||||||
try {
|
try {
|
||||||
logger.info("Reading " + ENVIRONMENT_VARIABLE_TOKEN_NAME + " from web.xml context");
|
logger.info("Reading " + ENVIRONMENT_VARIABLE_TOKEN_NAME + " from web.xml context");
|
||||||
appTokenEnvVarName = httpSession.getServletContext()
|
appTokenEnvVarName = httpSession.getServletContext().getInitParameter(ENVIRONMENT_VARIABLE_TOKEN_NAME);
|
||||||
.getInitParameter(ENVIRONMENT_VARIABLE_TOKEN_NAME);
|
|
||||||
logger.info("Found param-value '" + appTokenEnvVarName
|
logger.info("Found param-value '" + appTokenEnvVarName
|
||||||
+ "' from web context, reading its value from ENVIRONMENT");
|
+ "' from web context, reading its value from ENVIRONMENT");
|
||||||
appToken = System.getenv(appTokenEnvVarName);
|
appToken = System.getenv(appTokenEnvVarName);
|
||||||
|
@ -115,4 +120,42 @@ public class WsInstanceUtil {
|
||||||
|
|
||||||
return appToken;
|
return appToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the url.
|
||||||
|
*
|
||||||
|
* @param workspace the workspace
|
||||||
|
* @param fileItem the file item
|
||||||
|
* @return the url
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public static String getUrl(Workspace workspace, URLFileItem fileItem) throws Exception {
|
||||||
|
try {
|
||||||
|
return readStreamAsString(
|
||||||
|
workspace.downloadFile(fileItem.getId(), fileItem.getName(), null, null).getStream());
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("GET URL error for file: " + fileItem, e);
|
||||||
|
throw new InternalErrorException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the entire input stream as string. The system encoding is used.
|
||||||
|
*
|
||||||
|
* @param is the input stream.
|
||||||
|
* @return the read string.
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public static String readStreamAsString(InputStream is) throws java.io.IOException {
|
||||||
|
StringBuilder sb = new StringBuilder(1000);
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
char[] buf = new char[1024];
|
||||||
|
int numRead = 0;
|
||||||
|
while ((numRead = reader.read(buf)) != -1) {
|
||||||
|
sb.append(buf, 0, numRead);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
||||||
* Sep 16, 2016
|
|
||||||
*/
|
|
||||||
public class TestFolderIDDecrypt {
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package org.gcube.portlets.user.workspaceexplorerapp;
|
||||||
|
|
||||||
|
public class WorkspaceExplorerAppTests {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue