protected String getParameterDefaultValue(String defValue, StandardField field) {
   if (StringUtils.isBlank(defValue)) {
     try {
       TypeDefaultValue tdv =
           MetadataServiceProvider.getTypeDefaultValueOfStdFieldByName(project, field.getName());
       if (tdv != null) {
         if (resource != null && StringUtils.equals(resource.getType(), "procedure")) {
           String dt =
               (String)
                   ((ARESProjectProperty) project.getProjectProperty())
                       .getProperties()
                       .get("dbType");
           if (StringUtils.isNotBlank(dt)) {
             return tdv.getData().get(dt.toLowerCase());
           }
         } else {
           return tdv.getData().get(dataType);
         }
       }
     } catch (Exception e) {
       // e.printStackTrace();
     }
   }
   return defValue;
 }
Пример #2
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();
 }
Пример #3
0
 private static boolean isOldProject(IARESProject project) {
   try {
     return !project.getProject().hasNature("com.hundsun.ares.studio.jres.core.modulenature");
   } catch (CoreException e) {
     e.printStackTrace();
   }
   return false;
 }
Пример #4
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;
 }
Пример #5
0
 /**
  * @param editingDomain
  * @param viewer
  * @param info
  * @param bundle
  * @return
  */
 private static List<IAction> getConstantSampleAction(
     ColumnViewer viewer, EditingDomain editingDomain, ConstantList info, IARESProject project) {
   List<IAction> actions = new ArrayList<IAction>();
   String text = "导出JAVA常量声明类";
   String scriptDir = "tools";
   if (isOldProject(project)) {
     scriptDir = "others";
   }
   URL url = null;
   try {
     url =
         new URL(
             project.getProject().getLocationURI()
                 + "/"
                 + scriptDir
                 + "/"
                 + "logical_constant_generate_java.js");
   } catch (MalformedURLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   IAction action =
       new AddSampleAction(
           viewer,
           editingDomain,
           text,
           info,
           url,
           "/"
               + project.getProject().getName()
               + "/"
               + scriptDir
               + "/"
               + "logical_constant_generate_java.js");
   actions.add(action);
   return actions;
 }
Пример #6
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;
 }
 private boolean hasReference(IARESProject proj, IContainer container) {
   for (IResPathEntry entry : proj.getRawResPath()) {
     if (container.getFullPath().isPrefixOf(entry.getPath())) return true;
   }
   return false;
 }
Пример #8
0
  /**
   * @param viewer
   * @param editingDomain
   * @param info
   * @param project
   * @return
   */
  private static List<IAction> getMenuSampleAction(
      ColumnViewer viewer, EditingDomain editingDomain, MenuList info, IARESProject project) {
    List<IAction> actions = new ArrayList<IAction>();
    String text = "更新功能列表";
    String scriptDir = "tools";
    if (isOldProject(project)) {
      scriptDir = "others";
    }
    URL url = null;
    try {
      url =
          new URL(
              project.getProject().getLocationURI()
                  + "/"
                  + scriptDir
                  + "/"
                  + "logical_menuFunction_infoUpdate.js");
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    IAction action =
        new AddSampleAction(
            viewer,
            editingDomain,
            text,
            info,
            url,
            "/"
                + project.getProject().getName()
                + "/"
                + scriptDir
                + "/"
                + "logical_menuFunction_infoUpdate.js");
    actions.add(action);

    text = "生成SQL";
    try {
      url =
          new URL(
              project.getProject().getLocationURI()
                  + "/"
                  + scriptDir
                  + "/"
                  + "logical_menu_generate_sql.js");
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    action =
        new AddSampleAction(
            viewer,
            editingDomain,
            text,
            info,
            url,
            "/"
                + project.getProject().getName()
                + "/"
                + scriptDir
                + "/"
                + "logical_menu_generate_sql.js");
    actions.add(action);
    return actions;
  }