Search in sources :

Example 6 with DalConfigHost

use of com.ctrip.platform.dal.daogen.host.DalConfigHost in project dal by ctripcorp.

the class CSharpCodeGenContextCreator method process.

@Override
public void process(CodeGenContext context) throws Exception {
    try {
        CSharpCodeGenContext ctx = (CSharpCodeGenContext) context;
        Project project = BeanGetter.getDaoOfProject().getProjectByID(ctx.getProjectId());
        DalConfigHost dalConfigHost = null;
        if (project.getDal_config_name() != null && !project.getDal_config_name().isEmpty()) {
            dalConfigHost = new DalConfigHost(project.getDal_config_name());
        } else if (project.getNamespace() != null && !project.getNamespace().isEmpty()) {
            dalConfigHost = new DalConfigHost(project.getNamespace());
        } else {
            dalConfigHost = new DalConfigHost("");
        }
        ctx.setDalConfigHost(dalConfigHost);
        ctx.setNamespace(project.getNamespace());
    } catch (Throwable e) {
        LoggerManager.getInstance().error(e);
        throw e;
    }
}
Also used : Project(com.ctrip.platform.dal.daogen.entity.Project) CSharpCodeGenContext(com.ctrip.platform.dal.daogen.generator.csharp.CSharpCodeGenContext) DalConfigHost(com.ctrip.platform.dal.daogen.host.DalConfigHost)

Aggregations

DalConfigHost (com.ctrip.platform.dal.daogen.host.DalConfigHost)6 Project (com.ctrip.platform.dal.daogen.entity.Project)4 DaoOfDatabaseSet (com.ctrip.platform.dal.daogen.dao.DaoOfDatabaseSet)2 CSharpCodeGenContext (com.ctrip.platform.dal.daogen.generator.csharp.CSharpCodeGenContext)2 JavaCodeGenContext (com.ctrip.platform.dal.daogen.generator.java.JavaCodeGenContext)2 DatabaseSet (com.ctrip.platform.dal.daogen.entity.DatabaseSet)1 DatabaseSetEntry (com.ctrip.platform.dal.daogen.entity.DatabaseSetEntry)1 HashMap (java.util.HashMap)1