Feature #22109 load VRE Folder without using JCR indices

feature/22109
Massimiliano Assante 3 years ago
parent 80b24443e0
commit c7c962414d

@ -1,5 +1,6 @@
<?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">
@ -7,7 +8,8 @@
<wb-module deploy-name="workspace-widget-portlet"> <wb-module deploy-name="workspace-widget-portlet">
@ -15,7 +17,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -23,7 +26,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -31,11 +35,13 @@
<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="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -43,7 +49,8 @@
<property name="context-root" value="workspace-widget-portlet"/> <property name="context-root" value="workspace-widget-portlet"/>
@ -51,7 +58,8 @@
<property name="java-output-path" value="/workspace-widget-portlet/target/classes"/> <property name="java-output-path" value="/workspace-widget-portlet/target/classes"/>
@ -59,7 +67,8 @@
</wb-module> </wb-module>

@ -4,6 +4,11 @@
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.5.2-SNAPSHOT] - 2021-10-04
- Feature #22109 Workspace widget to load VRE Folders without using JCR indices
## [v1.5.1] - 2021-07-13 ## [v1.5.1] - 2021-07-13
- Feature #21507 support new UMATokensProvider class - Feature #21507 support new UMATokensProvider class

@ -13,7 +13,7 @@
<artifactId>workspace-widget-portlet</artifactId> <artifactId>workspace-widget-portlet</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<name>workspace-widget-portlet Portlet</name> <name>workspace-widget-portlet Portlet</name>
<version>1.5.1</version> <version>1.5.2-SNAPSHOT</version>
<description> <description>
Workspace Widget Portlet is a small Front-end component looking like G Drive which exposes the content of the user's workspace or VRE Folders in read only mode. Workspace Widget Portlet is a small Front-end component looking like G Drive which exposes the content of the user's workspace or VRE Folders in read only mode.
</description> </description>

@ -3,6 +3,7 @@ package org.gcube.portlets.user.wswidget;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.Scanner; import java.util.Scanner;
import javax.portlet.PortletException; import javax.portlet.PortletException;
@ -27,14 +28,11 @@ import org.gcube.common.storagehub.model.items.Item;
import org.gcube.oidc.rest.JWTToken; import org.gcube.oidc.rest.JWTToken;
import org.gcube.portal.oidc.lr62.JWTTokenUtil; import org.gcube.portal.oidc.lr62.JWTTokenUtil;
import org.gcube.portal.oidc.lr62.OIDCUmaUtil; import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
import org.gcube.portlets.user.wswidget.shared.AuthorizedUser; import org.gcube.portlets.user.wswidget.shared.AuthorizedUser;
import org.gcube.portlets.user.wswidget.shared.Breadcrumb; import org.gcube.portlets.user.wswidget.shared.Breadcrumb;
import org.gcube.portlets.user.wswidget.shared.WSItem; import org.gcube.portlets.user.wswidget.shared.WSItem;
import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONObject;
@ -143,8 +141,13 @@ public class WorkspaceWidget extends MVCPortlet {
toSet = new Breadcrumb(itemId, Utils.getCurrentUser(request).getFirstName()+"\'s home"); toSet = new Breadcrumb(itemId, Utils.getCurrentUser(request).getFirstName()+"\'s home");
request.getPortletSession().setAttribute(BREADCRUMB_ATTR, toSet, PortletSession.APPLICATION_SCOPE); request.getPortletSession().setAttribute(BREADCRUMB_ATTR, toSet, PortletSession.APPLICATION_SCOPE);
} else { //is in a VRE } else { //is in a VRE
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build(); _log.debug("looking for vre context");
itemId = wsclient.getVreFolder("hl:accounting").getId(); String context = Utils.getCurrentContext(request);
final String vreContext = context.replace("/", "-").substring(1); //shub expects this name, e.g. gcube-devsec-devVRE
_log.debug("shub vre name to look for: "+vreContext);
StorageHubClient shc = new StorageHubClient();
Optional<ItemContainer<? extends Item>> vreContainer = shc.getVREFolders().getContainers().stream().filter(v -> v.get().getTitle().equals(vreContext)).findFirst();
itemId = vreContainer.get().getId();
itemsList = StorageHubServiceUtil.getItemChildren(authUser, itemId, itemId, start, offset); itemsList = StorageHubServiceUtil.getItemChildren(authUser, itemId, itemId, start, offset);
String groupName = GroupLocalServiceUtil.getGroup(groupId).getName(); String groupName = GroupLocalServiceUtil.getGroup(groupId).getName();
groupName = groupName.replace("_", " "); groupName = groupName.replace("_", " ");

Loading…
Cancel
Save