Package org.radsimplified.genapp.metadata

Examples of org.radsimplified.genapp.metadata.App


    codeFile.close();
  }
 
  public static void generateApp() throws IOException {
   
    App app = App.getApp();

    String[] entityCodeTypes = {"", "Controller", "Service", "ServiceImpl"};
   
    String gcPath =  GenApp.properties.getProperty("codePath"); // "/home/" + GenApp.user + "/workspace/";
    String rootPath =  gcPath + app.getArtifactId() + "/";
    String packagePath = rootPath + "src/main/java/" + app.getGroupId().replace('.', '/') + "/" + app.getArtifactId() + "/";
   
    File rootDir = new File(gcPath + app.getArtifactId());

    if (!rootDir.exists()) {
     
      FileUtil.copy(GenApp.properties.getProperty("skeleton"), gcPath + app.getArtifactId());
      mkdir(packagePath + "generated/common");
      mkdir(packagePath + "generated/converters");
      mkdir(packagePath + "common");
      for (String module: app.getModules()) {
        mkdir(packagePath + "generated/" + module);
        mkdir(packagePath + "handcrafted/" + module);
        mkdir(packagePath + module);
        mkdir(rootPath + "src/main/webapp/WEB-INF/views/" + module);
      }
    }

    VelocityContext appData = new VelocityContext();
    appData.put("app", app);
    appData.put("helper", new Helper());
    appData.put("userEntity", app.getEntity("User"));
    appData.put("dolCurly", "${");

    generateCode(rootPath + "pom.xml", "pom.xml.vm", appData, false);
    generateCode(rootPath + "src/main/resources/app.properties", "app.properties.vm", appData, true);
    generateCode(rootPath + "src/main/webapp/WEB-INF/messages/messagesGenerated.properties", "messagesGenerated.properties.vm", appData, true);
    generateCode(rootPath + "src/main/webapp/WEB-INF/spring/app-config.xml", "app-config.xml.vm", appData, true);
    generateCode(rootPath + "src/main/webapp/WEB-INF/spring/mail.xml", "mail.xml.vm", appData, true);
    generateCode(packagePath + "generated/common/Ref.java", "Ref.java.vm", appData, true);
    generateCode(packagePath + "generated/common/PageInfo.java", "PageInfo.java.vm", appData, true);
    generateCode(packagePath + "generated/common/Paginate.java", "Paginate.java.vm", appData, true);
    generateCode(packagePath + "generated/common/SelectOption.java", "SelectOption.java.vm", appData, true);
    generateCode(packagePath + "generated/common/SmtpAuthenticator.java", "SmtpAuthenticator.java.vm", appData, true);
    generateCode(packagePath + "generated/common/HelperGenerated.java", "HelperGenerated.java.vm", appData, true);
    generateCode(packagePath + "common/Helper.java", "Helper.java.vm", appData, false);
    generateCode(packagePath + "generated/common/CaptchaController.java", "CaptchaController.java.vm", appData, true);
    generateCode(packagePath + "generated/common/BaseControllerGenerated.java", "BaseControllerGenerated.java.vm", appData, true);
    generateCode(packagePath + "common/BaseController.java", "BaseController.java.vm", appData, true);
    generateCode(packagePath + "generated/common/RootControllerGenerated.java", "RootControllerGenerated.java.vm", appData, true);
    generateCode(packagePath + "common/RootController.java", "RootController.java.vm", appData, false);
    generateCode(packagePath + "generated/ChangePasswordForm.java", "ChangePasswordForm.java.vm", appData, true);
    generateCode(packagePath + "generated/ForgotPasswordForm.java", "ForgotPasswordForm.java.vm", appData, true);
    generateCode(packagePath + "generated/common/BaseEntityGenerated.java", "BaseEntityGenerated.java.vm", appData, true);
    generateCode(packagePath + "common/BaseEntity.java", "BaseEntity.java.vm", appData, false);
    generateCode(packagePath + "generated/common/BaseServiceGenerated.java", "BaseServiceGenerated.java.vm", appData, true);
    generateCode(packagePath + "generated/common/BaseServiceImplGenerated.java", "BaseServiceImplGenerated.java.vm", appData, true);
    generateCode(packagePath + "common/BaseService.java", "BaseService.java.vm", appData, true);
    generateCode(packagePath + "common/BaseServiceImpl.java", "BaseServiceImpl.java.vm", appData, true);
    generateCode(rootPath + "src/main/webapp/WEB-INF/views/register.jsp", "register.jsp.vm", appData, true);

    for (BizEntity entity: app.getEntities()) {
     
      appData.put("entity", entity);
     
      for (String codeType: entityCodeTypes) {
        generateCode(packagePath + "generated/" + entity.getModuleUrl() + "/" +
View Full Code Here

TOP

Related Classes of org.radsimplified.genapp.metadata.App

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.