>Added support for invite-only closed groups

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@132509 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-10-03 17:41:29 +00:00
parent 6764557280
commit 51fb7e23c9
9 changed files with 106 additions and 269 deletions

View File

@ -4,9 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="invites-common-library-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/invites-common-library/invites-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="join-vre"/> <property name="context-root" value="join-vre"/>
</wb-module> </wb-module>

View File

@ -1,6 +1,7 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.join-vre.3.1.0" <Changeset component="org.gcube.portlets-user.join-vre.3.1.0"
date="2016-08-25"> date="2016-10-03">
<Change>Added support for invite-only closed groups</Change>
<Change>Fix for Bug #4877 Email Notification sent multiple times <Change>Fix for Bug #4877 Email Notification sent multiple times
sometimes</Change> sometimes</Change>
<Change>Logo VRE was not updated in the portlet due to liferay versioning of Document Library</Change> <Change>Logo VRE was not updated in the portlet due to liferay versioning of Document Library</Change>

View File

@ -76,12 +76,17 @@ public class ResponsivePanel extends Composite {
} }
public void requestMembership(VRE vre) { public void requestMembership(VRE vre) {
if (vre.isUponRequest()) { switch (vre.getMembershipType()) {
case RESTRICTED:
RequestMembershipDialog modal = new RequestMembershipDialog(this, vre); RequestMembershipDialog modal = new RequestMembershipDialog(this, vre);
modal.show(); modal.show();
} else { break;
AccessVREDialog modal = new AccessVREDialog(vre); case OPEN:
modal.show(); AccessVREDialog accessModal = new AccessVREDialog(vre);
accessModal.show();
break;
default:
break;
} }
} }

View File

@ -1,51 +0,0 @@
package org.gcube.portlets.user.joinvre.client.ui;
import org.gcube.portlets.user.joinvre.shared.VRE;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Modal;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class RedirectPanel extends Composite {
private static InfoPanelUiBinder uiBinder = GWT.create(InfoPanelUiBinder.class);
interface InfoPanelUiBinder extends UiBinder<Widget, RedirectPanel> {
}
@UiField Modal m;
@UiField HTML description;
@UiField Button close;
@UiField Button link;
private VRE vre;
public RedirectPanel(VRE toDisplay) {
initWidget(uiBinder.createAndBindUi(this));
vre = toDisplay;
}
public void show() {
m.setTitle("Infrastructure Gateway notice for " + vre.getName());
description.setHTML("Dear user, <br/>" + vre.getName() + " is not hosted in this Gateway, "+
"if you wish to enter or to request access, please click to the link below. We will redirect you to the D4Science Gateway hosting it.");
link.setHref(vre.getUrl());
link.setTarget("_blank");
link.setText("Take me to " + vre.getName());
link.setBlock(true);
link.getElement().getStyle().setMarginTop(25, Unit.PX);
link.getElement().getStyle().setMarginBottom(15, Unit.PX);
m.show();
}
@UiHandler("close")
void handleClick(ClickEvent e) {
m.hide();
}
}

View File

@ -44,7 +44,8 @@ public class VreThumbnail extends Composite {
if (name.length() > 22) if (name.length() > 22)
name = name.substring(0, 17) + "..."; name = name.substring(0, 17) + "...";
vreName.setText(name); vreName.setText(name);
if (vre.isUponRequest()) { switch (vre.getMembershipType()) {
case RESTRICTED:
joinButton.setType(ButtonType.DEFAULT); joinButton.setType(ButtonType.DEFAULT);
joinButton.setText("Request Access"); joinButton.setText("Request Access");
if (vre.getUserBelonging() == UserBelonging.PENDING) { if (vre.getUserBelonging() == UserBelonging.PENDING) {
@ -56,8 +57,14 @@ public class VreThumbnail extends Composite {
joinButton.setType(ButtonType.SUCCESS); joinButton.setType(ButtonType.SUCCESS);
joinButton.setText("Access Granted"); joinButton.setText("Access Granted");
} }
} else { break;
case OPEN:
joinButton.setText("Enter this VRE"); joinButton.setText("Enter this VRE");
break;
default:
joinButton.setEnabled(false);
joinButton.setText("Private");
break;
} }
vreImage.setUrl(vre.getImageURL()); vreImage.setUrl(vre.getImageURL());
} }
@ -65,11 +72,6 @@ public class VreThumbnail extends Composite {
@UiHandler("joinButton") @UiHandler("joinButton")
void handleClick(ClickEvent e) { void handleClick(ClickEvent e) {
if (myVre.getUserBelonging() != UserBelonging.PENDING) { if (myVre.getUserBelonging() != UserBelonging.PENDING) {
if (myVre.isExternal()) {
RedirectPanel modal = new RedirectPanel(myVre);
modal.show();
}
else {
joinService.joinVRE(myVre.getId(), new AsyncCallback<String>() { joinService.joinVRE(myVre.getId(), new AsyncCallback<String>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -85,7 +87,7 @@ public class VreThumbnail extends Composite {
} }
}); });
} }
}
} }

