upload
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m2s

This commit is contained in:
Jan-Philipp Luithardt
2025-12-03 17:57:30 +01:00
parent ed7bd7d1ed
commit 3ddc6bbc15
50 changed files with 282 additions and 114 deletions

View File

@@ -1,5 +1,7 @@
package hhn.temp.project;
import hhn.temp.project.expections.TaskHasNoWorkerException;
public class Task {
private String name;
@@ -7,16 +9,10 @@ public class Task {
private TaskStatus taskStatus;
private int taskID;
private static int idCounter = 0;
private String workername;
public Task(String name, String description) {
if (name == null || description == null ) {
throw new IllegalArgumentException("Name/Description is null!");
}
if(name.isEmpty()) {
throw new IllegalArgumentException("Name is empty!");
}
this.name = name;
this.description = description;
@@ -26,11 +22,11 @@ public class Task {
}
public int getTaskID() {
return taskID;
return this.taskID;
}
public String getName() {
return name;
return this.name;
}
public String getDescription() {
@@ -59,4 +55,34 @@ public class Task {
this.taskStatus = taskStatus;
}
public void setWorker(String workerName) {
if(workerName == null || workerName.isEmpty()) {
throw new IllegalArgumentException("There is nothing in this variable.");
}
if(!checkOnlyLetter(workerName)){
throw new IllegalArgumentException("Only Lettery as Worker Name!");
}
this.workername = workerName;
this.setStatus(TaskStatus.INPROCESS);
}
public String getWorker() {
if(this.workername == null) {
throw new TaskHasNoWorkerException("Please set first a Worker");
}
return this.workername;
}
private boolean checkOnlyLetter(String text) {
boolean result = true;
for(int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if(!Character.isLetter(c)) {
result = false;
break;
}
}
return result;
}
}