Revision 45308 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
DefaultFeatureStore.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.fmap.dal.feature.impl; |
26 | 26 |
|
27 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.SpatialManager; |
|
28 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureTypeManager; |
|
29 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureManager; |
|
30 |
|
|
31 | 27 |
import java.util.ArrayList; |
32 | 28 |
import java.util.Collection; |
33 | 29 |
import java.util.Collections; |
... | ... | |
39 | 35 |
import java.util.Map.Entry; |
40 | 36 |
import java.util.Set; |
41 | 37 |
import javax.json.JsonObject; |
42 |
|
|
43 | 38 |
import org.apache.commons.io.FilenameUtils; |
44 | 39 |
import org.apache.commons.io.IOUtils; |
45 | 40 |
import org.apache.commons.lang3.StringUtils; |
... | ... | |
50 | 45 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
51 | 46 |
import org.gvsig.expressionevaluator.GeometryExpressionUtils; |
52 | 47 |
import org.gvsig.fmap.dal.BaseStoresRepository; |
53 |
|
|
54 | 48 |
import org.gvsig.fmap.dal.DALLocator; |
55 | 49 |
import org.gvsig.fmap.dal.DataManager; |
56 | 50 |
import org.gvsig.fmap.dal.DataQuery; |
... | ... | |
89 | 83 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
90 | 84 |
import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
91 | 85 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
86 |
import org.gvsig.fmap.dal.feature.FeatureStoreTimeSupport; |
|
87 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
92 | 88 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
93 | 89 |
import org.gvsig.fmap.dal.feature.FeatureType; |
90 |
import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged; |
|
94 | 91 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
95 |
import org.gvsig.fmap.dal.feature.FeatureStoreTimeSupport; |
|
96 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
|
97 |
import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged; |
|
98 | 92 |
import org.gvsig.fmap.dal.feature.exception.AlreadyEditingException; |
99 | 93 |
import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException; |
100 | 94 |
import org.gvsig.fmap.dal.feature.exception.CreateFeatureException; |
... | ... | |
120 | 114 |
import org.gvsig.fmap.dal.feature.exception.StoreUpdateFeatureTypeException; |
121 | 115 |
import org.gvsig.fmap.dal.feature.exception.ValidateFeaturesException; |
122 | 116 |
import org.gvsig.fmap.dal.feature.exception.WriteNotAllowedException; |
117 |
import org.gvsig.fmap.dal.feature.impl.dynobjectutils.DynObjectFeatureFacade; |
|
118 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureManager; |
|
119 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureTypeManager; |
|
120 |
import org.gvsig.fmap.dal.feature.impl.editing.memory.SpatialManager; |
|
123 | 121 |
import org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet; |
124 |
import org.gvsig.fmap.dal.feature.impl.dynobjectutils.DynObjectFeatureFacade; |
|
125 | 122 |
import org.gvsig.fmap.dal.feature.impl.undo.DefaultFeatureCommandsStack; |
126 | 123 |
import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack; |
127 | 124 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
... | ... | |
166 | 163 |
import org.gvsig.tools.persistence.Persistent; |
167 | 164 |
import org.gvsig.tools.persistence.PersistentState; |
168 | 165 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
166 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
|
169 | 167 |
import org.gvsig.tools.undo.RedoException; |
170 | 168 |
import org.gvsig.tools.undo.UndoException; |
171 | 169 |
import org.gvsig.tools.undo.command.Command; |
172 | 170 |
import org.gvsig.tools.util.HasAFile; |
173 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
|
174 | 171 |
import org.gvsig.tools.util.UnmodifiableBasicMap; |
175 | 172 |
import org.gvsig.tools.visitor.VisitCanceledException; |
176 | 173 |
import org.gvsig.tools.visitor.Visitor; |
... | ... | |
2078 | 2075 |
|
2079 | 2076 |
@Override |
2080 | 2077 |
public Feature findFirst(String filter) throws DataException { |
2081 |
return this.findFirst(filter, null, true); |
|
2078 |
return this.findFirst(filter, (String)null, true);
|
|
2082 | 2079 |
} |
2083 | 2080 |
|
2084 | 2081 |
@Override |
... | ... | |
2091 | 2088 |
FeatureQuery query = this.createFeatureQuery(filter, sortBy, asc); |
2092 | 2089 |
return findFirst(query); |
2093 | 2090 |
} |
2091 |
|
|
2092 |
@Override |
|
2093 |
public Feature findFirst(String filter, Expression sortBy, boolean asc) throws DataException { |
|
2094 |
FeatureQuery query = this.createFeatureQuery(filter, sortBy, asc); |
|
2095 |
return findFirst(query); |
|
2096 |
} |
|
2094 | 2097 |
|
2095 | 2098 |
@Override |
2096 | 2099 |
public Feature findFirst(Expression filter) throws DataException { |
2097 |
return this.findFirst(filter, null, true); |
|
2100 |
return this.findFirst(filter, (String)null, true);
|
|
2098 | 2101 |
} |
2099 | 2102 |
|
2100 | 2103 |
@Override |
... | ... | |
2109 | 2112 |
} |
2110 | 2113 |
|
2111 | 2114 |
@Override |
2115 |
public Feature findFirst(Expression filter, Expression sortBy, boolean asc) throws DataException { |
|
2116 |
FeatureQuery query = this.createFeatureQuery(filter, sortBy, asc); |
|
2117 |
return findFirst(query); |
|
2118 |
} |
|
2119 |
|
|
2120 |
@Override |
|
2112 | 2121 |
public Feature findFirst(FeatureQuery query) throws DataException { |
2113 | 2122 |
if( query == null ) { |
2114 | 2123 |
query = this.createFeatureQuery(); |
... | ... | |
2665 | 2674 |
return new DefaultFeatureQuery(); |
2666 | 2675 |
} |
2667 | 2676 |
|
2677 |
@Override |
|
2668 | 2678 |
public FeatureQuery createFeatureQuery(Expression filter, String sortBy, boolean asc) { |
2669 | 2679 |
FeatureQuery query = null; |
2670 | 2680 |
if( filter!=null ) { |
... | ... | |
2675 | 2685 |
if( query == null ) { |
2676 | 2686 |
query = this.createFeatureQuery(); |
2677 | 2687 |
} |
2688 |
if ( StringUtils.containsAny(sortBy, "(", ")") ) { |
|
2689 |
throw new IllegalArgumentException("Incorrect sortBy expression"); |
|
2690 |
} |
|
2678 | 2691 |
String[] attrnames; |
2679 | 2692 |
if( sortBy.contains(",") ) { |
2680 | 2693 |
attrnames = StringUtils.split(sortBy, ","); |
... | ... | |
2702 | 2715 |
return query; |
2703 | 2716 |
} |
2704 | 2717 |
|
2718 |
@Override |
|
2705 | 2719 |
public FeatureQuery createFeatureQuery(String filter, String sortBy, boolean asc) { |
2706 | 2720 |
if( StringUtils.isBlank(filter) ) { |
2707 | 2721 |
return this.createFeatureQuery( |
... | ... | |
2718 | 2732 |
} |
2719 | 2733 |
} |
2720 | 2734 |
|
2735 |
public FeatureQuery createFeatureQuery(Expression filter, Expression sortBy, boolean asc) { |
|
2736 |
FeatureQuery query = null; |
|
2737 |
if( filter != null ) { |
|
2738 |
query = this.createFeatureQuery(); |
|
2739 |
query.setFilter(filter); |
|
2740 |
} |
|
2741 |
if( sortBy != null) { |
|
2742 |
if( query == null ) { |
|
2743 |
query = this.createFeatureQuery(); |
|
2744 |
} |
|
2745 |
query.getOrder().add(sortBy, asc); |
|
2746 |
} |
|
2747 |
|
|
2748 |
if( query != null ) { |
|
2749 |
query.retrievesAllAttributes(); |
|
2750 |
} |
|
2751 |
return query; |
|
2752 |
} |
|
2753 |
|
|
2754 |
public FeatureQuery createFeatureQuery(String filter, Expression sortBy, boolean asc) { |
|
2755 |
if( StringUtils.isBlank(filter) ) { |
|
2756 |
return this.createFeatureQuery( |
|
2757 |
(Expression)null, |
|
2758 |
sortBy, |
|
2759 |
asc |
|
2760 |
); |
|
2761 |
} else { |
|
2762 |
return this.createFeatureQuery( |
|
2763 |
ExpressionUtils.createExpression(filter), |
|
2764 |
sortBy, |
|
2765 |
asc |
|
2766 |
); |
|
2767 |
} |
|
2768 |
} |
|
2769 |
|
|
2721 | 2770 |
@Override |
2722 | 2771 |
public DataQuery createQuery() { |
2723 | 2772 |
return createFeatureQuery(); |
Also available in: Unified diff