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 46e5b11..ce9c108 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java @@ -1,5 +1,8 @@ package org.ntlab.acanthus_server.entities; +import org.ntlab.acanthus_server.models.Accounts; +import org.ntlab.acanthus_server.models.Gallery; + import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -30,6 +33,9 @@ this.pageMap.put(0, 0); } + private Gallery gallery = Gallery.getInstance(); + private Accounts accounts = Accounts.getInstance(); + public void setName(String name){ this.name = name; } @@ -46,12 +52,37 @@ this.ispublic = ispublic; } + public Integer getAid() { return aid; } + public Collection getAnimationInvites() { return invites; } - public Integer getAid() { - return aid; + + //----------------------------------------------------------------- + // 本当に招待されているかを確認する + public Collection searchAnimationInvites(Integer aid, String invitedUid, String invitedUserToken) { + Animation anime_info = gallery.getAnimationInformation(aid); + Account invitedAccount = accounts.getAccountByUid(Integer.parseInt(invitedUid)); + ArrayList invitedlist = null; + + for(Account account : anime_info.invites) { + if(account == invitedAccount) { + invitedlist.add(account); + return invitedlist; + } + } + return null; } + + //----------------------------------------------------------------- + //作品に招待する + public void addAccoutToAnimationInvites(Integer aid, String ownerUid, String invitedUid) { + Animation animation = gallery.getAnimationByAid(aid); + Account invitedAccount = accounts.getAccountByUid(Integer.parseInt(invitedUid)); + invites.add(invitedAccount); + } + + //----------------------------------------------------------------- }