commit c3365e8b39241f1949a75fd54edf0eb9c6a9b5ab
Author: Hrabikv <75799502+Hrabikv@users.noreply.github.com>
Date:   Sat Nov 25 11:49:01 2023 +0100

    https://kivprogrammers.atlassian.net/browse/TSP2-62 updete workunity

diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/ActivityController.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/ActivityController.java
index 6c90299..fa388b2 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/ActivityController.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/ActivityController.java
@@ -32,8 +32,7 @@ public class ActivityController {
 
     //"/v2/management/activity_list"
     @GetMapping("/activity_list")
-    public ResponseEntity<String> getProjectsList(@RequestParam Map<String, String> requestData) {
-        Long projectId = Long.parseLong(requestData.get("selectedProjectId").toString());
+    public ResponseEntity<String> getProjectsList(@RequestParam Long projectId) {
 
         //ProjectToDto projectToDto = new ProjectToDto();
         //List<ProjectDto> projects = projectToDto.convert(projectService.getAllProjects());
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/WorkUnitController.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/WorkUnitController.java
index 7eaddfd..4c47194 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/WorkUnitController.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/management/WorkUnitController.java
@@ -2,6 +2,7 @@ package cz.zcu.fav.kiv.antipatterndetectionapp.v2.controller.management;
 
 import com.google.gson.Gson;
 import cz.zcu.fav.kiv.antipatterndetectionapp.model.management.WorkUnit;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.SelectedWorkUnitsDto;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.WorkUnitDto;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.workUnit.WorkUnitServiceV2;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.utils.converters.ClassToDto;
@@ -13,9 +14,12 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import javax.persistence.criteria.CriteriaBuilder;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
-@RequestMapping("v2/work_unit")
+@RequestMapping("v2/management")
 @Controller
 public class WorkUnitController {
     @Autowired
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/ActivityDto.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/ActivityDto.java
index 875442f..22b1ae1 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/ActivityDto.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/ActivityDto.java
@@ -17,6 +17,7 @@ public class ActivityDto {
     private long externalId;
     private Date startDate;
     private Date endDate;
+    private long id;
 
 
     public static ActivityDto.ActivityDtoBuilder builder() {return new ActivityDto.ActivityDtoBuilder();}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/SelectedWorkUnitsDto.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/SelectedWorkUnitsDto.java
new file mode 100644
index 0000000..97944a0
--- /dev/null
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/SelectedWorkUnitsDto.java
@@ -0,0 +1,31 @@
+package cz.zcu.fav.kiv.antipatterndetectionapp.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class SelectedWorkUnitsDto {
+    @JsonProperty("activityId")
+    private long activityId;
+
+    @JsonProperty("wuIds")
+    private List<Long> wuIds;
+
+    // Getter and Setter methods
+
+    public long getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(int activityId) {
+        this.activityId = activityId;
+    }
+
+    public List<Long> getWuIds() {
+        return wuIds;
+    }
+
+    public void setWuIds(List<Long> wuIds) {
+        this.wuIds = wuIds;
+    }
+}
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/workUnit/WorkUnitServiceV2Impl.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/workUnit/WorkUnitServiceV2Impl.java
index 304da3b..30e3585 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/workUnit/WorkUnitServiceV2Impl.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/workUnit/WorkUnitServiceV2Impl.java
@@ -10,11 +10,15 @@ import java.util.List;
 
 @Service
 public class WorkUnitServiceV2Impl implements WorkUnitServiceV2 {
+
     @Autowired
     WorkUnitRepository workUnitRepository;
 
+    @Autowired
+    WorkUnitService workUnitService;
+
     @Override
-    public List<WorkUnit> fetchProjectWorkUnits(long projectId){
+    public List<WorkUnit> fetchProjectWorkUnits(long projectId) {
         //List<WorkUnit> units = this.workUnitRepository.fetchActivityWorkUnits(activityId);
         List<WorkUnit> units = this.workUnitRepository.fetchAllProjectWorkUnits(projectId);
         return units;
diff --git a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/utils/converters/ActivityToDto.java b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/utils/converters/ActivityToDto.java
index c1ad8c2..f086251 100644
--- a/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/utils/converters/ActivityToDto.java
+++ b/src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/utils/converters/ActivityToDto.java
@@ -20,6 +20,7 @@ public class ActivityToDto implements ClassToDto<Activity, ActivityDto> {
                 .startDate(source.getStartDate())
                 .name(source.getName())
                 .description(source.getDescription())
+                .id(source.getId())
                 .build();
     }
 
