From 4aace3127aabf928cf5171eadfdc66eee1fe5ba0 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Thu, 22 Oct 2015 16:32:48 +0000 Subject: [PATCH] Feature #861 My VREs Portlet to categorize VREs by virtualGroups git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@119979 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 +- .settings/org.eclipse.jst.jsp.core.prefs | 3 + .settings/org.eclipse.wst.common.component | 2 +- ....eclipse.wst.common.project.facet.core.xml | 1 + pom.xml | 13 +- .../user/my_vres/client/MyVREsService.java | 7 +- .../my_vres/client/MyVREsServiceAsync.java | 8 +- .../user/my_vres/client/VresPanel.java | 211 ++---------------- .../my_vres/client/widgets/ClickableVRE.java | 14 +- .../my_vres/server/MyVREsServiceImpl.java | 210 ++++++----------- src/main/webapp/WEB-INF/portlet.xml | 6 + 11 files changed, 121 insertions(+), 358 deletions(-) create mode 100644 .settings/org.eclipse.jst.jsp.core.prefs diff --git a/.classpath b/.classpath index 548cc3b..da8ee55 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -34,5 +34,5 @@ - + diff --git a/.settings/org.eclipse.jst.jsp.core.prefs b/.settings/org.eclipse.jst.jsp.core.prefs new file mode 100644 index 0000000..3a5c98d --- /dev/null +++ b/.settings/org.eclipse.jst.jsp.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +validateFragments=false +validation.use-project-settings=true diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index bcb4989..0aa2ab1 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index c24712e..afd5d47 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -4,4 +4,5 @@ + diff --git a/pom.xml b/pom.xml index 1d6b646..3d1c1dd 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,10 @@ org.gcube.portlets.user my-vres war - 1.4.0-SNAPSHOT + 1.5.0-SNAPSHOT My VREs Portlet - gCube My VREs Portlet shows only the VO and VREs a user is member of. + gCube My VREs Portlet shows only the VO and VREs a user is member of, divided by category. scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} @@ -25,7 +25,7 @@ - 2.5.1 + 2.7.0 distro 1.7 @@ -50,7 +50,8 @@ com.google.gwt - gwt-user + gwt-user + ${gwtVersion} org.gcube.portlets.user @@ -60,6 +61,10 @@ org.gcube.portal custom-portal-handler + + org.gcube.common.portal + portal-manager + org.gcube.applicationsupportlayer accesslogger diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsService.java b/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsService.java index 2eb6ae6..8764315 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsService.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsService.java @@ -1,10 +1,9 @@ package org.gcube.portlet.user.my_vres.client; import java.util.ArrayList; +import java.util.LinkedHashMap; -import org.gcube.portlet.user.my_vres.shared.VO; - - +import org.gcube.portlet.user.my_vres.shared.VRE; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; @@ -14,7 +13,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; */ @RemoteServiceRelativePath("greet") public interface MyVREsService extends RemoteService { - ArrayList getInfrastructureVOs(); + LinkedHashMap> getUserVREs(); void loadLayout(String scope, String URL); } diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsServiceAsync.java b/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsServiceAsync.java index f339e18..d30f867 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsServiceAsync.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/MyVREsServiceAsync.java @@ -1,14 +1,18 @@ package org.gcube.portlet.user.my_vres.client; import java.util.ArrayList; +import java.util.LinkedHashMap; -import org.gcube.portlet.user.my_vres.shared.VO; +import org.gcube.portlet.user.my_vres.shared.VRE; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyVREsServiceAsync { - void getInfrastructureVOs(AsyncCallback> callback); + void loadLayout(String scope, String URL, AsyncCallback callback); + void getUserVREs( + AsyncCallback>> callback); + } diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java b/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java index 7cf8b47..96d74b3 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java @@ -3,21 +3,13 @@ package org.gcube.portlet.user.my_vres.client; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; +import java.util.LinkedHashMap; -import org.gcube.portlet.user.my_vres.client.widgets.BulletList; import org.gcube.portlet.user.my_vres.client.widgets.ClickableVRE; -import org.gcube.portlet.user.my_vres.client.widgets.ListItem; -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 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.Cookies; -import com.google.gwt.user.client.Timer; -import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; @@ -36,21 +28,13 @@ public class VresPanel extends Composite { * Create a remote service proxy to talk to the server-side service */ private final MyVREsServiceAsync myVREsService = GWT.create(MyVREsService.class); - - private static String VO = "Organizations"; - private static String VRE = "Groups"; - public static final String COOKIE_NAME = "gCube-EnvironmentViewRestore"; - public static final int COOKIE_MONTHS_EXPIRY_TIME = 6; //6 Months - private HTML switcher = new HTML(); private FlowPanel flowPanel; private VerticalPanel mainPanel = new VerticalPanel(); private HorizontalPanel changeViewPanel = new HorizontalPanel(); private HorizontalPanel imagesPanel = new HorizontalPanel(); - private Timer t = null; - private ArrayList cachedVOs = null; + private LinkedHashMap> cachedVREs = null; - private boolean isIconView = true; boolean hasVres = false; public VresPanel() { @@ -65,87 +49,28 @@ public class VresPanel extends Composite { changeViewPanel.setWidth("95%"); changeViewPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); changeViewPanel.add(imagesPanel); + loadVREs(); initWidget(mainPanel); - - switcher.setStyleName("imageLink"); - imagesPanel.add(switcher); - - switcher.setStyleName("switcher"); - switcher.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - if (isIconView) - showListView(); - else - showIconView(); - } - }); - - setLastStateUsingCookie(); } - private void loadVREs() { - myVREsService.getInfrastructureVOs(new AsyncCallback>() { - public void onSuccess(ArrayList result) { - cachedVOs = result; - if (isIconView) - showIconView(); - else - showListView(); - } + private void loadVREs() { + + myVREsService.getUserVREs(new AsyncCallback>>() { + + @Override public void onFailure(Throwable caught) { - flowPanel.add(new HTML("Could not fetch personal VREs: " + caught.getMessage())); + flowPanel.add(new HTML("Could not fetch personal VREs: " + caught.getMessage())); + } + + @Override + public void onSuccess(LinkedHashMap> result) { + cachedVREs = result; + showIconView(); + } }); - } - private void showListView() { - mainPanel.clear(); - mainPanel.add(changeViewPanel); - HTML voTitle = new HTML(VO); - voTitle.setStyleName("listPanel-title"); - BulletList voList = new BulletList(); - voList.setStyleName("list"); - boolean showVOs = false; - - for (VO vo: cachedVOs) { - if (! vo.isRoot() && vo.getUserBelonging() == UserBelonging.BELONGING) { - voList.add(addVo(vo)); - showVOs = true; - } - } - if (showVOs){ - mainPanel.add(voTitle); - mainPanel.add(voList); - } - HTML vreTitle = new HTML(VRE); - vreTitle.setStyleName("listPanel-title"); - - BulletList vreList = new BulletList(); - vreList.setStyleName("list"); - boolean showVREs = false; - - ArrayList sortedVREs = new ArrayList(); - for (VO vo: cachedVOs) { - for (VRE vre : vo.getVres()) { - sortedVREs.add(vre); - hasVres = true; - } - } - - Collections.sort(sortedVREs); - for (VRE vre : sortedVREs) { - vreList.add(addVRE(vre)); - showVREs = true; - } - - if (showVREs) { - mainPanel.add(vreTitle); - mainPanel.add(vreList); - } - Cookies.setCookie(COOKIE_NAME, "1", getExpiryDate()); - isIconView = false; - setSwitcherText(); } private void showIconView() { @@ -155,13 +80,14 @@ public class VresPanel extends Composite { mainPanel.add(flowPanel); ArrayList sortedVREs = new ArrayList(); - for (VO vo: cachedVOs) { - for (VRE vre : vo.getVres()) { + for (String cat : cachedVREs.keySet()) { + for (VRE vre: cachedVREs.get(cat)) { sortedVREs.add(vre); hasVres = true; } } - Collections.sort(sortedVREs); + + for (VRE vre : sortedVREs) { ClickableVRE vreButton = new ClickableVRE(vre, myVREsService); @@ -172,105 +98,10 @@ public class VresPanel extends Composite { mainPanel.add(new NoVresPanel()); imagesPanel.clear(); } - Cookies.setCookie(COOKIE_NAME, "0", getExpiryDate()); - isIconView = true; - setSwitcherText(); + } - private ListItem addVo(final VO vo) { - final ListItem li = new ListItem(); - li.setStyleName("list-item item-vo "); - li.setText(vo.getName()); - li.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - showLoading(li); - String scope = vo.getGroupName(); - myVREsService.loadLayout(scope, vo.getFriendlyURL(), new AsyncCallback() { - public void onFailure(Throwable arg0) { - Window.open( vo.getFriendlyURL(), "_self", ""); - } - public void onSuccess(Void arg0) { - Window.open( vo.getFriendlyURL(), "_self", ""); - } - }); - } - }); - return li; - } - - private ListItem addVRE(final VRE vre) { - final ListItem li = new ListItem(); - li.setStyleName("list-item item-vre "); - li.setText(vre.getName()); - li.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - showLoading(li); - String scope = vre.getGroupName(); - myVREsService.loadLayout(scope, vre.getFriendlyURL(), new AsyncCallback() { - public void onFailure(Throwable arg0) { - Window.open( vre.getFriendlyURL(), "_self", ""); - } - public void onSuccess(Void arg0) { - Window.open( vre.getFriendlyURL(), "_self", ""); - } - }); - } - }); - return li; - } - private void showLoading(final ListItem li) { - li.setText("Loading ."); - t = new Timer() { - @Override - public void run() { - li.setText(li.getText() + " ."); - t.schedule(250); - if (li.getText().length() > 50) - t.cancel(); - } - }; - t.schedule(250); - } - - private void setSwitcherText() { - if (isIconView) - switcher.setHTML("SHOW LIST"); - else - switcher.setHTML("SHOW TILES"); - } - - - /** - * - * @return - */ - @SuppressWarnings("deprecation") - public Date getExpiryDate() { - Date expiryDate = new Date(); - int month = expiryDate.getMonth(); - month += COOKIE_MONTHS_EXPIRY_TIME ; - expiryDate.setMonth(month); - return expiryDate; - } - /** - * - */ - private void setLastStateUsingCookie() { - Date expiryDate = getExpiryDate(); - - if (Cookies.getCookie(COOKIE_NAME) == null) { - Cookies.setCookie(COOKIE_NAME, "0", expiryDate); - } - else { - String lastIconsState = Cookies.getCookie(COOKIE_NAME); - if (lastIconsState.compareTo("1") == 0) - isIconView = false; - else - isIconView = true; - } - loadVREs(); - } } diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java b/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java index ab25a7a..c0faced 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java @@ -7,6 +7,7 @@ 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.Window; +import com.google.gwt.user.client.Window.Location; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Image; @@ -49,17 +50,8 @@ public class ClickableVRE extends HTML { addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { - showLoading(); - String scope = vre.getGroupName(); - service.loadLayout(scope, vre.getFriendlyURL(), new AsyncCallback() { - public void onFailure(Throwable arg0) { - Window.open( vre.getFriendlyURL(), "_self", ""); - } - public void onSuccess(Void arg0) { - Window.open( vre.getFriendlyURL(), "_self", ""); - } - }); - + showLoading(); + Location.assign(vre.getFriendlyURL()); } }); } diff --git a/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java b/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java index 4a562a8..cf239de 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java @@ -5,15 +5,17 @@ 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.HttpServletRequest; 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.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlet.user.my_vres.client.MyVREsService; import org.gcube.portlet.user.my_vres.shared.UserBelonging; @@ -25,7 +27,6 @@ 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.Group; import com.liferay.portal.model.Organization; import com.liferay.portal.model.User; import com.liferay.portal.service.OrganizationLocalServiceUtil; @@ -52,7 +53,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer private VO rootVO = new VO(); - + /** * the current ASLSession @@ -87,130 +88,83 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer /** * first method called by the UI */ - public ArrayList getInfrastructureVOs() { + public LinkedHashMap> getUserVREs() { getASLSession(); //_log.trace("getInfrastructureVOs method called"); if (!isWithinPortal()) - return getFakeVOs(); - //return new ArrayList(); + return getFakeVREs(); + //return new ArrayList(); else try { String username = getASLSession().getUsername(); User currUser = OrganizationsUtil.validateUser(username); - - List organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount()); ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY); + LinkedHashMap> toReturn = new LinkedHashMap>(); + //before iterating the actual groups create the virtualGroups in the correct order + List virtualGroups = OrganizationManagerImpl.getVirtualGroups(); + for (String vg : virtualGroups) { + String[] splits = vg.split("\\|"); + String gName = splits[0]; + ArrayList toCreate = new ArrayList(); + String cat = gName; + toReturn.put(cat, toCreate); + } + + //start of iteration of the actual groups + List organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount()); Organization rootOrganization = null; for (Organization organization : organizations) { - if (organization.getName().equals( getRootOrganizationName() ) ) { + if (organization.getName().equals(PortalContext.getConfiguration().getInfrastructureName())) { rootOrganization = organization; break; } - } + } + try { - //_log.info("root: " + rootOrganization.getName() ); - } - catch (NullPointerException e) { + _log.debug("root: " + rootOrganization.getName() ); + } 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 new ArrayList(); + return toReturn; } - // Create the list of the Infrastructure VOs - List infrastructureVOs = new ArrayList(); - - //create and check the root VO - rootVO = new VO(); - rootVO.setName(rootOrganization.getName()); - rootVO.setGroupName("/"+rootOrganization.getName()); - rootVO.setRoot(true); - - Group orgGroup = rootOrganization.getGroup(); - String friendlyURL = orgGroup.getPathFriendlyURL(true, themeDisplay) + orgGroup.getFriendlyURL(); - - rootVO.setFriendlyURL(getPortalBasicUrl()+friendlyURL); - long logoId = rootOrganization.getLogoId(); - String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId); - rootVO.setImageURL(logoURL); - - - if (rootOrganization.getComments() != null) - rootVO.setDescription(rootOrganization.getComments()); - //for each root sub organizations (VO) for (Organization vOrg : rootOrganization.getSuborganizations()) { - - //_log.debug("SKIP GCUBE APPS " + vOrg.getName() ); - - //_log.debug("FOUND VO: " + vOrg.getName() ); - //create the VO - VO voToAdd = new VO(); - voToAdd.setName(vOrg.getName()); - voToAdd.setGroupName("/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName()); - voToAdd.setRoot(false); - - for (Organization vre : vOrg.getSuborganizations()) { + for (Organization vre : vOrg.getSuborganizations()) { VRE vreToAdd = new VRE(); vreToAdd.setName(vre.getName()); vreToAdd.setGroupName("/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName()+"/"+vre.getName()); - logoId = vre.getLogoId(); - logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId); + long logoId = vre.getLogoId(); + String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId); vreToAdd.setImageURL(logoURL); String vreUrl = vre.getGroup().getPathFriendlyURL(true, themeDisplay) + vre.getGroup().getFriendlyURL(); - vreToAdd.setFriendlyURL(getPortalBasicUrl()+vreUrl); - - //set the description for the vre - if (vre.getComments() != null) { - vreToAdd.setDescription(vre.getComments()); - } + vreToAdd.setFriendlyURL(vreUrl); //check if the user belongs to it if (currUser.getOrganizations().contains(vre)) { vreToAdd.setUserBelonging(UserBelonging.BELONGING); - voToAdd.addVRE(vreToAdd); + + String catName = OrganizationManagerImpl.getVirtualGroupName(vre); + String[] splits = catName.split("\\|"); + catName = splits[0]; + + //for preserving order we inserted the keys before + if (toReturn.containsKey(catName)) { + ArrayList toUpdate = toReturn.get(catName); + toUpdate.add(vreToAdd); + } } } - - - - Group group = vOrg.getGroup(); - String url = group.getPathFriendlyURL(true, themeDisplay) + group.getFriendlyURL(); - voToAdd.setFriendlyURL(getPortalBasicUrl() + url); - - //set the description for the vre - if (vOrg.getComments() != null) voToAdd.setDescription(vOrg.getComments()); - //check if the user belongs to it - if (currUser.getOrganizations().contains(vOrg)) { - voToAdd.setUserBelonging(UserBelonging.BELONGING); - } - else - voToAdd.setUserBelonging(UserBelonging.NOT_BELONGING); - infrastructureVOs.add(voToAdd); } - - - ArrayList toReturn = new ArrayList(); - - - for (VO vo : infrastructureVOs) { - for (VRE vre : vo.getVres()) { - //_log.debug("VRE FOUND.... " + vre.getName()); - } - toReturn.add(vo); - } - //sort the VOs - Collections.sort(toReturn, Collections.reverseOrder()); - - //set the root vo as FIRST - toReturn.add(0, rootVO); - - ArrayList toStoreInSession = toReturn; - //_log.debug("SETTING INFRASTRUCTURE VOS in ASLSession"); - getASLSession().setAttribute(CACHED_VOS, toStoreInSession); - + + //sort the vres in the groups + for (String cat : toReturn.keySet()) { + ArrayList toSort = toReturn.get(cat); + Collections.sort(toSort); + } return toReturn; } @@ -263,49 +217,17 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer return toReturn; } - /** - * - * @return the portal basic url, e.g. http://www.foo.com - */ - private String getPortalBasicUrl() { - HttpServletRequest request = this.getThreadLocalRequest(); - String toReturn = ""; - //protocol - String protocol = (request.isSecure()) ? "https://" : "http://" ; - toReturn += protocol; - //server name - toReturn += request.getServerName(); - //port - toReturn += (request.getServerPort() == 80) ? "" : ":"+request.getServerPort() ; - // _log.trace("getPortalBasicUrl: " +toReturn + "queryString: " + request.getQueryString()); - return toReturn; - } - + /** - * simply returns fake VOS for debugging purpose + * simply returns fake VREs for development purpose * @return */ - protected static ArrayList getFakeVOs() { - VO rootVO = new VO(); - rootVO.setRoot(true); - rootVO.setName("/d4science.research-infrastructures.eu/"); - rootVO.setDescription("This is the description for the ROOT VO"); - rootVO.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/RedGrid.jpg"); - rootVO.setUserBelonging(UserBelonging.BELONGING); - - - /***************************************/ - - VO emVO = new VO(); - emVO.setRoot(false); - emVO.setGroupName("/d4science.research-infrastructures.eu/EM/"); - emVO.setName("EM VO"); - emVO.setDescription("EM and AEM Virtual Organisation The FARM Virtual Organisation is the dynamic group of individuals and/or institutions defined around a set of sharing rules in which resource providers and consumers specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the Fisheries and Aquaculture Resources Management."); - emVO.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/RedGrid.jpg"); - - emVO.setUserBelonging(UserBelonging.BELONGING); - // + protected static LinkedHashMap> getFakeVREs() { + LinkedHashMap> toReturn = new LinkedHashMap>(); + + final String categoryNameOne = "gCubeApps"; + final String categoryNameTwo = "BlueBRIDGE"; // VRE cool_EM_VRE = new VRE(); cool_EM_VRE.setName("BiodiversityResearchEnvironment"); @@ -314,7 +236,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer "This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data."); cool_EM_VRE.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/gcm-preview.jpg"); cool_EM_VRE.setUserBelonging(UserBelonging.BELONGING); - emVO.addVRE(cool_EM_VRE); + VRE cool_EM_VRE2 = new VRE(); cool_EM_VRE2.setName("COOL VRE 2"); @@ -334,6 +256,12 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer cool_EM_VRE3.setImageURL("https://newportal.i-marine.d4science.org/image/organization_logo?img_id=13302&t1339191699773"); cool_EM_VRE3.setUserBelonging(UserBelonging.BELONGING); + ArrayList toAdd = new ArrayList(); + toAdd.add(cool_EM_VRE); + toAdd.add(cool_EM_VRE2); + toAdd.add(cool_EM_VRE3); + + VRE demo = new VRE(); demo.setName("Demo"); demo.setGroupName("/d4science.research-infrastructures.eu/EM/Demo"); @@ -351,19 +279,13 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer vreGCM.setImageURL("https://newportal.i-marine.d4science.org/image/organization_logo?img_id=13302&t1339191699773"); vreGCM.setUserBelonging(UserBelonging.BELONGING); - - emVO.addVRE(cool_EM_VRE); - emVO.addVRE(cool_EM_VRE2); - emVO.addVRE(cool_EM_VRE3); - emVO.addVRE(demo); - emVO.addVRE(vreGCM); + ArrayList toAdd2 = new ArrayList(); + toAdd2.add(demo); + toAdd2.add(vreGCM); + + toReturn.put(categoryNameOne, toAdd); + toReturn.put(categoryNameTwo, toAdd2); - emVO.setUserBelonging(UserBelonging.BELONGING); - - ArrayList toReturn = new ArrayList(); - toReturn.add(rootVO); - toReturn.add(emVO); - toReturn.add(emVO); return toReturn; } } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml index 5dc6d95..e0de9de 100644 --- a/src/main/webapp/WEB-INF/portlet.xml +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -14,6 +14,12 @@ VREs Login VRE + + + portlet-setup-show-borders + true + + administrator