Revision 47784 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

View differences:

DefaultFeatureStore.java
35 35
import java.util.Objects;
36 36
import java.util.Set;
37 37
import java.util.UUID;
38
import java.util.function.Predicate;
38 39
import javax.json.JsonObject;
39 40
import org.apache.commons.io.FilenameUtils;
40 41
import org.apache.commons.io.IOUtils;
......
265 266
    private final Observer transactionObserver;
266 267
    private String fullNameForTraces;
267 268

  
269
    private Predicate<FeatureStoreNotification> notificacionsFilter;
270
    
268 271
    private class StateInformation extends HashMap<Object, Object> {
269 272

  
270 273
        private static final long serialVersionUID = 4109026189635185666L;
......
1071 1074
    @Override
1072 1075
    public FeatureStoreNotification notifyChange(FeatureStoreNotification storeNotification) {
1073 1076
        if (delegateObservable != null) {
1074
            try {
1075
                delegateObservable.notifyObservers(storeNotification);
1076
            } catch (Throwable ex) {
1077
                LOGGER.warn("Problems notifying changes in the store '" + this.getName() + " (" + storeNotification.getType() + ").", ex);
1077
            if( doesTheNotificationHaveToBeSent(storeNotification) ) {
1078
                try {
1079
                    delegateObservable.notifyObservers(storeNotification);
1080
                } catch (Throwable ex) {
1081
                    LOGGER.warn("Problems notifying changes in the store '" + this.getName() + " (" + storeNotification.getType() + ").", ex);
1082
                }
1078 1083
            }
1079 1084
        }
1080 1085
        return storeNotification;
......
4104 4109
        }
4105 4110
    }
4106 4111

  
4107
    
4112
    public Predicate<FeatureStoreNotification> setNotificationsFilter(Predicate<FeatureStoreNotification> filter) {
4113
        Predicate<FeatureStoreNotification> x = this.notificacionsFilter;
4114
        this.notificacionsFilter = filter;
4115
        return x;
4116
    }
4117
 
4118
    private boolean doesTheNotificationHaveToBeSent(FeatureStoreNotification notfication) {
4119
        if( this.notificacionsFilter==null ) {
4120
            return false;
4121
        }
4122
        return !this.notificacionsFilter.test(notfication);
4123
    }
4108 4124
}

Also available in: Unified diff