Feature #22109 load VRE Folder without using JCR indices

This commit is contained in:
Massimiliano Assante 2021-10-04 15:56:55 +02:00
parent 80b24443e0
commit c7c962414d
4 changed files with 32 additions and 15 deletions

View File

@ -1,5 +1,6 @@
<?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">
@ -15,7 +17,8 @@
<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"/>
@ -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/java"/>
@ -43,7 +49,8 @@
<property name="context-root" value="workspace-widget-portlet"/>
@ -51,7 +58,8 @@
<property name="java-output-path" value="/workspace-widget-portlet/target/classes"/>
@ -59,7 +67,8 @@
</wb-module>

View File

@ -4,6 +4,11 @@
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).
## [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
- Feature #21507 support new UMATokensProvider class

View File

@ -13,7 +13,7 @@
<artifactId>workspace-widget-portlet</artifactId>
<packaging>war</packaging>
<name>workspace-widget-portlet Portlet</name>
<version>1.5.1</version>
<version>1.5.2-SNAPSHOT</version>
<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.
</description>

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.wswidget;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
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.portal.oidc.lr62.JWTTokenUtil;
import org.gcube.portal.oidc.lr62.OIDCUmaUtil;
import org.gcube.portlets.user.wswidget.shared.AuthorizedUser;
import org.gcube.portlets.user.wswidget.shared.Breadcrumb;
import org.gcube.portlets.user.wswidget.shared.WSItem;
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.JSONFactoryUtil;
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");
request.getPortletSession().setAttribute(BREADCRUMB_ATTR, toSet, PortletSession.APPLICATION_SCOPE);
} else { //is in a VRE
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
itemId = wsclient.getVreFolder("hl:accounting").getId();
_log.debug("looking for vre context");
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);
String groupName = GroupLocalServiceUtil.getGroup(groupId).getName();
groupName = groupName.replace("_", " ");