org.enodeframework.eventing.EventAppendResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of enode Show documentation
Show all versions of enode Show documentation
The enodeframework core implementation.
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 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);
}
}
}
}