public Event(Event event) { if (event == null) { throw new IllegalArgumentException("event must be not null"); } this.tenantId = event.getTenantId(); this.trigger = event.getTrigger(); this.dampening = event.getDampening() != null ? new Dampening(event.getDampening()) : null; // evalSets are maintained as reference as it is a mostly read-only field this.evalSets = event.getEvalSets(); this.eventType = event.getEventType(); this.ctime = event.getCtime(); this.id = event.getId(); this.dataSource = event.getDataSource(); this.dataId = event.getDataId(); this.context = new HashMap<>(event.getContext()); this.category = event.getCategory(); this.text = event.getText(); this.tags = new HashMap<>(event.getTags()); }
public ExternalConditionEval(ExternalCondition condition, Event event) { super(Type.EXTERNAL, condition.match(event.getText()), event.getCtime(), event.getContext()); this.condition = condition; this.event = event; }
public EventConditionEval(EventCondition condition, Event value) { super(Type.EVENT, condition.match(value), value.getCtime(), value.getContext()); this.condition = condition; this.value = value; }
int tenantComparator = o1.getTenantId().compareTo(o2.getTenantId()); if (tenantComparator != 0) { return tenantComparator * iOrder; return o1.getId().compareTo(o2.getId()) * iOrder; if (o1.getContext() == null && o2.getContext() == null) { return 0; if (o1.getContext().isEmpty() && o2.getContext().isEmpty()) { return 0; if (!o1.getContext().containsKey(contextKey) && !o2.getContext().containsKey(contextKey)) { return 0; if (!o1.getContext().containsKey(contextKey) && o2.getContext().containsKey(contextKey)) { return 1; if (!o1.getContext().containsKey(contextKey) && !o2.getContext().containsKey(contextKey)) { return -1; return o1.getContext().get(contextKey).compareTo(o2.getContext().get(contextKey)) * iOrder; if (o1.getCategory() == null && o2.getCategory() == null) { return 0; if (o1.getCategory() == null && o2.getCategory() != null) { return 1;
sEventValue = value.getTenantId(); } else if (ID.equals(eventField)) { sEventValue = value.getId(); } else if (CTIME.equals(eventField)) { lEventValue = value.getCtime(); } else if (TEXT.equals(eventField)) { sEventValue = value.getText(); } else if (CATEGORY.equals(eventField)) { sEventValue = value.getCategory(); } else if (eventField.startsWith(TAGS)) { sEventValue = value.getTags().get(key);
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; Action action = (Action) o; if (ctime != action.ctime) return false; if (eventId != null ? !eventId.equals(action.eventId) : action.eventId != null) return false; if (event != null ? !event.equals(action.event) : action.event != null) return false; return result != null ? result.equals(action.result) : action.result == null; }
public Action(String tenantId, String actionPlugin, String actionId, Event event) { super(tenantId, actionPlugin, actionId); this.event = event; if (event != null) { this.eventId = event.getId(); } this.ctime = System.currentTimeMillis(); }
public void addContext(String name, String value) { if (null == name || null == value) { throw new IllegalArgumentException("Propety must have non-null name and value"); } getContext().put(name, value); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ExternalConditionEval that = (ExternalConditionEval) o; if (condition != null ? !condition.equals(that.condition) : that.condition != null) return false; if (value != null ? !value.equals(that.value) : that.value != null) return false; return event != null ? event.equals(that.event) : that.event == null; }
return -1; if (o1.getEvent().getId() == null && o2.getEvent().getId() == null) { return 0; if (o1.getEvent().getId() == null && o2.getEvent().getId() != null) { return 1; if (o1.getEvent().getId() != null && o2.getEvent().getId() == null) { return -1; return o1.getEvent().getId().compareTo(o2.getEvent().getId()) * iOrder; case ACTION_PLUGIN: if (o1.getActionPlugin() == null && o2.getActionPlugin() == null) {
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; EventConditionEval that = (EventConditionEval) o; if (condition != null ? !condition.equals(that.condition) : that.condition != null) return false; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true; }