Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I your application you need to let users perforn the following operations on tasks: ( 1 ) describe; ( 2 ) describe all. To fulfil

I your application you need to let users perforn the following operations on tasks:
(1) describe;
(2) describe all.
To fulfil the requirements you have to:
. add missing annotations to a TaskController.
.implements all methods and add required annotations to make them available through HTTP calls.
Tips:
Use TaskDto to get information from the user and send it back to them.
Java Version and available libraries
.java 17
.apache Commons Lang 3.3.9
.Google Guava 28.1-jar
.Spring Data JPA starter2.7.5
.Spring Data webstarter2.7.5
----Requirements
1. Describe one:
.Request
.URL:/task/describe/{id}
.Method:GET
.Response
.Scenario 1:Task found
.Status:200
.Body(example):
["Description of Task[13:Name] is:Some description"]
.Scenario 2:Task not found
.Status:200
.Body(example):
[""Task with id=13 does not exist"]
2.Find all tasks:
.Request
.URL:/tasks
.Method:GET
.Response
.Status:200
.Body(example):
[{"id":"1","title":"Task1","description":"Some description","status":"CREATED"},
{"id":"2","title":"Task2","description":"Another description","status":"CREATED"}]
3. Describe all tasks:
.Request
.URL:/tasks/describe
.Method:GET
.Response
.Status:200
.Body(example):
["Description of Task [1:Task 1] is:Some description","Description of Task [2:Task 2] is:Another description"]
Source
TaskRepository.java
import org.springframework.data.repository.CrudRepository;
@Repository
public interface TaskRepository extends CrudRepository
}
Task.java
@Entity
public class Task {
@Id
@GeneratedValue
private Long id;
private String title;
private String description;
private TaskStatus status=CREATED;
public Task(String title){
this.title = title;
}
private Task(){}
//no getter method---------------------------------
public void setTitle(String title){
this.title = title;
}
public void setDescription(String description){
this.description = description;
}
public void setTaskStatus(TaskStatus status){
this.status = status;
}
public Long getId(){
return id;
}
public TaskDto toDto(){
return new TaskDto(String.valueOf(id), title, description, status.name());
}
}
TaskDto.java
public class TaskDto {
private String id;
private String title;
private String description;
private String status;
-------------------------------------------------
TaskStatus.java
public enum TaskStatus {
CREATED,APPROVED,REJECTED,BLOCKED,DONE
}
TaskController.java---------------------
all End point need implement
task.java no getter method onl id getter method. importance
task.java should't change ,please above class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago