@@ -0,0 +1,2628 @@
+package org.jeecqrs.bundle.jcommondomain.sagas;%0A%0Aimport java.util.Collection;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Set;%0Aimport org.jeecqrs.common.event.Event;%0Aimport org.jeecqrs.sagas.Saga;%0Aimport org.jeecqrs.sagas.SagaIdentificationStrategy;%0A%0A/**%0A * A saga identification strategy that implements the %7B@link Map%7D interface%0A * and requires %7B@link SagaIdentifier%7Ds to be registered for each event.%0A * %0A * @param %3CS%3E  the saga type%0A */%0Apublic class MapSagaIdentificationStrategy%3CS extends Saga%3CEvent%3E%3E implements%0A        SagaIdentificationStrategy%3CS, Event%3E,%0A        Map%3CClass%3C? extends Event%3E, SagaIdentifier%3C? extends Event%3E%3E %7B%0A%0A    private final Map%3CClass%3C? extends Event%3E, SagaIdentifier%3C? extends Event%3E%3E delegate = new HashMap%3C%3E();%0A    %0A    @Override%0A    public String identifySaga(Event event) %7B%0A        Class%3C? extends Event%3E evClass = event.getClass();%0A        SagaIdentifier%3CEvent%3E idf = (SagaIdentifier%3CEvent%3E) this.get(evClass);%0A        if (idf == null)%0A            throw new IllegalStateException(%22No identifier registered for event type %22 + event);%0A        return idf.sagaIdFor(event);%0A    %7D%0A%0A    @Override%0A    public int size() %7B%0A        return delegate.size();%0A    %7D%0A%0A    @Override%0A    public boolean isEmpty() %7B%0A        return delegate.isEmpty();%0A    %7D%0A%0A    @Override%0A    public boolean containsKey(Object key) %7B%0A        return delegate.containsKey(key);%0A    %7D%0A%0A    @Override%0A    public boolean containsValue(Object value) %7B%0A        return delegate.containsValue(value);%0A    %7D%0A%0A    @Override%0A    public SagaIdentifier%3C? extends Event%3E get(Object key) %7B%0A        return delegate.get(key);%0A    %7D%0A%0A    @Override%0A    public SagaIdentifier%3C? extends Event%3E put(Class%3C? extends Event%3E key,%0A            SagaIdentifier%3C? extends Event%3E value) %7B%0A        return delegate.put(key, value);%0A    %7D%0A%0A    @Override%0A    public SagaIdentifier%3C? extends Event%3E remove(Object key) %7B%0A        throw new UnsupportedOperationException(%22Not supported.%22);%0A    %7D%0A%0A    @Override%0A    public void putAll(Map%3C? extends Class%3C? extends Event%3E, ? extends SagaIdentifier%3C? extends Event%3E%3E m) %7B%0A        delegate.putAll(m);%0A    %7D%0A%0A    @Override%0A    public void clear() %7B%0A        throw new UnsupportedOperationException(%22Not supported.%22);%0A    %7D%0A%0A    @Override%0A    public Set%3CClass%3C? extends Event%3E%3E keySet() %7B%0A        return delegate.keySet();%0A    %7D%0A%0A    @Override%0A    public Collection%3CSagaIdentifier%3C? extends Event%3E%3E values() %7B%0A        return delegate.values();%0A    %7D%0A%0A    @Override%0A    public Set%3CEntry%3CClass%3C? extends Event%3E, SagaIdentifier%3C? extends Event%3E%3E%3E entrySet() %7B%0A        return delegate.entrySet();%0A    %7D%0A%0A%7D%0A

Add MapSagaIdentificationStrategy