public Trigger getTopParent() { Trigger tmp = this; while (tmp.getParent() != null) { tmp = tmp.getParent(); } return tmp; }
private String getTableTriggerId(Trigger g) { if (g == null) return null; String id = g.getName().replace(".", "-"); Trigger group = g; while ((group = group.getParent()) != null) { id = group.getName().replace(".", "-") + "." + id; } return id; }
/** * Used by Core-TriggerDaemon to determine when to store TriggerUnits file Used by * Core-ScriptDaemon to determine when to delete TriggerUnits file * * @return */ public boolean hasAnyParentScript() { Trigger tmp = this.getParent(); while (tmp != null) { if (tmp.getScript() != null) { return true; } else { tmp = tmp.getParent(); } } return false; }
public void setParent(Trigger newParent) { if (this.parent != null) parent.removeChild(this); if (newParent == null) { this.parent = newParent; return; } if (newParent.getTriggerType() == TRIGGER_TYPE_BASIC) throw new IllegalArgumentException("Parent trigger must be a COMPOSITE trigger"); Trigger tmpParent = newParent; while (tmpParent != null) { if (tmpParent.getId().equals(this.getId())) { throw new IllegalArgumentException( "Parent reference loop occurred for " + tmpParent.getName() + " (" + tmpParent.getId() + ")"); } tmpParent = tmpParent.getParent(); } this.parent = newParent; this.parent.addChild(this); }