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 018/** 019 * 节点类型 020 * 021 * @author warm 022 * @since 2023/3/31 12:16 023 */ 024public enum PublishStatus { 025 EXPIRED(9, "已失效"), 026 UNPUBLISHED(0, "未发布"), 027 PUBLISHED(1, "已发布"); 028 029 private Integer key; 030 private String value; 031 032 PublishStatus(Integer key, String value) { 033 this.key = key; 034 this.value = value; 035 } 036 037 public static Integer getKeyByValue(String value) { 038 for (PublishStatus item : PublishStatus.values()) { 039 if (item.getValue().equals(value)) { 040 return item.getKey(); 041 } 042 } 043 return null; 044 } 045 046 public static String getValueByKey(Integer key) { 047 for (PublishStatus item : PublishStatus.values()) { 048 if (item.getKey().equals(key)) { 049 return item.getValue(); 050 } 051 } 052 return null; 053 } 054 055 public static PublishStatus getByKey(String key) { 056 for (PublishStatus item : PublishStatus.values()) { 057 if (item.getKey().equals(key)) { 058 return item; 059 } 060 } 061 return null; 062 } 063 064 public Integer getKey() { 065 return key; 066 } 067 068 public String getValue() { 069 return value; 070 } 071}