Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,28 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>${sl4j-version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${sl4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${sl4j-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!--******************************-->
<!--test-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>

<build>
Expand All @@ -155,9 +171,7 @@
<warSourceDirectory>${basedir}/web</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>

</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public String orderPage(){
return "order";
}

@RequestMapping("/task")
public String taskPage() {
return "task";
}

@RequestMapping("/admin")
public String getAdminPage(Model model) {
model.addAttribute("admin", "Very Secure Page for admins!");
Expand Down
74 changes: 62 additions & 12 deletions src/main/java/io/khasang/teamnote/entity/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,58 @@

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Set;

@Entity
@Table(name = "tasks")
@Table(name = "TASKS")
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private long userIdCreator;
private long userIdExecutor;
private long id;

@ManyToOne
@JoinColumn(name = "PARENT_ID",
foreignKey = @ForeignKey(name = "FK_TASKS_PARENT_ID_TO_TASKS_ID"))
private Task parentTask;

@OneToMany(mappedBy = "parentTask", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
public Set<Task> subTasks;

@ManyToOne
@JoinColumn(name = "USER_ID_CREATOR",
foreignKey = @ForeignKey(name = "FK_TASKS_USER_ID_CREATOR_TO_USERS_ID"))
private User userCreator;

@ManyToOne
@JoinColumn(name = "USER_ID_EXECUTOR",
foreignKey = @ForeignKey(name = "FK_TASKS_USER_ID_EXECUTOR_TO_USERS_ID"))
private User userExecutor;

@Column(name = "STATUS_ID")
private long statusId;
@Column(name = "PRIORITY_ID")
private long priorityId;
@Column(name = "LABLE_ID")
private long lableId;
private String name;
private String description;

@Column(name = "CREATION_DATE")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime creationDate;

@Column(name = "ISSUE_DATE")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime issueDate;

@Column(name = "ESTIMATED_DATE")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime estimatedDate;

@Column(name = "UPDATED_DATE")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime updatedDate;
Expand All @@ -48,20 +73,20 @@ public void setId(long id) {
this.id = id;
}

public long getUserIdCreator() {
return userIdCreator;
public User getUserCreator() {
return userCreator;
}

public void setUserIdCreator(long userIdCreator) {
this.userIdCreator = userIdCreator;
public void setUserCreator(User userCreator) {
this.userCreator = userCreator;
}

public long getUserIdExecutor() {
return userIdExecutor;
public User getUserExecutor() {
return userExecutor;
}

public void setUserIdExecutor(long userIdExecutor) {
this.userIdExecutor = userIdExecutor;
public void setUserExecutor(User userExecutor) {
this.userExecutor = userExecutor;
}

public long getStatusId() {
Expand Down Expand Up @@ -143,4 +168,29 @@ public String getColor() {
public void setColor(String color) {
this.color = color;
}

public Task getParentTask() {
return parentTask;
}

public void setParentTask(Task parentTask) {
this.parentTask = parentTask;
}

public Set<Task> getSubTasks() {
return subTasks;
}

public void setSubTasks(Set<Task> subTasks) {
this.subTasks = subTasks;
}

public void addSubTasks(Task subTask) {
subTask.setParentTask(this);
getSubTasks().add(subTask);
}

public void removeSubTasks(Task subTask) {
getSubTasks().remove(subTask);
}
}
61 changes: 46 additions & 15 deletions src/main/java/io/khasang/teamnote/entity/User.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
package io.khasang.teamnote.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
* This class represents a user. It includes attributes that identify a person ({@link #firstName}, {@link #lastName}),
* identify an application user ({@link #accountName}) and enable authentication ({@link #password}).
*
* @author MickeyMouse
*/
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Entity
@Table(name = "users", uniqueConstraints = {
@UniqueConstraint(columnNames = { "ACCOUNT_NAME" }, name = "users_unique_account_name"),
Expand Down Expand Up @@ -44,6 +34,14 @@ public class User {
@Column(name = "PASSWORD")
private String password;

@OneToMany(mappedBy = "userCreator", cascade= CascadeType.ALL,
orphanRemoval = true, fetch = FetchType.EAGER)
private Set<Task> createdTasks = new HashSet<>();

@OneToMany(mappedBy = "userExecutor", cascade= CascadeType.ALL,
orphanRemoval = true, fetch = FetchType.EAGER)
private Set<Task> assignedTasks = new HashSet<>();

public String getAccountName() {
return accountName;
}
Expand Down Expand Up @@ -92,4 +90,37 @@ public void setPassword(String password) {
this.password = password;
}

}
public Set<Task> getCreatedTasks() {
return createdTasks;
}

public void setCreatedTasks(Set<Task> createdTasks) {
this.createdTasks = createdTasks;
}

public void addCreatedTasks(Task createdTask) {
createdTask.setUserCreator(this);
getCreatedTasks().add(createdTask);
}

public void removeCreatedTasks(Task createdTask) {
getCreatedTasks().remove(createdTask);
}

public Set<Task> getAssignedTasks() {
return assignedTasks;
}

public void setAssignedTasks(Set<Task> assignedTasks) {
this.assignedTasks = assignedTasks;
}

public void addAssignedTasks(Task assignedTask) {
assignedTask.setUserExecutor(this);
getAssignedTasks().add(assignedTask);
}

public void removeAssignedTasks(Task assignedTask) {
getAssignedTasks().remove(assignedTask);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ private Task createTask() {

private Task prefillTask() {
Task task = new Task();
task.setUserIdCreator(1);
task.setUserIdExecutor(2);
task.setUserCreator(null);
task.setUserExecutor(null);
task.setStatusId(1);
task.setPriorityId(1);
task.setLableId(1);
Expand Down
79 changes: 79 additions & 0 deletions web/WEB-INF/menu/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
html {
font-size: 16px;
}

body {
margin: 0;
font-family: "Roboto", sans-serif;
font-size: 0.875rem;
line-height: 1.42857143;
color: #333;
}

header {
position: relative;
/*top: 0;
left: 0;*/
z-index: 999;

width: 100%;
height: 50px;

background: #eee;
box-shadow: rgba(0, 0, 0, 0.5) 0 -20px 20px 20px;
}

header h1 {
margin: 0;
padding: 0 15px;
height: 50px;
line-height: 50px;
font-weight: 400;
font-size: 18px;
float: left;
}

.wrapper {
/*margin-top: 50px;*/
padding: 15px 30px;
transition: all 0.3s ease-out;
}

.clearfix:after {
content: "";
display: block;
clear: both;
}


/* Small devices (tablets)
==========================*/
@media (min-width: 768px) {

}


/* Medium devices (desktops)
==========================*/
@media (min-width: 992px) {

body {
overflow-y: scroll;
}

.logo img {
width: 200px;
text-align: center;
margin-top: 10px;
float: none;
}

.wrapper {
margin-left: 200px;
}

.wrapper__minify {
margin-left: 50px;
}

}
Loading