Answered step by step
Verified Expert Solution
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:
describe;
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
apache Commons Lang
Google Guava jar
Spring Data JPA starter
Spring Data webstarter
Requirements
Describe one:
Request
URL:taskdescribeid
Method:GET
Response
Scenario :Task found
Status:
Bodyexample:
Description of Task:Name is:Some description"
Scenario :Task not found
Status:
Bodyexample:
Task with id does not exist"
Find all tasks:
Request
URL:tasks
Method:GET
Response
Status:
Bodyexample:
id:"title":"Task"description":"Some description","status":"CREATED"
id:"title":"Task"description":"Another description","status":"CREATED"
Describe all tasks:
Request
URL:tasksdescribe
Method:GET
Response
Status:
Bodyexample:
Description of Task :Task is:Some description","Description of Task :Task 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 statusCREATED;
public TaskString title
this.title title;
private Task
no getter method
public void setTitleString title
this.title title;
public void setDescriptionString description
this.description description;
public void setTaskStatusTaskStatus status
this.status status;
public Long getId
return id;
public TaskDto toDto
return new TaskDtoStringvalueOfid 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started