Skip to content
Snippets Groups Projects
Commit eed4122c authored by Sven Kästle's avatar Sven Kästle
Browse files

Merge branch 'annotation_#46-2' into development_master

parents c0be55a0 66968603
No related branches found
No related tags found
No related merge requests found
Showing
with 1500 additions and 31 deletions
......@@ -3,6 +3,7 @@ package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.annotation.model.Annotation;
import unipotsdam.gf.modules.annotation.model.AnnotationPatchRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationPostRequest;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import java.util.ArrayList;
......@@ -44,12 +45,13 @@ public interface IAnnotation {
Annotation getAnnotation(String annotationId);
/**
* Returns all annotations from a target
* Returns all annotations for a specific target id and category
*
* @param targetId the target id
* @return Returns all annotations
* @param targetId The if of the target
* @param targetCategory The category of the target
* @return Returns all annotations for a target
*/
ArrayList<Annotation> getAnnotations(int targetId);
ArrayList<Annotation> getAnnotations(String targetId, Category targetCategory);
/**
* Checks if an annotation id already exists in the database
......
package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import unipotsdam.gf.modules.submission.model.*;
import java.util.ArrayList;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public interface ISubmission {
/**
* Store the full submission text in the database
*
* @param request The full submission post request
* @return The new full submission
*/
FullSubmission addFullSubmission(FullSubmissionPostRequest request);
/**
* Get the entire submission from the databse
*
* @param fullSubmissionId The id of the submission
* @return The full submission
*/
FullSubmission getFullSubmission(String fullSubmissionId);
/**
* Checks if a full submission id already exists in the database
*
* @param fullSubmissionId The id of the full submission
* @return Returns true if the id exists
*/
boolean existsFullSubmissionId(String fullSubmissionId);
/**
* Store the submission part text in the database
*
* @param submissionPartPostRequest The submission part post request
* @return The new submission part
*/
SubmissionPart addSubmissionPart(SubmissionPartPostRequest submissionPartPostRequest);
/**
* Get the entire submission part from database
*
* @param fullSubmissionId The id of the full submission
* @param category The category of the submission
* @return The returned submission part
*/
SubmissionPart getSubmissionPart(String fullSubmissionId, Category category);
/**
* Get all submission parts based on an id
*
* @param fullSubmissionId The id of a full submission
* @return An ArrayList holding the submission parts
*/
ArrayList<SubmissionPart> getAllSubmissionParts(String fullSubmissionId);
/**
* Get all project representations of submission part for a given project id
*
* @param projectId The given project id
* @return An ArrayList of submission project representations
*/
ArrayList<SubmissionProjectRepresentation> getSubmissionPartsByProjectId(String projectId);
/**
* Checks if a submission part already exists in the database
*
* @param fullSubmissionId The id of the full submission
* @param category The category of the submission
* @return Returns true if the submission part exists
*/
boolean existsSubmissionPart(String fullSubmissionId, Category category);
}
......@@ -7,6 +7,7 @@ import unipotsdam.gf.modules.annotation.model.Annotation;
import unipotsdam.gf.modules.annotation.model.AnnotationBody;
import unipotsdam.gf.modules.annotation.model.AnnotationPatchRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationPostRequest;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import java.time.ZonedDateTime;
import java.util.ArrayList;
......@@ -27,8 +28,8 @@ public class AnnotationController implements IAnnotation {
connection.connect();
// build and execute request
String request = "INSERT INTO annotations (`id`, `userToken`, `targetId`, `title`, `comment`, `startCharacter`, `endCharacter`) VALUES (?,?,?,?,?,?,?);";
connection.issueInsertOrDeleteStatement(request, uuid, annotationPostRequest.getUserToken(), annotationPostRequest.getTargetId(), annotationPostRequest.getBody().getTitle(), annotationPostRequest.getBody().getComment(),annotationPostRequest.getBody().getStartCharacter(), annotationPostRequest.getBody().getEndCharacter());
String request = "INSERT INTO annotations (`id`, `userToken`, `targetId`, `targetCategory`, `title`, `comment`, `startCharacter`, `endCharacter`) VALUES (?,?,?,?,?,?,?,?);";
connection.issueInsertOrDeleteStatement(request, uuid, annotationPostRequest.getUserToken(), annotationPostRequest.getTargetId(), annotationPostRequest.getTargetCategory().toString().toUpperCase(), annotationPostRequest.getBody().getTitle(), annotationPostRequest.getBody().getComment(),annotationPostRequest.getBody().getStartCharacter(), annotationPostRequest.getBody().getEndCharacter());
// close connection
connection.close();
......@@ -104,7 +105,7 @@ public class AnnotationController implements IAnnotation {
}
@Override
public ArrayList<Annotation> getAnnotations(int targetId) {
public ArrayList<Annotation> getAnnotations(String targetId, Category category) {
// declare annotation ArrayList
ArrayList<Annotation> annotations = new ArrayList<>();
......@@ -114,8 +115,8 @@ public class AnnotationController implements IAnnotation {
connection.connect();
// build and execute request
String request = "SELECT * FROM annotations WHERE targetId = ?;";
VereinfachtesResultSet rs = connection.issueSelectStatement(request, targetId);
String request = "SELECT * FROM annotations WHERE targetId = ? AND targetCategory = ?;";
VereinfachtesResultSet rs = connection.issueSelectStatement(request, targetId, category.toString().toUpperCase());
while (rs.next()) {
annotations.add(getAnnotationFromResultSet(rs));
......@@ -171,7 +172,8 @@ public class AnnotationController implements IAnnotation {
String id = rs.getString("id");
long timestamp = rs.getTimestamp(2).getTime();
String userToken = rs.getString("userToken");
int targetId = rs.getInt("targetId");
String targetId = rs.getString("targetId");
Category targetCategory = Category.valueOf(rs.getString("targetCategory"));
// initialize new annotation body
String title = rs.getString("title");
......@@ -180,7 +182,7 @@ public class AnnotationController implements IAnnotation {
int endCharacter = rs.getInt("endCharacter");
AnnotationBody body = new AnnotationBody(title, comment, startCharacter, endCharacter);
return new Annotation(id, timestamp, userToken, targetId, body);
return new Annotation(id, timestamp, userToken, targetId, targetCategory, body);
}
}
package unipotsdam.gf.modules.annotation.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
......@@ -10,15 +12,17 @@ public class Annotation {
private String id;
private long timestamp;
private String userToken;
private int targetId;
private String targetId;
private Category targetCategory;
private AnnotationBody body;
// constructor
public Annotation(String id, long timestamp, String userToken, int targetId, AnnotationBody body) {
public Annotation(String id, long timestamp, String userToken, String targetId, Category targetCategory, AnnotationBody body) {
this.id = id;
this.timestamp = timestamp;
this.userToken = userToken;
this.targetId = targetId;
this.targetCategory = targetCategory;
this.body = body;
}
......@@ -47,14 +51,22 @@ public class Annotation {
this.userToken = userToken;
}
public int getTargetId() {
public String getTargetId() {
return targetId;
}
public void setTargetId(int targetId) {
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public Category getTargetCategory() {
return targetCategory;
}
public void setTargetCategory(Category targetCategory) {
this.targetCategory = targetCategory;
}
public AnnotationBody getBody() {
return body;
}
......@@ -70,6 +82,7 @@ public class Annotation {
", timestamp=" + timestamp +
", userToken='" + userToken + '\'' +
", targetId=" + targetId +
", targetCategory=" + targetCategory +
", body=" + body +
'}';
}
......
package unipotsdam.gf.modules.annotation.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
public class AnnotationMessage {
// variables
private String from;
private String targetId;
private Category targetCategory;
private AnnotationMessageType type;
private String annotationId;
......@@ -30,6 +33,14 @@ public class AnnotationMessage {
this.targetId = targetId;
}
public Category getTargetCategory() {
return targetCategory;
}
public void setTargetCategory(Category targetCategory) {
this.targetCategory = targetCategory;
}
public AnnotationMessageType getType() {
return type;
}
......@@ -51,8 +62,10 @@ public class AnnotationMessage {
return "AnnotationMessage{" +
"from='" + from + '\'' +
", targetId='" + targetId + '\'' +
", targetCategory=" + targetCategory +
", type=" + type +
", annotationId='" + annotationId + '\'' +
'}';
}
}
package unipotsdam.gf.modules.annotation.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
......@@ -8,13 +10,15 @@ public class AnnotationPostRequest {
// variables
private String userToken;
private int targetId;
private String targetId;
private Category targetCategory;
private AnnotationBody body;
// constructors
public AnnotationPostRequest(String userToken, int targetId, AnnotationBody body) {
public AnnotationPostRequest(String userToken, String targetId, Category targetCategory, AnnotationBody body) {
this.userToken = userToken;
this.targetId = targetId;
this.targetCategory = targetCategory;
this.body = body;
}
......@@ -30,14 +34,22 @@ public class AnnotationPostRequest {
this.userToken = userToken;
}
public int getTargetId() {
public String getTargetId() {
return targetId;
}
public void setTargetId(int targetId) {
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public Category getTargetCategory() {
return targetCategory;
}
public void setTargetCategory(Category targetCategory) {
this.targetCategory = targetCategory;
}
public AnnotationBody getBody() {
return body;
}
......@@ -51,8 +63,9 @@ public class AnnotationPostRequest {
return "AnnotationPostRequest{" +
"userToken='" + userToken + '\'' +
", targetId=" + targetId +
", body=" + body.toString() +
", targetCategory=" + targetCategory +
", body=" + body +
'}';
}
}
......@@ -6,6 +6,7 @@ import unipotsdam.gf.modules.annotation.model.Annotation;
import unipotsdam.gf.modules.annotation.model.AnnotationPatchRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationPostRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationResponse;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
......@@ -108,12 +109,12 @@ public class AnnotationService {
}
@GET
@Path("/target/{id}")
public Response getAnnotations(@PathParam("id") int targetId) {
@Path("/targetid/{id}/targetcategory/{category}")
public Response getAnnotations(@PathParam("id") String targetId, @PathParam("category") String category) {
// receive the annotation
AnnotationController controller = new AnnotationController();
ArrayList<Annotation> annotations = controller.getAnnotations(targetId);
ArrayList<Annotation> annotations = controller.getAnnotations(targetId, Category.valueOf(category.toUpperCase()));
if (!annotations.isEmpty()) {
return Response.ok(annotations).build();
......
package unipotsdam.gf.modules.annotation.websocket;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class AnnotationWSTarget {
// variables
String targetId;
Category targetCategory;
// constructor
public AnnotationWSTarget(String targetId, Category targetCategory) {
this.targetId = targetId;
this.targetCategory = targetCategory;
}
// methods
public String getTargetId() {
return targetId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public Category getTargetCategory() {
return targetCategory;
}
public void setTargetCategory(Category targetCategory) {
this.targetCategory = targetCategory;
}
@Override
public String toString() {
return "AnnotationWSTarget{" +
"targetId='" + targetId + '\'' +
", targetCategory=" + targetCategory.toString() +
'}';
}
}
package unipotsdam.gf.modules.annotation.websocket;
import unipotsdam.gf.modules.annotation.model.AnnotationMessage;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import javax.websocket.*;
import javax.websocket.server.PathParam;
......@@ -10,26 +11,27 @@ import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
@ServerEndpoint(value = "/ws/annotation/{targetId}", decoders = AnnotationMessageDecoder.class, encoders = AnnotationMessageEncoder.class)
@ServerEndpoint(value = "/ws/annotation/{targetId}/{targetCategory}", decoders = AnnotationMessageDecoder.class, encoders = AnnotationMessageEncoder.class)
public class AnnotationWebSocketEndpoint {
private Session session;
private static final Set<AnnotationWebSocketEndpoint> endpoints = new CopyOnWriteArraySet<>();
private static HashMap<String, String> targets = new HashMap<>();
private static HashMap<String, AnnotationWSTarget> targets = new HashMap<>();
@OnOpen
public void onOpen(Session session, @PathParam("targetId") String targetId) throws IOException {
public void onOpen(Session session, @PathParam("targetId") String targetId, @PathParam("targetCategory") String targetCategory) throws IOException {
// initialize session
this.session = session;
// save endpoint in set of endpoints
endpoints.add(this);
// save mapping of session and target id
targets.put(session.getId(), targetId);
// save mapping of session and target (id + category)
targets.put(session.getId(), new AnnotationWSTarget(targetId, Category.valueOf(targetCategory.toUpperCase())));
}
@OnMessage
public void onMessage(Session session, AnnotationMessage annotationMessage) throws IOException, EncodeException {
annotationMessage.setTargetId(targets.get(session.getId()));
annotationMessage.setTargetId(targets.get(session.getId()).getTargetId());
annotationMessage.setTargetCategory(targets.get(session.getId()).getTargetCategory());
annotationMessage.setFrom(session.getId());
broadcast(annotationMessage);
......@@ -49,7 +51,8 @@ public class AnnotationWebSocketEndpoint {
endpoints.forEach(endpoint -> {
synchronized (endpoint) {
try {
if (targets.get(endpoint.session.getId()).equals(annotationMessage.getTargetId())
if (targets.get(endpoint.session.getId()).getTargetId().equals(annotationMessage.getTargetId())
&& targets.get(endpoint.session.getId()).getTargetCategory() == annotationMessage.getTargetCategory()
&& !endpoint.session.getId().equals(annotationMessage.getFrom())) {
System.out.println("Send message to session" + endpoint.session.getId() + " from session " + annotationMessage.getFrom());
endpoint.session.getBasicRemote().sendObject(annotationMessage);
......
package unipotsdam.gf.modules.submission.model;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class FullSubmission {
// variables
private String id;
private long timestamp;
private String user;
private String text;
private String projectId;
// constructor
public FullSubmission(String id, long timestamp, String user, String text, String projectId) {
this.id = id;
this.timestamp = timestamp;
this.user = user;
this.text = text;
this.projectId = projectId;
}
// methods
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public String toString() {
return "FullSubmission{" +
"id='" + id + '\'' +
", timestamp=" + timestamp +
", user='" + user + '\'' +
", text='" + text + '\'' +
", projectId='" + projectId + '\'' +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class FullSubmissionPostRequest {
// variables
private String user;
private String text;
private String projectId;
// constructors
public FullSubmissionPostRequest(String user, String text, String projectId) {
this.user = user;
this.text = text;
this.projectId = projectId;
}
public FullSubmissionPostRequest() {}
// methods
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public String toString() {
return "FullSubmissionPostRequest{" +
"user='" + user + '\'' +
", text='" + text + '\'' +
", projectId='" + projectId + '\'' +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import java.util.ArrayList;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class SubmissionPart {
// variables
private long timestamp;
private String userId;
private String fullSubmissionId;
private Category category;
private ArrayList<SubmissionPartBodyElement> body;
// constructor
public SubmissionPart(long timestamp, String userId, String fullSubmissionId, Category category, ArrayList<SubmissionPartBodyElement> body) {
this.timestamp = timestamp;
this.userId = userId;
this.fullSubmissionId = fullSubmissionId;
this.category = category;
this.body = body;
}
public SubmissionPart(){}
// methods
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFullSubmissionId() {
return fullSubmissionId;
}
public void setFullSubmissionId(String fullSubmissionId) {
this.fullSubmissionId = fullSubmissionId;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public ArrayList<SubmissionPartBodyElement> getBody() {
return body;
}
public void setBody(ArrayList<SubmissionPartBodyElement> body) {
this.body = body;
}
@Override
public String toString() {
return "SubmissionPart{" +
"timestamp=" + timestamp +
", userId='" + userId + '\'' +
", fullSubmissionId='" + fullSubmissionId + '\'' +
", category=" + category +
", body=" + body +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class SubmissionPartBodyElement {
// variables
private String text;
private int startCharacter;
private int endCharacter;
// constructors
public SubmissionPartBodyElement(String text, int startCharacter, int endCharacter) {
this.text = text;
this.startCharacter = startCharacter;
this.endCharacter = endCharacter;
}
public SubmissionPartBodyElement() {}
// methods
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
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 "SubmissionPartBodyElement{" +
", text='" + text + '\'' +
", startCharacter=" + startCharacter +
", endCharacter=" + endCharacter +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import java.util.ArrayList;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class SubmissionPartPostRequest {
// variables
private String userId;
private String fullSubmissionId;
private Category category;
private ArrayList<SubmissionPartBodyElement> body;
// constructors
public SubmissionPartPostRequest(String userId, String fullSubmissionId, Category category, ArrayList<SubmissionPartBodyElement> body) {
this.userId = userId;
this.fullSubmissionId = fullSubmissionId;
this.category = category;
this.body = body;
}
public SubmissionPartPostRequest(){}
// methods
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFullSubmissionId() {
return fullSubmissionId;
}
public void setFullSubmissionId(String fullSubmissionId) {
this.fullSubmissionId = fullSubmissionId;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public ArrayList<SubmissionPartBodyElement> getBody() {
return body;
}
public void setBody(ArrayList<SubmissionPartBodyElement> body) {
this.body = body;
}
@Override
public String toString() {
return "SubmissionPartPostRequest{" +
"userId='" + userId + '\'' +
", fullSubmissionId='" + fullSubmissionId + '\'' +
", category=" + category +
", body=" + body +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
public class SubmissionProjectRepresentation {
// variables
private String user;
private Category category;
private String fullSubmissionId;
// constructor
public SubmissionProjectRepresentation(String user, Category category, String fullSubmissionId) {
this.user = user;
this.category = category;
this.fullSubmissionId = fullSubmissionId;
}
public SubmissionProjectRepresentation(){}
// methods
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public String getFullSubmissionId() {
return fullSubmissionId;
}
public void setFullSubmissionId(String fullSubmissionId) {
this.fullSubmissionId = fullSubmissionId;
}
@Override
public String toString() {
return "SubmissionProjectRepresentation{" +
"user='" + user + '\'' +
", category=" + category +
", fullSubmissionId='" + fullSubmissionId + '\'' +
'}';
}
}
package unipotsdam.gf.modules.submission.model;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
public class SubmissionResponse {
// variables
String message;
// constructors
public SubmissionResponse(String message) {
this.message = message;
}
public SubmissionResponse(){}
// methods
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "SubmissionResponse{" +
"message='" + message + '\'' +
'}';
}
}
package unipotsdam.gf.modules.submission.view;
import unipotsdam.gf.modules.peer2peerfeedback.Category;
import unipotsdam.gf.modules.submission.controller.SubmissionController;
import unipotsdam.gf.modules.submission.model.*;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
*/
@Path("/submissions")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class SubmissionService {
@POST
@Path("/full")
public Response addFullSubmission(FullSubmissionPostRequest fullSubmissionPostRequest) {
// save full submission request in database and return the new full submission
SubmissionController controller = new SubmissionController();
FullSubmission fullSubmission = controller.addFullSubmission(fullSubmissionPostRequest);
return Response.ok(fullSubmission).build();
}
@GET
@Path("/full/{id}")
public Response getFullSubmission(@PathParam("id") String fullSubmissionId) {
// get full submission from database based by id
SubmissionController controller = new SubmissionController();
FullSubmission fullSubmission = controller.getFullSubmission(fullSubmissionId);
if (fullSubmission != null) {
return Response.ok(fullSubmission).build();
}
else {
// declare response
SubmissionResponse response = new SubmissionResponse();
response.setMessage("Submission with the id '" + fullSubmissionId + "' can't be found");
return Response.status(Response.Status.NOT_FOUND).entity(response).build();
}
}
@POST
@Path("/part")
public Response addSubmissionPart(SubmissionPartPostRequest submissionPartPostRequest) {
// save submission part request in the database and return the new submission part
SubmissionController controller = new SubmissionController();
SubmissionPart submissionPart = controller.addSubmissionPart(submissionPartPostRequest);
return Response.ok(submissionPart).build();
}
@GET
@Path("/full/{id}/category/{category}")
public Response getSubmissionPart(@PathParam("id") String fullSubmissionId, @PathParam("category") String category) {
// get submission part from database based by id
SubmissionController controller = new SubmissionController();
SubmissionPart submissionPart = controller.getSubmissionPart(fullSubmissionId, Category.valueOf(category.toUpperCase()));
if (submissionPart != null) {
return Response.ok(submissionPart).build();
}
else {
// declare response
SubmissionResponse response = new SubmissionResponse();
response.setMessage("Submission part with the full submission id '" + fullSubmissionId + "' and the category '" + category.toUpperCase() + "' can't be found");
return Response.status(Response.Status.NOT_FOUND).entity(response).build();
}
}
@GET
@Path("/full/{id}/parts")
public Response getAllSubmissionParts(@PathParam("id") String fullSubmissionId) {
// get submission parts from database based by id
SubmissionController controller = new SubmissionController();
ArrayList<SubmissionPart> parts = controller.getAllSubmissionParts(fullSubmissionId);
if (parts.size() > 0) {
return Response.ok(parts).build();
}
else {
SubmissionResponse response = new SubmissionResponse();
response.setMessage("No submission parts found for submission with the id '" + fullSubmissionId + "'");
return Response.status(Response.Status.NOT_FOUND).entity(response).build();
}
}
@GET
@Path("/project/{id}")
public Response getSubmissionPartsByProjectId(@PathParam("id") String projectId) {
// get submission project representation from database based by project id
SubmissionController controller = new SubmissionController();
ArrayList<SubmissionProjectRepresentation> representations = controller.getSubmissionPartsByProjectId(projectId);
if (representations.size() > 0) {
return Response.ok(representations).build();
}
else {
SubmissionResponse response = new SubmissionResponse();
response.setMessage("No submission parts found for project id '" + projectId + "'");
return Response.status(Response.Status.NOT_FOUND).entity(response).build();
}
}
}
......@@ -148,10 +148,20 @@ ol {
float: right;
margin: 20px;
}
.leftcontent-buttons-back {
float: left;
margin: 20px;
}
.leftcontent-text {
overflow: scroll;
white-space: pre-line;
color: lightgrey;
}
.resize-vertical {
resize: vertical;
}
.categoryText {
color: black;
font-weight: bold;
}
body, html {
height: 100vh;
width: 100vw;
}
.content-mainpage {
display: flex;
box-sizing: border-box;
font-family: Arial;
height: 100%;
overflow-y: hidden;
}
.rightcolumn {
float: right;
width: 25%;
height: 100%;
padding: 10px;
display: inline-block;
overflow: scroll;
}
.leftcolumn {
padding: 10px;
float: left;
width: 75%;
display: inline-block;
/* background-color: yellow; */
}
.rightcontent {
height: 100%;
}
.rightcontent ol {
padding: 0px;
margin: 0px;
list-style-type: none;
height: 100%;
}
.rightcontent li {
height: calc((100% - 70px) / 8);
min-height: 40px;
}
.leftcontent {
max-height: 100%;
display: flex;
flex-flow: column;
/* background-color: white; */
}
.spacing {
margin-bottom: 10px;
/* background-color: orange; */
}
.container-fluid-content {
display: flex;
flex-flow: column;
height: 100%;
}
.flex {
display: flex;
}
.flex .container-fluid{
flex: 1;
}
.full-height {
height: 100%;
}
.leftcontent-buttons-save {
float: right;
margin: 20px;
}
.leftcontent-text {
overflow: scroll;
white-space: pre-line;
}
.category-card {
min-height: 30px;
height: 100%;
width: 100%;
border-radius: 5px;
font-weight: bold;
font-size: large;
overflow: hidden;
}
.category-card p {
position: relative;
float: left;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 100%;
}
.not-added{
border-style: dashed;
border-color: lightgray;
color: lightgray;
}
.titel {
background-color: #ba68c8;
}
.added-titel {
border-style: solid;
border-color: #ba68c8;
color: #ba68c8;
}
.recherche {
background-color: #7986cb;
}
.added-recherche {
border-style: solid;
border-color: #7986cb;
color: #7986cb;
}
.literaturverzeichnis {
background-color: #4dd0e1;
}
.added-literaturverzeichnis {
border-style: solid;
border-color: #4dd0e1;
color: #4dd0e1;
}
.forschungsfrage {
background-color: #81c784;
}
.added-forschungsfrage {
border-style: solid;
border-color: #81c784;
color: #81c784;
}
.untersuchungskonzept {
background-color: #dce775;
}
.added-untersuchungskonzept {
border-style: solid;
border-color: #dce775;
color: #dce775;
}
.methodik {
background-color: #ffd54f;
}
.added-methodik {
border-style: solid;
border-color: #ffd54f;
color: #ffd54f;
}
.durchfuehrung {
background-color: #ff8a65;
}
.added-durchfuehrung {
border-style: solid;
border-color: #ff8a65;
color: #ff8a65;
}
.auswertung {
background-color: #a1887f;
}
.added-auswertung {
border-style: solid;
border-color: #a1887f;
color: #a1887f;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment