| .. | .. |
|---|
| 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 license statuses. For further details: |
|---|
| 10 | | - * https://redmine.curistec.com/projects/securis/wiki/LicensesServerManagement |
|---|
| 11 | | - * |
|---|
| 12 | | - * @author rob |
|---|
| 13 | | - */ |
|---|
| 12 | +* LicenseStatus |
|---|
| 13 | +* <p> |
|---|
| 14 | +* Enumerates the possible license states. JSON code/value is the short code (CR, RE, AC, ...). |
|---|
| 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 LicenseStatus implements CodedEnum { |
|---|
| 15 | 21 | CREATED("CR"), REQUESTED("RE"), ACTIVE("AC"), PRE_ACTIVE("PA"), EXPIRED("EX"), CANCELLED("CA"), BLOCKED("BL"); |
|---|
| 16 | 22 | |
|---|
| 17 | 23 | private final String code; |
|---|
| 18 | 24 | |
|---|
| 19 | | - LicenseStatus(String code) { |
|---|
| 20 | | - this.code = code; |
|---|
| 21 | | - } |
|---|
| 25 | + /** |
|---|
| 26 | + * LicenseStatus<p> |
|---|
| 27 | + * Constructor |
|---|
| 28 | + * |
|---|
| 29 | + * @param code |
|---|
| 30 | + */ |
|---|
| 31 | + LicenseStatus(String code) { this.code = code; } |
|---|
| 22 | 32 | |
|---|
| 23 | | - @Override |
|---|
| 24 | | - public String getCode() { |
|---|
| 25 | | - return code; |
|---|
| 26 | | - } |
|---|
| 33 | + /** |
|---|
| 34 | + * getCode<p> |
|---|
| 35 | + * Return the short code used in DB/JSON. |
|---|
| 36 | + * |
|---|
| 37 | + * @return code |
|---|
| 38 | + */ |
|---|
| 39 | + @Override public String getCode() { return code; } |
|---|
| 27 | 40 | |
|---|
| 41 | + /** |
|---|
| 42 | + * valueFromCode<p> |
|---|
| 43 | + * Factory from code string (null on unknown). |
|---|
| 44 | + * |
|---|
| 45 | + * @param code |
|---|
| 46 | + */ |
|---|
| 28 | 47 | @JsonCreator |
|---|
| 29 | 48 | public static LicenseStatus valueFromCode(String code) { |
|---|
| 30 | 49 | for (LicenseStatus ps : LicenseStatus.values()) { |
|---|
| 31 | | - if (ps.code.equals(code)) { |
|---|
| 32 | | - return ps; |
|---|
| 33 | | - } |
|---|
| 50 | + if (ps.code.equals(code)) return ps; |
|---|
| 34 | 51 | } |
|---|
| 35 | 52 | return null; |
|---|
| 36 | 53 | } |
|---|
| 37 | 54 | |
|---|
| 55 | + /** |
|---|
| 56 | + * getName<p> |
|---|
| 57 | + * Expose the code as JSON value. |
|---|
| 58 | + * |
|---|
| 59 | + * @return name |
|---|
| 60 | + */ |
|---|
| 38 | 61 | @JsonValue |
|---|
| 39 | | - public String getName() { |
|---|
| 40 | | - return this.code; |
|---|
| 41 | | - } |
|---|
| 62 | + public String getName() { return this.code; } |
|---|
| 42 | 63 | |
|---|
| 64 | + /** |
|---|
| 65 | + * toString<p> |
|---|
| 66 | + * Get the string describing the current object |
|---|
| 67 | + * |
|---|
| 68 | + * @return object string |
|---|
| 69 | + */ |
|---|
| 43 | 70 | @Override |
|---|
| 44 | | - public String toString() { |
|---|
| 45 | | - return code; |
|---|
| 46 | | - } |
|---|
| 71 | + public String toString() { return code; } |
|---|
| 47 | 72 | } |
|---|