@Override public void onExecuteActions(Rule rule, Event event) { List<String> ruleExecutionInfo = new ArrayList<>(); ruleExecutionInfo.add(rule.getItemId()); ruleExecutionInfo.add(rule.getMetadata().getName()); ruleExecutionInfo.add(event.getEventType()); ruleExecutionInfo.add(event.getSessionId()); ruleExecutionInfo.add(event.getProfileId()); ruleExecutionInfo.add(event.getTimeStamp().toString()); ruleExecutionInfo.add(event.getScope()); outputLine(out, ruleExecutionInfo); } }
public void populateRuleInfo(Rule rule, Event event, String status) { if (!ArrayUtils.contains(ruleIds, rule.getItemId())) { return; } List<String> ruleExecutionInfo = new ArrayList<>(); ruleExecutionInfo.add(status); ruleExecutionInfo.add(rule.getItemId()); ruleExecutionInfo.add(rule.getMetadata().getName()); ruleExecutionInfo.add(event.getEventType()); ruleExecutionInfo.add(event.getSessionId()); ruleExecutionInfo.add(event.getProfileId()); ruleExecutionInfo.add(event.getTimeStamp().toString()); ruleExecutionInfo.add(event.getScope()); outputLine(out, ruleExecutionInfo); }
@Override public int onEvent(Event event) { if (!event.isPersistent() && !withInternal) { return EventService.NO_CHANGE; } List<String> eventInfo = new ArrayList<>(); eventInfo.add(event.getItemId()); eventInfo.add(event.getEventType()); eventInfo.add(event.getSessionId()); eventInfo.add(event.getProfileId()); eventInfo.add(event.getTimeStamp().toString()); eventInfo.add(event.getScope()); eventInfo.add(Boolean.toString(event.isPersistent())); outputLine(out, eventInfo); return EventService.NO_CHANGE; }
Event profileUpdated = new Event("profileUpdated", null, profile, event.getScope(), null, profile, new Date()); profileUpdated.setPersistent(false); eventService.send(profileUpdated);
Event profileUpdated = new Event("profileUpdated", null, profile, event.getScope(), null, profile, new Date()); profileUpdated.setPersistent(false); eventService.send(profileUpdated);
return event.getScope();
@Override public int execute(Action action, Event event) { String eventType = (String) action.getParameterValues().get("eventType"); @SuppressWarnings("unchecked") Map<String, Object> eventProperties = (Map<String, Object>) action.getParameterValues().get("eventProperties"); Item target = (Item) action.getParameterValues().get("eventTarget"); // String type = (String) target.get("type"); // Item targetItem = new CustomItem(); // BeanUtils.populate(targetItem, target); Event subEvent = new Event(eventType, event.getSession(), event.getProfile(), event.getScope(), event, target, event.getTimeStamp()); subEvent.setProfileId(event.getProfileId()); subEvent.getAttributes().putAll(event.getAttributes()); subEvent.getProperties().putAll(eventProperties); return eventService.send(subEvent); } }
propertyToUpdate.put(propertyName, propertyValue); Event updateProperties = new Event("updateProperties", event.getSession(), event.getProfile(), event.getScope(), null, event.getProfile(), new Date()); updateProperties.setPersistent(false);
public int onEvent(Event event) { Set<Rule> rules = getMatchingRules(event); int changes = EventService.NO_CHANGE; for (Rule rule : rules) { logger.debug("Fired rule " + rule.getMetadata().getId() + " for " + event.getEventType() + " - " + event.getItemId()); long actionsStartTime = System.currentTimeMillis(); for (Action action : rule.getActions()) { changes |= actionExecutorDispatcher.execute(action, event); } long totalActionsTime = System.currentTimeMillis() - actionsStartTime; Event ruleFired = new Event("ruleFired", event.getSession(), event.getProfile(), event.getScope(), event, rule, event.getTimeStamp()); ruleFired.getAttributes().putAll(event.getAttributes()); ruleFired.setPersistent(false); changes |= eventService.send(ruleFired); RuleStatistics ruleStatistics = getLocalRuleStatistics(rule); ruleStatistics.setLocalExecutionCount(ruleStatistics.getLocalExecutionCount()+1); ruleStatistics.setLocalActionsTime(ruleStatistics.getLocalActionsTime() + totalActionsTime); this.allRuleStatistics.put(rule.getItemId(), ruleStatistics); } return changes; }
public int onEvent(Event event) { Set<Rule> rules = getMatchingRules(event); int changes = EventService.NO_CHANGE; for (Rule rule : rules) { logger.debug("Fired rule " + rule.getMetadata().getId() + " for " + event.getEventType() + " - " + event.getItemId()); fireExecuteActions(rule, event); long actionsStartTime = System.currentTimeMillis(); for (Action action : rule.getActions()) { changes |= actionExecutorDispatcher.execute(action, event); } long totalActionsTime = System.currentTimeMillis() - actionsStartTime; Event ruleFired = new Event("ruleFired", event.getSession(), event.getProfile(), event.getScope(), event, rule, event.getTimeStamp()); ruleFired.getAttributes().putAll(event.getAttributes()); ruleFired.setPersistent(false); changes |= eventService.send(ruleFired); RuleStatistics ruleStatistics = getLocalRuleStatistics(rule); ruleStatistics.setLocalExecutionCount(ruleStatistics.getLocalExecutionCount()+1); ruleStatistics.setLocalActionsTime(ruleStatistics.getLocalActionsTime() + totalActionsTime); this.allRuleStatistics.put(rule.getItemId(), ruleStatistics); } return changes; }
long ruleConditionStartTime = System.currentTimeMillis(); String scope = rule.getMetadata().getScope(); if (scope.equals(Metadata.SYSTEM_SCOPE) || scope.equals(event.getScope())) { Condition eventCondition = definitionsService.extractConditionBySystemTag(rule.getCondition(), "eventCondition");
Event profileUpdated = new Event("profileUpdated", session, event.getProfile(), event.getScope(), event.getSource(), event.getProfile(), event.getTimeStamp()); profileUpdated.setPersistent(false); profileUpdated.getAttributes().putAll(event.getAttributes());
long ruleConditionStartTime = System.currentTimeMillis(); String scope = rule.getMetadata().getScope(); if (scope.equals(Metadata.SYSTEM_SCOPE) || scope.equals(event.getScope())) { Condition eventCondition = definitionsService.extractConditionBySystemTag(rule.getCondition(), "eventCondition");
Event profileUpdated = new Event("profileUpdated", session, event.getProfile(), event.getScope(), event.getSource(), event.getProfile(), event.getTimeStamp()); profileUpdated.setPersistent(false); profileUpdated.getAttributes().putAll(event.getAttributes());