Skip to content

Commit

Permalink
Merge pull request #67 from nitin-ebi/RS_Split
Browse files Browse the repository at this point in the history
EVA-2562: New EventType created for RS Split Operation
  • Loading branch information
nitin-ebi authored Sep 6, 2021
2 parents 201b509 + fa8ddac commit b972754
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -64,6 +65,11 @@ public ACCESSION getMergedInto() {
return mergedInto;
}

@Override
public ACCESSION getSplitInto() {
throw new NotImplementedException();
}

@Override
public String getReason() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public interface IEvent<MODEL, ACCESSION> {
*/
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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,6 +62,11 @@ public ACCESSION getMergedInto() {
return mergeInto;
}

@Override
public ACCESSION getSplitInto() {
throw new NotImplementedException();
}

@Override
public EventType getEventType() {
return eventType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public abstract class EventDocument<

private ACCESSION mergeInto;

private ACCESSION splitInto;

private String reason;

private List<INACTIVE_DOCUMENT> inactiveObjects;
Expand All @@ -67,7 +69,11 @@ public void fill(EventType eventType, ACCESSION accessionIdOrigin, ACCESSION acc
String reason, List<INACTIVE_DOCUMENT> 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()) {
Expand All @@ -90,6 +96,11 @@ public ACCESSION getMergedInto() {
return mergeInto;
}

@Override
public ACCESSION getSplitInto() {
return splitInto;
}

@Override
public String getReason() {
return reason;
Expand Down

0 comments on commit b972754

Please sign in to comment.