Package generator

Source Code of generator.PopulationGenerator

/**
*
* APDPlat - Application Product Development Platform
* Copyright (c) 2013, 杨尚川, yang-shangchuan@qq.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

package generator;


import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apdplat.platform.generator.ActionGenerator;
import org.apdplat.platform.generator.MavenRunner;
import org.apdplat.platform.generator.ModelGenerator;
import org.apdplat.platform.generator.ModelGenerator.ModelInfo;
import org.apdplat.platform.generator.WebGenerator;
import org.apdplat.platform.generator.WindowsMavenRunner;



/**
*
* @author 杨尚川
*/
public class PopulationGenerator {
    /**
     * 根据类路径下的文件/generator/moduleProjectName/*.xls生成相应的模型
     * 编译模型之后再次生成相应的控制器
     * 生成的文件放置在moduleProjectName指定的项目下
     * @param args
     */
    public static void main(String[] args){
        //待生成的模型位于哪一个模块?物理文件夹名称
        String moduleProjectName="APDPlat_Module";       
        //运行此生成器之前确保*.xls已经建立完毕
        //并将*.xls拷贝到/generator/moduleProjectName/下
        //不会强行覆盖model,如果待生成的文件存在则会忽略生成
        //生成model
        List<ModelInfo> modelInfos=ModelGenerator.generate(moduleProjectName);       
        MavenRunner mavenRunner = new WindowsMavenRunner();
        String workspaceModuleBasePath = ActionGenerator.class.getResource("/").getFile().replace("target/classes/", "")+ "../" + moduleProjectName;
        //在程序生成Action之前先运行mvn install
        mavenRunner.run(workspaceModuleBasePath);           
        //不会强行覆盖ACTION,如果待生成的文件存在则会忽略生成
        //生成action
        ActionGenerator.generate(modelInfos,workspaceModuleBasePath);
        Set<String> generateModules=new HashSet<>();
        generateModules.add("infoCollect");
        //运行此生成器之前确保module.xml,和相关的model已经建立完毕
        WebGenerator.generate(generateModules);
    }
}
TOP

Related Classes of generator.PopulationGenerator

TOP
Copyright © 2018 www.massapi.com. 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.