ported to liferay 6.2

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@126437 82a268e6-3cf1-43bd-a215-b396298e98cf
master
Massimiliano Assante 8 years ago
parent edb11138d9
commit abd4849c94

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/my-vres-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/my-vres-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -34,5 +34,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/my-vres-1.6.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/my-vres-2.0.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

@ -2,7 +2,7 @@
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="java" version="1.7"/>
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="jst.web" version="3.0"/>
</faceted-project>

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>my-vres</artifactId>
<packaging>war</packaging>
<version>1.6.0-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
<name>My VREs Portlet</name>
<description>
gCube My VREs Portlet shows only the VO and VREs a user is member of, divided by category.
@ -27,7 +27,7 @@
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<liferay.version>6.2.5</liferay.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
@ -50,44 +50,44 @@
<!-- Google Web Toolkit (GWT) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<artifactId>gcube-widgets</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>accesslogger</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>guided-tour-widget</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependency>
</dependencies>
<build>

@ -1,18 +1,12 @@
package org.gcube.portlet.user.my_vres.client;
import org.gcube.portlet.user.my_vres.client.resources.TourResources;
import org.gcube.portlets.widgets.guidedtour.client.GCUBEGuidedTour;
import org.gcube.portlets.widgets.guidedtour.client.GuidedTourResourceProvider;
import org.gcube.portlets.widgets.guidedtour.resources.client.GuidedTourResource;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*
* @author massi
*
*/
public class MyVREs implements EntryPoint {
@ -21,24 +15,6 @@ public class MyVREs implements EntryPoint {
*/
public void onModuleLoad() {
RootPanel.get("myVREsDIV").add(new VresPanel());
showGuidedTour();
}
private void showGuidedTour() {
GWT.runAsync(GCUBEGuidedTour.class, new RunAsyncCallback() {
public void onSuccess() {
GCUBEGuidedTour.showTour(MyVREs.class.getName(), new GuidedTourResourceProvider() {
@Override
public GuidedTourResource getResource() {
TourResources resources = GWT.create(TourResources.class);
return resources.quickTour();
}
});
}
public void onFailure(Throwable caught) {
Window.alert("Could not check show tour");
}
});
}
}

@ -1,162 +0,0 @@
<!-- this is your main configuration XML (example name GuidedTour.xml), the
source tag have to link this file: -->
<guidedtour width="780" height="450" usemask="false">
<title>Social Collaboration Facilities</title>
<guide>http://goo.gl/SXwcjh
</guide>
<themecolor>BLUE</themecolor>
<steps>
<step showTitle="true" v-alignment="ALIGN_TOP">
<title>Overview</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 25px;">
This portal offers three major facilities for collaboration: <b>Collaboration Environments</b>, <b>Social Networking</b> services, and <b>Shared Workspace</b>.
</div>
<div style="padding-bottom: 25px;">
<b>Collaboration Environments</b> are dedicated working environments offering selected services
in addition to the social networking services and the shared workspace. Each environment serves a community.
</div>
<div style="padding-bottom: 25px;">
<b>Social networking</b> services realize a shared status wall where users can post messages, share links and files with their coworkers.</div>
<div style="padding-bottom: 25px;">
The <a href="/group/data-e-infrastructure-gateway/workspace" target="_blank"><b>Shared Workspace</b></a>, is a service for managing files in the cloud. Through the workspace you can manage, upload and delete files as you wish.
You can <b>share folders</b> with any users you like so as to maximize collaboration among members.
</div>
<div style="padding-bottom: 10px;">
Discover more about the Collaboration Facilities through this quick tour, click next.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/1.jpg" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>Join New</title>
<bodies>
<body><![CDATA[
<div style="padding-bottom: 40px;">
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 40px;">
You can check the <b>Collaboration Environments</b> and the communities available on the System
by clicking on Join New in the top menu of this page.
</div>
<div style="padding-bottom: 40px;">
For each <b>Collaboration Environment</b> you can ask to join.
Your request will be reviewed by a delegated person in the related community and approved (depending on the scope of the community).
</div>
<div style="padding-bottom: 40px;">
You will be notified whether your request will be approved or not via email. While the request is in the approval phase the related icon will be listed as pending.
</div>
<div style="padding-bottom: 40px;">
In some cases you could be added to a community automatically, should this happen you will be notified via email.
</div>
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/6.jpg" />
</images>
</step>
<step showTitle="true" v-alignment="ALIGN_TOP">
<title>The Dockbar</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 10px;">
The Dockbar is <b>very important</b>, it is always on the top of the page and contains 4 icons (links) always accessible as shown in the figure.
</div>
<div style="padding-bottom: 10px;">
Each icon points to a <b>key application of the System</b>, please take few seconds to locate them (on your top-left corner of the page).
</div>
<div style="padding-top: 10px;">
<ul style="list-style-type: circle; padding-left: 10px;">
<li><b>Home Social</b> is the page behind this tour and contains your personalized news feed;</li>
<li><b>Workspace</b> is the application for sharing your data and for your private cloud storage;</li>
<li><b>Messages</b> allows you to exchange private messages with the other users of the System;</li>
<li><b>Notifications</b> keeps you up-to-date to what is happening and it is related to you. To know how to <b>tune/change how you get notified</b> see the next step.</b> </li>
</ul>
</div>
<div style="padding-top: 10px;">
<b>Please note:</b> whenever you receive a new notification or message the related icon gets red.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/2.png" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>Notification Settings</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 10px;">
To open the <b>Notification Settings</b> go to the <a href="/group/data-e-infrastructure-gateway/notifications" target="_blank">Notifications Page</a>
and click Notification Settings (top-right). See the red rectangle in the figure to locate the settings.
</div>
</div>
]]>
</body>
<body><![CDATA[
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 20px;">
<b>Notification Settings</b> are very <b>fine grained</b>. For each Notification type generated by the System you can choose <b>whether to and how to</b> get notified.
</div>
<div style="padding-bottom: 10px;">
For each type of notification you can choose to be notified through this <b>portal</b>, via <b>email</b> or <b>none</b> (by clicking OFF). By default almost all the notification types are set to ON.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/3.jpg" />
<image url="images/tour/4.jpg" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>News Sharing</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 40px;">
When <b>posting a news</b> you can use some useful features:
<div style="padding-top: 15px;">
If you <b>paste a link</b> the System will try to create a preview of it.
</div>
<div style="padding-top: 15px;">
If you want to <b>post a file</b> instead use the attachment icon and pick the file from your disk.
</div>
<div style="padding-top: 15px;">
You can also use the “@” to <b>mention</b> someone. In this case the mentioned user will receive a notification.
</div>
<div style="padding-top: 15px;">
Finally, if you want <b>everyone in a group to be notified</b> about your update, select the +notification to members in the "Share with" dropdown menu.
They will receive a notification about your post, unless they decided not to in their settings.
</div>
<div style="padding-top: 25px;">
The tour is over, remember to click on the "Don't show this again" checkbox <b>located at the bottom of this window</b> to not make this popup appear in the future. Thank you for taking this tour.
</div>
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/5.jpg" />
<image url="images/tour/7.jpg" />
</images>
</step>
</steps>
</guidedtour>

@ -1,164 +0,0 @@
<!-- this is your main configuration XML (example name GuidedTour.xml), the
source tag have to link this file: -->
<guidedtour width="780" height="450" usemask="false">
<title>Social Collaboration Facilities</title>
<guide>http://goo.gl/SXwcjh
</guide>
<themecolor>BLUE</themecolor>
<steps>
<step showTitle="true" v-alignment="ALIGN_TOP">
<title>Generale</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 25px;">
Questo portale offre tre caratteristiche per la collaborazione: <b>Ambienti Collaborativi</b>, servizi per <b>Social Networking</b> ed un <b>Workspace Condiviso</b>.
</div>
<div style="padding-bottom: 25px;">
Gli <b>Ambienti Collaborativi</b> sono ambienti di lavoro che offrono servizi selezionati in aggiunta a quelli di Social Networking
ed al workspace condiviso. Ogni ambiente serve una community.
</div>
<div style="padding-bottom: 25px;">
I servizi di <b>Social networking</b> mettono a disposizione una bacheca virtuale dove gli utenti possono scrivere, condividere link e file tra di loro.</div>
<div style="padding-bottom: 25px;">
Il <a href="/group/data-e-infrastructure-gateway/workspace" target="_blank"><b>Workspace Condiviso</b></a>, è un servizio per gestire file nel Cloud.
Attraverso esso puoi gestire, caricare e cancellare file come meglio credi.
Puoi <b>condividere cartelle</b> con qualsiasi utente per massimizzare la collaborazione tra utenti.
</div>
<div style="padding-bottom: 10px;">
Scopri di più attraverso questo tour virtuale, clicca su Next.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/1.jpg" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>Iscrizioni</title>
<bodies>
<body><![CDATA[
<div style="padding-bottom: 40px;">
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 40px;">
Puoi vedere gli <b>Ambienti Collaborativi</b> e le community disponibili nel Sistema cliccando su "Join New" nel menu sotto questa pagina.
</div>
<div style="padding-bottom: 40px;">
Per ogni <b>Ambienti Collaborativo</b> puoi chiedere la sottoscrizione.
La tua richiesta sarà assegnata ad una persona delegata dalla community ed approvata (a seconda dello scopo della community).
</div>
<div style="padding-bottom: 40px;">
Sarai notificato sia che la richiesta venga approvata che no, via email.
Mentre la richiesta si trova in fase di approvazione l'icona relativa sarà segnalata come pendente (Pending).
</div>
<div style="padding-bottom: 40px;">
In casi particolari potresti essere aggiunto automaticamente ad un ambiente, se questo succede verrai notificato via email.
</div>
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/6.jpg" />
</images>
</step>
<step showTitle="true" v-alignment="ALIGN_TOP">
<title>La Dockbar</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 10px;">
La Dockbar è <b>molto importante</b>, è sempre presente in alto e contiene 4 icone come mostrato in figura.
</div>
<div style="padding-bottom: 5px;">
Ogni icona punta ad una <b>applicazione del Sistema</b>, per favore prenditi qualche secondo per capire dove si trova la Dockbar (in alto alla tua sinistra)
</div>
<div style="padding-top: 5px;">
<ul style="list-style-type: circle; padding-left: 10px;">
<li><b>Home Social</b> è la pagina dietro questo tour virtuale e contiene la tua bacheca personale (News Feed);</li>
<li><b>Workspace</b> è l'applicazione per condividere i tuoi dati e per il tuo Cloud storage privato;</li>
<li><b>Messages</b> permette di scambiare messaggi con gli altri utenti del sistema e di allegare grossi file dal workspace;</li>
<li><b>Notifications</b> ti tiene aggiornato su cosa succede nel Sistema (relativo a te).
Per conoscere e <b>personalizzare il modo in cui vieni notificato</b>, guarda lo step successivo.</li>
</ul>
</div>
<div style="padding-top: 5px;">
<b>Nota bene:</b> quando ricevi una nuova notifica o messagio l'icona relativa diventa rossa.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/2.png" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>Notifiche</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 10px;">
Per aprire le <b>Impostazioni di Notifica</b> vai alla pagina delle <a href="/group/data-e-infrastructure-gateway/notifications" target="_blank">Notifiche</a>
e clicca "Notification Settings" come mostrato in figura nel rettangolo rosso.
</div>
</div>
]]>
</body>
<body><![CDATA[
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 20px;">
Le <b>impostazioni</b> sono molto <b>personalizzabili</b>. Per ogni tipo di Notifica generata dal Sistema puoi scegliere <b>se e come</b> essere notificato.
</div>
<div style="padding-bottom: 10px;">
Per ogni tipo di Notifica puoi scegliere di essere notificato tramite questo <b>portale</b>, via <b>email</b> o <b>nessuna notifica</b> (cliccando OFF).
Di default quasi tutte le notifiche sono impostate ad ON.
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/3.jpg" />
<image url="images/tour/4.jpg" />
</images>
</step>
<step showTitle="false" v-alignment="ALIGN_MIDDLE">
<title>Condividere News</title>
<bodies>
<body><![CDATA[
<div style="line-height: 19px; padding: 0 10px; font-size: 14px; ">
<div style="padding-bottom: 40px;">
Quando <b>condividi una news</b> puoi usare queste utility:
<div style="padding-top: 15px;">
Se <b>incolli un link</b> il Sistema cercherà di crearne un'anteprima.
</div>
<div style="padding-top: 15px;">
Per i <b>file</b> invece puoi usare l'icona di attachment.
</div>
<div style="padding-top: 15px;">
Puoi anche usare la “@” per <b>menzionare</b> qualcuno. In questo caso "qualcuno" riceverà una notifica :)</div>
<div style="padding-top: 15px;">
Inoltre, se vuoi che <b>ognuno nel gruppo sia notificato</b> a proposito del tuo post, seleziona la +notification to members nel "Share with" menu.
Gli utenti saranno notificati via email a meno che abbiano deciso di no nelle loro impostazioni.
</div>
<div style="padding-top: 25px;">
Il Tour è finito, ricorda di cliccare "Don't show this again" <b>qui in basso</b> per non far apparire questo popup in futuro. Grazie per aver seguito il tour virtuale.
</div>
</div>
</div>
]]>
</body>
</bodies>
<images>
<image url="images/tour/5.jpg" />
<image url="images/tour/7.jpg" />
</images>
</step>
</steps>
</guidedtour>

@ -1,12 +0,0 @@
package org.gcube.portlet.user.my_vres.client.resources;
import org.gcube.portlets.widgets.guidedtour.resources.client.GuidedTourResource;
import com.google.gwt.resources.client.ClientBundle;
public interface TourResources extends ClientBundle {
@Source("GuidedTour.xml")
GuidedTourResource quickTour();
}

@ -6,6 +6,7 @@ import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -20,8 +21,8 @@ import com.google.gwt.user.client.ui.Image;
*/
public class ClickableVRE extends HTML {
private final static int WIDTH = 85;
private final static int HEIGHT = 95;
private final static int WIDTH = 90;
private final static int HEIGHT = 100;
private String name;
private String imageUrl;
@ -50,7 +51,17 @@ public class ClickableVRE extends HTML {
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Location.assign(vre.getFriendlyURL());
String html = "<div style=\"display: table; text-align:center; width: 100%; height: 75px;\">" +
"<span style=\"vertical-align:middle; display: table-cell;\">redirecting ...</span>" +
"</div>";
setHTML(html);
Timer timer = new Timer() {
@Override
public void run() {
Location.assign(vre.getFriendlyURL());
}
};
timer.schedule(50);
}
});
}

@ -1,37 +1,31 @@
package org.gcube.portlet.user.my_vres.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.portal.PortalContext;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.communitymanager.impl.OrganizationManagerImpl;
import org.gcube.common.portal.GCubePortalConstants;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlet.user.my_vres.client.MyVREsService;
import org.gcube.portlet.user.my_vres.shared.UserBelonging;
import org.gcube.portlet.user.my_vres.shared.VO;
import org.gcube.portlet.user.my_vres.shared.VRE;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.servlet.ImageServletTokenUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.User;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
/**
* The server side implementation of the RPC service.
@ -46,19 +40,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
*
*/
public static final String CACHED_VOS = "CACHED_VRES";
/**
*
*/
public static final String ROOT_ORG = "rootorganization";
private VO rootVO = new VO();
/**
* the current ASLSession
* @return the session
*/
private ASLSession getASLSession() {
String sessionID = this.getThreadLocalRequest().getSession().getId();
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
@ -97,59 +79,44 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
else
try {
String username = getASLSession().getUsername();
User currUser = OrganizationsUtil.validateUser(username);
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
GroupManager gm = new LiferayGroupManager();
LinkedHashMap<String, ArrayList<VRE>> toReturn = new LinkedHashMap<String, ArrayList<VRE>>();
//before iterating the actual groups create the virtualGroups in the correct order
List<String> virtualGroups = OrganizationManagerImpl.getVirtualGroups();
for (String vg : virtualGroups) {
String[] splits = vg.split("\\|");
String gName = splits[0];
List<VirtualGroup> virtualGroups = gm.getVirtualGroups();
for (VirtualGroup vg : virtualGroups) {
String gName = vg.getName();
ArrayList<VRE> toCreate = new ArrayList<VRE>();
String cat = gName;
toReturn.put(cat, toCreate);
}
//start of iteration of the actual groups
List<Organization> organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
Organization rootOrganization = null;
for (Organization organization : organizations) {
if (organization.getName().equals(PortalContext.getConfiguration().getInfrastructureName())) {
rootOrganization = organization;
break;
}
}
GCubeGroup rootGroupVO = gm.getRootVO();
try {
_log.debug("root: " + rootOrganization.getName() );
_log.debug("root: " + rootGroupVO.getGroupName() );
} catch (NullPointerException e) {
_log.error("Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle");
return toReturn;
}
//for each root sub organizations (VO)
for (Organization vOrg : rootOrganization.getSuborganizations()) {
for (Organization vre : vOrg.getSuborganizations()) {
for (GCubeGroup vOrg : rootGroupVO.getChildren()) {
for (GCubeGroup vre : vOrg.getChildren()) {
VRE vreToAdd = new VRE();
vreToAdd.setName(vre.getName());
vreToAdd.setGroupName("/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName()+"/"+vre.getName());
vreToAdd.setName(vre.getGroupName());
vreToAdd.setGroupName(gm.getInfrastructureScope(vre.getGroupId()));
long logoId = vre.getLogoId();
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
String logoURL = "/image/layout_set_logo?img_id="+ logoId;
vreToAdd.setImageURL(logoURL);
String vreUrl = vre.getGroup().getPathFriendlyURL(true, themeDisplay) + vre.getGroup().getFriendlyURL();
String vreUrl = GCubePortalConstants.PREFIX_GROUP_URL+vre.getFriendlyURL();
vreToAdd.setFriendlyURL(vreUrl);
//check if the user belongs to it
if (currUser.getOrganizations().contains(vre)) {
vreToAdd.setUserBelonging(UserBelonging.NOT_BELONGING);
GCubeUser currUser = new LiferayUserManager().getUserByUsername(username);
if (gm.listGroupsByUser(currUser.getUserId()).contains(vre)) {
vreToAdd.setUserBelonging(UserBelonging.BELONGING);
String catName = OrganizationManagerImpl.getVirtualGroupName(vre);
String[] splits = catName.split("\\|");
catName = splits[0];
String catName = gm.getVirtualGroup(vre.getGroupId()).getName();
//for preserving order we inserted the keys before
if (toReturn.containsKey(catName)) {
@ -192,33 +159,6 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
_log.trace("User login logged to: " + scope);
}
/**
* read the root VO name from a property file and retuns it
*/
protected static String getRootOrganizationName() {
//get the portles to look for from the property file
Properties props = new Properties();
String toReturn = "gcube";
try {
String propertyfile = OrganizationsUtil.getTomcatFolder()+"conf/gcube-data.properties";
File propsFile = new File(propertyfile);
FileInputStream fis = new FileInputStream(propsFile);
props.load( fis);
toReturn = props.getProperty(ROOT_ORG);
}
//catch exception in case properties file does not exist
catch(IOException e) {
toReturn = "gcube";
_log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default VO Name " + toReturn);
return toReturn;
}
_log.debug("Returning Root VO Name: " + toReturn );
return toReturn;
}
/**
* simply returns fake VREs for development purpose
* @return

@ -4,9 +4,6 @@
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<!-- inherits GCUBE Quick tour -->
<inherits name='org.gcube.portlets.widgets.guidedtour.GuidedTour' />
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlet.user.my_vres.client.MyVREs' />

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display>
<category name="gCube Social Apps">

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app>
<portlet>

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.gcube.portlet.user.my_vres.server.MyVREsServiceImpl</servlet-class>
@ -12,18 +13,7 @@
<servlet-name>greetServlet</servlet-name>
<url-pattern>/myvres/greet</url-pattern>
</servlet-mapping>
<!-- Quick Tour -->
<servlet>
<servlet-name>quicktourServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.guidedtour.server.TourServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>quicktourServlet</servlet-name>
<url-pattern>/myvres/quicktourServlet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>MyVREs.html</welcome-file>

Loading…
Cancel
Save