public void applyChain(String name, boolean ordersRecoverable, boolean visible) {
    String oldjobChainName = Utils.getAttributeValue("name", _chain);
    if (oldjobChainName != null && oldjobChainName.length() > 0) {
      _dom.setChangedForDirectory("job_chain", oldjobChainName, SchedulerDom.DELETE);
    }
    Utils.setAttribute("name", name, _chain);
    Utils.setAttribute("orders_recoverable", ordersRecoverable, _chain);
    Utils.setAttribute("visible", visible, _chain);

    if (_chains == null) {
      _chains = new Element("job_chains");
      _config.addContent(_chains);
    }

    if (!_chains.getChildren("job_chain").contains(_chain)) _chains.addContent(_chain);

    update.updateJobChains();
    _dom.setChanged(true);
    // _dom.setChangedForDirectory("job_chain", name, SchedulerDom.MODIFY);
    _dom.setChangedForDirectory("job_chain", name, SchedulerDom.NEW);
  }
 public void deleteChain(int index) {
   List chains = _chains.getChildren("job_chain");
   String delname = Utils.getAttributeValue("name", (Element) chains.get(index));
   ((Element) chains.get(index)).detach();
   if (chains.size() == 0) {
     _config.removeChild("job_chains");
     _chains = null;
   }
   //
   _chainNames = new String[chains.size()];
   int i = 0;
   Iterator it = chains.iterator();
   while (it.hasNext()) {
     Element chain = (Element) it.next();
     String name = Utils.getAttributeValue("name", chain);
     _chainNames[i++] = name;
   }
   //
   _dom.setChanged(true);
   _dom.setChangedForDirectory("job_chain", delname, SchedulerDom.DELETE);
   _chain = null;
   update.updateJobChains();
 }