added VRE Yard page
This commit is contained in:
parent
32ae6ee2cc
commit
2e2b84cb9c
|
@ -6,11 +6,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
13
pom.xml
13
pom.xml
|
@ -13,13 +13,13 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>thematic-gateways-portlet</artifactId>
|
<artifactId>thematic-gateways-portlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>thematic-gateways-portlet Portlet</name>
|
<name>thematic-gateways-portlet Portlets</name>
|
||||||
<version>7.0.0</version>
|
<version>7.1.0-SNAPSHOT</version>
|
||||||
<description>
|
<description>
|
||||||
Thematic Gateways Portlet
|
Thematic Gateways Portlet
|
||||||
</description>
|
</description>
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet.git</connection>
|
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet.git</connection>
|
||||||
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet.git</developerConnection>
|
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet.git</developerConnection>
|
||||||
<url>https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet</url>
|
<url>https://code-repo.d4science.org/gCubeSystem/thematic-gateways-portlet</url>
|
||||||
</scm>
|
</scm>
|
||||||
|
@ -39,13 +39,18 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>LATEST</version>
|
<version>3.6.0-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.infrastructure.detachedres</groupId>
|
||||||
|
<artifactId>detachedres-library</artifactId>
|
||||||
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dvos</groupId>
|
<groupId>org.gcube.dvos</groupId>
|
||||||
<artifactId>usermanagement-core</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.gcube.portlets.user.vreyard;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.portlet.PortletException;
|
||||||
|
import javax.portlet.RenderRequest;
|
||||||
|
import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||||
|
|
||||||
|
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||||
|
import com.liferay.portal.kernel.util.PrefsPropsUtil;
|
||||||
|
import com.liferay.portal.util.PortalUtil;
|
||||||
|
import com.liferay.util.bridges.mvc.MVCPortlet;
|
||||||
|
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.DetachedREsJAXB;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.GatewayJAXB;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VOJAXB;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.is.obj.VREJAXB;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO;
|
||||||
|
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Portlet implementation class VreYard
|
||||||
|
*/
|
||||||
|
public class VreYard extends MVCPortlet {
|
||||||
|
private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(VreYard.class);
|
||||||
|
|
||||||
|
//these props are read from portal.ext.properties file
|
||||||
|
public static final String DEFAULT_USER_PROPERTY = "d4science.publicportlets.user";
|
||||||
|
public static final String DEFAULT_CONTEXT_PROPERTY = "d4science.publicportlets.context";
|
||||||
|
public static final String DEFAULT_TOKEN_PROPERTY = "d4science.publicportlets.token";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String DEFAULT_SCOPE_PROPERTY = "/d4science.research-infrastructures.eu/";
|
||||||
|
public static final String DEFAULT_TOKEN = "8effc529-44ec-4895-b727-ed0dc14ad113-843339462";
|
||||||
|
|
||||||
|
public static final String DEFAULT_ROLE = "OrganizationMember";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String context = PrefsPropsUtil.getString(PortalUtil.getCompanyId(renderRequest), DEFAULT_CONTEXT_PROPERTY);
|
||||||
|
String token = PrefsPropsUtil.getString(PortalUtil.getCompanyId(renderRequest), DEFAULT_TOKEN_PROPERTY);
|
||||||
|
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
DetachedREsClient detachedREsClient = new DetachedREsClient();
|
||||||
|
DetachedREs detachedREs = detachedREsClient.getDetachedREs();
|
||||||
|
renderRequest.setAttribute("thedetachedREs", detachedREs);
|
||||||
|
int totalVREDimissed = 0;
|
||||||
|
for (Gateway gateway : detachedREs.getGateways().values()) {
|
||||||
|
_log.info("\n\n");
|
||||||
|
_log.info("Gateway: " + gateway.getName() + " \nDesc:\n" + gateway.getDescription().trim());
|
||||||
|
int vreDismissedPerGatew = 0;
|
||||||
|
for (VO vo : gateway.getVos().values()) {
|
||||||
|
_log.debug("VO: " + vo.getName());
|
||||||
|
for (VRE vre : vo.getVres().values()) {
|
||||||
|
|
||||||
|
_log.info("VRE name: " + vre.getName() + "\ndescription: " + vre.getDescription().trim()
|
||||||
|
+ "\nVRE catalogue url: " + vre.getCatalogUrl() + " VRE catalog Portlet URL: "
|
||||||
|
+ vre.getCatalogPortletURL());
|
||||||
|
vreDismissedPerGatew++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_log.info("\n\t\t\t******** VREs dismissed per " + gateway.getName() + " are: "
|
||||||
|
+ vreDismissedPerGatew);
|
||||||
|
totalVREDimissed += vreDismissedPerGatew;
|
||||||
|
}
|
||||||
|
|
||||||
|
_log.debug("\n\nTotal VREs dismissed: " + totalVREDimissed);
|
||||||
|
} catch (Exception e) {
|
||||||
|
_log.error(e.getLocalizedMessage(), e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//renderRequest.setAttribute("theGateways", theGateways);
|
||||||
|
super.render(renderRequest, renderResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,5 +4,6 @@
|
||||||
<display>
|
<display>
|
||||||
<category name="gCube Applications">
|
<category name="gCube Applications">
|
||||||
<portlet id="thematic-gateways-portlet"></portlet>
|
<portlet id="thematic-gateways-portlet"></portlet>
|
||||||
|
<portlet id="vre-yard"></portlet>
|
||||||
</category>
|
</category>
|
||||||
</display>
|
</display>
|
|
@ -12,6 +12,16 @@
|
||||||
</footer-portlet-javascript>
|
</footer-portlet-javascript>
|
||||||
<css-class-wrapper>thematic-gateways-portlet</css-class-wrapper>
|
<css-class-wrapper>thematic-gateways-portlet</css-class-wrapper>
|
||||||
</portlet>
|
</portlet>
|
||||||
|
<portlet>
|
||||||
|
<portlet-name>vre-yard</portlet-name>
|
||||||
|
<icon>/icon.png</icon>
|
||||||
|
<header-portlet-css>/css/main.css</header-portlet-css>
|
||||||
|
<header-portlet-css>/css/jquery-ui.min.css</header-portlet-css>
|
||||||
|
<footer-portlet-javascript>
|
||||||
|
/js/main.js
|
||||||
|
</footer-portlet-javascript>
|
||||||
|
<css-class-wrapper>vre-yard-portlet</css-class-wrapper>
|
||||||
|
</portlet>
|
||||||
<role-mapper>
|
<role-mapper>
|
||||||
<role-name>administrator</role-name>
|
<role-name>administrator</role-name>
|
||||||
<role-link>Administrator</role-link>
|
<role-link>Administrator</role-link>
|
||||||
|
|
|
@ -34,4 +34,37 @@
|
||||||
<role-name>user</role-name>
|
<role-name>user</role-name>
|
||||||
</security-role-ref>
|
</security-role-ref>
|
||||||
</portlet>
|
</portlet>
|
||||||
|
<portlet>
|
||||||
|
<portlet-name>vre-yard</portlet-name>
|
||||||
|
<display-name>Vre Yard</display-name>
|
||||||
|
<portlet-class>
|
||||||
|
org.gcube.portlets.user.vreyard.VreYard
|
||||||
|
</portlet-class>
|
||||||
|
<init-param>
|
||||||
|
<name>view-template</name>
|
||||||
|
<value>/html/vreyard/view.jsp</value>
|
||||||
|
</init-param>
|
||||||
|
<expiration-cache>0</expiration-cache>
|
||||||
|
<supports>
|
||||||
|
<mime-type>text/html</mime-type>
|
||||||
|
<portlet-mode>view</portlet-mode>
|
||||||
|
</supports>
|
||||||
|
<portlet-info>
|
||||||
|
<title>Oops ... we couldn't find the page!</title>
|
||||||
|
<short-title>Oops!</short-title>
|
||||||
|
<keywords></keywords>
|
||||||
|
</portlet-info>
|
||||||
|
<security-role-ref>
|
||||||
|
<role-name>administrator</role-name>
|
||||||
|
</security-role-ref>
|
||||||
|
<security-role-ref>
|
||||||
|
<role-name>guest</role-name>
|
||||||
|
</security-role-ref>
|
||||||
|
<security-role-ref>
|
||||||
|
<role-name>power-user</role-name>
|
||||||
|
</security-role-ref>
|
||||||
|
<security-role-ref>
|
||||||
|
<role-name>user</role-name>
|
||||||
|
</security-role-ref>
|
||||||
|
</portlet>
|
||||||
</portlet-app>
|
</portlet-app>
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
span.entry-description {
|
span.entry-description {
|
||||||
font-size: 1.3em;
|
font-size: 1.3em;
|
||||||
}
|
}
|
||||||
|
@ -9,3 +10,14 @@ span.entry-title-text {
|
||||||
div.app-view-entry-taglib .entry-thumbnail img {
|
div.app-view-entry-taglib .entry-thumbnail img {
|
||||||
max-width: 90px;
|
max-width: 90px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.vre-yard-portlet h1 {
|
||||||
|
margin-top: 50px;
|
||||||
|
font-size: 2em;
|
||||||
|
line-height: 25px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.vre-yard-portlet h1 > small {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
|
@ -48,6 +48,10 @@
|
||||||
<%@ page import="com.liferay.portal.webserver.WebServerServletTokenUtil" %>
|
<%@ page import="com.liferay.portal.webserver.WebServerServletTokenUtil" %>
|
||||||
<%@ page import="com.liferay.portal.service.VirtualHostLocalServiceUtil" %>
|
<%@ page import="com.liferay.portal.service.VirtualHostLocalServiceUtil" %>
|
||||||
<%@ page import="org.gcube.portlets.user.thematicgateways.*" %>
|
<%@ page import="org.gcube.portlets.user.thematicgateways.*" %>
|
||||||
|
<%@ page import="org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs"%>
|
||||||
|
<%@ page import="org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway"%>
|
||||||
|
<%@ page import="org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO"%>
|
||||||
|
<%@ page import="org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE"%>
|
||||||
|
|
||||||
|
|
||||||
<portlet:defineObjects />
|
<portlet:defineObjects />
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
|
||||||
|
<%@include file="../init.jsp"%>
|
||||||
|
|
||||||
|
<portlet:defineObjects />
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$('.vreInfo').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<p class="lead">We couldn't find the page you were looking
|
||||||
|
for, perhaps you were interested in one of the following Virtual
|
||||||
|
Research Environment, that have been hosted on D4Science in the past.</p>
|
||||||
|
<div class="vre-yard-portlet">
|
||||||
|
<%
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
SimpleDateFormat sdfToDisplay = new SimpleDateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
|
DetachedREs detachedREs = (DetachedREs) request.getAttribute("thedetachedREs");
|
||||||
|
for (Gateway gateway : detachedREs.getGateways().values()) {
|
||||||
|
List<VRE> gatewayVREs = new ArrayList<VRE>();
|
||||||
|
for (VO vo : gateway.getVos().values()) {
|
||||||
|
for (VRE vre : vo.getVres().values()) {
|
||||||
|
Date date = sdf.parse(vre.getStartDate());
|
||||||
|
vre.setStartDate(sdfToDisplay.format(date));
|
||||||
|
date = sdf.parse(vre.getEndDate());
|
||||||
|
vre.setEndDate(sdfToDisplay.format(date));
|
||||||
|
gatewayVREs.add(vre);
|
||||||
|
}
|
||||||
|
} // end for VO
|
||||||
|
pageContext.setAttribute("gatewayVREs", gatewayVREs);
|
||||||
|
|
||||||
|
String gatewayDisplayName = gateway.getName().replace("Detached", "");
|
||||||
|
%>
|
||||||
|
|
||||||
|
<h1><%=gatewayDisplayName%><br> <small><%=gateway.getDescription()%></small>
|
||||||
|
</h1>
|
||||||
|
<div style="width: 100%; text-align: left;">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th class="span3">VRE name</th>
|
||||||
|
<th class="span2">Operational from</th>
|
||||||
|
<th class="span2">Operational to</th>
|
||||||
|
<th class="span2">Managers</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach var="vre" items="${gatewayVREs}">
|
||||||
|
<tr style="border-bottom: 1px solid #CCC;">
|
||||||
|
<td><button title="${vre.description}" type="button"
|
||||||
|
class="btn btn-link vreInfo" data-placement='bottom'>
|
||||||
|
${vre.name}</button></td>
|
||||||
|
<td>${vre.startDate}</td>
|
||||||
|
<td>${vre.endDate}</td>
|
||||||
|
<td>${vre.managers}</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
} //end for Gateway
|
||||||
|
%>
|
||||||
|
<div style="width: 100%; text-align: center; margin-top: 75px; margin-bottom: 75px;">
|
||||||
|
<h3>Could not find what you are looking for?
|
||||||
|
<p>
|
||||||
|
<button class="btn btn-large btn-primary"
|
||||||
|
onclick="location.href='https://support.d4science.org'"
|
||||||
|
type="button">Visit D4Science Support page</button> or
|
||||||
|
<button class="btn btn-large btn-primary"
|
||||||
|
onclick="location.href='https://services.d4science.org/thematic-gateways'"
|
||||||
|
type="button">Visit the active Gateways</button></p></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue