diff --git a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/EventType.java b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/EventType.java index 168112a6..d8e8d239 100644 --- a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/EventType.java +++ b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/EventType.java @@ -31,7 +31,10 @@ public enum EventType { // accession1 merged into accession2 MERGED, + // new accession id created because of RS split + RS_SPLIT, + // accession is no longer valid - DEPRECATED; + DEPRECATED } diff --git a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/HistoryEvent.java b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/HistoryEvent.java index 4c58c770..76b17085 100644 --- a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/HistoryEvent.java +++ b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/HistoryEvent.java @@ -17,6 +17,7 @@ */ package uk.ac.ebi.ampt2d.commons.accession.core.models; +import sun.reflect.generics.reflectiveObjects.NotImplementedException; import uk.ac.ebi.ampt2d.commons.accession.persistence.models.IAccessionedObject; import java.time.LocalDateTime; @@ -64,6 +65,11 @@ public ACCESSION getMergedInto() { return mergedInto; } + @Override + public ACCESSION getSplitInto() { + throw new NotImplementedException(); + } + @Override public String getReason() { return null; diff --git a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/IEvent.java b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/IEvent.java index b7b7794d..90913f47 100644 --- a/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/IEvent.java +++ b/accession-commons-core/src/main/java/uk/ac/ebi/ampt2d/commons/accession/core/models/IEvent.java @@ -41,6 +41,11 @@ public interface IEvent { */ ACCESSION getMergedInto(); + /** + * @return Accession of the target object into which the original object accession has split + */ + ACCESSION getSplitInto(); + /** * @return Type of the event like creation, update, etc, executed on the accessioned object */ diff --git a/accession-commons-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/jpa/models/JpaEvent.java b/accession-commons-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/jpa/models/JpaEvent.java index 2175ade8..eba6f992 100644 --- a/accession-commons-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/jpa/models/JpaEvent.java +++ b/accession-commons-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/jpa/models/JpaEvent.java @@ -17,6 +17,7 @@ */ package uk.ac.ebi.ampt2d.commons.accession.persistence.jpa.models; +import sun.reflect.generics.reflectiveObjects.NotImplementedException; import uk.ac.ebi.ampt2d.commons.accession.core.models.EventType; import uk.ac.ebi.ampt2d.commons.accession.persistence.models.IAccessionedObject; import uk.ac.ebi.ampt2d.commons.accession.core.models.IEvent; @@ -61,6 +62,11 @@ public ACCESSION getMergedInto() { return mergeInto; } + @Override + public ACCESSION getSplitInto() { + throw new NotImplementedException(); + } + @Override public EventType getEventType() { return eventType; diff --git a/accession-commons-mongodb/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/mongodb/document/EventDocument.java b/accession-commons-mongodb/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/mongodb/document/EventDocument.java index 9daa465d..5376dc98 100644 --- a/accession-commons-mongodb/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/mongodb/document/EventDocument.java +++ b/accession-commons-mongodb/src/main/java/uk/ac/ebi/ampt2d/commons/accession/persistence/mongodb/document/EventDocument.java @@ -53,6 +53,8 @@ public abstract class EventDocument< private ACCESSION mergeInto; + private ACCESSION splitInto; + private String reason; private List inactiveObjects; @@ -67,7 +69,11 @@ public void fill(EventType eventType, ACCESSION accessionIdOrigin, ACCESSION acc String reason, List inactiveObjects) { this.eventType = eventType; this.accession = accessionIdOrigin; - this.mergeInto = accessionIdDestiny; + if(eventType==EventType.RS_SPLIT){ + this.splitInto = accessionIdDestiny; + }else if(eventType==EventType.MERGED){ + this.mergeInto = accessionIdDestiny; + } this.reason = reason; this.inactiveObjects = new ArrayList<>(); if (inactiveObjects != null && !inactiveObjects.isEmpty()) { @@ -90,6 +96,11 @@ public ACCESSION getMergedInto() { return mergeInto; } + @Override + public ACCESSION getSplitInto() { + return splitInto; + } + @Override public String getReason() { return reason;