View File

@ -22,7 +22,7 @@ import org.gcube.portlets.user.joinvre.client.JoinService;
import org.gcube.portlets.user.joinvre.shared.UserBelonging; import org.gcube.portlets.user.joinvre.shared.UserBelonging;
import org.gcube.portlets.user.joinvre.shared.VRE; import org.gcube.portlets.user.joinvre.shared.VRE;
import org.gcube.portlets.user.joinvre.shared.VRECategory; import org.gcube.portlets.user.joinvre.shared.VRECategory;
import org.gcube.portlets.user.joinvre.shared.VRECustomAttributes; import org.gcube.portlets.user.joinvre.shared.VreMembershipType;
import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
@ -35,6 +35,7 @@ import org.gcube.vomanagement.usermanagement.model.CustomAttributeKeys;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup; import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.model.GCubeMembershipRequest; import org.gcube.vomanagement.usermanagement.model.GCubeMembershipRequest;
import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.gcube.vomanagement.usermanagement.model.GroupMembershipType;
import org.gcube.vomanagement.usermanagement.model.MembershipRequestStatus; import org.gcube.vomanagement.usermanagement.model.MembershipRequestStatus;
import org.gcube.vomanagement.usermanagement.model.VirtualGroup; import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
@ -44,7 +45,6 @@ import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.Group; import com.liferay.portal.model.Group;
import com.liferay.portal.model.VirtualHost; import com.liferay.portal.model.VirtualHost;
import com.liferay.portal.security.auth.PrincipalThreadLocal; import com.liferay.portal.security.auth.PrincipalThreadLocal;
@ -56,7 +56,6 @@ import com.liferay.portal.service.LayoutSetLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.VirtualHostLocalServiceUtil; import com.liferay.portal.service.VirtualHostLocalServiceUtil;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.webserver.WebServerServletTokenUtil;
/** /**
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
@ -136,30 +135,6 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
return toReturn; return toReturn;
} }
public VRECustomAttributes getVRECustomAttr(GCubeGroup group) throws PortalException, SystemException {
VRECustomAttributes toReturn = new VRECustomAttributes();
try {
GroupManager gm = new LiferayGroupManager();
toReturn.setUponRequest(group.isRequestBasedGroup());
_log.debug(group.getGroupName() + " getVRECustomAttr group.isRequestBasedGroup?" + group.isRequestBasedGroup());
Boolean attributeValue = (Boolean) gm.readCustomAttr(group.getGroupId(), CustomAttributeKeys.IS_EXTERNAL.getKeyName());
toReturn.setExternal(attributeValue);
if (attributeValue) { //we read the custom attr URL if and only if the VRE is External, in the other case is useless
String url = (String) gm.readCustomAttr(group.getGroupId(), CustomAttributeKeys.URL.getKeyName());
toReturn.setUrlIfAny(url);
}
} catch (Exception e) {
_log.error("Something went wrong when trying to read VRE Custom Attr, " + e);
return toReturn;
}
_log.trace("RETURNING VRECustomAttributes:\n" + toReturn.toString());
return toReturn;
}
/** /**
* *
* @return the Virtual groups with their VREs in the order estabilished in the LR Control Panel * @return the Virtual groups with their VREs in the order estabilished in the LR Control Panel
@ -207,13 +182,6 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
String groupName = gm.getInfrastructureScope(vreOrganization.getGroupId()); String groupName = gm.getInfrastructureScope(vreOrganization.getGroupId());
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreOrganization.getFriendlyURL(); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+vreOrganization.getFriendlyURL();
VRECustomAttributes attrs = getVRECustomAttr(vreOrganization);
boolean requireAccessGrant = attrs.isUponRequest();
boolean isExternal = attrs.isExternal();
String urlIfAny = attrs.getUrlIfAny();
String catName = gm.getVirtualGroup(vreID).getName(); String catName = gm.getVirtualGroup(vreID).getName();
VRECategory toLookFor = null; VRECategory toLookFor = null;
@ -224,7 +192,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
if (toLookFor != null) { if (toLookFor != null) {
ArrayList<VRE> toUpdate = toReturn.get(toLookFor); ArrayList<VRE> toUpdate = toReturn.get(toLookFor);
UserBelonging belongs = UserBelonging.NOT_BELONGING; UserBelonging belongs = UserBelonging.NOT_BELONGING;
VRE toAdd = new VRE(vreID,vreName, vreDescription, vreLogoURL, groupName, friendlyURL, belongs, requireAccessGrant, isExternal, urlIfAny); VRE toAdd = new VRE(vreID,vreName, vreDescription, vreLogoURL, groupName, friendlyURL, belongs, getVREMembershipType(vreOrganization.getMembershipType()));
if (session.getUsername().compareTo(TEST_USER) != 0) { if (session.getUsername().compareTo(TEST_USER) != 0) {
GCubeUser currUser = new LiferayUserManager().getUserByUsername(session.getUsername()); GCubeUser currUser = new LiferayUserManager().getUserByUsername(session.getUsername());
//check if the user belongs to it //check if the user belongs to it
@ -272,7 +240,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
+ "<li> cluster occurrence data;" + "<li> cluster occurrence data;"
+ "<li> estimate similarities among habitats." + "<li> estimate similarities among habitats."
+ "</ul>" + "</ul>"
+ "", "", "http://placehold.it/200x200", "/group/devsec", UserBelonging.NOT_BELONGING, false)); + "", "", "http://placehold.it/200x200", "/group/devsec", UserBelonging.NOT_BELONGING));
vres.add(new VRE(0, "Scalable Data", "" vres.add(new VRE(0, "Scalable Data", ""
+ "<h2>Scalable Data Mining</h2>" + "<h2>Scalable Data Mining</h2>"
+ "The Scalable Data Mining is a VRE designed to apply Data Mining techniques to biological data. The algorithms are executed in a distributed fashion on the e-Infrastructure nodes or on local multi-core machines. Scalability is thus meant as distributed data processing but even as services dynamically provided to the users. The system is scalable in the number of users and in the size of the data to process. Statistical data processing can be applied to perform Niche Modelling or Ecological Modelling experiments. Other applications can use general purpose techniques like Bayesian models. Time series of observations can be managed as well, in order to classify trends, catch anomaly patterns and perform simulations. The idea under the distributed computation for data mining techniques is to overcome common limitations that can happen when using statistical algorithms: " + "The Scalable Data Mining is a VRE designed to apply Data Mining techniques to biological data. The algorithms are executed in a distributed fashion on the e-Infrastructure nodes or on local multi-core machines. Scalability is thus meant as distributed data processing but even as services dynamically provided to the users. The system is scalable in the number of users and in the size of the data to process. Statistical data processing can be applied to perform Niche Modelling or Ecological Modelling experiments. Other applications can use general purpose techniques like Bayesian models. Time series of observations can be managed as well, in order to classify trends, catch anomaly patterns and perform simulations. The idea under the distributed computation for data mining techniques is to overcome common limitations that can happen when using statistical algorithms: "
@ -286,25 +254,24 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
+ "<li> cluster occurrence data;" + "<li> cluster occurrence data;"
+ "<li> estimate similarities among habitats." + "<li> estimate similarities among habitats."
+ "</ul>" + "</ul>"
+ "", "", "http://placehold.it/200x200", "/group/devsec", UserBelonging.NOT_BELONGING, true)); + "", "", "http://placehold.it/200x200", "/group/devsec", UserBelonging.NOT_BELONGING));
toReturn.put(devsecCategory, vres); toReturn.put(devsecCategory, vres);
devsecCategory = new VRECategory(2, "Sailing", "Sailing prod desc"); devsecCategory = new VRECategory(2, "Sailing", "Sailing prod desc");
vres = new ArrayList<VRE>(); vres = new ArrayList<VRE>();
vres.add(new VRE(1, "PerformanceEvaluationInAquaculture", "devVRE VRE description", "http://placehold.it/200x100", "http://placehold.it/200x100", "/group/devVRE", UserBelonging.NOT_BELONGING, false, true, "http://i-marine.d4science.org")); vres.add(new VRE(2, "devmode", "devmode VRE description", "http://placehold.it/200x100", "https://placeholdit.imgix.net/~text?txtsize=19&txt=200%C3%97100&w=200&h=100", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(2, "devmode", "devmode VRE description", "http://placehold.it/200x100", "https://placeholdit.imgix.net/~text?txtsize=19&txt=200%C3%97100&w=200&h=100", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "StrategicInvestmentAnalysis", "devVRE VRE description", "", "https://placeholdit.imgix.net/~text?txtsize=19&txt=200%C3%97100&w=200&h=100", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.OPEN));
vres.add(new VRE(1, "StrategicInvestmentAnalysis", "devVRE VRE description", "", "https://placeholdit.imgix.net/~text?txtsize=19&txt=200%C3%97100&w=200&h=100", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmode2", "devmode VRE description", "http://placehold.it/200x100", "", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.OPEN));
vres.add(new VRE(2, "devmode2", "devmode VRE description", "http://placehold.it/200x100", "", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "devVR3E", "devVRE VRE description", "http://placehold.it/200x200", "aaaa", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(1, "devVR3E", "devVRE VRE description", "http://placehold.it/200x200", "aaaa", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmode3", "devmode VRE description", "http://placehold.it/200x200", "", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(2, "devmode3", "devmode VRE description", "http://placehold.it/200x200", "", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "devVRE4", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(1, "devVRE4", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmode4", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(2, "devmode4", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "devVRE5", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(1, "devVRE5", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmode5", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(2, "devmode5", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "devVRE6", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(1, "devVRE6", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmode6", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(2, "devmode6", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, true)); vres.add(new VRE(1, "devVRE7", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, VreMembershipType.PRIVATE));
vres.add(new VRE(1, "devVRE7", "devVRE VRE description", "", "http://placehold.it/200x200", "/group/devVRE", UserBelonging.NOT_BELONGING, false)); vres.add(new VRE(2, "devmod76", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING));
vres.add(new VRE(2, "devmod76", "devmode VRE description", "", "http://placehold.it/200x200", "/group/devmode", UserBelonging.NOT_BELONGING, true));
toReturn.put(devsecCategory, vres); toReturn.put(devsecCategory, vres);
return toReturn; return toReturn;
} }
@ -326,10 +293,9 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
String vreLogoURL = gm.getGroupLogoURL(logoId); String vreLogoURL = gm.getGroupLogoURL(logoId);
String infraScope = gm.getInfrastructureScope(selectedVRE.getGroupId()); String infraScope = gm.getInfrastructureScope(selectedVRE.getGroupId());
String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+selectedVRE.getFriendlyURL(); String friendlyURL = GCubePortalConstants.PREFIX_GROUP_URL+selectedVRE.getFriendlyURL();
VRECustomAttributes attrs = getVRECustomAttr(selectedVRE);
boolean requireAccessGrant = attrs.isUponRequest();
boolean isExternal = attrs.isExternal();
String urlIfAny = attrs.getUrlIfAny();
GCubeUser currUser = um.getUserByUsername(session.getUsername()); GCubeUser currUser = um.getUserByUsername(session.getUsername());
//check if the user belongs to it //check if the user belongs to it
@ -339,12 +305,28 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
else if (checkPending(session.getUsername(), selectedVRE.getGroupId())) else if (checkPending(session.getUsername(), selectedVRE.getGroupId()))
belongEnum = UserBelonging.PENDING; belongEnum = UserBelonging.PENDING;
//return the selected VRE for this user //return the selected VRE for this user
toReturn = new VRE(groupId, vreName, vreDescription, vreLogoURL, infraScope, friendlyURL, belongEnum, requireAccessGrant, isExternal, urlIfAny); toReturn = new VRE(groupId, vreName, vreDescription, vreLogoURL, infraScope, friendlyURL, belongEnum, getVREMembershipType(selectedVRE.getMembershipType()));
} catch (Exception e) { } catch (Exception e) {
_log.error("Something wrong happened while trying to getSite by id, probably the group id is wrong. " + e.getMessage()); _log.error("Something wrong happened while trying to getSite by id, probably the group id is wrong. " + e.getMessage());
} }
return toReturn; return toReturn;
} }
/**
*
* @param type
* @return the correspondent mapping to the gcube model
*/
private VreMembershipType getVREMembershipType(GroupMembershipType type) {
switch (type) {
case RESTRICTED:
return VreMembershipType.RESTRICTED;
case OPEN:
return VreMembershipType.OPEN;
default:
return VreMembershipType.PRIVATE;
}
}
/** /**
* *
* @param screenName * @param screenName

View File

@ -9,49 +9,45 @@ import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VRE extends ResearchEnvironment implements Serializable, Comparable<VRE> { public class VRE extends ResearchEnvironment implements Serializable, Comparable<VRE> {
protected boolean uponRequest; protected VreMembershipType membershipType;
protected long id; protected long id;
protected boolean isExternal;
protected String url;
public VRE() { public VRE() {
super(); super();
} }
public VRE(long id, String vreName, String description, String imageURL,
String infraScope, String friendlyURL, UserBelonging userBelonging) {
super(vreName, description, imageURL, infraScope, friendlyURL, userBelonging);
this.membershipType = VreMembershipType.RESTRICTED;
this.id = id;
}
/** /**
*
* @param id * @param id
* @param vreName * @param vreName
* @param description * @param description
* @param imageURL * @param imageURL
* @param groupName * @param infraScope
* @param friendlyURL * @param friendlyURL
* @param categories
* @param userBelonging * @param userBelonging
* @param uponRequest * @param membershipType
*/ */
public VRE(long id, String vreName, String description, String imageURL, public VRE(long id, String vreName, String description, String imageURL,
String infraScope, String friendlyURL, UserBelonging userBelonging, boolean uponRequest) { String infraScope, String friendlyURL, UserBelonging userBelonging, VreMembershipType membershipType) {
super(vreName, description, imageURL, infraScope, friendlyURL, userBelonging); super(vreName, description, imageURL, infraScope, friendlyURL, userBelonging);
this.uponRequest = uponRequest; this.membershipType = membershipType;
this.id = id; this.id = id;
isExternal = false;
url = "";
} }
public VRE(long id, String vreName, String description, String imageURL,
String infraScope, String friendlyURL, UserBelonging userBelonging, boolean uponRequest, boolean isExternal, String url) { public VreMembershipType getMembershipType() {
super(vreName, description, imageURL, infraScope, friendlyURL, userBelonging); return membershipType;
this.uponRequest = uponRequest;
this.id = id;
this.isExternal = isExternal;
this.url = url;
} }
public boolean isUponRequest() { public void setMembershipType(VreMembershipType membershipType) {
return uponRequest; this.membershipType = membershipType;
}
public void setUponRequest(boolean uponRequest) {
this.uponRequest = uponRequest;
} }
public long getId() { public long getId() {
@ -62,25 +58,9 @@ public class VRE extends ResearchEnvironment implements Serializable, Comparable
this.id = id; this.id = id;
} }
public boolean isExternal() {
return isExternal;
}
public void setExternal(boolean isExternal) {
this.isExternal = isExternal;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override @Override
public String toString() { public String toString() {
return "VRE {" + getName() + ", "+ getFriendlyURL() + ", uponRequest=" + uponRequest+"}"; return "VRE [membershipType=" + membershipType + ", id=" + id + ", name=" + this.getName() + "]";
} }
@Override @Override

View File

@ -1,86 +0,0 @@
package org.gcube.portlets.user.joinvre.shared;
public class VRECustomAttributes {
private boolean isUponRequest;
private boolean isExternal;
private String urlIfAny;
public VRECustomAttributes() {
super();
this.isUponRequest = false;
this.isExternal = false;
this.urlIfAny = "";
}
public VRECustomAttributes(boolean isUponRequest, boolean isExternal,
String urlIfAny) {
super();
this.isUponRequest = isUponRequest;
this.isExternal = isExternal;
this.urlIfAny = urlIfAny;
}
public boolean isUponRequest() {
return isUponRequest;
}
public void setUponRequest(boolean isUponRequest) {
this.isUponRequest = isUponRequest;
}
public boolean isExternal() {
return isExternal;
}
public void setExternal(boolean isExternal) {
this.isExternal = isExternal;
}
public String getUrlIfAny() {
return urlIfAny;
}
public void setUrlIfAny(String urlIfAny) {
this.urlIfAny = urlIfAny;
}
@Override
public String toString() {
return "VRECustomAttributes [isUponRequest=" + isUponRequest
+ ", isExternal=" + isExternal + ", urlIfAny=" + urlIfAny + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (isExternal ? 1231 : 1237);
result = prime * result + (isUponRequest ? 1231 : 1237);
result = prime * result
+ ((urlIfAny == null) ? 0 : urlIfAny.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VRECustomAttributes other = (VRECustomAttributes) obj;
if (isExternal != other.isExternal)
return false;
if (isUponRequest != other.isUponRequest)
return false;
if (urlIfAny == null) {
if (other.urlIfAny != null)
return false;
} else if (!urlIfAny.equals(other.urlIfAny))
return false;
return true;
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.joinvre.shared;
public enum VreMembershipType {
OPEN,
RESTRICTED,
PRIVATE;
}