diff --git a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java index d5cae5e..8af4a5f 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java @@ -1,6 +1,7 @@ package org.ntlab.acanthus_server.entities; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import org.ntlab.acanthus_server.models.Accounts; import org.ntlab.acanthus_server.models.Gallery; @@ -11,22 +12,31 @@ import java.util.HashMap; public class Animation { + @JsonProperty("aid") private int aid; + @JsonProperty("name") private String name; + @JsonProperty("description") private String description; private Boolean isPublic; + @JsonProperty("createdDate") private LocalDateTime createdDate; + @JsonProperty("lastUpdate") private String lastUpdate; + @JsonProperty("likes") private Integer likes; + @JsonProperty("views") private Integer views; + @JsonProperty("hashTags") private ArrayList hashTag = new ArrayList<>(); + @JsonProperty("pageMap") + private HashMap pageMap = new HashMap<>(); @JsonIgnore private Account owner; @JsonIgnore private ArrayList editors = new ArrayList<>(); @JsonIgnore private ArrayList invites = new ArrayList<>(); - private HashMap pageMap = new HashMap<>(); @JsonIgnore private boolean isDummy; @@ -38,7 +48,7 @@ this.isPublic = false; this.owner = owner; this.editors.add(new Editor(owner, true)); - this.pageMap.put(0, 0); + this.pageMap.put(0, new Page()); } public Animation(Account account) { @@ -51,19 +61,19 @@ //----------------------------------------------------------------- // setter - public void setAid(Integer aid){ + public void setAid(Integer aid) { this.aid = aid; } - public void setName(String name){ + public void setName(String name) { this.name = name; } - public void setDescription(String description){ + public void setDescription(String description) { this.description = description; } - public void setIsPublic(Boolean publicStatus){ + public void setIsPublic(Boolean publicStatus) { this.isPublic = publicStatus; } @@ -75,24 +85,40 @@ //----------------------------------------------------------------- // add - public void addEditors(Editor editor) { this.editors.add(editor); } + public void addEditors(Editor editor) { + this.editors.add(editor); + } - public void addLikes() { this.likes++; } + public void addLikes() { + this.likes++; + } - public void addViews() { this.views++; } + public void addViews() { + this.views++; + } - public void addHashTag(String inputHashTag) { this.hashTag.add(inputHashTag); } + public void addHashTag(String inputHashTag) { + this.hashTag.add(inputHashTag); + } //----------------------------------------------------------------- // getter - public Integer getAid() { return aid; } + public Integer getAid() { + return aid; + } - public String getName() { return name; } + public String getName() { + return name; + } - public Account getOwner() { return owner; } + public Account getOwner() { + return owner; + } - public Collection getEditors() { return editors; } + public Collection getEditors() { + return editors; + } public Collection getInvites() { return invites; @@ -101,7 +127,9 @@ //----------------------------------------------------------------- // remover - public void removeAnimationInvites(Account invitedAccount) { this.invites.remove(invitedAccount); } + public void removeAnimationInvites(Account invitedAccount) { + this.invites.remove(invitedAccount); + } //----------------------------------------------------------------- // 本当に招待されているかを確認する @@ -110,8 +138,8 @@ //Account invitedAccount = accounts.getAccountByUid(Integer.parseInt(invitedUid)); ArrayList inviters = new ArrayList<>(); - for(Account account : this.invites) { - if(account == invitedAccount) { + for (Account account : this.invites) { + if (account == invitedAccount) { inviters.add(account); } } @@ -158,7 +186,7 @@ this.isPublic = false; this.owner = ownerAccount; this.editors.add(new Editor(owner, true)); - this.pageMap.put(0,0); + this.pageMap.put(0, new Page()); this.createdDate = LocalDateTime.now(); //this.lastAccess = LocalDateTime.of(2015, 12, 15, 0, 0);