You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/07/06 12:36:11 UTC
[isis] 06/11: ISIS-2789: converts Sets to a
map, keyed by propertyId
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2789
in repository https://gitbox.apache.org/repos/asf/isis.git
commit f175c5d2f770a11b6b22e33c0683ed5e819849f7
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Jul 6 13:11:21 2021 +0100
ISIS-2789: converts Set<ProprttyChangeRecord>s to a map, keyed by propertyId
---
.../changetracking/EntityChangeTrackerDefault.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/EntityChangeTrackerDefault.java b/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/EntityChangeTrackerDefault.java
index 58bba51..9fb8e9c 100644
--- a/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/EntityChangeTrackerDefault.java
+++ b/core/transaction/src/main/java/org/apache/isis/core/transaction/changetracking/EntityChangeTrackerDefault.java
@@ -103,7 +103,7 @@ implements
/**
* Contains initial change records having set the pre-values of every property of every object that was enlisted.
*/
- private final Set<_PropertyChangeRecord> entityPropertyChangeRecords = _Sets.newLinkedHashSet();
+ private final Map<String,_PropertyChangeRecord> entityPropertyChangeRecords = _Maps.newLinkedHashMap();
/**
* Contains pre- and post- values of every property of every object that actually changed. A lazy snapshot,
@@ -321,10 +321,10 @@ implements
entity.getSpecification().streamProperties(MixedIn.EXCLUDED)
.filter(property->!property.isNotPersisted())
.map(property->_PropertyChangeRecord.of(entity, property))
- .filter(record->!entityPropertyChangeRecords.contains(record)) // already enlisted, so ignore
+ .filter(record->!entityPropertyChangeRecords.containsKey(record.getPropertyId())) // already enlisted, so ignore
.forEach(record->{
fun.accept(record);
- entityPropertyChangeRecords.add(record);
+ entityPropertyChangeRecords.put(record.getPropertyId(), record);
});
}
@@ -334,9 +334,9 @@ implements
*/
private Set<_PropertyChangeRecord> capturePostValuesAndDrain() {
- val records = entityPropertyChangeRecords.stream()
+ val records = entityPropertyChangeRecords.values().stream()
// set post values, which have been left empty up to now
- .peek(managedProperty->managedProperty.updatePostValue())
+ .peek(_PropertyChangeRecord::updatePostValue)
.filter(managedProperty->managedProperty.getPreAndPostValue().shouldPublish())
.collect(_Sets.toUnmodifiable());
@@ -348,7 +348,7 @@ implements
// side-effect free, used by XRay
long countPotentialPropertyChangeRecords() {
- return entityPropertyChangeRecords.stream().count();
+ return entityPropertyChangeRecords.size();
}
// -- METRICS SERVICE