Пример #1
0
 public Map<String, Map<String, Integer>> getLabelReferences()
     throws IOException, SAXException, ParserConfigurationException, GenericServiceException {
   if (this.labels.size() == 0) {
     // Nothing to search for
     return references;
   }
   // get labels from FTL files
   getLabelsFromFtlFiles();
   // get labels from java files
   getLabelsFromJavaFiles();
   // get labels from simple method files
   getLabelsFromSimpleMethodFiles();
   // get labels from widgets files
   List<File> fileList = FastList.newInstance();
   for (String rootFolder : this.rootFolders) {
     fileList.addAll(FileUtil.findXmlFiles(rootFolder + "webapp", null, null, null));
     fileList.addAll(FileUtil.findXmlFiles(rootFolder + "widget", null, null, null));
   }
   for (File file : fileList) {
     String inFile = FileUtil.readString("UTF-8", file);
     if (inFile.contains("</forms>")) {
       getLabelsFromFormWidgets(inFile, file);
       findLabelKeyInElement(inFile, file.getPath(), "set");
       continue;
     }
     if (inFile.contains("</screens>")
         || inFile.contains("</menus>")
         || inFile.contains("</trees>")) {
       findUiLabelMapInFile(inFile, file.getPath());
       findLabelKeyInElement(inFile, file.getPath(), "set");
       continue;
     }
   }
   // get labels from Ofbiz components files
   getLabelsFromOfbizComponents();
   return references;
 }
Пример #2
0
 private void getLabelsFromOfbizComponents()
     throws IOException, SAXException, ParserConfigurationException {
   List<File> componentsFiles =
       FileUtil.findXmlFiles(
           null, null, "ofbiz-component", "http://ofbiz.apache.org/dtds/ofbiz-component.xsd");
   for (File componentFile : componentsFiles) {
     String filePath = componentFile.getPath();
     Document menuDocument = UtilXml.readXmlDocument(componentFile.toURI().toURL());
     Element rootElem = menuDocument.getDocumentElement();
     for (Element elem1 : UtilXml.childElementList(rootElem)) {
       checkOfbizComponentTag(elem1, filePath);
       for (Element elem2 : UtilXml.childElementList(elem1)) {
         checkOfbizComponentTag(elem2, filePath);
       }
     }
   }
 }