001/* 002 * Copyright 2024-2025, Warm-Flow (290631660@qq.com). 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.dromara.warm.flow.core.enums; 017 018import org.dromara.warm.flow.core.utils.ObjectUtil; 019 020public enum ActivityStatus { 021 022 SUSPENDED(0,"挂起"), 023 024 ACTIVITY(1,"激活"); 025 026 private Integer key; 027 private String value; 028 029 ActivityStatus(Integer key, String value) { 030 this.key = key; 031 this.value = value; 032 } 033 034 public Integer getKey() { 035 return key; 036 } 037 038 public String getValue() { 039 return value; 040 } 041 public static Integer getKeyByValue(String value) { 042 for (ActivityStatus item : ActivityStatus.values()) { 043 if (item.getValue().equals(value)) { 044 return item.getKey(); 045 } 046 } 047 return null; 048 } 049 050 public static String getValueByKey(Integer Key) { 051 for (ActivityStatus item : ActivityStatus.values()) { 052 if (item.getKey().equals(Key)) { 053 return item.getValue(); 054 } 055 } 056 return null; 057 } 058 059 public static ActivityStatus getByKey(String key) { 060 for (ActivityStatus item : ActivityStatus.values()) { 061 if (item.getKey().equals(key)) { 062 return item; 063 } 064 } 065 return null; 066 } 067 068 /** 069 * 判断流程是否激活 070 * @param Key 071 * @return 072 */ 073 public static Boolean isActivity(Integer Key) { 074 return ObjectUtil.isNotNull(Key) && (ActivityStatus.ACTIVITY.getKey().equals(Key)); 075 } 076}