2014-12-12 11:31:41 +01:00
|
|
|
package org.gcube.portlets.user.gcubewidgets.client;
|
|
|
|
|
2016-04-06 14:00:42 +02:00
|
|
|
|
2014-12-12 11:31:41 +01:00
|
|
|
import org.gcube.portlets.user.gcubewidgets.client.rpc.ScopeService;
|
|
|
|
import org.gcube.portlets.user.gcubewidgets.client.rpc.ScopeServiceAsync;
|
|
|
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
2016-04-06 14:00:42 +02:00
|
|
|
import com.google.gwt.user.client.Window.Location;
|
2014-12-12 11:31:41 +01:00
|
|
|
|
|
|
|
public class ClientScopeHelper {
|
|
|
|
public static ScopeServiceAsync getService() {
|
|
|
|
return GWT.create(ScopeService.class);
|
|
|
|
//Window.Location.getHref();
|
|
|
|
}
|
2016-04-04 18:57:04 +02:00
|
|
|
|
|
|
|
public static String extractOrgFriendlyURL(String portalURL) {
|
|
|
|
String groupRegEx = "/group/";
|
|
|
|
if (portalURL.contains(groupRegEx)) {
|
|
|
|
String[] splits = portalURL.split(groupRegEx);
|
|
|
|
String friendlyURL = splits[1];
|
|
|
|
if (friendlyURL.contains("/")) {
|
|
|
|
friendlyURL = friendlyURL.split("/")[0];
|
|
|
|
} else {
|
|
|
|
friendlyURL = friendlyURL.split("\\?")[0].split("\\#")[0];
|
|
|
|
}
|
|
|
|
return "/"+friendlyURL;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2016-04-06 14:00:42 +02:00
|
|
|
|
2014-12-12 11:31:41 +01:00
|
|
|
}
|