| .. | .. |
|---|
| 1 | +/* |
|---|
| 2 | +* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved. |
|---|
| 3 | +*/ |
|---|
| 1 | 4 | package net.curisit.securis.db; |
|---|
| 2 | 5 | |
|---|
| 3 | 6 | import net.curisit.securis.db.common.CodedEnum; |
|---|
| .. | .. |
|---|
| 6 | 9 | import com.fasterxml.jackson.annotation.JsonValue; |
|---|
| 7 | 10 | |
|---|
| 8 | 11 | /** |
|---|
| 9 | | - * Contains the possible pack statuses. For further details: |
|---|
| 10 | | - * https://redmine.curistec.com/projects/securis/wiki/LicensesServerManagement |
|---|
| 11 | | - * |
|---|
| 12 | | - * @author rob |
|---|
| 13 | | - */ |
|---|
| 12 | +* PackStatus |
|---|
| 13 | +* <p> |
|---|
| 14 | +* Enumerates possible pack lifecycle statuses. JSON representation is the short code. |
|---|
| 15 | +* See: https://redmine.curistec.com/projects/securis/wiki/LicensesServerManagement |
|---|
| 16 | +* |
|---|
| 17 | +* @author JRA |
|---|
| 18 | +* Last reviewed by JRA on Oct 5, 2025. |
|---|
| 19 | +*/ |
|---|
| 14 | 20 | public enum PackStatus implements CodedEnum { |
|---|
| 21 | + |
|---|
| 22 | + // Available status for the pack |
|---|
| 15 | 23 | CREATED("CR"), ACTIVE("AC"), ON_HOLD("OH"), EXPIRED("EX"), CANCELLED("CA"); |
|---|
| 16 | 24 | |
|---|
| 17 | 25 | private final String code; |
|---|
| 18 | 26 | |
|---|
| 19 | | - PackStatus(String code) { |
|---|
| 20 | | - this.code = code; |
|---|
| 21 | | - } |
|---|
| 27 | + /** |
|---|
| 28 | + * PackStatus<p> |
|---|
| 29 | + * Constructor |
|---|
| 30 | + * |
|---|
| 31 | + * @param code |
|---|
| 32 | + */ |
|---|
| 33 | + PackStatus(String code) { this.code = code; } |
|---|
| 22 | 34 | |
|---|
| 23 | | - @Override |
|---|
| 24 | | - public String getCode() { |
|---|
| 25 | | - return code; |
|---|
| 26 | | - } |
|---|
| 35 | + /** |
|---|
| 36 | + * getCode<p> |
|---|
| 37 | + * Short code stored in DB / used in JSON. |
|---|
| 38 | + * |
|---|
| 39 | + * @return packCode |
|---|
| 40 | + */ |
|---|
| 41 | + @Override public String getCode() { return code; } |
|---|
| 27 | 42 | |
|---|
| 43 | + /** |
|---|
| 44 | + * valueFromCode<p> |
|---|
| 45 | + * Factory method from short code. |
|---|
| 46 | + * |
|---|
| 47 | + * @param packCode |
|---|
| 48 | + * @return packStatus |
|---|
| 49 | + */ |
|---|
| 28 | 50 | @JsonCreator |
|---|
| 29 | 51 | public static PackStatus valueFromCode(String code) { |
|---|
| 30 | 52 | for (PackStatus ps : PackStatus.values()) { |
|---|
| 31 | | - if (ps.code.equals(code)) { |
|---|
| 32 | | - return ps; |
|---|
| 33 | | - } |
|---|
| 53 | + if (ps.code.equals(code)) return ps; |
|---|
| 34 | 54 | } |
|---|
| 35 | 55 | return null; |
|---|
| 36 | 56 | } |
|---|
| 37 | 57 | |
|---|
| 58 | + /** |
|---|
| 59 | + * getName<p> |
|---|
| 60 | + * Expose short code as JSON value. |
|---|
| 61 | + * |
|---|
| 62 | + * @return name |
|---|
| 63 | + */ |
|---|
| 38 | 64 | @JsonValue |
|---|
| 39 | | - public String getName() { |
|---|
| 40 | | - return this.code; |
|---|
| 41 | | - } |
|---|
| 42 | | - |
|---|
| 65 | + public String getName() { return this.code; } |
|---|
| 43 | 66 | } |
|---|