40 |
40 |
protected FeatureProvider data;
|
41 |
41 |
protected FeatureReference reference;
|
42 |
42 |
private WeakReference storeRef;
|
|
43 |
|
|
44 |
private boolean inserted = false;
|
43 |
45 |
|
44 |
|
|
45 |
|
/*
|
|
46 |
/*
|
46 |
47 |
* Usar con mucha precaucion o mejor no usar. Lo precisa el
|
47 |
48 |
* DefaultFeatureSet en la ordenacion.
|
48 |
49 |
*/
|
... | ... | |
55 |
56 |
this.data = data;
|
56 |
57 |
this.storeRef = new WeakReference(store);
|
57 |
58 |
this.reference = null;
|
|
59 |
this.inserted = !data.isNew();
|
58 |
60 |
}
|
59 |
61 |
|
60 |
62 |
DefaultFeature(DefaultFeature feature) {
|
61 |
63 |
this.data = feature.data.getCopy();
|
62 |
64 |
this.storeRef = feature.storeRef;
|
63 |
65 |
this.reference = feature.reference;
|
|
66 |
this.inserted = feature.isInserted();
|
64 |
67 |
}
|
65 |
68 |
|
66 |
69 |
public void setData(FeatureProvider data) {
|
67 |
70 |
this.data = data;
|
68 |
71 |
this.reference = null;
|
|
72 |
this.inserted = true;
|
69 |
73 |
}
|
70 |
74 |
|
71 |
75 |
public FeatureProvider getData() {
|
... | ... | |
212 |
216 |
|
213 |
217 |
public FeatureReference getReference() {
|
214 |
218 |
if (this.reference == null) {
|
215 |
|
DefaultFeatureReference temp_ref = new DefaultFeatureReference(this);
|
216 |
|
if (this.data.isNew()) {
|
217 |
|
DefaultFeatureStore store = (DefaultFeatureStore) this.getStore();
|
218 |
|
Feature f;
|
219 |
|
try {
|
220 |
|
f = store.getFeatureManager().get(temp_ref, store);
|
221 |
|
} catch (DataException e) {
|
222 |
|
throw new UnableToGetReferenceException(e);
|
223 |
|
}
|
224 |
|
if (f == null) {
|
225 |
|
return null;
|
226 |
|
}
|
|
219 |
if (!isInserted()) {
|
|
220 |
return null;
|
227 |
221 |
}
|
228 |
|
this.reference = temp_ref;
|
|
222 |
reference = new DefaultFeatureReference(this);
|
229 |
223 |
}
|
230 |
224 |
return this.reference;
|
231 |
225 |
}
|
... | ... | |
564 |
558 |
}
|
565 |
559 |
return super.toString();
|
566 |
560 |
}
|
|
561 |
|
|
562 |
|
|
563 |
/**
|
|
564 |
* @return the inserted
|
|
565 |
*/
|
|
566 |
public boolean isInserted() {
|
|
567 |
return inserted;
|
|
568 |
}
|
|
569 |
|
|
570 |
|
|
571 |
/**
|
|
572 |
* @param inserted the inserted to set
|
|
573 |
*/
|
|
574 |
public void setInserted(boolean inserted) {
|
|
575 |
this.inserted = inserted;
|
|
576 |
}
|
567 |
577 |
}
|