Revision 37297
branches/v2_0_0_prep/libraries/org.gvsig.annotation/org.gvsig.annotation.lib/org.gvsig.annotation.lib.impl/pom.xml | ||
---|---|---|
52 | 52 |
<groupId>org.gvsig</groupId> |
53 | 53 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
54 | 54 |
<scope>compile</scope> |
55 |
</dependency> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>org.gvsig</groupId> |
|
58 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
59 |
<scope>compile</scope> |
|
60 |
</dependency> |
|
56 | 61 |
<dependency> |
57 | 62 |
<groupId>org.opengis</groupId> |
58 | 63 |
<artifactId>geoapi</artifactId> |
branches/v2_0_0_prep/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java | ||
---|---|---|
617 | 617 |
// Sorted |
618 | 618 |
FeatureAttributeDescriptor attr = getFirstAttributeOfType(store |
619 | 619 |
.getDefaultFeatureType(), new int[] { DataTypes.INT, |
620 |
DataTypes.LONG, DataTypes.STRING }); |
|
620 |
DataTypes.LONG, DataTypes.STRING, DataTypes.DOUBLE, DataTypes.FLOAT });
|
|
621 | 621 |
{ |
622 | 622 |
// asure that attr is in query attributes |
623 | 623 |
boolean attrFound = false; |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java | ||
---|---|---|
30 | 30 |
*/ |
31 | 31 |
package org.gvsig.fmap.dal.raster.impl; |
32 | 32 |
|
33 |
import java.util.Collection; |
|
33 | 34 |
import java.util.Iterator; |
34 | 35 |
import java.util.Set; |
35 | 36 |
|
... | ... | |
56 | 57 |
import org.gvsig.fmap.dal.spi.DataStoreInitializer; |
57 | 58 |
import org.gvsig.fmap.dal.spi.DataStoreProvider; |
58 | 59 |
import org.gvsig.metadata.MetadataLocator; |
60 |
import org.gvsig.timesupport.Interval; |
|
61 |
import org.gvsig.timesupport.RelativeInterval; |
|
59 | 62 |
import org.gvsig.tools.ToolsLocator; |
60 | 63 |
import org.gvsig.tools.dispose.impl.AbstractDisposable; |
61 | 64 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
... | ... | |
493 | 496 |
public String getFullName() { |
494 | 497 |
return this.provider.getFullName(); |
495 | 498 |
} |
499 |
|
|
500 |
public Interval getInterval() { |
|
501 |
// TODO Auto-generated method stub |
|
502 |
return null; |
|
503 |
} |
|
504 |
|
|
505 |
public Collection getTimes() { |
|
506 |
// TODO Auto-generated method stub |
|
507 |
return null; |
|
508 |
} |
|
509 |
|
|
510 |
public Collection getTimes(Interval interval) { |
|
511 |
// TODO Auto-generated method stub |
|
512 |
return null; |
|
513 |
} |
|
496 | 514 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java | ||
---|---|---|
44 | 44 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
45 | 45 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
46 | 46 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
47 |
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter; |
|
47 | 48 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
48 | 49 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
49 | 50 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
... | ... | |
126 | 127 |
"Data.manager.providers.factory"; |
127 | 128 |
final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION = |
128 | 129 |
"DAL store provider factories"; |
130 |
|
|
131 |
final static private String DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER = |
|
132 |
"Data.manager.feature.attribute.getter"; |
|
133 |
final static private String DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER_DESCRIPTION = |
|
134 |
"DAL feature attribute getters"; |
|
129 | 135 |
|
130 | 136 |
/** This map contains the name of the default provider for each data type */ |
131 | 137 |
private Map defaultDataIndexProviders; |
... | ... | |
878 | 884 |
} |
879 | 885 |
return dataTypes; |
880 | 886 |
} |
887 |
|
|
888 |
public void registerFeatureAttributeGetter(String name, Class clazz) { |
|
889 |
if (name == null || clazz == null) { |
|
890 |
throw new IllegalArgumentException("Any parameters can be null"); |
|
891 |
} |
|
892 |
if(!(FeatureAttributeGetter.class.isAssignableFrom(clazz))) { |
|
893 |
throw new IllegalArgumentException( |
|
894 |
"Not supported implemtation: name=" + name |
|
895 |
+ " class=" + clazz.getName()); |
|
896 |
} |
|
897 |
} |
|
898 |
|
|
899 |
public FeatureAttributeGetter createFeatureAttributeGetter(String name) throws InitializeException { |
|
900 |
if (name == null) { |
|
901 |
throw new IllegalArgumentException("The parameter can not be null"); |
|
902 |
} |
|
903 |
|
|
904 |
try{ |
|
905 |
return (FeatureAttributeGetter) ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER).create(name); |
|
906 |
} catch (InstantiationException e) { |
|
907 |
throw new InitializeException("FeatureAttributeGetter", e); |
|
908 |
} catch (IllegalAccessException e) { |
|
909 |
throw new InitializeException("FeatureAttributeGetter", e); |
|
910 |
} |
|
911 |
} |
|
881 | 912 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import org.gvsig.fmap.dal.DALLibrary; |
32 | 32 |
import org.gvsig.fmap.dal.DALLocator; |
33 |
import org.gvsig.fmap.dal.DataManager; |
|
33 | 34 |
import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform; |
34 | 35 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureQuery; |
35 | 36 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference; |
... | ... | |
37 | 38 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection; |
38 | 39 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
39 | 40 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreTransforms; |
41 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.DayToAbsoluteInstantFeatureAttributeGetter; |
|
42 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.DayToRelativeInstantFeatureAttributeGetter; |
|
43 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.HourToAbsoluteInstantFeatureAttributeGetter; |
|
44 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.HourToRelativeInstantFeatureAttributeGetter; |
|
45 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.MilliToAbsoluteInstantFeatureAttributeGetter; |
|
46 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.MilliToRelativeInstantFeatureAttributeGetter; |
|
47 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.MinuteToAbsoluteInstantFeatureAttributeGetter; |
|
48 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.MinuteToRelativeInstantFeatureAttributeGetter; |
|
49 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.MonthToAbsoluteInstantFeatureAttributeGetter; |
|
50 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.SecondToAbsoluteInstantFeatureAttributeGetter; |
|
51 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.SecondToRelativeInstantFeatureAttributeGetter; |
|
52 |
import org.gvsig.fmap.dal.feature.impl.attributegetter.YearToAbsoluteInstantFeatureAttributeGetter; |
|
40 | 53 |
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager; |
41 | 54 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
42 | 55 |
import org.gvsig.i18n.Messages; |
... | ... | |
46 | 59 |
import org.gvsig.tools.dynobject.DynObjectManager; |
47 | 60 |
import org.gvsig.tools.library.AbstractLibrary; |
48 | 61 |
import org.gvsig.tools.library.LibraryException; |
62 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
49 | 63 |
|
50 | 64 |
/** |
51 | 65 |
* Initialize the implementation of DAL. |
... | ... | |
97 | 111 |
|
98 | 112 |
// DefaultFeatureAttributeDescriptor.registerPersistent(); |
99 | 113 |
|
114 |
//Register the FeatureAttributeTransform |
|
115 |
DataManager dataManager = DALLocator.getDataManager(); |
|
116 |
if (dataManager == null) { |
|
117 |
throw new ReferenceNotRegisteredException( |
|
118 |
DALLocator.DATA_MANAGER_NAME, DALLocator.getInstance()); |
|
119 |
} |
|
120 |
dataManager.registerFeatureAttributeGetter("milliToRelativeInstant", MilliToRelativeInstantFeatureAttributeGetter.class); |
|
121 |
dataManager.registerFeatureAttributeGetter("milliToAbsoluteInstant", MilliToAbsoluteInstantFeatureAttributeGetter.class); |
|
122 |
dataManager.registerFeatureAttributeGetter("secondToRelativeInstant", SecondToRelativeInstantFeatureAttributeGetter.class); |
|
123 |
dataManager.registerFeatureAttributeGetter("secondToAbsoluteInstant",SecondToAbsoluteInstantFeatureAttributeGetter.class); |
|
124 |
dataManager.registerFeatureAttributeGetter("minuteToRelativeInstant",MinuteToRelativeInstantFeatureAttributeGetter.class); |
|
125 |
dataManager.registerFeatureAttributeGetter("minuteToAbsoluteInstant", MinuteToAbsoluteInstantFeatureAttributeGetter.class); |
|
126 |
dataManager.registerFeatureAttributeGetter("hourToRelativeInstant", HourToRelativeInstantFeatureAttributeGetter.class); |
|
127 |
dataManager.registerFeatureAttributeGetter("hourToAbsoluteInstant", HourToAbsoluteInstantFeatureAttributeGetter.class); |
|
128 |
dataManager.registerFeatureAttributeGetter("dayToAbsoluteInstant", DayToAbsoluteInstantFeatureAttributeGetter.class); |
|
129 |
dataManager.registerFeatureAttributeGetter("dayToRelativeInstant", DayToRelativeInstantFeatureAttributeGetter.class); |
|
130 |
dataManager.registerFeatureAttributeGetter("monthToAbsoluteInstant", MonthToAbsoluteInstantFeatureAttributeGetter.class); |
|
131 |
dataManager.registerFeatureAttributeGetter("yearToAbsoluteInstant", YearToAbsoluteInstantFeatureAttributeGetter.class); |
|
132 |
|
|
100 | 133 |
if (exs.size() > 0) { |
101 | 134 |
throw new LibraryException(this.getClass(), exs); |
102 | 135 |
} |
... | ... | |
124 | 157 |
} |
125 | 158 |
} |
126 | 159 |
|
127 |
} |
|
160 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java | ||
---|---|---|
40 | 40 |
import org.gvsig.metadata.MetadataLocator; |
41 | 41 |
import org.gvsig.metadata.MetadataManager; |
42 | 42 |
import org.gvsig.metadata.exceptions.MetadataException; |
43 |
import org.gvsig.timesupport.TimeSupportLibrary; |
|
43 | 44 |
import org.gvsig.tools.ToolsLibrary; |
44 | 45 |
import org.gvsig.tools.library.AbstractLibrary; |
45 | 46 |
import org.gvsig.tools.library.LibraryException; |
... | ... | |
57 | 58 |
require(GeometryLibrary.class); |
58 | 59 |
require(ToolsLibrary.class); |
59 | 60 |
require(MetadataLibrary.class); |
61 |
require(TimeSupportLibrary.class); |
|
60 | 62 |
} |
61 | 63 |
|
62 | 64 |
protected void doInitialize() throws LibraryException { |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal; |
2 | 2 |
|
3 |
import java.util.Collection; |
|
3 | 4 |
import java.util.Iterator; |
4 | 5 |
|
5 | 6 |
import org.gvsig.fmap.dal.exception.DataException; |
6 | 7 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
7 | 8 |
import org.gvsig.metadata.Metadata; |
9 |
import org.gvsig.timesupport.Interval; |
|
10 |
import org.gvsig.timesupport.RelativeInterval; |
|
11 |
import org.gvsig.timesupport.Time; |
|
8 | 12 |
import org.gvsig.tools.dispose.Disposable; |
9 | 13 |
import org.gvsig.tools.exception.BaseException; |
10 | 14 |
import org.gvsig.tools.observer.ComplexWeakReferencingObservable; |
... | ... | |
267 | 271 |
* @throws DataException |
268 | 272 |
*/ |
269 | 273 |
public DataQuery createQuery(); |
274 |
|
|
275 |
/** |
|
276 |
* Gets the {@link Interval} of the store, that means the temporal |
|
277 |
* interval where the store has valid data. |
|
278 |
* @return |
|
279 |
* a time interval or null if there is not time support |
|
280 |
*/ |
|
281 |
public Interval getInterval(); |
|
282 |
|
|
283 |
/** |
|
284 |
* Gets all the possible values of time for which the store has data. |
|
285 |
* @return |
|
286 |
* a collection of {@link Time} objects. |
|
287 |
*/ |
|
288 |
public Collection getTimes(); |
|
289 |
|
|
290 |
/** |
|
291 |
* Gets all the possible values of time for which the store has data |
|
292 |
* and intersects with an interval. |
|
293 |
* @param interval |
|
294 |
* the interval of time |
|
295 |
* @return |
|
296 |
* a collection of {@link Time} objects. |
|
297 |
*/ |
|
298 |
public Collection getTimes(Interval interval); |
|
270 | 299 |
} |
271 | 300 |
|
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java | ||
---|---|---|
30 | 30 |
* |
31 | 31 |
*/ |
32 | 32 |
public interface DataTypes extends org.cresques.DataTypes, |
33 |
org.gvsig.fmap.geom.DataTypes { |
|
33 |
org.gvsig.fmap.geom.DataTypes, org.gvsig.timesupport.DataTypes {
|
|
34 | 34 |
|
35 | 35 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java | ||
---|---|---|
33 | 33 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
34 | 34 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
35 | 35 |
import org.gvsig.fmap.dal.feature.Feature; |
36 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter; |
|
36 | 38 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
37 | 39 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
38 | 40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
... | ... | |
380 | 382 |
public EditableFeatureType createFeatureType(); |
381 | 383 |
|
382 | 384 |
public List getDataTypes(); |
385 |
|
|
386 |
/** |
|
387 |
* Registers a class that can be used to create a {@link FeatureAttributeGetter} |
|
388 |
* and associate it to a {@link FeatureAttributeDescriptor}. |
|
389 |
* |
|
390 |
* @param name |
|
391 |
* the name used to register the class. |
|
392 |
* @param clazz |
|
393 |
* it has to be an instance of {@link FeatureAttributeDescriptor} |
|
394 |
*/ |
|
395 |
public void registerFeatureAttributeGetter(String name, Class clazz); |
|
396 |
|
|
397 |
/** |
|
398 |
* Creates a {@link FeatureAttributeGetter} by name. If there is not any class |
|
399 |
* registered with this name or if there is any error an exception is thrown. |
|
400 |
* |
|
401 |
* @param name |
|
402 |
* the name that was used to register the class |
|
403 |
* @return |
|
404 |
* a {@link FeatureAttributeGetter} |
|
405 |
* @throws InitializeException |
|
406 |
* if there is any error creating the object |
|
407 |
*/ |
|
408 |
public FeatureAttributeGetter createFeatureAttributeGetter(String name) throws InitializeException; |
|
383 | 409 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.spi; |
2 | 2 |
|
3 |
import java.util.Collection; |
|
3 | 4 |
import java.util.Iterator; |
4 | 5 |
|
5 | 6 |
import org.gvsig.fmap.dal.DataServerExplorer; |
... | ... | |
10 | 11 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
11 | 12 |
import org.gvsig.fmap.dal.resource.Resource; |
12 | 13 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
14 |
import org.gvsig.timesupport.Interval; |
|
15 |
import org.gvsig.timesupport.Time; |
|
13 | 16 |
import org.gvsig.tools.dispose.Disposable; |
14 | 17 |
import org.gvsig.tools.dynobject.DynObject; |
15 | 18 |
|
... | ... | |
116 | 119 |
*/ |
117 | 120 |
public String getFullName(); |
118 | 121 |
|
122 |
/** |
|
123 |
* Gets the {@link Interval} of the store, that means the temporal |
|
124 |
* interval where the store has valid data. |
|
125 |
* @return |
|
126 |
* a time interval or null if there is not time support |
|
127 |
*/ |
|
128 |
public Interval getInterval(); |
|
129 |
|
|
130 |
/** |
|
131 |
* Gets all the possible values of time for which the store has data. |
|
132 |
* @return |
|
133 |
* a collection of {@link Time} objects. |
|
134 |
*/ |
|
135 |
public Collection getTimes(); |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets all the possible values of time for which the store has data |
|
139 |
* and intersects with an interval. |
|
140 |
* @param interval |
|
141 |
* the interval of time |
|
142 |
* @return |
|
143 |
* a collection of {@link Time} objects. |
|
144 |
*/ |
|
145 |
public Collection getTimes(Interval interval); |
|
146 |
|
|
119 | 147 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.feature; |
2 | 2 |
|
3 | 3 |
import org.cresques.cts.IProjection; |
4 |
|
|
4 | 5 |
import org.gvsig.fmap.dal.DataTypes; |
5 | 6 |
import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeIntegrityException; |
6 | 7 |
import org.gvsig.tools.evaluator.Evaluator; |
... | ... | |
180 | 181 |
public EditableFeatureAttributeDescriptor setIsAutomatic( |
181 | 182 |
boolean isAutomatic); |
182 | 183 |
|
184 |
/** |
|
185 |
* Sets is the attribute is a temporal attribute. |
|
186 |
* |
|
187 |
* @param isTime |
|
188 |
* <code>true</code> if the attribute is temporal |
|
189 |
* @return |
|
190 |
* this |
|
191 |
*/ |
|
192 |
public EditableFeatureAttributeDescriptor setIsTime(boolean isTime); |
|
183 | 193 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java | ||
---|---|---|
164 | 164 |
* <em> |
165 | 165 |
* <strong>NOTE:</strong> if you use this method to get a |
166 | 166 |
* {@link FeatureSet}, you must get sure it is disposed |
167 |
* (@see {@link DisposableIterator#dispose()}) in any case, even if an
|
|
168 |
* error occurs while getting the data. It is recommended to use the
|
|
169 |
* <code>accept</code> methods instead, which handle everything for you.
|
|
170 |
* Take into account the accept methods may use a fast iterator to
|
|
171 |
* get the features.
|
|
172 |
* </em>
|
|
167 |
* (@see {@link DisposableIterator#dispose()}) in any case, even if an
|
|
168 |
* error occurs while getting the data. It is recommended to use the
|
|
169 |
* <code>accept</code> methods instead, which handle everything for you.
|
|
170 |
* Take into account the accept methods may use a fast iterator to
|
|
171 |
* get the features.
|
|
172 |
* </em>
|
|
173 | 173 |
* </p> |
174 | 174 |
* |
175 | 175 |
* @see #accept(org.gvsig.tools.visitor.Visitor) |
... | ... | |
187 | 187 |
* <em> |
188 | 188 |
* <strong>NOTE:</strong> if you use this method to get a |
189 | 189 |
* {@link FeatureSet}, you must get sure it is disposed |
190 |
* (@see {@link DisposableIterator#dispose()}) in any case, even if an
|
|
191 |
* error occurs while getting the data. It is recommended to use the
|
|
192 |
* <code>accept</code> methods instead, which handle everything for you.
|
|
193 |
* Take into account the accept methods may use a fast iterator to
|
|
194 |
* get the features.
|
|
195 |
* </em>
|
|
190 |
* (@see {@link DisposableIterator#dispose()}) in any case, even if an
|
|
191 |
* error occurs while getting the data. It is recommended to use the
|
|
192 |
* <code>accept</code> methods instead, which handle everything for you.
|
|
193 |
* Take into account the accept methods may use a fast iterator to
|
|
194 |
* get the features.
|
|
195 |
* </em>
|
|
196 | 196 |
* </p> |
197 | 197 |
* |
198 | 198 |
* @see #accept(org.gvsig.tools.visitor.Visitor, |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java | ||
---|---|---|
153 | 153 |
public Object getAdditionalInfo(String infoName); |
154 | 154 |
|
155 | 155 |
/** |
156 |
* Reaturns if value is created automaticaly by the source
|
|
156 |
* Returns if value is created automatically by the source
|
|
157 | 157 |
*/ |
158 | 158 |
public boolean isAutomatic(); |
159 | 159 |
|
160 |
/** |
|
161 |
* Gets if the attribute is a temporal attribute. |
|
162 |
* @return |
|
163 |
* <code>true</code> if is a temporal attribute |
|
164 |
*/ |
|
165 |
public boolean isTime(); |
|
166 |
|
|
167 |
/** |
|
168 |
* Gets if the attribute has a {@link FeatureAttributeGetter}. |
|
169 |
* @return |
|
170 |
* a FeatureAttributeGetter or null. |
|
171 |
*/ |
|
172 |
public FeatureAttributeGetter getFeatureAttributeGetter(); |
|
173 |
|
|
174 |
/** |
|
175 |
* Sets the {@link FeatureAttributeGetter} that is used to update the |
|
176 |
* presentation of a field. |
|
177 |
* @param featureAttributeGetter |
|
178 |
* the {@link FeatureAttributeGetter} to set. |
|
179 |
*/ |
|
180 |
public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter); |
|
160 | 181 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java | ||
---|---|---|
301 | 301 |
protected void setAllowAutomaticValues(boolean value) { |
302 | 302 |
this.allowAtomaticValues = value; |
303 | 303 |
} |
304 |
|
|
305 |
public void setDefaultTimeAttributeName(String name) { |
|
306 |
if (name == null || name.length() == 0) { |
|
307 |
this.defaultTimeAttributeIndex = -1; |
|
308 |
return; |
|
309 |
} |
|
310 |
DefaultFeatureAttributeDescriptor attr = (DefaultFeatureAttributeDescriptor) this |
|
311 |
.get(name); |
|
312 |
if (attr == null) { |
|
313 |
throw new IllegalArgumentException("Attribute '" + name |
|
314 |
+ "' not found."); |
|
315 |
} |
|
316 |
|
|
317 |
this.defaultTimeAttributeIndex = attr.getIndex(); |
|
318 |
} |
|
304 | 319 |
} |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class MonthToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public MonthToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.MONTH_OF_YEAR); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class MilliToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public MilliToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.MILLIS_OF_SECOND); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class SecondToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter { |
|
32 |
static final long MILLIS_IN_SECOND = 1000; |
|
33 |
|
|
34 |
public SecondToRelativeInstantFeatureAttributeGetter() { |
|
35 |
super(MILLIS_IN_SECOND); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.slf4j.Logger; |
|
25 |
import org.slf4j.LoggerFactory; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter; |
|
28 |
import org.gvsig.timesupport.TimeSupportLocator; |
|
29 |
import org.gvsig.timesupport.TimeSupportManager; |
|
30 |
import org.gvsig.tools.ToolsLocator; |
|
31 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public abstract class AbstractObjectToTimefeatureAttributeGetter implements FeatureAttributeGetter { |
|
40 |
protected static final TimeSupportManager TIME_SUPPORT_MANAGER = TimeSupportLocator.getManager(); |
|
41 |
protected static final DataTypesManager DATA_TYPES_MANAGER = ToolsLocator.getDataTypesManager(); |
|
42 |
protected static final Logger LOG = LoggerFactory.getLogger(AbstractObjectToTimefeatureAttributeGetter.class); |
|
43 |
|
|
44 |
public AbstractObjectToTimefeatureAttributeGetter() { |
|
45 |
super(); |
|
46 |
} |
|
47 |
} |
|
0 | 48 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class DayToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter { |
|
32 |
static final long MILLIS_IN_A_DAY = 1000 * 60 * 60 * 24; |
|
33 |
|
|
34 |
public DayToRelativeInstantFeatureAttributeGetter() { |
|
35 |
super(MILLIS_IN_A_DAY); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
|
|
25 |
/** |
|
26 |
* @author gvSIG Team |
|
27 |
* @version $Id$ |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class HourToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter { |
|
31 |
static final long MILLIS_IN_A_HOUR = 1000 * 60 * 60; |
|
32 |
|
|
33 |
public HourToRelativeInstantFeatureAttributeGetter() { |
|
34 |
super(MILLIS_IN_A_HOUR); |
|
35 |
} |
|
36 |
} |
|
37 |
|
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class SecondToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public SecondToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.SECOND_OF_MINUTE); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.DataTypes; |
|
25 |
import org.gvsig.timesupport.RelativeInstant; |
|
26 |
import org.gvsig.tools.dataTypes.DataType; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* @author gvSIG Team |
|
31 |
* @version $Id$ |
|
32 |
* |
|
33 |
*/ |
|
34 |
public abstract class AbstractRelativeInstantFeatureAttributeGetter extends AbstractObjectToTimefeatureAttributeGetter { |
|
35 |
protected DataType dataType = null; |
|
36 |
protected long millisInUnit = 1; |
|
37 |
|
|
38 |
public AbstractRelativeInstantFeatureAttributeGetter(long millisInUnit) { |
|
39 |
super(); |
|
40 |
this.dataType = DATA_TYPES_MANAGER.get(DataTypes.INSTANT); |
|
41 |
this.millisInUnit = millisInUnit; |
|
42 |
} |
|
43 |
|
|
44 |
public DataType getDataType() { |
|
45 |
return dataType; |
|
46 |
} |
|
47 |
|
|
48 |
public Object getter(Object sourceAttributeValue) { |
|
49 |
if (sourceAttributeValue == null){ |
|
50 |
return TIME_SUPPORT_MANAGER.createRelativeInstant(0); |
|
51 |
} |
|
52 |
return TIME_SUPPORT_MANAGER.createRelativeInstant((long)new Double(sourceAttributeValue.toString()).doubleValue() * millisInUnit); |
|
53 |
} |
|
54 |
|
|
55 |
public Object setter(Object targetAttributeValue) { |
|
56 |
return new Long(((RelativeInstant)targetAttributeValue).toMillis() / millisInUnit); |
|
57 |
} |
|
58 |
|
|
59 |
} |
|
0 | 60 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class DayToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public DayToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.DAY_OF_MONTH); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class HourToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public HourToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.HOUR_OF_DAY); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class MinuteToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter { |
|
32 |
static final long MILLIS_IN_A_MINUTE = 1000 * 60; |
|
33 |
|
|
34 |
public MinuteToRelativeInstantFeatureAttributeGetter() { |
|
35 |
super(MILLIS_IN_A_MINUTE); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
0 | 39 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.DataTypes; |
|
25 |
import org.gvsig.timesupport.AbsoluteInstant; |
|
26 |
import org.gvsig.timesupport.AbsoluteInstantTypeNotRegisteredException; |
|
27 |
import org.gvsig.tools.dataTypes.DataType; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* @author gvSIG Team |
|
32 |
* @version $Id$ |
|
33 |
* |
|
34 |
*/ |
|
35 |
public abstract class AbstractAbsoluteInstantFeatureAttributeGetter extends AbstractObjectToTimefeatureAttributeGetter { |
|
36 |
protected int dateTimeFieldtype = -1; |
|
37 |
protected DataType dataType = null; |
|
38 |
|
|
39 |
public AbstractAbsoluteInstantFeatureAttributeGetter( |
|
40 |
int dateTimeFieldtype) { |
|
41 |
super(); |
|
42 |
this.dateTimeFieldtype = dateTimeFieldtype; |
|
43 |
this.dataType = DATA_TYPES_MANAGER.get(DataTypes.INSTANT); |
|
44 |
} |
|
45 |
|
|
46 |
public Object getter(Object sourceAttributeValue) { |
|
47 |
try { |
|
48 |
if (sourceAttributeValue == null){ |
|
49 |
return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, 0); |
|
50 |
} |
|
51 |
return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, ((Integer)sourceAttributeValue).intValue()); |
|
52 |
} catch (AbsoluteInstantTypeNotRegisteredException e) { |
|
53 |
LOG.error("Impossible to apply the tranformation for this field", e); |
|
54 |
} |
|
55 |
return TIME_SUPPORT_MANAGER.createAbsoluteInstant(); |
|
56 |
} |
|
57 |
|
|
58 |
public Object setter(Object targetAttributeValue) { |
|
59 |
return new Integer(((AbsoluteInstant)targetAttributeValue).getValue(0)); |
|
60 |
} |
|
61 |
|
|
62 |
public DataType getDataType() { |
|
63 |
return dataType; |
|
64 |
} |
|
65 |
} |
|
0 | 66 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class YearToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public YearToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.YEAR); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
import org.gvsig.timesupport.AbsoluteInstantType; |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class MinuteToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter { |
|
33 |
|
|
34 |
public MinuteToAbsoluteInstantFeatureAttributeGetter() { |
|
35 |
super(AbsoluteInstantType.MINUTE_OF_HOUR); |
|
36 |
} |
|
37 |
} |
|
0 | 38 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.dal.feature.impl.attributegetter; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author gvSIG Team |
|
28 |
* @version $Id$ |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class MilliToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter { |
|
32 |
|
|
33 |
public MilliToRelativeInstantFeatureAttributeGetter() { |
|
34 |
super(1); |
|
35 |
} |
|
36 |
} |
|
0 | 37 |
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java | ||
---|---|---|
21 | 21 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
22 | 22 |
import org.gvsig.fmap.geom.Geometry; |
23 | 23 |
import org.gvsig.fmap.geom.primitive.Envelope; |
24 |
import org.gvsig.timesupport.Instant; |
|
25 |
import org.gvsig.timesupport.Interval; |
|
24 | 26 |
import org.gvsig.tools.ToolsLocator; |
25 | 27 |
import org.gvsig.tools.dataTypes.CoercionException; |
26 | 28 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
... | ... | |
94 | 96 |
this.data.set(i, null); |
95 | 97 |
return; |
96 | 98 |
|
97 |
} |
|
99 |
} |
|
100 |
|
|
101 |
if (attribute.getFeatureAttributeGetter() != null){ |
|
102 |
value = attribute.getFeatureAttributeGetter().setter(value); |
|
103 |
} |
|
104 |
|
|
105 |
if (attribute.getObjectClass().isInstance(value)) { |
|
106 |
this.data.set(i, value); |
|
107 |
return; |
|
108 |
} |
|
98 | 109 |
|
99 | 110 |
if (!attribute.getObjectClass().isInstance(value)) { |
100 | 111 |
try { |
... | ... | |
111 | 122 |
} |
112 | 123 |
|
113 | 124 |
this.data.set(i, value); |
114 |
} |
|
115 |
|
|
116 |
private Object get(int index,Class theClass, int type) { |
|
117 |
Object value = this.get(index); |
|
118 |
if( theClass.isInstance(value) ) { |
|
119 |
return value; |
|
120 |
} |
|
121 |
try { |
|
122 |
return this.getDataTypesManager().coerce(type, value); |
|
123 |
} catch (CoercionException e) { |
|
124 |
throw new IllegalArgumentException( |
|
125 |
"Can't convert to "+theClass.getSimpleName()+" from '"+value.getClass().getName()+"' with value '"+value.toString()+"'.", |
|
126 |
e); |
|
127 |
} |
|
128 |
} |
|
125 |
} |
|
129 | 126 |
|
130 |
// private Object getNumberByType(Number value, int type) { |
|
131 |
// if (type==DataTypes.DOUBLE){ |
|
132 |
// return new Double(value.doubleValue()); |
|
133 |
// }else if (type==DataTypes.FLOAT){ |
|
134 |
// return new Float(value.floatValue()); |
|
135 |
// }else if (type==DataTypes.LONG){ |
|
136 |
// return new Long(value.longValue()); |
|
137 |
// }else if (type==DataTypes.INT){ |
|
138 |
// return new Integer(value.intValue()); |
|
139 |
// }else if (type==DataTypes.STRING){ |
|
140 |
// return value.toString(); |
|
141 |
// } |
|
142 |
// return value; |
|
143 |
// } |
|
127 |
private Object get(int index,Class theClass, int type) { |
|
128 |
Object value = this.get(index); |
|
129 |
if( theClass.isInstance(value) ) { |
|
130 |
return value; |
|
131 |
} |
|
132 |
try { |
|
133 |
return this.getDataTypesManager().coerce(type, value); |
|
134 |
} catch (CoercionException e) { |
|
135 |
throw new IllegalArgumentException( |
|
136 |
"Can't convert to "+theClass.getSimpleName()+" from '"+value.getClass().getName()+"' with value '"+value.toString()+"'.", |
|
137 |
e); |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
// private Object getNumberByType(Number value, int type) { |
|
142 |
// if (type==DataTypes.DOUBLE){ |
|
143 |
// return new Double(value.doubleValue()); |
|
144 |
// }else if (type==DataTypes.FLOAT){ |
|
145 |
// return new Float(value.floatValue()); |
|
146 |
// }else if (type==DataTypes.LONG){ |
|
147 |
// return new Long(value.longValue()); |
|
148 |
// }else if (type==DataTypes.INT){ |
|
149 |
// return new Integer(value.intValue()); |
|
150 |
// }else if (type==DataTypes.STRING){ |
|
151 |
// return value.toString(); |
|
152 |
// } |
|
153 |
// return value; |
|
154 |
// } |
|
144 | 155 |
|
145 |
public void initializeValues() {
|
|
146 |
FeatureType type = this.getType();
|
|
147 |
Iterator iterator = type.iterator();
|
|
156 |
public void initializeValues() {
|
|
157 |
FeatureType type = this.getType();
|
|
158 |
Iterator iterator = type.iterator();
|
|
148 | 159 |
|
149 |
while (iterator.hasNext()) {
|
|
150 |
FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
|
|
151 |
.next();
|
|
152 |
if (attribute.isAutomatic() || attribute.isReadOnly()
|
|
153 |
|| attribute.getEvaluator() != null) {
|
|
154 |
continue;
|
|
155 |
}
|
|
156 |
if (attribute.getDefaultValue() == null && !attribute.allowNull()) {
|
|
157 |
continue;
|
|
158 |
}
|
|
159 |
this.set(attribute, attribute.getDefaultValue());
|
|
160 |
}
|
|
161 |
}
|
|
160 |
while (iterator.hasNext()) {
|
|
161 |
FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
|
|
162 |
.next();
|
|
163 |
if (attribute.isAutomatic() || attribute.isReadOnly()
|
|
164 |
|| attribute.getEvaluator() != null) {
|
|
165 |
continue;
|
|
166 |
}
|
|
167 |
if (attribute.getDefaultValue() == null && !attribute.allowNull()) {
|
|
168 |
continue;
|
|
169 |
}
|
|
170 |
this.set(attribute, attribute.getDefaultValue());
|
|
171 |
}
|
|
172 |
}
|
|
162 | 173 |
|
163 |
public void clear() {
|
|
164 |
initializeValues();
|
|
165 |
}
|
|
174 |
public void clear() {
|
|
175 |
initializeValues();
|
|
176 |
}
|
|
166 | 177 |
|
167 |
public void initializeValues(Feature feature) {
|
|
168 |
FeatureType myType=this.getType();
|
|
169 |
FeatureType type =feature.getType();
|
|
170 |
Iterator iterator = type.iterator();
|
|
178 |
public void initializeValues(Feature feature) {
|
|
179 |
FeatureType myType=this.getType();
|
|
180 |
FeatureType type =feature.getType();
|
|
181 |
Iterator iterator = type.iterator();
|
|
171 | 182 |
|
172 |
while (iterator.hasNext()) {
|
|
173 |
FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
|
|
174 |
.next();
|
|
175 |
FeatureAttributeDescriptor myAttribute=myType.getAttributeDescriptor(attribute.getName());
|
|
176 |
if (myAttribute != null) {
|
|
177 |
this.set(myAttribute, feature.get(attribute.getIndex()));
|
|
178 |
}
|
|
179 |
}
|
|
180 |
}
|
|
183 |
while (iterator.hasNext()) {
|
|
184 |
FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
|
|
185 |
.next();
|
|
186 |
FeatureAttributeDescriptor myAttribute=myType.getAttributeDescriptor(attribute.getName());
|
|
187 |
if (myAttribute != null) {
|
|
188 |
this.set(myAttribute, feature.get(attribute.getIndex()));
|
|
189 |
}
|
|
190 |
}
|
|
191 |
}
|
|
181 | 192 |
|
182 |
public FeatureStore getStore() { |
|
183 |
return (FeatureStore) this.storeRef.get(); |
|
184 |
} |
|
185 | 193 |
|
186 |
public FeatureType getType() {
|
|
187 |
return this.data.getType();
|
|
188 |
}
|
|
194 |
public FeatureStore getStore() {
|
|
195 |
return (FeatureStore) this.storeRef.get();
|
|
196 |
}
|
|
189 | 197 |
|
190 |
public EditableFeature getEditable() {
|
|
191 |
return new DefaultEditableFeature(this);
|
|
192 |
}
|
|
198 |
public FeatureType getType() {
|
|
199 |
return this.data.getType();
|
|
200 |
}
|
|
193 | 201 |
|
194 |
public Feature getCopy() {
|
|
195 |
return new DefaultFeature(this);
|
|
196 |
}
|
|
202 |
public EditableFeature getEditable() {
|
|
203 |
return new DefaultEditableFeature(this);
|
|
204 |
}
|
|
197 | 205 |
|
198 |
public FeatureReference getReference() { |
|
199 |
if (this.reference == null) { |
|
200 |
this.reference = new DefaultFeatureReference(this); |
|
201 |
} |
|
202 |
return this.reference; |
|
203 |
} |
|
206 |
public Feature getCopy() { |
|
207 |
return new DefaultFeature(this); |
|
208 |
} |
|
204 | 209 |
|
205 |
public void validate(int mode) { |
|
206 |
((DefaultFeatureType) this.data.getType()).validateFeature(this, mode); |
|
207 |
} |
|
210 |
public FeatureReference getReference() { |
|
211 |
if (this.reference == null) { |
|
212 |
this.reference = new DefaultFeatureReference(this); |
|
213 |
} |
|
214 |
return this.reference; |
|
215 |
} |
|
208 | 216 |
|
209 |
public List getSRSs() { |
Also available in: Unified diff