final EObject originatingTransactionRequest = (EObject) source;
Assert.notNull(originatingTransactionRequest);
final TransactionEventType type = event.getType();
final SimpleFeatureCollection affectedFeatures = event.getAffectedFeatures();
if (isIgnorablePostEvent(originatingTransactionRequest, type)) {
// if its a post event and there's no corresponding pre event bbox no need to
// proceed(Saves some cpu cycles and a catalog lookup for findAffectedCachedLayers).
return;
}
final Set<String> affectedLayers = findAffectedCachedLayers(event);
if (affectedLayers.isEmpty()) {
// event didn't touch a cached layer
return;
}
if (PRE_INSERT == type || PRE_UPDATE == type || PRE_DELETE == type) {
ReferencedEnvelope preBounds = affectedFeatures.getBounds();
this.affectedLayers.put(originatingTransactionRequest, affectedLayers);
this.affectedBounds.put(originatingTransactionRequest, preBounds);
} else if (POST_UPDATE == type && affectedFeatures != null) {
final ReferencedEnvelope bounds = affectedBounds.get(originatingTransactionRequest);
// only truncate if the request didn't fail
ReferencedEnvelope postBounds = affectedFeatures.getBounds();
Assert.isTrue(bounds.getCoordinateReferenceSystem().equals(
postBounds.getCoordinateReferenceSystem()));
bounds.expandToInclude(postBounds);
} else {