add db
Some checks are pending
Gradle CI with Jacoco / build (push) Has started running

This commit is contained in:
Jan-Philipp Luithardt
2025-12-06 20:08:03 +01:00
parent ec210a629a
commit c775b4ab96
66 changed files with 848 additions and 165 deletions

View File

@@ -1,6 +1,7 @@
package hhn.temp.project;
import hhn.temp.project.expections.TaskHasNoWorkerException;
import hhn.temp.project.provider.MySql;
public class Task {
@@ -8,17 +9,17 @@ public class Task {
private String description;
private TaskStatus taskStatus;
private int taskID;
private static int idCounter = 0;
private String workername;
private MySql mySql;
public Task(String name, String description) {
public Task(int id, String name, String description, String workername, TaskStatus status, MySql mySql) {
this.taskID = id;
this.name = name;
this.description = description;
this.taskStatus = TaskStatus.OPEN;
//TODO when DB then auto IDs
this.taskID = idCounter++;
this.taskStatus = status;
this.workername = workername;
this.mySql = mySql;
}
public int getTaskID() {
@@ -43,6 +44,7 @@ public class Task {
throw new IllegalArgumentException("Description is null!");
}
this.mySql.updateDescription(taskID, description);
this.description = description;
}
@@ -52,6 +54,7 @@ public class Task {
throw new IllegalArgumentException("TaskStatus is null!");
}
this.mySql.updateStatus(taskID, taskStatus);
this.taskStatus = taskStatus;
}
@@ -62,6 +65,9 @@ public class Task {
if(!checkOnlyLetter(workerName)){
throw new IllegalArgumentException("Only Lettery as Worker Name!");
}
this.mySql.updateStatus(taskID, TaskStatus.INPROCESS);
this.mySql.updateWorker(taskID, workerName);
this.workername = workerName;
this.setStatus(TaskStatus.INPROCESS);
}