SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

95 lines
3.2 KiB

package de.superx.job;
import static com.fasterxml.jackson.annotation.JsonTypeInfo.As.EXISTING_PROPERTY;
import static com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME;
import org.apache.commons.lang.StringUtils;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use = NAME, include = EXISTING_PROPERTY, property = "type", visible = true)
public abstract class ActionNode {
public enum ActionType {
LOAD(LoadAction.class, 1),
DOSQL(SqlScriptAction.class, 2),
DOQUERY(SqlAction.class, 3),
UNLOAD(UnloadAction.class, 4),
MSG(null, 5),
TRANSFER(TransferAction.class, 6),
KETTLE(KettleAction.class, 7),
CONTAINER(ContainerNode.class, 8),
UNLOADPARAMS(UnloadParams.class, 9),
TIMESTAMP(Timestamp.class, 10),
LOAD_ETL_ROUTINES(LoadEtlRoutinesAction.class, 11),
LOAD_MONDRIAN_SCHEMA(LoadMondrianSchemaAction.class, 12),
UNKNOWN(null, 13),
EXTRACT(ExtractAction.class, 14),
UPGRADE_DBFORMS_CONFIG(UpgradeDbFormsConfigAction.class, 16),
EXECUTE_DBT(ExecuteDbtAction.class, 17),
UPDATE_METADATA(UpdateMetadataAction.class, 18),
EXECUTE_SQLFLUFF(ExecuteSQLFluffAction.class, 19),
REMOVE_SPRING_BATCH_HISTORY(RemoveSpringBatchHistoryAction.class, 20),
EXECUTE_ACTION_GROUP(ExecuteActionGroupAction.class, 21),
;
private Class<? extends ActionNode> clazz;
private int stepTypeId;
private ActionType(Class<? extends ActionNode> clazz, int stepTypeId) {
this.clazz = clazz;
this.stepTypeId = stepTypeId;
}
public int getStepTypeId() {
return this.stepTypeId;
}
public Class<? extends ActionNode> getActionClass() {
return this.clazz;
}
public static ActionType getActionTypeById(int stepTypeId) {
for(ActionType actionType : values()) {
if(actionType.getStepTypeId() == stepTypeId) {
return actionType;
}
}
return ActionType.UNKNOWN;
}
}
public ActionType type;
public String name;
public String id;
public Integer tid;
public Integer systemInfoId;
public boolean active;
public Integer custom;
public ActionNode(String name, String id, Integer systemInfoId, boolean active, Integer custom, ActionType type) {
if (name == null) {
throw new IllegalArgumentException("Name must not be null");
}
// table batch_step_execution.set_name is varchar(100)!
this.name = StringUtils.abbreviate(name, 100);
if (id == null || id.isEmpty()) {
this.id = this.name.toLowerCase().replace(" ", "_");
} else {
this.id = id;
}
this.type = type;
this.systemInfoId = systemInfoId;
this.active = active;
this.custom = custom;
}
public ActionNode(String name, String id, Integer systemInfoId, boolean active, ActionType type) {
this(name, id, systemInfoId, active, Integer.valueOf(0), type);
}
public ActionNode() {}
}