diff --git a/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java b/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java index e4b0134..a0bd270 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java @@ -4,10 +4,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Collection; + @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "aid", - "animationName" + "animationName", + "owner", + "editors" }) @@ -21,12 +25,19 @@ @JsonProperty("animationName") private String animationName; + @JsonProperty("owner") + private Integer owner; + + @JsonProperty("editors") + private Collection editors; + public AnimationJson(Animation animation){ this.aid = animation.getAid(); this.animationName = animation.getName(); + this.owner = animation.getOwner().getUid(); + this.editors = animation.getEditors(); } - } diff --git a/src/main/java/org/ntlab/acanthus_server/models/Gallery.java b/src/main/java/org/ntlab/acanthus_server/models/Gallery.java index 4d945ea..c18b3f2 100644 --- a/src/main/java/org/ntlab/acanthus_server/models/Gallery.java +++ b/src/main/java/org/ntlab/acanthus_server/models/Gallery.java @@ -35,7 +35,8 @@ //----------------------------------------------------------------- // 作品をすべて返す - public HashMap getMap(){return animationHashMap;} + //public HashMap getMap(){return animationHashMap;} + public Collection getAllAnimation(){return animationHashMap.values();} //----------------------------------------------------------------- // 1つの作品の全ての情報を返す. diff --git a/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java b/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java index 8dbac86..1abebd2 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/gallery/GalleryRest.java @@ -2,6 +2,7 @@ import org.ntlab.acanthus_server.entities.Account; import org.ntlab.acanthus_server.entities.Animation; +import org.ntlab.acanthus_server.entities.AnimationJson; import org.ntlab.acanthus_server.models.Accounts; import org.ntlab.acanthus_server.models.Gallery; import org.springframework.stereotype.Component; @@ -20,7 +21,13 @@ @GET @Produces(MediaType.APPLICATION_JSON) - public Collection getGallery(){return gallery.getMap().values();} + public Collection getGallery(){ + var animationJsonList = new ArrayList(); + for(var animation : gallery.getAllAnimation() ) animationJsonList.add(new AnimationJson(animation)); + return animationJsonList; + } + //public Animation getGallery(){return ;} + //public Collection getGallery(){return gallery.getAllAnimation();} @POST @Produces(MediaType.APPLICATION_JSON) @@ -35,11 +42,14 @@ @Path("/{aid}") @GET @Produces(MediaType.APPLICATION_JSON) - public Animation getAnimationInformation(@PathParam("aid") Integer aid){ + public Collection getAnimationInformation(@PathParam("aid") Integer aid){ var searchAnimation =gallery.getAnimationInformation(aid); - return searchAnimation; + var animationJsonList = new ArrayList(); + animationJsonList.add(new AnimationJson(searchAnimation)); + + return animationJsonList; }