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

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

There is a newer version: 1.1.10
Show newest version
package org.enodeframework.eventing;

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

import java.util.List;
import java.util.Map;

public class EventAppendResult {

    private final Object lockObj = new Object();

    private List successAggregateRootIdList = Lists.newArrayList();

    private List duplicateEventAggregateRootIdList = Lists.newArrayList();

    private Map> duplicateCommandAggregateRootIdList = Maps.newHashMap();

    public List getSuccessAggregateRootIdList() {
        return successAggregateRootIdList;
    }

    public void setSuccessAggregateRootIdList(List successAggregateRootIdList) {
        this.successAggregateRootIdList = successAggregateRootIdList;
    }

    public List getDuplicateEventAggregateRootIdList() {
        return duplicateEventAggregateRootIdList;
    }

    public void setDuplicateEventAggregateRootIdList(List duplicateEventAggregateRootIdList) {
        this.duplicateEventAggregateRootIdList = duplicateEventAggregateRootIdList;
    }

    public Map> getDuplicateCommandAggregateRootIdList() {
        return duplicateCommandAggregateRootIdList;
    }

    public void setDuplicateCommandAggregateRootIdList(Map> duplicateCommandAggregateRootIdList) {
        this.duplicateCommandAggregateRootIdList = duplicateCommandAggregateRootIdList;
    }

    public void addSuccessAggregateRootId(String aggregateRootId) {
        synchronized (lockObj) {
            if (!successAggregateRootIdList.contains(aggregateRootId)) {
                successAggregateRootIdList.add(aggregateRootId);
            }
        }
    }

    public void addDuplicateEventAggregateRootId(String aggregateRootId) {
        synchronized (lockObj) {
            if (!duplicateEventAggregateRootIdList.contains(aggregateRootId)) {
                duplicateEventAggregateRootIdList.add(aggregateRootId);
            }
        }
    }

    public void addDuplicateCommandIds(String aggregateRootId, List aggregateDuplicateCommandIdList) {
        synchronized (lockObj) {
            if (!duplicateCommandAggregateRootIdList.containsKey(aggregateRootId)) {
                duplicateCommandAggregateRootIdList.put(aggregateRootId, aggregateDuplicateCommandIdList);
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy