Exemplo n.º 1
0
 public void loadFromFile(String fileName, boolean force) {
   if (!isLoaded || force) {
     xmlFile = new KXmlFile();
     try {
       xmlFile.loadFromFile(fileName);
       initContollers();
       isLoaded = true;
     } catch (Exception e) {
       Ko.klogger()
           .log(Level.WARNING, "Impossible de lire le fichier de validation : " + fileName, e);
       isLoaded = false;
     }
   }
 }
Exemplo n.º 2
0
 public void loadFromFile(String fileName, boolean force) {
   if (!isLoaded || force) {
     xmlFile = new KXmlFile();
     try {
       xmlFile.loadFromFile(fileName);
       initMappings();
       isLoaded = true;
     } catch (Exception e) {
       Ko.klogger()
           .log(
               Level.SEVERE,
               "Impossible de terminer la lecture du fichier de configuration " + fileName,
               e);
       isLoaded = false;
     }
   }
 }
Exemplo n.º 3
0
 private void initMappings() {
   NodeList nodes = xmlFile.getChildNodes();
   for (int i = 0; i < nodes.getLength(); i++) {
     if (nodes.item(i).getNodeName().equals("mappings")) {
       NodeList cNodes = nodes.item(i).getChildNodes();
       for (int j = 0; j < cNodes.getLength(); j++) {
         if (cNodes.item(j).getNodeName().equals("mapping")) {
           KMapping mapping = new KMapping();
           mapping.initFromXml(cNodes.item(j));
           mappings.add(mapping);
           mapping.setParentObject(mappings);
         } else if (cNodes.item(j).getNodeName().equals("virtualMapping")) {
           KMapping mapping = new KVirtualMapping();
           mapping.initFromXml(cNodes.item(j));
           mappings.add(mapping);
           mapping.setParentObject(mappings);
         }
       }
     } else if (nodes.item(i).getNodeName().equals("ajax-includes")) {
       NodeList cNodes = nodes.item(i).getChildNodes();
       for (int j = 0; j < cNodes.getLength(); j++) {
         if (cNodes.item(j).getNodeName().equals("request")) {
           KAjaxRequest ajaxRequest = new KAjaxRequest();
           ajaxRequest.initFromXml(cNodes.item(j));
           ajaxIncludes.add(ajaxRequest);
           ajaxRequest.setParentObject(ajaxIncludes);
         }
       }
     } else if (nodes.item(i).getNodeName().equals("filters")) {
       NodeList cNodes = nodes.item(i).getChildNodes();
       for (int j = 0; j < cNodes.getLength(); j++) {
         if (cNodes.item(j).getNodeName().equals("filter")) {
           KFilter filter = new KFilter();
           filter.initFromXml(cNodes.item(j));
           filters.add(filter);
           filter.setParentObject(filters);
         }
       }
     }
   }
 }
Exemplo n.º 4
0
 public void initContollers() {
   KTesterController testerCtrl = new KTesterController();
   testerCtrl.initFromXML(null);
   testerCtrl.setEr(er);
   testerCtrl.setMessages(messages);
   kobjectControllers.put("KTester", testerCtrl);
   NodeList nodes = xmlFile.getChildNodes();
   for (int i = 0; i < nodes.getLength(); i++) {
     if (nodes.item(i).getNodeName().equals("class")) {
       String className = ((Element) nodes.item(i)).getAttribute("name");
       if (className != null && className != "") {
         KObjectController koCtrl = getObjectController(className);
         if (koCtrl != null) {
           koCtrl.initFromXML(nodes.item(i));
           koCtrl.setEr(er);
           koCtrl.setMessages(messages);
           Ko.koDisplays.put(className, koCtrl.getDisplayInstance());
         }
       }
     }
   }
 }
Exemplo n.º 5
0
 public Element getAjaxIncludesNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "ajax-includes");
 }
Exemplo n.º 6
0
 public Element getFiltersNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "filters");
 }
Exemplo n.º 7
0
 public Element getMappingsNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "mappings");
 }