Added Relevance. Fixes #3272

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@113600 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-03-13 15:50:16 +00:00
parent 0a0f61029f
commit a0352057c4
2 changed files with 11 additions and 14 deletions

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.user.joinvre.client.panels;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.gcube.portlets.user.joinvre.client.JoinService;
import org.gcube.portlets.user.joinvre.client.JoinServiceAsync;
@ -14,9 +11,7 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Image;

View File

@ -16,6 +16,7 @@ import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.user.joinvre.client.JoinService;
import org.gcube.portlets.user.joinvre.client.panels.Relevance;
import org.gcube.portlets.user.joinvre.shared.UserBelonging;
import org.gcube.portlets.user.joinvre.shared.VRE;
import org.gcube.portlets.user.joinvre.shared.VRECategory;
@ -163,7 +164,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
}
}
private static final String RELEVANCE = "relevance";
private static final String RELEVANCE = "Relevance";
public int getRelevance(Organization organization){
try {
@ -174,12 +175,17 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
PermissionThreadLocal.setPermissionChecker(permissionChecker);
_log.trace("Setting Permission ok!");
if (organization.getExpandoBridge().getAttribute(RELEVANCE) == null || organization.getExpandoBridge().getAttribute(RELEVANCE).equals("")) {
_log.trace(String.format("Attribute %s not initialized. In this case by default Access Grant is permitted", REQUEST_BASED_GROUP));
if (organization.getExpandoBridge().getAttribute(RELEVANCE) == null || organization.getExpandoBridge().getAttribute(RELEVANCE).equals("")) {
_log.trace(String.format("Attribute %s not initialized. In this case by default Access Grant is permitted", RELEVANCE));
return 0;
} else {
String attributeValue = (String) organization.getExpandoBridge().getAttribute(REQUEST_BASED_GROUP);
return Integer.parseInt(attributeValue);
Integer relevanceValue = (Integer) organization.getExpandoBridge().getAttribute(RELEVANCE);
int relevance = relevanceValue.intValue();
int maxAcceptableValue = Relevance.values().length - 1;
if(relevance > maxAcceptableValue){
relevance = maxAcceptableValue;
}
return relevance;
}
} catch (Exception e) {
return 0;
@ -229,13 +235,9 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
String vreName = vreOrganization.getName();
String vreDescription = (vreOrganization.getComments()!=null) ? vreOrganization.getComments() : "";
long logoId = vreOrganization.getLogoId();
String vreLogoURL = String.format("%s/organization_logo?img_id=%s&t=%s", imagePath, logoId, ImageServletTokenUtil.getToken(logoId));
String groupName = String.format("/%s/%s/%s", vOrg.getParentOrganization().getName(), vOrg.getName(), vreName);
Group vreGroup = vreOrganization.getGroup();
String friendlyURL = vreGroup.getPathFriendlyURL(true, themeDisplay) + vreGroup.getFriendlyURL();