Changes
parent
f0eef59046
commit
28bb6d11e3
|
@ -11,26 +11,55 @@ import java.util.Date;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class GenerateConstant {
|
public class GenerateConstant {
|
||||||
|
public static final String DATA_FIELD = "DataEngineValueActuator";
|
||||||
|
public static final String DATA_RECORD = "DataEngineRecordActuator";
|
||||||
|
public static final String DATA_SET = "DataEngineSetActuator";
|
||||||
|
// public static final String ACTION_IMPORT = "import com.muyu.rule.engine.action.ActionDiscard;";
|
||||||
|
public static final String SCOPE_IMPORT = "import com.muyu.rule.engine.scope.DataModelEngine";
|
||||||
public static final String PACKAGE_PATH = "package com.muyu.rule.generate;";
|
public static final String PACKAGE_PATH = "package com.muyu.rule.generate;";
|
||||||
|
public static final String VALUE_ACTUATOR = "import rule.data.engine.basic.abstracts.DataEngineValueActuator;";
|
||||||
|
|
||||||
|
public static String getClassName(String versionCode) {
|
||||||
|
String[] splits = versionCode.split("_");
|
||||||
|
String className = "";
|
||||||
|
for (String split : splits) {
|
||||||
|
className += split.substring(0, 1).toUpperCase() + split.substring(1);
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String generateConstant(Rule rule, RuleEdition ruleEdition) {
|
public static String generateConstant(Rule rule, RuleEdition ruleEdition) {
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
String format = simpleDateFormat.format(new Date());
|
String format = simpleDateFormat.format(new Date());
|
||||||
return
|
return
|
||||||
PACKAGE_PATH + "\n" +
|
PACKAGE_PATH + "\n" +
|
||||||
"import rule.data.engine.basic.abstracts.DataEngineValueActuator;\n" +
|
VALUE_ACTUATOR +
|
||||||
"/**\n" +
|
"/**\n" +
|
||||||
" * @date: " + format + "\n" +
|
" * @date: " + format + "\n" +
|
||||||
" * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
|
" * @Description: " + ruleEdition.getName() + "_" + ruleEdition.getRuleKind() + "\n" +
|
||||||
" * @Version: 1.0\n" +
|
" * @Version: 1.0\n" +
|
||||||
" */\n" +
|
" */\n" +
|
||||||
"public class " + rule.getName() + ruleEdition.getRuleCoding() + " extends " + "DataEngineValueActuator" + " {\n" +
|
"public class " + getClassName(rule.getName() + ruleEdition.getRuleCoding()) + " extends " + "DataEngineValueActuator" + " {\n" +
|
||||||
" @Override\n" +
|
" @Override\n" +
|
||||||
" public void run () {\n" +
|
" public void run () {\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String selectType(String level) {
|
||||||
|
String type = "";
|
||||||
|
switch (level) {
|
||||||
|
case "F":
|
||||||
|
type = DATA_FIELD;
|
||||||
|
break;
|
||||||
|
case "R":
|
||||||
|
type = DATA_RECORD;
|
||||||
|
break;
|
||||||
|
case "C":
|
||||||
|
type = DATA_SET;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue