View Javadoc
1   package fr.ifremer.quadrige3.batch.shape.config;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: Quadrige3 Core Shared
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2017 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  import org.nuiton.config.ConfigOptionDef;
27  
28  import java.io.File;
29  
30  import static org.nuiton.i18n.I18n.n;
31  
32  /**
33   * batch shape configuration options.
34   *
35   * @author benoit.lavenier@e-is.pro
36   */
37  public enum ShapeConfigurationOption implements ConfigOptionDef {
38  
39      // ------------------------------------------------------------------------//
40      // -- READ-ONLY OPTIONS ---------------------------------------------------//
41      // ------------------------------------------------------------------------//
42  
43      INPUT_SHAPES_DIRECTORY(
44              "quadrige3.batch.shape.input.directory",
45              n("quadrige3.batch.shape.config.input.directory.description"),
46              "${quadrige3.data.directory}/shapes_input",
47              File.class),
48  
49      OUTPUT_SHAPES_DIRECTORY(
50              "quadrige3.batch.shape.output.directory",
51              n("quadrige3.batch.shape.config.output.directory.description"),
52              "${quadrige3.data.directory}/shapes_output",
53              File.class),
54  
55      // ------------------------------------------------------------------------//
56      // -- DATA CONSTANTS ------------------------------------------------------//
57      // ------------------------------------------------------------------------//
58  
59      SHAPE_ATTRIBUTE_ID(
60              "quadrige3.batch.shape.attribute.id",
61              n("quadrige3.batch.shape.config.attribute.id.description"),
62              "ID_LDS",
63              String.class),
64  
65      SHAPE_ATTRIBUTE_LABEL(
66              "quadrige3.batch.shape.attribute.label",
67              n("quadrige3.batch.shape.config.attribute.label.description"),
68              "MNE_LDS",
69              String.class),
70  
71      SHAPE_ATTRIBUTE_NAME(
72              "quadrige3.batch.shape.attribute.name",
73              n("quadrige3.batch.shape.config.attribute.name.description"),
74              "LIB_LDS",
75              String.class),
76  
77      SHAPE_ATTRIBUTE_BATHY(
78              "quadrige3.batch.shape.attribute.bathy",
79              n("quadrige3.batch.shape.config.attribute.bathy.description"),
80              "BAT_LDS",
81              String.class),
82  
83      SHAPE_ATTRIBUTE_COMMENT(
84              "quadrige3.batch.shape.attribute.comment",
85              n("quadrige3.batch.shape.config.attribute.comment.description"),
86              "COM_LDS",
87              String.class),
88  
89      SHAPE_ATTRIBUTE_POS_SYSTEM_ID (
90              "quadrige3.batch.shape.attribute.posSystemId",
91              n("quadrige3.batch.shape.config.attribute.posSystemId.description"),
92              "POS_LDS",
93              String.class),
94  
95  
96      SHAPE_ATTRIBUTE_UT_FORMAT (
97              "quadrige3.batch.shape.attribute.utFormat",
98              n("quadrige3.batch.shape.config.attribute.utFormat.description"),
99              "UT_LDS",
100             String.class),
101 
102     SHAPE_ATTRIBUTE_DAYLIGHT_SAVING_TIME (
103             "quadrige3.batch.shape.attribute.daylightSavingTime",
104             n("quadrige3.batch.shape.config.attribute.daylightSavingTime.description"),
105             "CUT_LDS",
106             String.class),
107 
108     ;
109 
110     /** Configuration key. */
111     private final String key;
112 
113     /** I18n key of option description */
114     private final String description;
115 
116     /** Type of option */
117     private final Class<?> type;
118 
119     /** Default value of option. */
120     private String defaultValue;
121 
122     /** Flag to not keep option value on disk */
123     private boolean isTransient;
124 
125     /** Flag to not allow option value modification */
126     private boolean isFinal;
127 
128     ShapeConfigurationOption(String key,
129                              String description,
130                              String defaultValue,
131                              Class<?> type,
132                              boolean isTransient) {
133         this.key = key;
134         this.description = description;
135         this.defaultValue = defaultValue;
136         this.type = type;
137         this.isTransient = isTransient;
138         this.isFinal = isTransient;
139     }
140 
141     ShapeConfigurationOption(String key,
142                              String description,
143                              String defaultValue,
144                              Class<?> type) {
145         this(key, description, defaultValue, type, true);
146     }
147 
148     /** {@inheritDoc} */
149     @Override
150     public String getKey() {
151         return key;
152     }
153 
154     /** {@inheritDoc} */
155     @Override
156     public Class<?> getType() {
157         return type;
158     }
159 
160     /** {@inheritDoc} */
161     @Override
162     public String getDescription() {
163         return description;
164     }
165 
166     /** {@inheritDoc} */
167     @Override
168     public String getDefaultValue() {
169         return defaultValue;
170     }
171 
172     /** {@inheritDoc} */
173     @Override
174     public boolean isTransient() {
175         return isTransient;
176     }
177 
178     /** {@inheritDoc} */
179     @Override
180     public boolean isFinal() {
181         return isFinal;
182     }
183 
184     /** {@inheritDoc} */
185     @Override
186     public void setDefaultValue(String defaultValue) {
187         this.defaultValue = defaultValue;
188     }
189 
190     /** {@inheritDoc} */
191     @Override
192     public void setTransient(boolean newValue) {
193         // not used
194     }
195 
196     /** {@inheritDoc} */
197     @Override
198     public void setFinal(boolean newValue) {
199         // not used
200     }
201 }