Skip to content

Commit

Permalink
Updated SocialActivityAttachment and SocialActivityModel classes to i…
Browse files Browse the repository at this point in the history
…mplement ImportableItem class (#1197)

* Updated SocialActivityAttachment and SocialActivityModel classes to implement ImportableItem class

Updated SocialActivityAttachment and SocialActivityModel classes to implement ImportableItem class

* Made IdempotentId field Nonnull

Made IdempotentId field Nonnull

* Update SocialActivityModel.java
  • Loading branch information
saratchebrolu authored Dec 13, 2022
1 parent 6137d31 commit 2f92b8c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
package org.datatransferproject.types.common.models.social;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.datatransferproject.types.common.ImportableItem;

import javax.annotation.Nonnull;
import java.util.Objects;

public class SocialActivityAttachment {
public class SocialActivityAttachment implements ImportableItem {
private SocialActivityAttachmentType type;
private String url;
private String name;
Expand All @@ -43,6 +46,7 @@ public String getUrl() {
return url;
}

@JsonIgnore(false)
public String getName() {
return name;
}
Expand Down Expand Up @@ -70,4 +74,8 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(getType(), getUrl(), getName(), getContent());
}

@Nonnull
@Override
public String getIdempotentId() { return url; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import org.datatransferproject.types.common.ImportableItem;

import javax.annotation.Nonnull;
import java.time.Instant;
import java.util.Collection;
import java.util.Objects;

public class SocialActivityModel {
public class SocialActivityModel implements ImportableItem {
private String id;
private Instant published;
private SocialActivityType type;
Expand Down Expand Up @@ -114,4 +116,13 @@ public String getContent() {
public String getUrl() {
return url;
}

@Nonnull
@Override
public String getIdempotentId() {
return Integer.toString(hashCode());
}

@Override
public String getName() { return title; }
}

0 comments on commit 2f92b8c

Please sign in to comment.