예제 #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;
     }
   }
 }
예제 #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;
     }
   }
 }
예제 #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);
         }
       }
     }
   }
 }
예제 #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());
         }
       }
     }
   }
 }
예제 #5
0
 public Element getAjaxIncludesNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "ajax-includes");
 }
예제 #6
0
 public Element getFiltersNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "filters");
 }
예제 #7
0
 public Element getMappingsNode() {
   return XmlUtils.getFirstNodeByTagName(xmlFile.getDocument(), "mappings");
 }