Skip to content

Commit

Permalink
Stop storing "consideredEventMarkRef" into repo
Browse files Browse the repository at this point in the history
We should not store all considered event marks into
SimulationResultProcessedObjectType objects in repo.
This is how it was designed and documented in XSD.

This fix adds forgotten clearing of the data before storing the object
into the repository.
  • Loading branch information
mederly committed Mar 24, 2023
1 parent 36dac7b commit 9326dc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ private void storeProcessedObjects(
getOpenResultTransactionsHolder().addProcessedObject(processedObject, simulationTransaction, task, result);
}
Collection<SimulationResultProcessedObjectType> processedObjectsBeans = ProcessedObjectImpl.toBeans(processedObjects);
stripUnneededData(processedObjectsBeans);
List<ItemDelta<?, ?>> modifications = PrismContext.get().deltaFor(SimulationResultType.class)
.item(SimulationResultType.F_PROCESSED_OBJECT)
.addRealValues(processedObjectsBeans)
Expand All @@ -217,6 +218,13 @@ private void storeProcessedObjects(
}
}

private void stripUnneededData(Collection<SimulationResultProcessedObjectType> processedObjectsBeans) {
processedObjectsBeans.forEach(po -> {
// This is done to save space in repository. TODO add removal of "after" state here
po.getConsideredEventMarkRef().clear();
});
}

private static OpenResultTransactionsHolder getOpenResultTransactionsHolder() {
return ModelBeans.get().simulationResultManager.getOpenResultTransactionsHolder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -202,6 +203,7 @@ public void shutdown() {
}

/** TEMPORARY. Retrieves stored deltas. May be replaced by something more general in the future. */
@VisibleForTesting
@Override
public @NotNull List<ProcessedObjectImpl<?>> getStoredProcessedObjects(@NotNull String oid, OperationResult result)
throws SchemaException {
Expand Down

0 comments on commit 9326dc8

Please sign in to comment.