Revision 47611 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 | ||
---|---|---|
63 | 63 |
import org.gvsig.fmap.dal.DatabaseWorkspaceManager; |
64 | 64 |
import org.gvsig.fmap.dal.StoresRepository; |
65 | 65 |
import org.gvsig.fmap.dal.SupportTransactions; |
66 |
import org.gvsig.fmap.dal.SupportTransactionsHelper; |
|
66 | 67 |
import org.gvsig.fmap.dal.exception.CloneException; |
67 | 68 |
import org.gvsig.fmap.dal.exception.CloseException; |
68 | 69 |
import org.gvsig.fmap.dal.exception.CreateException; |
... | ... | |
182 | 183 |
import org.gvsig.tools.persistence.Persistent; |
183 | 184 |
import org.gvsig.tools.persistence.PersistentState; |
184 | 185 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
185 |
import org.gvsig.tools.resourcesstorage.CompoundResourcesStorage; |
|
186 | 186 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
187 | 187 |
import org.gvsig.tools.undo.RedoException; |
188 | 188 |
import org.gvsig.tools.undo.UndoException; |
... | ... | |
253 | 253 |
private FeatureStoreTimeSupport timeSupport; |
254 | 254 |
|
255 | 255 |
private PropertiesSupportHelper propertiesSupportHelper; |
256 |
private DataTransaction transaction; |
|
257 | 256 |
|
257 |
private final SupportTransactionsHelper transactionHelper; |
|
258 |
|
|
258 | 259 |
private String editingSessionCode; |
259 | 260 |
private String lastEditingSessionCode; |
260 | 261 |
|
... | ... | |
313 | 314 |
public DefaultFeatureStore() { |
314 | 315 |
this.state = new StateInformation(); |
315 | 316 |
this.sampleFeatureCache = null; |
317 |
this.transactionHelper = new SupportTransactionsHelper(); |
|
316 | 318 |
this.transactionObserver = (Observable o, Object o1) -> { |
317 | 319 |
if( o1 instanceof BaseNotification && ( |
318 | 320 |
((BaseNotification)o1).isOfType("ROLLBACK") || |
... | ... | |
522 | 524 |
this.delegateObservable = null; |
523 | 525 |
} |
524 | 526 |
DisposeUtils.disposeQuietly(this.resourcesStorage); |
525 |
if( this.transaction!=null ) { |
|
526 |
this.transaction.remove(this); |
|
527 |
this.transaction = null; |
|
527 |
DataTransaction transaction = this.getTransaction(); |
|
528 |
if( transaction!=null ) { |
|
529 |
transaction.remove(this); |
|
530 |
this.setTransaction(null); |
|
528 | 531 |
} |
529 | 532 |
} |
530 | 533 |
|
... | ... | |
3815 | 3818 |
public ResourcesStorage getResourcesStorage() { |
3816 | 3819 |
if (this.resourcesStorage != null) { |
3817 | 3820 |
if(this.resourcesStorage instanceof SupportTransactions){ |
3818 |
((SupportTransactions)this.resourcesStorage).setTransaction(transaction); |
|
3819 |
} else if(this.resourcesStorage instanceof CompoundResourcesStorage) { |
|
3820 |
for (ResourcesStorage storage : (CompoundResourcesStorage)this.resourcesStorage) { |
|
3821 |
if(storage instanceof SupportTransactions){ |
|
3822 |
((SupportTransactions)storage).setTransaction(transaction); |
|
3823 |
} |
|
3824 |
} |
|
3821 |
((SupportTransactions)this.resourcesStorage).setTransaction(this.getTransaction()); |
|
3825 | 3822 |
} |
3826 | 3823 |
DisposeUtils.bind(this.resourcesStorage); |
3827 | 3824 |
return this.resourcesStorage; |
... | ... | |
3995 | 3992 |
} |
3996 | 3993 |
return isFeatureModified(feature.getReference()); |
3997 | 3994 |
} |
3995 |
|
|
3998 | 3996 |
|
3999 | 3997 |
@Override |
4000 | 3998 |
public void setTransaction(DataTransaction transaction) { |
4001 |
if( this.transaction!=null ) { |
|
4002 |
this.transaction.deleteObserver(transactionObserver); |
|
3999 |
DataTransaction prevTransaction = transactionHelper.getTransaction(); |
|
4000 |
if( prevTransaction!=null ) { |
|
4001 |
prevTransaction.deleteObserver(transactionObserver); |
|
4003 | 4002 |
} |
4004 |
this.transaction = transaction;
|
|
4003 |
this.transactionHelper.setTransaction(transaction);
|
|
4005 | 4004 |
if (this.provider != null){ |
4006 | 4005 |
if (transaction == null || transaction instanceof DataTransactionServices) { |
4007 | 4006 |
this.provider.setTransaction((DataTransactionServices) transaction); |
... | ... | |
4014 | 4013 |
|
4015 | 4014 |
@Override |
4016 | 4015 |
public DataTransaction getTransaction() { |
4017 |
return transaction; |
|
4016 |
DataTransaction xtransaction = transactionHelper.getTransaction(); |
|
4017 |
return xtransaction; |
|
4018 | 4018 |
} |
4019 | 4019 |
|
4020 | 4020 |
@Override |
... | ... | |
4047 | 4047 |
return references; |
4048 | 4048 |
} |
4049 | 4049 |
|
4050 |
@Override |
|
4050 | 4051 |
public List<FeatureReference> getEditedFeaturesNotValidated() { |
4051 | 4052 |
|
4052 | 4053 |
try { |
Also available in: Unified diff