From cf9b0f1ef758c455336f48edc728a502f28cd8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20K=C3=A4stle?= <sven.kaestle@gmx.de> Date: Fri, 6 Jul 2018 19:40:10 +0200 Subject: [PATCH] refactor: Adjust annotation patch and post request --- .../model/AnnotationPatchRequest.java | 27 +++++++---- .../model/AnnotationPostRequest.java | 47 +++++-------------- 2 files changed, 32 insertions(+), 42 deletions(-) diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPatchRequest.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPatchRequest.java index c41e294a..af5be4da 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPatchRequest.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPatchRequest.java @@ -7,28 +7,39 @@ package unipotsdam.gf.modules.annotation.model; public class AnnotationPatchRequest { // variables - private String body; + private String title; + private String comment; // constructors - public AnnotationPatchRequest(String body) { - this.body = body; + public AnnotationPatchRequest(String title, String comment) { + this.title = title; + this.comment = comment; } public AnnotationPatchRequest() {} // methods - public String getBody() { - return body; + public String getTitle() { + return title; } - public void setBody(String body) { - this.body = body; + public void setTitle(String title) { + this.title = title; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; } @Override public String toString() { return "AnnotationPatchRequest{" + - "body='" + body + '\'' + + "title='" + title + '\'' + + ", comment='" + comment + '\'' + '}'; } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPostRequest.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPostRequest.java index 5459cb5b..5dfe6e20 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPostRequest.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/model/AnnotationPostRequest.java @@ -7,31 +7,27 @@ package unipotsdam.gf.modules.annotation.model; public class AnnotationPostRequest { // variables - private int userId; + private String userToken; private int targetId; - private String body; - private int startCharacter; - private int endCharacter; + private AnnotationBody body; // constructors - public AnnotationPostRequest(int userId, int targetId, String body, int startCharacter, int endCharacter) { - this.userId = userId; + public AnnotationPostRequest(String userToken, int targetId, AnnotationBody body) { + this.userToken = userToken; this.targetId = targetId; this.body = body; - this.startCharacter = startCharacter; - this.endCharacter = endCharacter; } public AnnotationPostRequest() { } // methods - public int getUserId() { - return userId; + public String getUserToken() { + return userToken; } - public void setUserId(int userId) { - this.userId = userId; + public void setUserToken(String userToken) { + this.userToken = userToken; } public int getTargetId() { @@ -42,38 +38,21 @@ public class AnnotationPostRequest { this.targetId = targetId; } - public String getBody() { + public AnnotationBody getBody() { return body; } - public void setBody(String body) { + public void setBody(AnnotationBody body) { this.body = body; } - public int getStartCharacter() { - return startCharacter; - } - - public void setStartCharacter(int startCharacter) { - this.startCharacter = startCharacter; - } - - public int getEndCharacter() { - return endCharacter; - } - - public void setEndCharacter(int endCharacter) { - this.endCharacter = endCharacter; - } - @Override public String toString() { return "AnnotationPostRequest{" + - "userId=" + userId + + "userToken='" + userToken + '\'' + ", targetId=" + targetId + - ", body='" + body + '\'' + - ", startCharacter=" + startCharacter + - ", endCharacter=" + endCharacter + + ", body=" + body.toString() + '}'; } + } -- GitLab