RootVO name retrieve moved to config class
This commit is contained in:
parent
fd9ed393a0
commit
75559aace1
|
@ -1,20 +1,16 @@
|
||||||
package org.gcube.portal.event.publisher.lr62;
|
package org.gcube.portal.event.publisher.lr62;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.event.publisher.Event;
|
import org.gcube.event.publisher.Event;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
|
|
||||||
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.model.User;
|
import com.liferay.portal.model.User;
|
||||||
import com.liferay.portal.util.PortalUtil;
|
|
||||||
|
|
||||||
public class PortalEvent extends Event {
|
public class PortalEvent extends Event {
|
||||||
|
|
||||||
|
@ -24,37 +20,18 @@ public class PortalEvent extends Event {
|
||||||
|
|
||||||
protected static final UserManager USER_MANAGER = new LiferayUserManager();
|
protected static final UserManager USER_MANAGER = new LiferayUserManager();
|
||||||
|
|
||||||
private static String rootVOName;
|
|
||||||
|
|
||||||
public static final String TYPE = "portal";
|
public static final String TYPE = "portal";
|
||||||
public static final String USER_ENTRY = "user";
|
public static final String USER_ENTRY = "user";
|
||||||
public static final String GROUP_ENTRY = "group";
|
public static final String GROUP_ENTRY = "group";
|
||||||
public static final String ROLE_ENTRY = "role";
|
public static final String ROLE_ENTRY = "role";
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
rootVOName = new LiferayGroupManager().getRootVOName();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("Cannot get root VO name, using hostname");
|
|
||||||
try {
|
|
||||||
rootVOName = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (UnknownHostException e1) {
|
|
||||||
log.error("Cannot get localhost name", e);
|
|
||||||
rootVOName = PortalUtil.getComputerName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PortalEvent(String name) {
|
public PortalEvent(String name) {
|
||||||
this(name, null);
|
this(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortalEvent(String name, Map<String, String> data) {
|
public PortalEvent(String name, Map<String, String> data) {
|
||||||
super(name, TYPE, getRootVOName(), data);
|
super(name, TYPE, EventPublisherConfiguration.getConfiguration().getRootVOName(), data);
|
||||||
}
|
|
||||||
|
|
||||||
protected static String getRootVOName() {
|
|
||||||
return rootVOName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUser(User user) throws UserManagementSystemException, UserRetrievalFault {
|
public void setUser(User user) throws UserManagementSystemException, UserRetrievalFault {
|
||||||
|
|
Loading…
Reference in New Issue