1 package fr.inrae.agroclim.indicators.exception.type;
2
3 import fr.inrae.agroclim.indicators.exception.ErrorCategory;
4 import fr.inrae.agroclim.indicators.exception.IndicatorsErrorCategory;
5 import fr.inrae.agroclim.indicators.model.data.ResourceManager;
6 import lombok.Getter;
7 import lombok.RequiredArgsConstructor;
8
9 /**
10 * Keys from messages.properties used to warn about errors in {@link ResourceManager}.
11 *
12 * @author Olivier Maury
13 */
14 @RequiredArgsConstructor
15 public enum ResourceErrorType implements CommonErrorType {
16 /**
17 * Climate, topic.
18 *
19 * No parameter.
20 */
21 CLIMATE("100", null),
22 /**
23 * No climate data.
24 *
25 * No parameter.
26 */
27 CLIMATE_EMPTY("110", CLIMATE),
28 /**
29 * No climate data for the phase.
30 *
31 * parameter 0 : start stage name parameter 1 : end stage name parameter 2 : start stage day parameter 3 : end stage
32 * day parameter 4 : year parameter 5 : first available day parameter 6 ! last available day
33 */
34 CLIMATE_EMPTY_FOR_PHASE("111", CLIMATE_EMPTY),
35 /**
36 * Not enough data.
37 *
38 * No parameter.
39 */
40 CLIMATE_SIZE_WRONG("101", CLIMATE),
41 /**
42 * Years of climate, topic.
43 *
44 * No parameter.
45 */
46 CLIMATE_YEARS("120", null),
47 /**
48 * No years of climate.
49 *
50 * No parameter.
51 */
52 CLIMATE_YEARS_EMPTY("121", CLIMATE_YEARS),
53 /**
54 * Not enough data.
55 *
56 * No parameter.
57 */
58 CLIMATE_YEARS_MISSING("122", CLIMATE_YEARS),
59 /**
60 * Phenology, topic.
61 *
62 * No parameter.
63 */
64 PHENO("200", null),
65 /**
66 * No phenological data.
67 *
68 * No parameter.
69 */
70 PHENO_EMPTY("201", PHENO),
71 /**
72 * Years of phenology, topic.
73 *
74 * No parameter.
75 */
76 PHENO_YEARS("210", PHENO),
77 /**
78 * No years of phenology.
79 *
80 * No parameter.
81 */
82 PHENO_YEARS_EMPTY("211", PHENO_YEARS),
83 /**
84 * Setting not set.
85 *
86 * No parameter.
87 */
88 RESOURCES_CROPDEVELOPMENT_YEARS("001", null),
89 /**
90 * Soil, topic.
91 *
92 * No parameter.
93 */
94 SOIL("300", null),
95 /**
96 * Not enough data.
97 *
98 * No parameter.
99 */
100 SOIL_SIZE_WRONG("301", SOIL),
101 /**
102 * Variables, topic.
103 *
104 * No parameter.
105 */
106 VARIABLES("400", null),
107 /**
108 * No variable.
109 *
110 * No parameter.
111 */
112 VARIABLES_EMPTY("401", VARIABLES),
113 /**
114 * No variale.
115 *
116 * No parameter.
117 */
118 VARIABLES_MISSING("402", VARIABLES);
119 /**
120 * Subcode for the error.
121 */
122 @Getter
123 private final String subCode;
124 /**
125 * Parent refers to the resource part.
126 */
127 @Getter
128 private final ResourceErrorType parent;
129
130 @Override
131 public ErrorCategory getCategory() {
132 return IndicatorsErrorCategory.RESOURCES;
133 }
134
135 }