aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com
diff options
context:
space:
mode:
authorgjoranv <gjoranv@gmail.com>2023-10-20 12:12:16 +0200
committergjoranv <gjoranv@gmail.com>2023-10-20 18:06:33 +0200
commitfd9124a26a90872695866d838f1be5b92ebe3b2b (patch)
treeae61b6ed07d819cfcb2dd31d6e7a6fd723320478 /controller-api/src/main/java/com
parent1001245156e27417928e6b0fa8a96a89dd1aef31 (diff)
Fix conversion from legacy states, and add test.
Diffstat (limited to 'controller-api/src/main/java/com')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatus.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatus.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatus.java
index 7ec43a85ac5..340e2e95de0 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatus.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/billing/BillStatus.java
@@ -7,9 +7,10 @@ public enum BillStatus {
OPEN, // All bills start in this state, the only state where changes can be made
FINALIZED, // No more changes can be made to the bill
CLOSED, // End state
- VOID, // End state
- LEGACY_ISSUED("ISSUED"), // Legacy state, should be removed when unused by any current bills
- LEGACY_EXPORTED("EXPORTED"); // Legacy state, should be removed when unused by any current bills
+ VOID; // End state
+
+ private static final String LEGACY_ISSUED = "ISSUED"; // Legacy state, used by historical bills
+ private static final String LEGACY_EXPORTED = "EXPORTED"; // Legacy state, used by historical bills
private final String value;
@@ -17,16 +18,13 @@ public enum BillStatus {
this.value = name();
}
- BillStatus(String value) {
- this.value = value;
- }
-
public String value() {
- if (this == LEGACY_ISSUED || this == LEGACY_EXPORTED) return OPEN.value;
return value;
}
public static BillStatus from(String status) {
+ if (LEGACY_ISSUED.equals(status) || LEGACY_EXPORTED.equals(status)) return OPEN;
return Enum.valueOf(BillStatus.class, status.toUpperCase());
}
+
}