removed call back when click on Add More VREs button
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@132186 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1b96d6355b
commit
be319c85c3
|
@ -15,9 +15,6 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
public interface MyVREsService extends RemoteService {
|
public interface MyVREsService extends RemoteService {
|
||||||
LinkedHashMap<String, ArrayList<VRE>> getUserVREs();
|
LinkedHashMap<String, ArrayList<VRE>> getUserVREs();
|
||||||
|
|
||||||
void loadLayout(String scope, String URL);
|
|
||||||
|
|
||||||
String showMoreVREs();
|
|
||||||
|
|
||||||
String getSiteLandingPagePath();
|
String getSiteLandingPagePath();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
public interface MyVREsServiceAsync {
|
public interface MyVREsServiceAsync {
|
||||||
|
|
||||||
|
|
||||||
void loadLayout(String scope, String URL, AsyncCallback<Void> callback);
|
|
||||||
|
|
||||||
void getUserVREs(
|
void getUserVREs(
|
||||||
AsyncCallback<LinkedHashMap<String, ArrayList<VRE>>> callback);
|
AsyncCallback<LinkedHashMap<String, ArrayList<VRE>>> callback);
|
||||||
|
|
||||||
void showMoreVREs(AsyncCallback<String> callback);
|
|
||||||
|
|
||||||
void getSiteLandingPagePath(AsyncCallback<String> callback);
|
void getSiteLandingPagePath(AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.gcube.portlet.user.my_vres.shared.VRE;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
@ -26,7 +25,6 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
*/
|
*/
|
||||||
public class VresPanel extends Composite {
|
public class VresPanel extends Composite {
|
||||||
public static final String loading = GWT.getModuleBaseURL() + "../images/loading.gif";
|
public static final String loading = GWT.getModuleBaseURL() + "../images/loading.gif";
|
||||||
private static final String ADD_OTHER = "Add More";
|
|
||||||
private final MyVREsServiceAsync myVREsService = GWT.create(MyVREsService.class);
|
private final MyVREsServiceAsync myVREsService = GWT.create(MyVREsService.class);
|
||||||
private FlowPanel flowPanel;
|
private FlowPanel flowPanel;
|
||||||
private VerticalPanel mainPanel = new VerticalPanel();
|
private VerticalPanel mainPanel = new VerticalPanel();
|
||||||
|
@ -86,7 +84,7 @@ public class VresPanel extends Composite {
|
||||||
flowPanel.setWidth("100%");
|
flowPanel.setWidth("100%");
|
||||||
flowPanel.setStyleName("flowPanel");
|
flowPanel.setStyleName("flowPanel");
|
||||||
for (VRE vre: cachedVREs.get(cat)) {
|
for (VRE vre: cachedVREs.get(cat)) {
|
||||||
ClickableVRE vreButton = new ClickableVRE(vre, myVREsService);
|
ClickableVRE vreButton = new ClickableVRE(vre);
|
||||||
flowPanel.add(vreButton);
|
flowPanel.add(vreButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,29 +95,10 @@ public class VresPanel extends Composite {
|
||||||
if (! hasAtLeastOneVRE(cachedVREs)) {
|
if (! hasAtLeastOneVRE(cachedVREs)) {
|
||||||
mainPanel.add(new NoVresPanel());
|
mainPanel.add(new NoVresPanel());
|
||||||
imagesPanel.clear();
|
imagesPanel.clear();
|
||||||
} else {
|
|
||||||
addMoreVREsButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMoreVREsButton() {
|
|
||||||
SimplePanel catPanel = new SimplePanel();
|
|
||||||
catPanel.setStyleName("category-panel");
|
|
||||||
HTML categ = new HTML(ADD_OTHER);
|
|
||||||
categ.setStyleName("category-name");
|
|
||||||
catPanel.add(categ);
|
|
||||||
|
|
||||||
mainPanel.add(catPanel);
|
|
||||||
FlowPanel flowPanel = new FlowPanel();
|
|
||||||
flowPanel.setWidth("100%");
|
|
||||||
flowPanel.setStyleName("flowPanel");
|
|
||||||
|
|
||||||
ClickableVRE vreButton = new ClickableVRE(myVREsService);
|
|
||||||
flowPanel.add(vreButton);
|
|
||||||
|
|
||||||
mainPanel.add(flowPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasAtLeastOneVRE(LinkedHashMap<String, ArrayList<VRE>> cachedVREs) {
|
private boolean hasAtLeastOneVRE(LinkedHashMap<String, ArrayList<VRE>> cachedVREs) {
|
||||||
for (String cat : cachedVREs.keySet())
|
for (String cat : cachedVREs.keySet())
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.gcube.portlet.user.my_vres.client.widgets;
|
package org.gcube.portlet.user.my_vres.client.widgets;
|
||||||
|
|
||||||
import org.gcube.common.portal.GCubePortalConstants;
|
|
||||||
import org.gcube.portlet.user.my_vres.client.MyVREsServiceAsync;
|
|
||||||
import org.gcube.portlet.user.my_vres.shared.VRE;
|
import org.gcube.portlet.user.my_vres.shared.VRE;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -9,7 +7,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window.Location;
|
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.HTML;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
|
||||||
|
@ -35,42 +32,19 @@ public class ClickableVRE extends HTML {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClickableVRE(final MyVREsServiceAsync service) {
|
public ClickableVRE(final VRE vre) {
|
||||||
super.setPixelSize(WIDTH, HEIGHT);
|
super.setPixelSize(WIDTH, HEIGHT);
|
||||||
setPixelSize(WIDTH, HEIGHT);
|
setPixelSize(WIDTH, HEIGHT);
|
||||||
imageWidth = WIDTH - 25;
|
|
||||||
String html = "";
|
String html = "";
|
||||||
html = "<div class=\"more-vre\"></div>";
|
if (vre.getName() == null || vre.getName().compareTo("") == 0) {
|
||||||
setHTML(html);
|
html = "<div class=\"more-vre\"></div>";
|
||||||
setStyleName("vreButton");
|
} else {
|
||||||
|
name = (vre.getName().length() > 15) ? vre.getName().substring(0, 13) + ".." : vre.getName();
|
||||||
addClickHandler(new ClickHandler() {
|
html = "<div class=\"vreCaption\">" +name + "</div>";
|
||||||
public void onClick(ClickEvent event) {
|
}
|
||||||
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);
|
|
||||||
service.showMoreVREs(new AsyncCallback<String>() {
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) { }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String result) {
|
|
||||||
Location.assign(result+GCubePortalConstants.VRES_EXPLORE_FRIENDLY_URL);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClickableVRE(final VRE vre, final MyVREsServiceAsync service) {
|
|
||||||
super.setPixelSize(WIDTH, HEIGHT);
|
|
||||||
setPixelSize(WIDTH, HEIGHT);
|
|
||||||
imageWidth = WIDTH - 12;
|
imageWidth = WIDTH - 12;
|
||||||
name = (vre.getName().length() > 15) ? vre.getName().substring(0, 13) + ".." : vre.getName();
|
|
||||||
imageUrl = vre.getImageURL();
|
imageUrl = vre.getImageURL();
|
||||||
this.setTitle("Enter");
|
this.setTitle("Enter");
|
||||||
String html = "<div class=\"vreCaption\">" + name + "</div>";
|
|
||||||
html += "<div style=\"display: table; text-align:center; width: 100%; height: 75px;\">" +
|
html += "<div style=\"display: table; text-align:center; width: 100%; height: 75px;\">" +
|
||||||
"<span style=\"vertical-align:middle; display: table-cell;\"><img style=\"width: " + imageWidth + "px;\" src=\"" +imageUrl + "\" /></span>" +
|
"<span style=\"vertical-align:middle; display: table-cell;\"><img style=\"width: " + imageWidth + "px;\" src=\"" +imageUrl + "\" /></span>" +
|
||||||
"</div>";
|
"</div>";
|
||||||
|
@ -83,13 +57,13 @@ public class ClickableVRE extends HTML {
|
||||||
"<span style=\"vertical-align:middle; display: table-cell;\">redirecting ...</span>" +
|
"<span style=\"vertical-align:middle; display: table-cell;\">redirecting ...</span>" +
|
||||||
"</div>";
|
"</div>";
|
||||||
setHTML(html);
|
setHTML(html);
|
||||||
Timer timer = new Timer() {
|
Timer timer = new Timer() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Location.assign(vre.getFriendlyURL());
|
Location.assign(vre.getFriendlyURL());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
timer.schedule(50);
|
timer.schedule(50);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,33 +17,17 @@ 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.UserBelonging;
|
||||||
import org.gcube.portlet.user.my_vres.shared.VRE;
|
import org.gcube.portlet.user.my_vres.shared.VRE;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
|
||||||
import org.gcube.vomanagement.usermanagement.exception.VirtualGroupNotExistingException;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
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.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
|
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
|
||||||
|
import org.gcube.vomanagement.usermanagement.util.ManagementUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.liferay.portal.kernel.exception.PortalException;
|
|
||||||
import com.liferay.portal.kernel.exception.SystemException;
|
|
||||||
import com.liferay.portal.kernel.util.StringBundler;
|
|
||||||
import com.liferay.portal.model.Group;
|
|
||||||
import com.liferay.portal.model.VirtualHost;
|
|
||||||
import com.liferay.portal.security.auth.PrincipalThreadLocal;
|
|
||||||
import com.liferay.portal.security.permission.PermissionChecker;
|
|
||||||
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
|
|
||||||
import com.liferay.portal.security.permission.PermissionThreadLocal;
|
|
||||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
|
||||||
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.util.PortalUtil;
|
|
||||||
import com.liferay.portal.webserver.WebServerServletTokenUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -58,6 +42,9 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
*/
|
*/
|
||||||
public static final String CACHED_VOS = "CACHED_VRES";
|
public static final String CACHED_VOS = "CACHED_VRES";
|
||||||
|
|
||||||
|
public static final String ADD_MORE_CATEGORY = "Add More";
|
||||||
|
public static final String ADD_MORE_IMAGE_PATH= "images/More.png";
|
||||||
|
|
||||||
private ASLSession getASLSession() {
|
private ASLSession getASLSession() {
|
||||||
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
||||||
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
|
@ -70,10 +57,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
}
|
}
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public String showMoreVREs() {
|
|
||||||
return PortalContext.getConfiguration().getSiteLandingPagePath(getThreadLocalRequest());
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public String getSiteLandingPagePath() {
|
public String getSiteLandingPagePath() {
|
||||||
String user = getASLSession().getUsername();
|
String user = getASLSession().getUsername();
|
||||||
|
@ -111,8 +95,8 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
|
|
||||||
LinkedHashMap<String, ArrayList<VRE>> toReturn = new LinkedHashMap<String, ArrayList<VRE>>();
|
LinkedHashMap<String, ArrayList<VRE>> toReturn = new LinkedHashMap<String, ArrayList<VRE>>();
|
||||||
|
|
||||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
|
||||||
List<VirtualGroup> currentSiteVGroups = getVirtualGroups(currentSiteGroupId);
|
List<VirtualGroup> currentSiteVGroups = ManagementUtils.getVirtualGroupsBySiteGroupId(ManagementUtils.getSiteGroupIdFromServletRequest(getThreadLocalRequest().getServerName()));
|
||||||
for (VirtualGroup vg : currentSiteVGroups) {
|
for (VirtualGroup vg : currentSiteVGroups) {
|
||||||
String gName = vg.getName();
|
String gName = vg.getName();
|
||||||
ArrayList<VRE> toCreate = new ArrayList<VRE>();
|
ArrayList<VRE> toCreate = new ArrayList<VRE>();
|
||||||
|
@ -162,6 +146,17 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
ArrayList<VRE> toSort = toReturn.get(cat);
|
ArrayList<VRE> toSort = toReturn.get(cat);
|
||||||
Collections.sort(toSort);
|
Collections.sort(toSort);
|
||||||
}
|
}
|
||||||
|
HttpServletRequest request = getThreadLocalRequest();
|
||||||
|
PortalContext context = PortalContext.getConfiguration();
|
||||||
|
String gatewayURL = context.getGatewayURL(request);
|
||||||
|
String exploreURL = gatewayURL+context.getSiteLandingPagePath(request)+GCubePortalConstants.VRES_EXPLORE_FRIENDLY_URL;
|
||||||
|
VRE addMore = new VRE("", "", "", "", exploreURL, UserBelonging.BELONGING);
|
||||||
|
//add a fake category and addMoreVRE
|
||||||
|
ArrayList<VRE> addMoreVREs = new ArrayList<VRE>();
|
||||||
|
addMoreVREs.add(addMore);
|
||||||
|
toReturn.put(ADD_MORE_CATEGORY, addMoreVREs);
|
||||||
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -170,25 +165,6 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param scope
|
|
||||||
*/
|
|
||||||
public void loadLayout(String scope, String URL) {
|
|
||||||
_log.trace("Calling Load Layout...");
|
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
|
||||||
ASLSession mysession = getASLSession();
|
|
||||||
mysession.setAttribute("loadlayout", "true");
|
|
||||||
session.setAttribute("loadLayout", "true");
|
|
||||||
session.setAttribute("selectedVRE", scope);
|
|
||||||
mysession.logUserLogin(scope);
|
|
||||||
mysession.setScope(scope);
|
|
||||||
|
|
||||||
_log.trace("User login logged to: " + scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* simply returns fake VREs for development purpose
|
* simply returns fake VREs for development purpose
|
||||||
* @return
|
* @return
|
||||||
|
@ -261,72 +237,6 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* read the list of virtual groups the current site (i-marine, services etc. ) should show up
|
|
||||||
* @param actualGroupId
|
|
||||||
* @return he list of virtual groups the current site (i-marine, services etc. ) should show up
|
|
||||||
* @throws GroupRetrievalFault
|
|
||||||
* @throws VirtualGroupNotExistingException
|
|
||||||
*/
|
|
||||||
private List<VirtualGroup> getVirtualGroups(long actualGroupId) throws GroupRetrievalFault, VirtualGroupNotExistingException {
|
|
||||||
List<VirtualGroup> toReturn = new ArrayList<VirtualGroup>();
|
|
||||||
try {
|
|
||||||
long userId = LiferayUserManager.getAdmin().getUserId();
|
|
||||||
PrincipalThreadLocal.setName(userId);
|
|
||||||
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId));
|
|
||||||
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
|
||||||
Group site = GroupLocalServiceUtil.getGroup(actualGroupId);
|
|
||||||
_log.debug("Set Thread Permission done, getVirtual Group of " + site.getName());
|
|
||||||
if (site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()) == null || site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()).equals("")) {
|
|
||||||
String warningMessage = String.format("Attribute %s not initialized.", CustomAttributeKeys.VIRTUAL_GROUP.getKeyName());
|
|
||||||
_log.warn(warningMessage);
|
|
||||||
throw new VirtualGroupNotExistingException(warningMessage);
|
|
||||||
} else {
|
|
||||||
String[] values = (String[]) site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName());
|
|
||||||
VirtualGroup toAdd = new VirtualGroup();
|
|
||||||
if (values != null && values.length > 0) {
|
|
||||||
for (int i = 0; i < values.length; i++) {
|
|
||||||
toAdd = new VirtualGroup();
|
|
||||||
String[] splits = values[i].split("\\|");
|
|
||||||
toAdd.setName(splits[0]);
|
|
||||||
toAdd.setDescription(splits[1]);
|
|
||||||
toReturn.add(toAdd);
|
|
||||||
_log.debug("VirtualGroup selected found for " + site.getName() + " -> " + toAdd.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
toAdd.setName("NoVirtualGroupAssigned");
|
|
||||||
toAdd.setDescription("NoVirtualGroupDescription");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return the current Group instance based on the request
|
|
||||||
* @throws PortalException
|
|
||||||
* @throws SystemException
|
|
||||||
*/
|
|
||||||
private Group getSiteFromServletRequest(final HttpServletRequest request) throws PortalException, SystemException {
|
|
||||||
String serverName = request.getServerName();
|
|
||||||
_log.trace("currentHost is " + serverName);
|
|
||||||
Group site = null;
|
|
||||||
List<VirtualHost> vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount());
|
|
||||||
for (VirtualHost virtualHost : vHosts) {
|
|
||||||
_log.trace("Found " + virtualHost.getHostname());
|
|
||||||
if (virtualHost.getHostname().compareTo("localhost") != 0 &&
|
|
||||||
virtualHost.getLayoutSetId() != 0 &&
|
|
||||||
virtualHost.getHostname().compareTo(serverName) == 0) {
|
|
||||||
long layoutSetId = virtualHost.getLayoutSetId();
|
|
||||||
site = LayoutSetLocalServiceUtil.getLayoutSet(layoutSetId).getGroup();
|
|
||||||
_log.trace("Found match! Your site is " + site.getName());
|
|
||||||
return site;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue