mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-3190
This commit is contained in:
parent
462e6d91c1
commit
100dc368c2
@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
|
||||
@ -171,10 +172,12 @@ public class ActionEventUtils {
|
||||
// get the entity details for which ActionEvent is generated
|
||||
String entityType = null;
|
||||
String entityUuid = null;
|
||||
CallContext context = CallContext.current();
|
||||
if (context != null) {
|
||||
entityType = (String)context.getContextParameter(EntityType);
|
||||
entityUuid = (String)context.getContextParameter(EntityUuid);
|
||||
Class entityKey = getEntityKey(eventType);
|
||||
if (entityKey != null)
|
||||
{
|
||||
CallContext context = CallContext.current();
|
||||
entityUuid = (String)context.getContextParameter(entityKey);
|
||||
if (entityUuid != null) entityType = entityKey.getName();
|
||||
}
|
||||
|
||||
org.apache.cloudstack.framework.events.Event event =
|
||||
@ -216,4 +219,22 @@ public class ActionEventUtils {
|
||||
}
|
||||
return account.getDomainId();
|
||||
}
|
||||
|
||||
private static Class getEntityKey(String eventType)
|
||||
{
|
||||
if (eventType.startsWith("DOMAIN."))
|
||||
{
|
||||
return Domain.class;
|
||||
}
|
||||
else if (eventType.startsWith("ACCOUNT."))
|
||||
{
|
||||
return Account.class;
|
||||
}
|
||||
else if (eventType.startsWith("USER."))
|
||||
{
|
||||
return User.class;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user