Ejemplo n.º 1
0
 public Trigger getTopParent() {
   Trigger tmp = this;
   while (tmp.getParent() != null) {
     tmp = tmp.getParent();
   }
   return tmp;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }
Ejemplo n.º 4
0
 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);
 }