Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your application allows you to manage Task and Project entities. You have to add missing annotations and code over entity classes and converters to make
Your application allows you to manage Task and Project
entities.
You have to add missing annotations and code over entity classes
and converters to make it possible to store Task and Project
and their relations in specified tables.
:Requirements:
Project. updates should be persisted in a table with thefollowing structure:
Table name: PROJECTEVENTUPDATES
Columns:
PROJECTID : foreign key;
USERNAME : value of Itemupdate.user ;
EVENTDATE: value of Itemupdate. date
Taskwatchers should be persisted in a table with the
Table name: TODOWATCHERS :
Columns:TODOID : foreign key;
LOGIN: value of string from the set.
Task.comments should prsisted in a table with the following structur
TODOTable name: COMMENTS with columns TODOIDAUTHORADDDATE, COMMENT ;
Taskupdates should prsisted in a table with the following structur
Table name:TODOUPDATES
columns:
TODOID:foreing keyAUTHOR:value of Itemupdate.user UPDATEDATE:value of Itemupdate.user
Tasktags should be persisted in a table with the following structure
Table name:TODOTAGS
columns:
TODOID:foreing keyName:key from the MapDESCRIPTION:value of Map
The following tables should exist after implementation:
PROJECTS with columnS PROJECTIDNAME ;PROJECTEVENTUPDATES with columnS PROJECTIDUSERNAME, EVENTDATE ;
TODOS with columns TODOIDSUBJECT DETAILS;TODOWATCHERS with columnS TODOIDLOGIN ;
TODOCOMMENTS with columns TODOIDAUTHORADDDATE, COMMENT ;TODOUPDATES with columns TODOIDAUTHORUPDATEDATE;
TODOWATCHERS with columnS TODOIDNAMEDESCRIPTION
@Entity
@Tablename "PROJECTS"
@NoArgsConstructoraccessAccessLevel.PRIVATE
public class Project
@Id
@Columnname "PROJECTID
private Long id;
@Columnname "NAME",nullable false
private String name;
@Transient
private List updatesnew ArrayList ;
private ProjectProjectBuilder builder
thisidbuilder.id;this.namebuilder.name; this.updatesbuilder.updates;
static ProjectBuilder builderLong idString name
return new ProjectBuilderidname;
static class ProjectBuilder
private final Long id;private final String name;
private final List updatesnew ArrayList;
ProjectBuilderLong idString name
thisidid;this.namename;
ProjectBuilder addItemUpdate update
updatesaddupdate;
return this;
Project buildreturn new Projectthis;
@Entity
@Tablename "TODOS"
@NoArgsConstructoraccessAccessLevel.PRIVATE
public class Task
@Id
@Columnname "TODOID
private Long id;
@Columnname "SUBJECT",nullable false
private String subject;
@Columnname "DETAILS",columnDefinition "CLOB"
private String details;
@Transient
private Set watchersnew HashSet;
@Transient
private List commentsnew ArrayList;
@Transient
private ListItemUpdate updatesnew ArrayList;
@Transient
private MapString,String tagsnew HashMap;
private TaskTaskBuilder builder
this.idbuilder.id;this.subjectbuilder.subject;this.detailsbuilder.details;this.watchersbuilder.watchers;this.commentsbuilder.comments;
this.updatesbuilder.updates;
this.tagsbuilder.tags;
static TaskBuilder builderLong idString subject,String details
return new TaskBuilderidsubject,details;
static class TaskBuilder
private final Long id;private final String subject;private final String details;private final SetString watchersnew HashSet;
private final ListComment commentsnew ArrayList;
private final ListItemUpdate updatesnew ArrayList;
private final MapString,String tagsnew HashMap;
public TaskBuilderLong id String subject, String details
TaskBuilder addWatcherString watcher
watchersaddwatcher; return this;
TaskBuilder addComment comment
commentsaddcomment;return this;
TaskBuilder addItemUpdate update
updatesaddupdate;return this;
TaskBuilder addTagString name,String description
tagsputnamedescription;return this;
Task build
return new Taskthis;
@Embeddable
@NoArgsConstructoraccessAccessLevel.PRIVATE
public class ItemUpdate private String user;private LocalDate date;
@Embeddable
@NoArgsConstructoraccessAccessLevel.PRIVATE
public class Comment
@Columnname "AUTHOR"
private String author;
@Columnname "ADDDATE"
private LocalDate date;
@Columnname "COMMENT"
private String comment;
tableProjectjava pcode class"asciimath"xcodepTask.java pcode class"asciimath"xcodedivdivimg srchttps:mediacheggcdn.comstudyfdfdcaecbaddfcfbIMGWAjpgdiv
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