From 2d3a1ff224f716cd8c7bdef72e97f67306abeda5 Mon Sep 17 00:00:00 2001 From: MaximilianoTabacman Date: Thu, 8 Feb 2024 09:54:01 -0300 Subject: [PATCH] Added transact: to methods affecting the contents --- .../GemStoneRepository.class.st | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source/Sagan-GemStone/GemStoneRepository.class.st b/source/Sagan-GemStone/GemStoneRepository.class.st index 4559fb6..f52faa3 100644 --- a/source/Sagan-GemStone/GemStoneRepository.class.st +++ b/source/Sagan-GemStone/GemStoneRepository.class.st @@ -96,18 +96,20 @@ GemStoneRepository >> matchingCriteriaBuilder [ { #category : 'private - management' } GemStoneRepository >> purgeAfterCheckingInclusion: aDomainObject [ - contents remove: aDomainObject ifAbsent: [ - DataInconsistencyFound signal: - ( '<1p> was expected to be found in the contents, but it was not.' expandMacrosWith: - aDomainObject ) - ]. - ^ aDomainObject + ^ self transact: [ + contents remove: aDomainObject ifAbsent: [ + DataInconsistencyFound signal: + ( '<1p> was expected to be found in the contents, but it was not.' expandMacrosWith: + aDomainObject ) + ]. + aDomainObject + ] ] { #category : 'management' } GemStoneRepository >> purgeAllMatching: aCriteriaOrBlock [ - contents := contents reject: ( self asMatchingCriteria: aCriteriaOrBlock ) + self transact: [ contents := contents reject: ( self asMatchingCriteria: aCriteriaOrBlock ) ] ] { #category : 'private - accessing' } @@ -120,8 +122,10 @@ GemStoneRepository >> saganGemStoneIndexOptions [ { #category : 'private - management' } GemStoneRepository >> storeAfterCheckingConflicts: aDomainObject [ - contents add: aDomainObject. - ^ aDomainObject + ^ self transact: [ + contents add: aDomainObject. + aDomainObject + ] ] { #category : 'management' } @@ -133,7 +137,7 @@ GemStoneRepository >> transact: aBlock [ { #category : 'management' } GemStoneRepository >> update: aMutableDomainObject executing: aBlock [ - aBlock value: aMutableDomainObject + self transact: [ aBlock value: aMutableDomainObject ] ] { #category : 'private - management' }