1 /*
2 * Prometheus: Application Framework
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.prometheus.views;
18
19 import io.github.tonywasher.joceanus.metis.viewer.MetisViewerResource;
20 import io.github.tonywasher.joceanus.oceanus.resource.OceanusBundleId;
21
22 /**
23 * Standard Viewer Entries.
24 */
25 public enum PrometheusViewerEntryId {
26 /**
27 * Error.
28 */
29 ERROR,
30
31 /**
32 * Profile.
33 */
34 PROFILE,
35
36 /**
37 * Data.
38 */
39 DATA,
40
41 /**
42 * View.
43 */
44 VIEW,
45
46 /**
47 * DataSet.
48 */
49 DATASET,
50
51 /**
52 * Updates.
53 */
54 UPDATES,
55
56 /**
57 * Analysis.
58 */
59 ANALYSIS,
60
61 /**
62 * Maintenance.
63 */
64 MAINTENANCE,
65
66 /**
67 * StaticData.
68 */
69 STATIC;
70
71 /**
72 * The String name.
73 */
74 private String theName;
75
76 @Override
77 public String toString() {
78 /* If we have not yet loaded the name */
79 if (theName == null) {
80 /* Load the name */
81 theName = bundleIdForEntryId(this).getValue();
82 }
83
84 /* return the name */
85 return theName;
86 }
87
88 /**
89 * Obtain the resource bundleId for the entryId.
90 *
91 * @param pId the id
92 * @return the resource bundleId
93 */
94 private static OceanusBundleId bundleIdForEntryId(final PrometheusViewerEntryId pId) {
95 return switch (pId) {
96 case ERROR -> MetisViewerResource.VIEWER_ENTRY_ERROR;
97 case PROFILE -> MetisViewerResource.VIEWER_ENTRY_PROFILE;
98 case DATA -> MetisViewerResource.VIEWER_ENTRY_DATA;
99 case VIEW -> MetisViewerResource.VIEWER_ENTRY_VIEW;
100 case DATASET -> PrometheusViewResource.VIEWERENTRY_DATASET;
101 case UPDATES -> PrometheusViewResource.VIEWERENTRY_UPDATES;
102 case ANALYSIS -> PrometheusViewResource.VIEWERENTRY_ANALYSIS;
103 case MAINTENANCE -> PrometheusViewResource.VIEWERENTRY_MAINT;
104 case STATIC -> PrometheusViewResource.VIEWERENTRY_STATIC;
105 default -> throw new IllegalArgumentException();
106 };
107 }
108 }