Added rootVO name and rootVO context getters

This commit is contained in:
Mauro Mugnaini 2020-07-09 15:41:52 +02:00
parent 6462f8ac73
commit fd9ed393a0
1 changed files with 21 additions and 0 deletions

View File

@ -2,12 +2,15 @@ package org.gcube.portal.event.publisher.lr62;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
@ -24,6 +27,8 @@ public class EventPublisherConfiguration {
private Long companyId;
private URL eventPublisherURL;
private String rootVOName;
private String encodedRootVOContext;
public static synchronized EventPublisherConfiguration getConfiguration(Long companyId) {
log.trace("Getting config from companyId");
@ -52,6 +57,13 @@ public class EventPublisherConfiguration {
throw new RuntimeException(e);
}
log.info("eventPublisherURL=" + getEventPublisherURL());
try {
rootVOName = new LiferayGroupManager().getRootVOName();
encodedRootVOContext = URLEncoder.encode("/" + rootVOName, "UTF-8");
} catch (Exception e) {
log.error("Cannot compute encoded root VO context", e);
}
}
public Long getCompanyId() {
@ -61,4 +73,13 @@ public class EventPublisherConfiguration {
public URL getEventPublisherURL() {
return eventPublisherURL;
}
public String getRootVOName() {
return rootVOName;
}
public String getEncodedRootVOContext() {
return encodedRootVOContext;
}
}