diff --git a/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java b/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java new file mode 100644 index 0000000..e4b0134 --- /dev/null +++ b/src/main/java/org/ntlab/acanthus_server/entities/AnimationJson.java @@ -0,0 +1,32 @@ +package org.ntlab.acanthus_server.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "aid", + "animationName" +}) + + +//----------------------------------------------------------------- +// 作品一覧取得用のJsonクラス + +public class AnimationJson { + @JsonProperty("aid") + private Integer aid; + + @JsonProperty("animationName") + private String animationName; + + + public AnimationJson(Animation animation){ + this.aid = animation.getAid(); + this.animationName = animation.getName(); + + } + + +} 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 2ed3d3e..27966f0 100644 --- a/src/main/java/org/ntlab/acanthus_server/models/Gallery.java +++ b/src/main/java/org/ntlab/acanthus_server/models/Gallery.java @@ -32,19 +32,31 @@ } + //----------------------------------------------------------------- + // 作品をすべて返す + public HashMap getMap(){return animationHashMap;} + //----------------------------------------------------------------- + // 1つの作品の全ての情報を返す. + public Animation getAnimationInformation( Integer aid){return animationHashMap.get(aid);} - public int registAnimation(String name, Account owner){ - var newAnimation = new Animation(name, owner); + + + //----------------------------------------------------------------- + // 作品を作る + + public int registAnimation(String animationName, Account owner){ + var newAnimation = new Animation(animationName, owner); var aid = new Random().nextInt(); newAnimation.setAid(aid); animationHashMap.put(aid,newAnimation); + newAnimation.setName(animationName); return aid; } public Animation getAnimationByAid(Integer aid) { return animationHashMap.get(aid); } -} \ No newline at end of file +} 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 af5ada5..a907352 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 @@ -24,7 +24,7 @@ @POST @Produces(MediaType.APPLICATION_JSON) - public Integer createAnimation(@FormParam("aid") Integer aid , @FormParam("name") String name ,@FormParam("token") String token ,@FormParam("uid") Integer uid){ + public Integer createAnimation(@FormParam("name") String name ,@FormParam("token") String token ,@FormParam("uid") Integer uid){ Accounts accounts = Accounts.getInstance(); Account Owner = accounts.getAccountByUid(uid);