Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/MinMaxState.java @ 5867:59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 15:23:01 +0200 |
parents | 4897a58c8746 |
children | af13ceeba52a |
comparison
equal
deleted
inserted
replaced
5866:9a6741ccf6d4 | 5867:59ff03ff48f1 |
---|---|
18 import org.dive4elements.artifacts.common.ArtifactNamespaceContext; | 18 import org.dive4elements.artifacts.common.ArtifactNamespaceContext; |
19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | 19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; |
20 | 20 |
21 import org.dive4elements.artifactdatabase.ProtocolUtils; | 21 import org.dive4elements.artifactdatabase.ProtocolUtils; |
22 | 22 |
23 import org.dive4elements.river.artifacts.FLYSArtifact; | 23 import org.dive4elements.river.artifacts.D4EArtifact; |
24 | 24 |
25 | 25 |
26 /** | 26 /** |
27 * State that holds minimun and maximum (for validation). | 27 * State that holds minimun and maximum (for validation). |
28 * | 28 * |
38 ElementCreator creator, | 38 ElementCreator creator, |
39 String name, | 39 String name, |
40 CallContext context, | 40 CallContext context, |
41 Element select | 41 Element select |
42 ) { | 42 ) { |
43 FLYSArtifact flys = (FLYSArtifact) artifact; | 43 D4EArtifact flys = (D4EArtifact) artifact; |
44 | 44 |
45 select.setAttributeNS( | 45 select.setAttributeNS( |
46 ArtifactNamespaceContext.NAMESPACE_URI, | 46 ArtifactNamespaceContext.NAMESPACE_URI, |
47 "art:type", | 47 "art:type", |
48 getType()); | 48 getType()); |
110 * This method returns the default values for min and max. If the static | 110 * This method returns the default values for min and max. If the static |
111 * field DefaultState.USE_DEFAULTS is set, the minimum and maximum inserted | 111 * field DefaultState.USE_DEFAULTS is set, the minimum and maximum inserted |
112 * by the user is returned as string. Otherwise, the absolute minimum and | 112 * by the user is returned as string. Otherwise, the absolute minimum and |
113 * maximum are returned. | 113 * maximum are returned. |
114 * | 114 * |
115 * @param artifact The FLYSArtifact. | 115 * @param artifact The D4EArtifact. |
116 * @param name The name of the parameter. | 116 * @param name The name of the parameter. |
117 * | 117 * |
118 * @return a string array [min,max] that contains the minimum and maximum | 118 * @return a string array [min,max] that contains the minimum and maximum |
119 * values for the parameter <i>name</i>. | 119 * values for the parameter <i>name</i>. |
120 */ | 120 */ |
132 | 132 |
133 /** | 133 /** |
134 * Returns a string array with minimum and maximum inserted by the user as | 134 * Returns a string array with minimum and maximum inserted by the user as |
135 * [min,max]. | 135 * [min,max]. |
136 * | 136 * |
137 * @param artifact The FLYSArtifact that stores the parameter. | 137 * @param artifact The D4EArtifact that stores the parameter. |
138 * @param name The name of the parameter for raw min/max value string. | 138 * @param name The name of the parameter for raw min/max value string. |
139 * | 139 * |
140 * @return a string array [min,max]. | 140 * @return a string array [min,max]. |
141 */ | 141 */ |
142 protected String[] getMinMaxByParameter(Artifact artifact, String name) { | 142 protected String[] getMinMaxByParameter(Artifact artifact, String name) { |
143 FLYSArtifact flys = (FLYSArtifact) artifact; | 143 D4EArtifact flys = (D4EArtifact) artifact; |
144 String rawValue = flys.getDataAsString(name); | 144 String rawValue = flys.getDataAsString(name); |
145 | 145 |
146 if (rawValue == null) { | 146 if (rawValue == null) { |
147 logger.debug("No value for '" + rawValue + "' existing."); | 147 logger.debug("No value for '" + rawValue + "' existing."); |
148 return null; | 148 return null; |
155 | 155 |
156 | 156 |
157 /** | 157 /** |
158 * Returns a string array with absolute minimum and maximum as [min,max]. | 158 * Returns a string array with absolute minimum and maximum as [min,max]. |
159 * | 159 * |
160 * @param artifact The FLYSArtifact (not used in this implementation). | 160 * @param artifact The D4EArtifact (not used in this implementation). |
161 * @param name The parameter name (not used in this implementation). | 161 * @param name The parameter name (not used in this implementation). |
162 * | 162 * |
163 * @return a string array [min,max]. | 163 * @return a string array [min,max]. |
164 */ | 164 */ |
165 protected String[] getMinMaxDefaults(Artifact artifact, String name) { | 165 protected String[] getMinMaxDefaults(Artifact artifact, String name) { |
166 FLYSArtifact flys = (FLYSArtifact) artifact; | 166 D4EArtifact flys = (D4EArtifact) artifact; |
167 | 167 |
168 Object lower = getLower(flys); | 168 Object lower = getLower(flys); |
169 Object upper = getUpper(flys); | 169 Object upper = getUpper(flys); |
170 | 170 |
171 return new String[] { String.valueOf(lower), String.valueOf(upper) }; | 171 return new String[] { String.valueOf(lower), String.valueOf(upper) }; |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 protected abstract Object getLower(FLYSArtifact flys); | 175 protected abstract Object getLower(D4EArtifact flys); |
176 | 176 |
177 protected abstract Object getUpper(FLYSArtifact flys); | 177 protected abstract Object getUpper(D4EArtifact flys); |
178 | 178 |
179 protected abstract String getType(); | 179 protected abstract String getType(); |
180 } | 180 } |
181 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 181 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |