1. 新增数据源oracle,已在application.yml中配置
2. 新增任务状态类,未来将在切换任务状态中使用 3. 新增ProtectLevel实体类,用来存储Template对应的三种防护等级数据 4. Task实体类中删除protectObjectIds,因为MySQL表结构发生修改 5. TaskController新增audit和delete路由,用以审核和删除Task 6. TemplateMapper新增newProtectLevel方法 7.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.realtime.protection.configuration.utils;
|
||||
package com.realtime.protection.configuration.utils.status;
|
||||
|
||||
public class AuditStatusValidator {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.realtime.protection.configuration.utils.status;
|
||||
|
||||
import com.realtime.protection.configuration.utils.status.state.State;
|
||||
|
||||
public class StatusChanger {
|
||||
|
||||
private final State state;
|
||||
|
||||
public StatusChanger(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public static StatusChanger setOriginal(State original) {
|
||||
return new StatusChanger(original);
|
||||
}
|
||||
|
||||
public Boolean changeState(State newState) {
|
||||
return this.state.handle(newState);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.realtime.protection.configuration.utils.status.state;
|
||||
|
||||
public class PauseState implements State {
|
||||
@Override
|
||||
public Boolean handle(State newState) {
|
||||
if (!(newState instanceof RunningState)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return handleRun();
|
||||
}
|
||||
|
||||
private Boolean handleRun() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.realtime.protection.configuration.utils.status.state;
|
||||
|
||||
public class RunningState implements State {
|
||||
@Override
|
||||
public Boolean handle(State newState) {
|
||||
if (newState instanceof RunningState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newState instanceof PauseState) {
|
||||
return handlePause();
|
||||
}
|
||||
|
||||
if (newState instanceof StopState) {
|
||||
return handleStop();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Boolean handlePause() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean handleStop() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.realtime.protection.configuration.utils.status.state;
|
||||
|
||||
public interface State {
|
||||
|
||||
Boolean handle(State newState);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.realtime.protection.configuration.utils.status.state;
|
||||
|
||||
public class StopState implements State {
|
||||
|
||||
@Override
|
||||
public Boolean handle(State newState) {
|
||||
if (!(newState instanceof RunningState)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return handleRun();
|
||||
}
|
||||
|
||||
public Boolean handleRun() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user