-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from dennislloydjr/compliance-data-changes
Compliance data changes
- Loading branch information
Showing
5 changed files
with
122 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
core/src/main/java/com/zaubersoftware/gnip4j/api/model/compliance/UserWithheldActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.zaubersoftware.gnip4j.api.model.compliance; | ||
|
||
import com.zaubersoftware.gnip4j.api.model.Activity; | ||
import com.zaubersoftware.gnip4j.api.model.Actor; | ||
import org.codehaus.jackson.annotate.JsonProperty; | ||
import org.codehaus.jackson.annotate.JsonTypeName; | ||
|
||
import java.util.Collection; | ||
import java.util.Date; | ||
|
||
/** | ||
* Represents a user is withheld in the Compliance v2 Stream | ||
* | ||
* @author Dennis Lloyd Jr | ||
* @since Dec 13, 2016 | ||
*/ | ||
@JsonTypeName(ComplianceActivity.Verb.USER_WITHHELD) | ||
public class UserWithheldActivity implements ComplianceActivity { | ||
@JsonProperty("id") | ||
private String id; | ||
|
||
@JsonProperty("withheld_in_countries") | ||
private Collection<String> withheldInCountries; | ||
|
||
@JsonProperty("timestamp_ms") | ||
private String timestamp; | ||
|
||
@Override | ||
public Activity toActivity() { | ||
final Activity result = new Activity(); | ||
result.setVerb(ComplianceActivity.Verb.USER_WITHHELD); | ||
result.setActor(new Actor()); | ||
result.getActor().setId(id); | ||
result.setWithheldInCountries(withheldInCountries); | ||
result.setUpdated(new Date(Long.parseLong(timestamp))); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters