Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2020-Present The Serverless Workflow Specification Authors
*
* Licensed 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 io.serverlessworkflow.impl.lifecycle;

import io.serverlessworkflow.impl.LifecycleEvents;

public enum EventType {
TASK_STARTED(LifecycleEvents.TASK_STARTED),
TASK_COMPLETED(LifecycleEvents.TASK_COMPLETED),
TASK_SUSPENDED(LifecycleEvents.TASK_SUSPENDED),
TASK_RESUMED(LifecycleEvents.TASK_RESUMED),
TASK_FAULTED(LifecycleEvents.TASK_FAULTED),
TASK_CANCELLED(LifecycleEvents.TASK_CANCELLED),
Comment thread
fjtirado marked this conversation as resolved.
TASK_RETRIED(LifecycleEvents.TASK_RETRIED),
WORKFLOW_STARTED(LifecycleEvents.WORKFLOW_STARTED),
WORKFLOW_COMPLETED(LifecycleEvents.WORKFLOW_COMPLETED),
WORKFLOW_SUSPENDED(LifecycleEvents.WORKFLOW_SUSPENDED),
WORKFLOW_RESUMED(LifecycleEvents.WORKFLOW_RESUMED),
WORKFLOW_FAULTED(LifecycleEvents.WORKFLOW_FAULTED),
WORKFLOW_CANCELLED(LifecycleEvents.WORKFLOW_CANCELLED),
WORKFLOW_STATUS_CHANGED(LifecycleEvents.WORKFLOW_STATUS_CHANGED);

private final String lifecycleId;

@Override
public String toString() {
return this.lifecycleId;
}
Comment thread
fjtirado marked this conversation as resolved.

EventType(String lifecycleId) {
this.lifecycleId = lifecycleId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskCancelledEvent extends TaskEvent {
public TaskCancelledEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_CANCELLED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskCompletedEvent extends TaskEvent {
public TaskCompletedEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_COMPLETED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public TaskFailedEvent(WorkflowContext workflow, TaskContext task, Throwable cau
public Throwable cause() {
return cause;
}

@Override
public EventType type() {
return EventType.TASK_FAULTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskResumedEvent extends TaskEvent {
public TaskResumedEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_RESUMED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskRetriedEvent extends TaskEvent {
public TaskRetriedEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_RETRIED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskStartedEvent extends TaskEvent {
public TaskStartedEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_STARTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ public class TaskSuspendedEvent extends TaskEvent {
public TaskSuspendedEvent(WorkflowContext workflow, TaskContext task) {
super(workflow, task);
}

@Override
public EventType type() {
return EventType.TASK_SUSPENDED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class WorkflowCancelledEvent extends WorkflowEvent {
public WorkflowCancelledEvent(WorkflowContextData workflow) {
super(workflow);
}

@Override
public EventType type() {
return EventType.WORKFLOW_CANCELLED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public WorkflowCompletedEvent(WorkflowContextData workflow, WorkflowModel output
public WorkflowModel output() {
return output;
}

@Override
public EventType type() {
return EventType.WORKFLOW_COMPLETED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ public WorkflowContextData workflowContext() {
public OffsetDateTime eventDate() {
return eventDate;
}

public abstract EventType type();
Comment thread
fjtirado marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ public WorkflowFailedEvent(WorkflowContextData workflow, Throwable cause) {
public Throwable cause() {
return cause;
}

@Override
public EventType type() {
return EventType.WORKFLOW_FAULTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class WorkflowResumedEvent extends WorkflowEvent {
public WorkflowResumedEvent(WorkflowContextData workflow) {
super(workflow);
}

@Override
public EventType type() {
return EventType.WORKFLOW_RESUMED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class WorkflowStartedEvent extends WorkflowEvent {
public WorkflowStartedEvent(WorkflowContextData workflow) {
super(workflow);
}

@Override
public EventType type() {
return EventType.WORKFLOW_STARTED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ public WorkflowStatus status() {
public WorkflowStatus previousStatus() {
return prevStatus;
}

@Override
public EventType type() {
return EventType.WORKFLOW_STATUS_CHANGED;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public class WorkflowSuspendedEvent extends WorkflowEvent {
public WorkflowSuspendedEvent(WorkflowContextData workflow) {
super(workflow);
}

@Override
public EventType type() {
return EventType.WORKFLOW_SUSPENDED;
}
}
Loading