use of com.orion.ops.consts.machine.MachineEnvAttr in project orion-ops by lijiahangmax.
the class MachineEnvServiceImpl method initEnv.
@Override
public void initEnv(Long machineId) {
List<String> keys = MachineEnvAttr.getKeys();
for (String key : keys) {
MachineEnvDO env = new MachineEnvDO();
MachineEnvAttr attr = MachineEnvAttr.of(key);
env.setMachineId(machineId);
env.setDescription(attr.getDescription());
env.setAttrKey(attr.getKey());
switch(attr) {
case TAIL_OFFSET:
env.setAttrValue(Const.TAIL_OFFSET_LINE + Strings.EMPTY);
break;
case TAIL_CHARSET:
case SFTP_CHARSET:
env.setAttrValue(Const.UTF_8);
break;
case TAIL_DEFAULT_COMMAND:
env.setAttrValue(CommandConst.TAIL_FILE_DEFAULT);
break;
default:
break;
}
machineEnvDAO.insert(env);
// 插入历史记录
historyValueService.addHistory(env.getId(), HistoryValueType.MACHINE_ENV, HistoryOperator.ADD, null, env.getAttrValue());
}
}
Aggregations