Revision 26252 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java

View differences:

DefaultFeatureSet.java
51 51

  
52 52

  
53 53
	public DefaultFeatureSet(DefaultFeatureStore store, FeatureQuery query)
54
			throws DataException {
54
	throws DataException {
55 55
		this.featureToIgnoreNotification = null;
56 56
		this.iteratorMode = NO_CHECKED;
57 57
		this.modified = false;
58 58
		this.size = -1;
59 59
		this.orderedData = null;
60 60
		this.store = store;
61
		this.transform = (DefaultFeatureStoreTransforms) store.getTransforms();
61
		if (this.store.isEditing()) {
62
			this.transform = this.store.getFeatureTypeManager().getTransforms();
63
		} else {
64
			this.transform = (DefaultFeatureStoreTransforms) store
65
				.getTransforms();
66
		}
62 67
		this.query = query;
63 68
		this.queryForProvider = query.getCopy();
64 69
		this.featureTypes = new ArrayList();
......
68 73
			this.queryForProvider.setFeatureType(this.transform
69 74
					.getSourceFeatureTypeFrom(this.query.getFeatureType()));
70 75
			this.queryForProvider.setFilter(null);
76
			// TODO Habria que comprobar si todos los campos que usan el filtro
77
			// son del provider. Si esto se cumple, no eliminamos el filtro.
71 78
		}
72 79

  
73 80
		if (query.hasFilter() && store.getIndexes() != null) {
74 81
			this.provider = (FeatureSetProvider) store.getIndexes()
75
					.getFeatureSet(this.queryForProvider.getFilter());
82
			.getFeatureSet(this.queryForProvider.getFilter());
76 83
		}
77 84
		if (this.provider == null) {
78 85
			this.provider = this.store.getProvider().createSet(
......
112 119
			}
113 120
		} else if ((mode & EDITED) == EDITED) {
114 121
			return provider.getSize()
115
					+ store.getFeatureManager().getDeltaSize();
122
			+ store.getFeatureManager().getDeltaSize();
116 123
		}
117 124
		return provider.getSize();
118 125
	}
......
143 150
		String type = ((FeatureStoreNotification) notification).getType();
144 151

  
145 152
		if (
146
			   type.equalsIgnoreCase(FeatureStoreNotification.AFTER_INSERT)
147
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DELETE)
148
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE)
149
			) {
153
				type.equalsIgnoreCase(FeatureStoreNotification.AFTER_INSERT)
154
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DELETE)
155
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE)
156
		) {
150 157
			if( this.featureToIgnoreNotification == ((FeatureStoreNotification) notification).getFeature() ) {
151 158
				return;
152 159
			}
......
154 161
			return;
155 162
		}
156 163
		if (
157
			   type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE_TYPE)
158
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REDO)
159
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UNDO)
160
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CANCELEDITING)
161
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REFRESH)
162
			|| type.equalsIgnoreCase(FeatureStoreNotification.COMPLEX_NOTIFICATION)
163
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CLOSE)
164
			|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DISPOSE)
165
			|| type.equalsIgnoreCase(FeatureStoreNotification.RESOURCE_CHANGED)
166
			|| type.equalsIgnoreCase(FeatureStoreNotification.TRANSFORM_CHANGE)
167
			) {
164
				type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE_TYPE)
165
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REDO)
166
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UNDO)
167
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CANCELEDITING)
168
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REFRESH)
169
				|| type.equalsIgnoreCase(FeatureStoreNotification.COMPLEX_NOTIFICATION)
170
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CLOSE)
171
				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DISPOSE)
172
				|| type.equalsIgnoreCase(FeatureStoreNotification.RESOURCE_CHANGED)
173
				|| type.equalsIgnoreCase(FeatureStoreNotification.TRANSFORM_CHANGE)
174
		) {
168 175
			modified = true;
169 176
			return;
170 177
		}
......
195 202
				return true;
196 203
			}
197 204
			return this.provider.getSize()
198
					+ this.store.getFeatureManager().getDeltaSize() == 0;
205
			+ this.store.getFeatureManager().getDeltaSize() == 0;
199 206
		}
200 207
		return this.provider.isEmpty();
201 208
	}
......
253 260

  
254 261
	public Iterator iterator(long index) throws DataException {
255 262
		if (index < 0) {
256
				throw new IndexOutOfBoundsException("The index (" + index
257
						+ ") is less than 0");
263
			throw new IndexOutOfBoundsException("The index (" + index
264
					+ ") is less than 0");
258 265
		}
259 266
		int mode = this.getIteratorMode();
260 267

  

Also available in: Unified diff