All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enodeframework.eventing.EventAppendResult.kt Maven / Gradle / Ivy

package org.enodeframework.eventing

import com.google.common.collect.Lists
import com.google.common.collect.Maps

class EventAppendResult {
    private val lockObj = Any()
    var successAggregateRootIdList: MutableList = Lists.newArrayList()
    var duplicateEventAggregateRootIdList: MutableList = Lists.newArrayList()
    var duplicateCommandAggregateRootIdList: MutableMap> = Maps.newHashMap()

    fun addSuccessAggregateRootId(aggregateRootId: String) {
        synchronized(lockObj) {
            if (!successAggregateRootIdList.contains(aggregateRootId)) {
                successAggregateRootIdList.add(aggregateRootId)
            }
        }
    }

    fun addDuplicateEventAggregateRootId(aggregateRootId: String) {
        synchronized(lockObj) {
            if (!duplicateEventAggregateRootIdList.contains(aggregateRootId)) {
                duplicateEventAggregateRootIdList.add(aggregateRootId)
            }
        }
    }

    fun addDuplicateCommandIds(aggregateRootId: String, aggregateDuplicateCommandIdList: List) {
        synchronized(lockObj) {
            if (!duplicateCommandAggregateRootIdList.containsKey(aggregateRootId)) {
                duplicateCommandAggregateRootIdList[aggregateRootId] = aggregateDuplicateCommandIdList
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy