@Override public boolean isDeleted() { return wrappedAggregate.isDeleted(); }
private void doCommit(A aggregate) { if (managedAggregates(CurrentUnitOfWork.get()).containsValue(aggregate)) { if (aggregate.isDeleted()) { doDelete(aggregate); } else { doSave(aggregate); } if (aggregate.isDeleted()) { postDelete(aggregate); } else { postSave(aggregate); } } else { reportIllegalState(aggregate); } }
private void detectIllegalStateChanges(MatchAllFieldFilter fieldFilter, Aggregate<T> workingAggregate) { logger.debug("Starting separate Unit of Work for the purpose of checking illegal state changes in Aggregate"); if (aggregateIdentifier != null && workingAggregate != null && reportIllegalStateChange) { UnitOfWork<?> uow = DefaultUnitOfWork.startAndGet(null); try { Aggregate<T> aggregate2 = repository.delegate.load(aggregateIdentifier); if (workingAggregate.isDeleted()) { throw new AxonAssertionError("The working aggregate was considered deleted, " + "but the Repository still contains a non-deleted copy of " + "the aggregate. Make sure the aggregate explicitly marks " + "itself as deleted in an EventHandler."); } assertValidWorkingAggregateState(aggregate2, fieldFilter, workingAggregate); } catch (AggregateNotFoundException notFound) { if (!workingAggregate.isDeleted()) { throw new AxonAssertionError("The working aggregate was not considered deleted, " //NOSONAR + "but the Repository cannot recover the state of the " + "aggregate, as it is considered deleted there."); } } catch (Exception e) { throw new FixtureExecutionException("An Exception occurred while reconstructing the Aggregate from " + "given and published events. This may be an indication " + "that the aggregate cannot be recreated from its events.", e); } finally { // rollback to prevent changes bing pushed to event store uow.rollback(); } } }
@Override public boolean isDeleted() { return wrappedAggregate.isDeleted(); }
private void doCommit(A aggregate) { if (managedAggregates(CurrentUnitOfWork.get()).containsValue(aggregate)) { if (aggregate.isDeleted()) { doDelete(aggregate); } else { doSave(aggregate); } if (aggregate.isDeleted()) { postDelete(aggregate); } else { postSave(aggregate); } } else { reportIllegalState(aggregate); } }