All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.quickdao.module.operation.flow.generateEntity.single.SetEntityClassNameFlow Maven / Gradle / Ivy

There is a newer version: 5.3.1
Show newest version
package cn.schoolwow.quickdao.module.operation.flow.generateEntity.single;

import cn.schoolwow.quickdao.domain.entity.Entity;
import cn.schoolwow.quickdao.domain.operation.GenerateJavaSourceFileRequest;
import cn.schoolwow.quickdao.util.StringUtil;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class SetEntityClassNameFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        GenerateJavaSourceFileRequest generateJavaSourceFileRequest = (GenerateJavaSourceFileRequest) flowContext.checkData("generateJavaSourceFileRequest");
        Entity databaseEntity = (Entity) flowContext.checkData("databaseEntity");

        String entityClassName = StringUtil.underline2Camel(databaseEntity.tableName);
        entityClassName = entityClassName.toUpperCase().charAt(0)+entityClassName.substring(1);
        if(null!=generateJavaSourceFileRequest.entityClassNameMapping){
            String newEntityClassName = generateJavaSourceFileRequest.entityClassNameMapping.apply(databaseEntity,entityClassName);
            if(null!=newEntityClassName&&!newEntityClassName.isEmpty()){
                entityClassName = newEntityClassName;
            }
        }
        flowContext.putTemporaryData("entityClassName", entityClassName);
    }

    @Override
    public String name() {
        return "设置实体类名";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy