Open Kilda Java Documentation
FlowState.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.payload.flow;
17 
18 import com.fasterxml.jackson.annotation.JsonCreator;
19 import com.fasterxml.jackson.annotation.JsonProperty;
20 
24 public enum FlowState {
28  ALLOCATED("Allocated"),
29 
33  IN_PROGRESS("In progress"),
34 
38  UP("Up"),
39 
43  DOWN("Down"),
44 
48  CACHED("Cached");
49 
53  @JsonProperty("state")
54  private final String state;
55 
61  @JsonCreator
62  FlowState(@JsonProperty("state") final String state) {
63  this.state = state;
64  }
65 
71  public String getState() {
72  return this.state;
73  }
74 
78  @Override
79  public String toString() {
80  return state;
81  }
82 
83  public boolean isActive() {
84  return this == UP;
85  }
86 
87  public boolean isActiveOrCached() {
88  return this == UP || this == CACHED;
89  }
90 }
91