upload
This commit is contained in:
@@ -3,11 +3,8 @@ package hhn.temp.project;
|
||||
|
||||
public class Main {
|
||||
|
||||
public void Main() {
|
||||
// public void Main() {
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public String loadString() {
|
||||
return "test";
|
||||
}
|
||||
}
|
||||
65
src/main/java/hhn/temp/project/Task.java
Normal file
65
src/main/java/hhn/temp/project/Task.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
public class Task {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private TaskStatus taskStatus;
|
||||
private int taskID;
|
||||
private static int idCounter = 0;
|
||||
|
||||
public Task(String name, String description) {
|
||||
|
||||
if (name == null || description == null ) {
|
||||
|
||||
throw new IllegalArgumentException("Name/Description is null!");
|
||||
}
|
||||
if(name.isEmpty() || description.isEmpty()) {
|
||||
throw new IllegalArgumentException("Name/Description is empty!");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.taskStatus = TaskStatus.OPEN;
|
||||
//TODO when DB then auto IDs
|
||||
this.taskID = idCounter++;
|
||||
}
|
||||
|
||||
public int getTaskID() {
|
||||
return taskID;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public TaskStatus getStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
if (description == null ) {
|
||||
|
||||
throw new IllegalArgumentException("Description is null!");
|
||||
}
|
||||
if(description.isEmpty()) {
|
||||
throw new IllegalArgumentException("Description is empty!");
|
||||
}
|
||||
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setStatus(TaskStatus taskStatus) {
|
||||
if (taskStatus == null ) {
|
||||
|
||||
throw new IllegalArgumentException("TaskStatus is null!");
|
||||
}
|
||||
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
}
|
||||
20
src/main/java/hhn/temp/project/TaskManager.java
Normal file
20
src/main/java/hhn/temp/project/TaskManager.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TaskManager {
|
||||
|
||||
private Map<Integer, Task> taskMap;
|
||||
|
||||
public TaskManager() {
|
||||
taskMap = new HashMap<>();
|
||||
}
|
||||
|
||||
public Task createTask(String name, String description) {
|
||||
Task task = new Task(name, description);
|
||||
taskMap.put(task.getTaskID(), task);
|
||||
|
||||
return task;
|
||||
}
|
||||
}
|
||||
5
src/main/java/hhn/temp/project/TaskStatus.java
Normal file
5
src/main/java/hhn/temp/project/TaskStatus.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
public enum TaskStatus {
|
||||
OPEN, CLOSED, IN_PROCESS
|
||||
}
|
||||
Reference in New Issue
Block a user