java.lang.Object
no.ntnu.principes.service.TaskTemplateService
Manages the creation and update of task templates and their assignments.
Handles the initial setup of tasks with proper assignments to household members,
and updates to task properties and member assignments.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TaskTemplateService with the required repositories. -
Method Summary
Modifier and TypeMethodDescriptioncreateTask(CreateTaskRequest taskRequest, List<Long> assignToMemberIds) Creates a new task with optional assignments to specific members.createTask(CreateTaskRequest taskRequest, List<Long> assignToMemberIds, boolean pushEvents) Creates a new task with optional assignments to specific members.booleanupdateTask(Long taskId, CreateTaskRequest taskRequest, List<Long> assignToMemberIds) Updates an existing task and its assignments.
-
Constructor Details
-
TaskTemplateService
public TaskTemplateService()Creates a new TaskTemplateService with the required repositories. Repositories are obtained from the central DatabaseManager.
-
-
Method Details
-
createTask
public Task createTask(CreateTaskRequest taskRequest, List<Long> assignToMemberIds, boolean pushEvents) Creates a new task with optional assignments to specific members. If no members are specified, creates an unassigned task assignment.- Parameters:
taskRequest- The request containing task detailsassignToMemberIds- List of member IDs to assign the task to, or null/empty for unassignedpushEvents- Whether to push events after task creation- Returns:
- The created task
-
createTask
Creates a new task with optional assignments to specific members. If no members are specified, creates an unassigned task assignment.- Parameters:
taskRequest- The request containing task detailsassignToMemberIds- List of member IDs to assign the task to, or null/empty for unassigned- Returns:
- The created task
-
updateTask
Updates an existing task and its assignments. Handles changes to task properties and member assignments, preserving or updating existing assignments as needed.- Parameters:
taskId- The ID of the task to updatetaskRequest- The request containing updated task detailsassignToMemberIds- List of member IDs to assign the task to, or null/empty for unassigned- Returns:
- The updated task
- Throws:
IllegalArgumentException- if the task is not found
-
getUnassignedTasks
-
hasCreatedTasks
public boolean hasCreatedTasks()
-