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 109b7d4..8d03f97 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Animation.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Animation.java @@ -2,23 +2,12 @@ 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; -import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; -import org.ntlab.acanthus_server.resources.gallery.StrokesRest; -import org.ntlab.acanthus_server.entities.Page; -import org.ntlab.acanthus_server.entities.Layer; -import org.ntlab.acanthus_server.entities.Position; -import org.ntlab.acanthus_server.entities.Stroke; - -import java.lang.reflect.Array; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.Date; -import java.util.HashMap; public class Animation { @JsonProperty("aid") @@ -38,8 +27,8 @@ private Integer views; @JsonProperty("hashTag") private ArrayList hashTag = new ArrayList<>(); - @JsonProperty("pageMap") - private ArrayList pageMap = new ArrayList<>(); + @JsonProperty("pages") + private ArrayList pages = new ArrayList<>(); @JsonIgnore private Account owner; @JsonIgnore @@ -63,7 +52,7 @@ this.isPublic = false; this.owner = owner; this.editors.add(new Editor(owner, true)); - this.pageMap.add(new Page(0, 1)); + this.pages.add(new Page(0, 1)); this.lastUpdate = date.format(dateTimeFormatter); } @@ -149,7 +138,7 @@ } public ArrayList getPages() { - return this.pageMap; + return this.pages; } //----------------------------------------------------------------- @@ -214,7 +203,7 @@ this.isPublic = false; this.owner = ownerAccount; this.editors.add(new Editor(owner, true)); - this.pageMap.add(new Page(0, 1)); + this.pages.add(new Page(0, 1)); LocalDateTime date = LocalDateTime.now(); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); diff --git a/src/main/java/org/ntlab/acanthus_server/entities/FollowUidJson.java b/src/main/java/org/ntlab/acanthus_server/entities/FollowUidJson.java index 513ff71..1440ce6 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/FollowUidJson.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/FollowUidJson.java @@ -7,21 +7,21 @@ public class FollowUidJson { @JsonProperty("followsUid") - private ArrayList uidList = new ArrayList<>(); + private ArrayList followsUid = new ArrayList<>(); //Json型でフォローしているユーザーIDを表示する処理 public FollowUidJson(Collection followUidList){ for (var followUid : followUidList){ - uidList.add(followUid); + followsUid.add(followUid); } } - public Collection getUidList() { - return uidList; + public Collection getFollowsUid() { + return followsUid; } - public void setUidList(ArrayList uidList) { - this.uidList = uidList; + public void setFollowsUid(ArrayList followsUid) { + this.followsUid = followsUid; } } diff --git a/src/main/java/org/ntlab/acanthus_server/entities/FollowerUidJson.java b/src/main/java/org/ntlab/acanthus_server/entities/FollowerUidJson.java index 2d42fe2..fe7cc33 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/FollowerUidJson.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/FollowerUidJson.java @@ -7,20 +7,20 @@ public class FollowerUidJson { @JsonProperty("followersUid") - private ArrayList uidList = new ArrayList<>(); + private ArrayList followersUid = new ArrayList<>(); //Json型でフォロワーのユーザーIDを表示する処理 public FollowerUidJson(Collection followUidList){ for (var followerUid : followUidList){ - uidList.add(followerUid); + followersUid.add(followerUid); } } - public Collection getUidList() { - return uidList; + public Collection getFollowersUid() { + return followersUid; } - public void setUidList(ArrayList uidList) { - this.uidList = uidList; + public void setFollowersUid(ArrayList followersUid) { + this.followersUid = followersUid; } } diff --git a/src/main/java/org/ntlab/acanthus_server/resources/accounts/FollowsRest.java b/src/main/java/org/ntlab/acanthus_server/resources/accounts/FollowsRest.java index a33b961..5370bb1 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/accounts/FollowsRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/accounts/FollowsRest.java @@ -72,7 +72,7 @@ @Path("/{uid}/follows") @DELETE @Produces(MediaType.APPLICATION_JSON) - public void releaseFollows(@PathParam("uid") Integer uid, @FormParam("token") String token, @FormParam("followUid") Integer followUid){ + public String releaseFollows(@PathParam("uid") Integer uid, @QueryParam("token") String token, @QueryParam("followUid") Integer followUid){ var account = accounts.getAccountByUid(uid); var followAccount = account.getFollowsHashMap().get(followUid);//フォロー内アカウント参照 @@ -81,7 +81,7 @@ account.getFollowsHashMap().remove(followUid); followAccount.getFollowersHashMap().remove(uid); - //return "フォローを解除しました"; + return "フォローを解除しました"; }else { var response = Response.status(401).entity("フォローしているユーザーでないかユーザーIDが間違っています"); throw new WebApplicationException(response.build()); diff --git a/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java b/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java index 6c8c986..94c6213 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java @@ -10,10 +10,8 @@ import javax.ws.rs.*; import javax.ws.rs.core.MediaType; -import java.awt.*; import java.io.IOException; import java.util.*; -import java.util.List; // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // @@ -93,8 +91,17 @@ @Path("/{aid}/pageMap/{pid}/image") @GET @Produces(MediaType.APPLICATION_JSON) - public String getLayers(@PathParam("aid") Integer aid, @PathParam("pid") Integer pid) { - return "http://nitta-lab-www.is.konan-u.ac.jp/gallery/" + aid + "/" + pid + "/a" + aid + "p" + pid + ".png"; + public HashMap getPageUrls(@PathParam("aid") Integer aid) { + Animation animation = gallery.getAnimationByAid(aid); + ArrayList pages = animation.getPages(); + HashMap pageUrl = new HashMap<>(); + + for (Page p: pages){ + String url = "http://nitta-lab-www.is.konan-u.ac.jp/gallery/" + aid + "/" + p.getPid() + "/a" + aid + "p" + p.getPid() + ".png"; + pageUrl.put(p.getPageNo(), url); + } + + return pageUrl; }