-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a98806d
commit f91113a
Showing
6 changed files
with
253 additions
and
82 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
186 changes: 186 additions & 0 deletions
186
...n_tracker_api/src/main/java/com/jordansimsmith/immersiontracker/ImmersionTrackerItem.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,186 @@ | ||
package com.jordansimsmith.immersiontracker; | ||
|
||
import java.util.Objects; | ||
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; | ||
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; | ||
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey; | ||
import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSortKey; | ||
|
||
@DynamoDbBean | ||
public class ImmersionTrackerItem { | ||
private String pk; | ||
private String sk; | ||
private String user; | ||
private String folderName; | ||
private String fileName; | ||
private Integer timestamp; | ||
private Integer tvdbId; | ||
private String tvdbName; | ||
private String tvdbImage; | ||
|
||
@DynamoDbPartitionKey | ||
@DynamoDbAttribute("pk") | ||
public String getPk() { | ||
return pk; | ||
} | ||
|
||
public void setPk(String pk) { | ||
this.pk = pk; | ||
} | ||
|
||
@DynamoDbSortKey | ||
@DynamoDbAttribute("sk") | ||
public String getSk() { | ||
return sk; | ||
} | ||
|
||
public void setSk(String sk) { | ||
this.sk = sk; | ||
} | ||
|
||
@DynamoDbAttribute("user") | ||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(String user) { | ||
this.user = user; | ||
} | ||
|
||
@DynamoDbAttribute("folder_name") | ||
public String getFolderName() { | ||
return folderName; | ||
} | ||
|
||
public void setFolderName(String folderName) { | ||
this.folderName = folderName; | ||
} | ||
|
||
@DynamoDbAttribute("file_name") | ||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public void setFileName(String fileName) { | ||
this.fileName = fileName; | ||
} | ||
|
||
@DynamoDbAttribute("timestamp") | ||
public Integer getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
public void setTimestamp(Integer timestamp) { | ||
this.timestamp = timestamp; | ||
} | ||
|
||
@DynamoDbAttribute("tvdb_id") | ||
public Integer getTvdbId() { | ||
return tvdbId; | ||
} | ||
|
||
public void setTvdbId(Integer tvdbId) { | ||
this.tvdbId = tvdbId; | ||
} | ||
|
||
@DynamoDbAttribute("tvdb_name") | ||
public String getTvdbName() { | ||
return tvdbName; | ||
} | ||
|
||
public void setTvdbName(String tvdbName) { | ||
this.tvdbName = tvdbName; | ||
} | ||
|
||
@DynamoDbAttribute("tvdb_image") | ||
public String getTvdbImage() { | ||
return tvdbImage; | ||
} | ||
|
||
public void setTvdbImage(String tvdbImage) { | ||
this.tvdbImage = tvdbImage; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ImmersionTrackerItem{" | ||
+ "pk='" | ||
+ pk | ||
+ '\'' | ||
+ ", sk='" | ||
+ sk | ||
+ '\'' | ||
+ ", user='" | ||
+ user | ||
+ '\'' | ||
+ ", folderName='" | ||
+ folderName | ||
+ '\'' | ||
+ ", fileName='" | ||
+ fileName | ||
+ '\'' | ||
+ ", timestamp=" | ||
+ timestamp | ||
+ ", tvdbId=" | ||
+ tvdbId | ||
+ ", tvdbName=" | ||
+ tvdbName | ||
+ ", tvdbImage='" | ||
+ tvdbImage | ||
+ '\'' | ||
+ '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ImmersionTrackerItem that = (ImmersionTrackerItem) o; | ||
return Objects.equals(pk, that.pk) | ||
&& Objects.equals(sk, that.sk) | ||
&& Objects.equals(user, that.user) | ||
&& Objects.equals(folderName, that.folderName) | ||
&& Objects.equals(fileName, that.fileName) | ||
&& Objects.equals(timestamp, that.timestamp) | ||
&& Objects.equals(tvdbId, that.tvdbId) | ||
&& Objects.equals(tvdbName, that.tvdbName) | ||
&& Objects.equals(tvdbImage, that.tvdbImage); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(pk, sk, user, folderName, fileName, timestamp, tvdbId, tvdbName, tvdbImage); | ||
} | ||
|
||
public static String formatPk(String user) { | ||
return "USER#" + user; | ||
} | ||
|
||
public static String formatEpisodeSk(String folderName, String fileName) { | ||
return "EPISODE#" + folderName + "#" + fileName; | ||
} | ||
|
||
public static String formatShowSk(String folderName) { | ||
return "SHOW#" + folderName; | ||
} | ||
|
||
public static ImmersionTrackerItem createEpisode( | ||
String user, String folderName, String fileName, int timestamp) { | ||
var episode = new ImmersionTrackerItem(); | ||
episode.setPk(formatPk(user)); | ||
episode.setSk(formatEpisodeSk(folderName, fileName)); | ||
episode.setFolderName(folderName); | ||
episode.setFileName(fileName); | ||
episode.setTimestamp(timestamp); | ||
episode.setUser(user); | ||
return episode; | ||
} | ||
|
||
public static ImmersionTrackerItem createShow(String user, String folderName) { | ||
var show = new ImmersionTrackerItem(); | ||
show.setPk(formatPk(user)); | ||
show.setSk(formatShowSk(folderName)); | ||
show.setUser(user); | ||
return show; | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
...tracker_api/src/main/java/com/jordansimsmith/immersiontracker/ImmersionTrackerRecord.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.