Exemplo n.º 1
0
 private String tranCH2En(String[] urls, IARESProject project) throws Exception {
   StringBuffer sb = new StringBuffer();
   IARESModuleRoot root = project.getModuleRoot(getModuleRootByCHName(urls[0], project));
   if (root != null) {
     for (int i = 1; i < urls.length; i++) {
       for (IARESModule module : root.getModules()) {
         IARESResource property = module.getARESResource(IARESModule.MODULE_PROPERTY_FILE);
         if (property != null && property.exists()) {
           try {
             ModuleProperty info = property.getInfo(ModuleProperty.class);
             if (info != null) {
               Object obj = info.getValue(ICommonModel.CNAME);
               if (obj != null) {
                 if (StringUtils.equals(urls[i], obj.toString())) {
                   sb.append("/");
                   sb.append(module.getShortName());
                   break;
                 }
               }
             }
           } catch (Exception e) {
             e.printStackTrace();
           }
         }
       }
     }
     for (String enname : urls) {
       root.getModule(enname);
     }
   }
   return sb.toString();
 }
Exemplo n.º 2
0
 private String getModuleRootByCHName(String chname, IARESProject project)
     throws ARESModelException {
   if (StringUtils.equals(chname, "数据库")) {
     return "database";
   } else if (StringUtils.equals(chname, "业务逻辑")) {
     if (project.getModuleRoot("business") != null && project.getModuleRoot("business").exists()) {
       return "business";
     } else if (project.getModuleRoot("service") != null
         && project.getModuleRoot("service").exists()) {
       return "service";
     }
   } else if (StringUtils.equals(chname, "原子")) {
     return "atom";
   } else if (StringUtils.equals(chname, "过程")) {
     return "procedure";
   } else if (StringUtils.equals(chname, "逻辑")) {
     return "logic";
   } else if (StringUtils.equals(chname, "对象")) {
     return "objects";
   }
   return StringUtils.EMPTY;
 }
Exemplo n.º 3
0
 private String getModuleEN(String key, IARESProject project) throws ARESModelException {
   if (StringUtils.startsWith(key, "数据库/")) {
     return StringUtils.replaceOnce(key, "数据库/", "database/");
   } else if (StringUtils.startsWith(key, "数据库\\")) {
     return StringUtils.replaceOnce(key, "数据库\\", "database\\");
   } else if (StringUtils.startsWith(key, "业务逻辑/")) {
     if (project.getModuleRoot("business") != null && project.getModuleRoot("business").exists()) {
       return StringUtils.replaceOnce(key, "业务逻辑/", "business/");
     } else if (project.getModuleRoot("service") != null
         && project.getModuleRoot("service").exists()) {
       System.out.println("asdasasasdad");
       return StringUtils.replaceOnce(key, "业务逻辑/", "service/");
     }
   } else if (StringUtils.startsWith(key, "业务逻辑\\")) {
     if (project.getModuleRoot("business") != null && project.getModuleRoot("business").exists()) {
       return StringUtils.replaceOnce(key, "业务逻辑\\", "business\\");
     } else if (project.getModuleRoot("service") != null
         && project.getModuleRoot("service").exists()) {
       return StringUtils.replaceOnce(key, "业务逻辑\\", "service\\");
     }
   } else if (StringUtils.startsWith(key, "原子/")) {
     return StringUtils.replaceOnce(key, "原子/", "atom/");
   } else if (StringUtils.startsWith(key, "原子\\")) {
     return StringUtils.replaceOnce(key, "原子\\", "atom\\");
   } else if (StringUtils.startsWith(key, "过程/")) {
     return StringUtils.replaceOnce(key, "过程/", "procedure/");
   } else if (StringUtils.startsWith(key, "过程\\")) {
     return StringUtils.replaceOnce(key, "过程\\", "procedure\\");
   } else if (StringUtils.startsWith(key, "对象/")) {
     return StringUtils.replaceOnce(key, "对象/", "objects/");
   } else if (StringUtils.startsWith(key, "对象\\")) {
     return StringUtils.replaceOnce(key, "对象\\", "objects\\");
   } else if (StringUtils.startsWith(key, "逻辑/")) {
     return StringUtils.replaceOnce(key, "逻辑/", "logic/");
   } else if (StringUtils.startsWith(key, "逻辑\\")) {
     return StringUtils.replaceOnce(key, "逻辑\\", "logic\\");
   }
   return key;
 }