Updated Branches: refs/heads/master 462e6d91c -> 100dc368c
CLOUDSTACK-3190 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/100dc368 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/100dc368 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/100dc368 Branch: refs/heads/master Commit: 100dc368c2ed93e0ca4246ec9818111fb21d41c6 Parents: 462e6d9 Author: Alex Ough <[email protected]> Authored: Fri Dec 6 14:13:25 2013 -0600 Committer: Murali Reddy <[email protected]> Committed: Mon Dec 9 12:16:21 2013 +0530 ---------------------------------------------------------------------- .../src/com/cloud/event/ActionEventUtils.java | 29 +++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/100dc368/server/src/com/cloud/event/ActionEventUtils.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java index eba6874..3fa68e5 100755 --- a/server/src/com/cloud/event/ActionEventUtils.java +++ b/server/src/com/cloud/event/ActionEventUtils.java @@ -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; + } }
