package foundation.io.define;
|
|
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.Logger;
|
|
import foundation.dao.DataWriter;
|
import foundation.data.entity.Entity;
|
import foundation.monitor.Progressor;
|
import foundation.persist.NamedSQL;
|
|
|
public class IOWorkStep {
|
|
protected static Logger logger;
|
private String id;
|
private String name;
|
private String title;
|
private String sqlName;
|
private String codeRule;
|
private String defaultValue;
|
private int no;
|
private boolean active;
|
|
static {
|
logger = LogManager.getLogger(IOWorkStep.class);
|
}
|
|
public IOWorkStep() {
|
|
}
|
|
public void load(Entity entity) {
|
id = entity.getString("id");
|
name = entity.getString("name");
|
title = entity.getString("title");
|
sqlName = entity.getString("sql_name");
|
no = entity.getInteger("order_no", 0);
|
active = entity.getBoolean("is_active", true);
|
defaultValue = entity.getString("default_value");
|
}
|
|
public void exec(IOSQLContext context, Progressor progressor, DataWriter dataWriter) throws Exception {
|
progressor.appendLine("运行 Action:" + title + "(" + name + ")");
|
|
NamedSQL namedSql = NamedSQL.getInstance(sqlName);
|
context.setParametersTo(namedSql);
|
namedSql.setParam("defaultValue", defaultValue);
|
namedSql.execute();
|
}
|
|
public void exec() throws Exception {
|
logger.debug("运行 Action:" + title + "(" + name + ")");
|
|
NamedSQL namedSql = NamedSQL.getInstance(sqlName);
|
namedSql.execute();
|
}
|
|
public String getId() {
|
return id;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public String getSqlName() {
|
return sqlName;
|
}
|
|
public int getNo() {
|
return no;
|
}
|
|
public boolean isActive() {
|
return active;
|
}
|
|
public String getCodeRule() {
|
return codeRule;
|
}
|
|
}
|