1 package eu.ehri.project.importers.ead; 2 3 import com.fasterxml.jackson.annotation.JsonCreator; 4 import com.fasterxml.jackson.annotation.JsonProperty; 5 import com.fasterxml.jackson.annotation.JsonValue; 6 import com.google.common.collect.ImmutableMap; 7 import eu.ehri.project.importers.ImportLog; 8 9 import java.util.Map; 10 import java.util.Set; 11 12 public class SyncLog { 13 private final ImportLog log; 14 private final Set<String> deleted; 15 private final Map<String, String> moved; 16 private final Set<String> created; 17 18 @JsonCreator 19 public SyncLog( 20 @JsonProperty("log") ImportLog log, 21 @JsonProperty("created") Set<String> created, @JsonProperty("deleted") Set<String> deleted, 22 @JsonProperty("moved") Map<String, String> moved) { 23 this.log = log; 24 this.deleted = deleted; 25 this.moved = moved; 26 this.created = created; 27 } 28 29 @JsonValue 30 public Map<String, Object> getData() { 31 return ImmutableMap.of( 32 "log", log, 33 "created", created, 34 "deleted", deleted, 35 "moved", moved 36 ); 37 } 38 39 public ImportLog log() { 40 return log; 41 } 42 43 44 public Set<String> deleted() { 45 return deleted; 46 } 47 48 49 public Set<String> created() { 50 return created; 51 } 52 53 54 public Map<String, String> moved() { 55 return moved; 56 } 57 58 @Override 59 public String toString() { 60 return String.format("%s, Moved: %d", log.toString(), moved.size()); 61 } 62 }