public boolean isSame(Trigger t) { if (this.equals(t) && same(actions, t.actions) && autoDisable == t.autoDisable && autoEnable == t.autoEnable && autoResolve == t.autoResolve && autoResolveAlerts == t.autoResolveAlerts && autoResolveMatch == t.autoResolveMatch && same(context, t.context) && same(description, t.description) && enabled == t.enabled && same(eventCategory, t.eventCategory) && same(eventText, t.eventText) && eventType == t.eventType && firingMatch == t.firingMatch && same(memberOf, t.memberOf) && same(name, t.name) && severity == t.severity && same(source, t.source) && same(tags, t.tags) && type == t.type) { return true; } return false; }
public void setFiringMatch(Match firingMatch) { if (firingMatch == null) { firingMatch = Match.ALL; } this.firingMatch = firingMatch; setMatch(this.mode == Mode.FIRING ? getFiringMatch() : getAutoResolveMatch()); }
public void addContext(String name, String value) { if (null == name || null == value) { throw new IllegalArgumentException("Context must have non-null name and value"); } getContext().put(name, value); }
this.tenantId = trigger.getTenantId(); this.id = trigger.getId(); this.name = trigger.getName(); this.context = new HashMap<>(trigger.getContext()); this.tags = new HashMap<>(trigger.getTags()); this.actions = new HashSet<>(); for (TriggerAction action : trigger.getActions()) { this.actions.add(new TriggerAction(action)); this.autoDisable = trigger.isAutoDisable(); this.autoEnable = trigger.isAutoEnable(); this.autoResolve = trigger.isAutoResolve(); this.autoResolveAlerts = trigger.isAutoResolveAlerts(); this.autoResolveMatch = trigger.getAutoResolveMatch(); this.dataIdMap = new HashMap<>(trigger.getDataIdMap() != null ? trigger.getDataIdMap() : new HashMap<>()); this.eventCategory = trigger.getEventCategory(); this.eventText = trigger.getEventText(); this.eventType = trigger.getEventType(); this.memberOf = trigger.getMemberOf(); this.description = trigger.getDescription(); this.enabled = trigger.isEnabled(); this.firingMatch = trigger.getFiringMatch(); this.type = trigger.getType(); this.source = trigger.getSource(); this.severity = trigger.getSeverity(); this.mode = trigger.getMode() != null ? trigger.getMode() : Mode.FIRING; this.match = trigger.getMode() == Mode.FIRING ? trigger.getFiringMatch() : trigger.getAutoResolveMatch();
public Event(String tenantId, Trigger trigger, Dampening dampening, List<Set<ConditionEval>> evalSets) { this.tenantId = tenantId; this.trigger = trigger; this.dampening = dampening; this.evalSets = evalSets; this.eventType = EventType.EVENT.name(); this.ctime = System.currentTimeMillis(); this.id = trigger.getId() + "-" + this.ctime + "-" + UUID.randomUUID(); this.dataSource = trigger.getSource(); this.dataId = trigger.getId(); this.context = trigger.getContext(); if (!isEmpty(trigger.getEventCategory())) { this.category = trigger.getEventCategory(); } else { this.category = (EventType.ALERT == trigger.getEventType()) ? EventCategory.ALERT.name() : EventCategory.TRIGGER.name(); } if (!isEmpty(trigger.getEventText())) { this.text = trigger.getEventText(); } else { this.text = isEmpty(trigger.getDescription()) ? trigger.getName() : trigger.getDescription(); } this.tags = trigger.getTags(); }
switch (field) { case ID: 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.getDescription() == null && o2.getDescription() == null) { return 0; if (o1.getDescription() == null && o2.getDescription() != null) { return 1; if (o1.getDescription() != null && o2.getDescription() == null) { return -1;
String o1TriggerDesc = o1.getTrigger().getDescription(); String o2TriggerDesc = o2.getTrigger().getDescription(); if (o1TriggerDesc == null && o2TriggerDesc == null) { return 0; String o1TriggerId = o1.getTrigger().getId(); String o2TriggerId = o2.getTrigger().getId(); if (o1TriggerId == null && o2TriggerId == null) { return 0; String o1TriggerName = o1.getTrigger().getName(); String o2TriggerName = o2.getTrigger().getName(); if (o1TriggerName == null && o2TriggerName == null) { return 0;
public void addAction(TriggerAction triggerAction) { triggerAction.setTenantId(this.getTenantId()); getActions().add(triggerAction); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FullTrigger that = (FullTrigger) o; return trigger != null ? trigger.equals(that.trigger) : that.trigger == null; }
String o1TriggerDesc = null == o1.getTrigger() ? null : o1.getTrigger().getDescription(); String o2TriggerDesc = null == o2.getTrigger() ? null : o2.getTrigger().getDescription(); if (o1TriggerDesc == null && o2TriggerDesc == null) { return 0; String o1TriggerId = null == o1.getTrigger() ? null : o1.getTrigger().getId(); String o2TriggerId = null == o2.getTrigger() ? null : o2.getTrigger().getId(); if (o1TriggerId == null && o2TriggerId == null) { return 0; String o1TriggerName = null == o1.getTrigger() ? null : o1.getTrigger().getName(); String o2TriggerName = null == o2.getTrigger() ? null : o2.getTrigger().getName(); if (o1TriggerName == null && o2TriggerName == null) { return 0;
public void setAutoResolveMatch(Match autoResolveMatch) { if (autoResolveMatch == null) { autoResolveMatch = Match.ALL; } this.autoResolveMatch = autoResolveMatch; setMatch(this.mode == Mode.FIRING ? getFiringMatch() : getAutoResolveMatch()); }
public void setMode(Mode mode) { this.mode = mode; setMatch(this.mode == Mode.FIRING ? getFiringMatch() : getAutoResolveMatch()); }