Skip to content

Commit

Permalink
feature: update scheduler and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kalencaya committed Sep 1, 2024
1 parent c636179 commit 404fb6c
Show file tree
Hide file tree
Showing 69 changed files with 1,988 additions and 1,605 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.schedule;

import cn.sliew.carp.framework.common.dict.DictInstance;
import cn.sliew.carp.framework.common.dict.common.YesOrNo;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ScheduleStatus implements DictInstance {

STOP(YesOrNo.NO.getValue(), "STOP"),
RUNNING(YesOrNo.YES.getValue(), "RUNNING"),
;

@JsonCreator
public static ScheduleStatus of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(ScheduleStatus.class, value));
}

@EnumValue
private String value;
private String label;

ScheduleStatus(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.workflow;

import cn.sliew.carp.framework.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WorkflowExecuteType implements DictInstance {

SEQUENTIAL("0", "Sequential"),
PARALLEL("1", "Parallel"),
DEPENDENT("2", "Dependent"),
IF("3", "If"),
SWITCH("4", "Switch"),
WHILE("5", "While"),
;

@JsonCreator
public static WorkflowExecuteType of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(WorkflowExecuteType.class, value));
}

@EnumValue
private String value;
private String label;

WorkflowExecuteType(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.workflow;

import cn.sliew.carp.framework.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WorkflowInstanceEvent implements DictInstance {

COMMAND_DEPLOY("0", "COMMAND_DEPLOY"),
COMMAND_SHUTDOWN("1", "COMMAND_SHUTDOWN"),
COMMAND_SUSPEND("2", "COMMAND_SUSPEND"),
COMMAND_RESUME("3", "COMMAND_RESUME"),
PROCESS_TASK_CHANGE("4", "PROCESS_TASK_CHANGE"),
PROCESS_SUCCESS("5", "PROCESS_SUCCESS"),
PROCESS_FAILURE("6", "PROCESS_FAILURE"),
;

@JsonCreator
public static WorkflowInstanceEvent of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(WorkflowInstanceEvent.class, value));
}

@EnumValue
private String value;
private String label;

WorkflowInstanceEvent(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.workflow;

import cn.sliew.carp.framework.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WorkflowInstanceState implements DictInstance {

PENDING("0", "PENDING"),
RUNNING("1", "RUNNING"),
SUSPEND("2", "SUSPEND"),
SUCCESS("3", "SUCCESS"),
FAILURE("4", "FAILURE"),
TERMINATED("5", "TERMINATED"),
;

@JsonCreator
public static WorkflowInstanceState of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(WorkflowInstanceState.class, value));
}

@EnumValue
private String value;
private String label;

WorkflowInstanceState(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.workflow;

import cn.sliew.carp.framework.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WorkflowTaskInstanceEvent implements DictInstance {

COMMAND_DEPLOY("0", "COMMAND_DEPLOY"),
COMMAND_SHUTDOWN("1", "COMMAND_SHUTDOWN"),
COMMAND_SUSPEND("2", "COMMAND_SUSPEND"),
COMMAND_RESUME("3", "COMMAND_RESUME"),

PROCESS_SUCCESS("4", "PROCESS_SUCCESS"),
PROCESS_FAILURE("5", "PROCESS_FAILURE"),
;

@JsonCreator
public static WorkflowTaskInstanceEvent of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(WorkflowTaskInstanceEvent.class, value));
}

@EnumValue
private String value;
private String label;

WorkflowTaskInstanceEvent(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package cn.sliew.carp.framework.common.dict.workflow;

import cn.sliew.carp.framework.common.dict.DictInstance;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Arrays;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WorkflowTaskInstanceStage implements DictInstance {

PENDING("0", "PENDING"),
RUNNING("1", "RUNNING"),
SUSPEND("3", "SUSPEND"),
SUCCESS("4", "SUCCESS"),
FAILURE("5", "FAILURE"),
TERMINATED("6", "TERMINATED"),
;

@JsonCreator
public static WorkflowTaskInstanceStage of(String value) {
return Arrays.stream(values())
.filter(instance -> instance.getValue().equals(value))
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(WorkflowTaskInstanceStage.class, value));
}

@EnumValue
private String value;
private String label;

WorkflowTaskInstanceStage(String value, String label) {
this.value = value;
this.label = label;
}

@Override
public String getValue() {
return value;
}

@Override
public String getLabel() {
return label;
}
}
Loading

0 comments on commit 404fb6c

Please sign in to comment.