Skip to content

Commit 7335795

Browse files
authored
feat: class multi select (#189, RDFA-546)
1 parent ad43bd1 commit 7335795

52 files changed

Lines changed: 2965 additions & 1091 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FEATURE_CHECKLIST.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Reference document for manual testing. Verify the areas relevant to your change
4646
- Schema context menu: New package, New Profile Diagram, Undo/Redo, Create/Edit/Delete profile header, Changelog, Compare, Migrate schema, Constraints import/export/full view, Export schema, Delete schema
4747
- Package context menu: Create class, Add to Profile/Dataset Diagram, Paste class, View/Edit package, Copy URL, Delete package
4848
- Class context menu: Show in diagram, Copy class, Constraints, Add to Profile/Dataset Diagram, Delete class
49+
- Multi-select classes: Ctrl/Cmd+click toggles a class, Shift+click selects a range
4950
- Diagram context menu: Edit diagram, Delete diagram
5051

5152
## Editor – Package View
@@ -57,7 +58,8 @@ Reference document for manual testing. Verify the areas relevant to your change
5758
- Drag and zoom
5859
- Reset View, Filter View, Reset Layout buttons
5960
- Click on class opens class editor
60-
- Class context menu: Copy class, Delete class, Move between layers
61+
- Multi-select: Ctrl/Cmd+click toggles a class, Shift+click adds a class, Ctrl/Cmd+drag toggles a selection box, Shift+drag adds, plain drag on the pane replaces the selection
62+
- Right-drag pans the diagram, right-click opens the context menu without selecting the class
6163
- Pane context menu: Add class, Paste class
6264

6365
## Editor – Class Editor
@@ -72,6 +74,7 @@ Reference document for manual testing. Verify the areas relevant to your change
7274
## Editor – Delete Dialog
7375

7476
- Package, Classes, Attributes and Associations listed correctly
77+
- Deleting a multi-selection lists all selected classes with their dependencies
7578
- Delete, Keep, Move to default actions
7679
- Set all
7780

@@ -84,6 +87,7 @@ Reference document for manual testing. Verify the areas relevant to your change
8487
- Drag and zoom
8588
- Reset View, Filter View, Reset Layout buttons
8689
- Click on class opens class editor
90+
- Multi-select: works the same as in the package view
8791
- Class context menu: Delete class, Remove from diagram, Move between layers
8892
- Pane context menu: Add class
8993

backend/src/main/java/org/rdfarchitect/api/controller/datasets/diagrams/CustomDatasetDiagramAllClassesRESTController.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.slf4j.Logger;
2828
import org.slf4j.LoggerFactory;
2929
import org.springframework.http.HttpHeaders;
30+
import org.springframework.web.bind.annotation.DeleteMapping;
3031
import org.springframework.web.bind.annotation.PathVariable;
3132
import org.springframework.web.bind.annotation.PostMapping;
3233
import org.springframework.web.bind.annotation.RequestBody;
@@ -62,14 +63,46 @@ public String addToDiagram(
6263
@RequestBody
6364
List<ClassInDiagram> classes) {
6465
logger.info(
65-
"Received DELETE request: \"/api/datasets/{{}}/diagrams/{{}}/classes\" from \"{}\"",
66+
"Received POST request: \"/api/datasets/{{}}/diagrams/{{}}/classes\" from \"{}\"",
6667
datasetName,
6768
diagramId,
6869
originURL);
6970

7071
customDiagramLayoutUseCase.addClassesToCustomDatasetDiagram(
7172
datasetName, UUID.fromString(diagramId), classes);
7273

74+
logger.info(
75+
"Sending response to POST request: \"/api/datasets/{{}}/diagrams/{{}}/classes\" from \"{}\"",
76+
datasetName,
77+
diagramId,
78+
originURL);
79+
return Response.SUCCESS;
80+
}
81+
82+
@DeleteMapping
83+
public String removeFromDiagram(
84+
@Parameter(description = "The name/url of the inquirer.")
85+
@RequestHeader(
86+
value = HttpHeaders.ORIGIN,
87+
required = false,
88+
defaultValue = "unknown")
89+
String originURL,
90+
@Parameter(description = "The literal name of the dataset.") @PathVariable
91+
String datasetName,
92+
@Parameter(description = "The uuid of the diagram.") @PathVariable String diagramId,
93+
@Parameter(description = "The list of class uuids to be removed from the diagram")
94+
@RequestBody
95+
List<UUID> classIds) {
96+
logger.info(
97+
"Received DELETE request: \"/api/datasets/{{}}/diagrams/{{}}/classes\" for {} class(es) from \"{}\"",
98+
datasetName,
99+
diagramId,
100+
classIds.size(),
101+
originURL);
102+
103+
customDiagramLayoutUseCase.removeClassesFromCustomDatasetDiagram(
104+
datasetName, UUID.fromString(diagramId), classIds);
105+
73106
logger.info(
74107
"Sending response to DELETE request: \"/api/datasets/{{}}/diagrams/{{}}/classes\" from \"{}\"",
75108
datasetName,

backend/src/main/java/org/rdfarchitect/api/controller/datasets/diagrams/CustomDatasetDiagramClassRESTController.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

backend/src/main/java/org/rdfarchitect/api/controller/datasets/graphs/DeleteRESTController.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.slf4j.Logger;
3333
import org.slf4j.LoggerFactory;
3434
import org.springframework.http.HttpHeaders;
35-
import org.springframework.web.bind.annotation.GetMapping;
3635
import org.springframework.web.bind.annotation.PathVariable;
3736
import org.springframework.web.bind.annotation.PostMapping;
3837
import org.springframework.web.bind.annotation.RequestBody;
@@ -41,6 +40,7 @@
4140
import org.springframework.web.bind.annotation.RestController;
4241

4342
import java.util.List;
43+
import java.util.Map;
4444
import java.util.UUID;
4545

4646
@RestController
@@ -57,11 +57,11 @@ public class DeleteRESTController {
5757
@Operation(
5858
summary = "Get deletion impact",
5959
description =
60-
"Returns a tree of affected resources for deleting the resource with the given UUID.",
60+
"Returns, per requested UUID, a tree of affected resources for deleting that resource.",
6161
tags = {"graph"},
6262
responses = {@ApiResponse(responseCode = "200")})
63-
@GetMapping("/uuid/{uuid}/deletion-impact")
64-
public AffectedResource getDeletionImpact(
63+
@PostMapping("/deletion-impact")
64+
public Map<UUID, AffectedResource> getDeletionImpact(
6565
@Parameter(description = "The name/url of the inquirer.")
6666
@RequestHeader(
6767
value = HttpHeaders.ORIGIN,
@@ -75,29 +75,26 @@ public AffectedResource getDeletionImpact(
7575
"The url encoded uri of the graph, or \"default\" to access the default graph.")
7676
@PathVariable
7777
String graphURI,
78-
@Parameter(description = "The url encoded iri identifier of the cim resource.")
79-
@PathVariable
80-
String uuid) {
78+
@Parameter(description = "The uuids of the cim resources to analyse.") @RequestBody
79+
List<UUID> uuids) {
8180
logger.info(
82-
"Received GET request: \"/api/datasets/{{}}/graphs/{{}}/uuid/{{}/deletion-impact\" from \"{}\".",
81+
"Received POST request: \"/api/datasets/{{}}/graphs/{{}}/deletion-impact\" for {} resource(s) from \"{}\".",
8382
datasetName,
8483
graphURI,
85-
uuid,
84+
uuids.size(),
8685
originURL);
8786

8887
var extendedGraphURI = expandURIUseCase.expandUri(datasetName, graphURI);
88+
var graphIdentifier = new GraphIdentifier(datasetName, extendedGraphURI);
8989

90-
var resultObj =
91-
findDeleteDependenciesUseCase.getDeleteDependencies(
92-
new GraphIdentifier(datasetName, extendedGraphURI), UUID.fromString(uuid));
90+
var result = findDeleteDependenciesUseCase.getDeleteDependencies(graphIdentifier, uuids);
9391

9492
logger.info(
95-
"Sending response to GET request: \"/api/datasets/{{}}/graphs/{{}}/uuid/{{}/deletion-impact\" from \"{}\".",
93+
"Sending response to POST request: \"/api/datasets/{{}}/graphs/{{}}/deletion-impact\" from \"{}\".",
9694
datasetName,
9795
graphURI,
98-
uuid,
9996
originURL);
100-
return resultObj;
97+
return result;
10198
}
10299

103100
@Operation(

backend/src/main/java/org/rdfarchitect/api/controller/datasets/graphs/classes/copy/CopyClassRESTController.java renamed to backend/src/main/java/org/rdfarchitect/api/controller/datasets/graphs/classes/paste/PasteRESTController.java

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*
1616
*/
1717

18-
package org.rdfarchitect.api.controller.datasets.graphs.classes.copy;
18+
package org.rdfarchitect.api.controller.datasets.graphs.classes.paste;
1919

2020
import io.swagger.v3.oas.annotations.Operation;
2121
import io.swagger.v3.oas.annotations.Parameter;
2222

2323
import lombok.RequiredArgsConstructor;
2424

25-
import org.rdfarchitect.api.dto.CopyClassRequestDTO;
2625
import org.rdfarchitect.api.dto.CopyClassResponseDTO;
26+
import org.rdfarchitect.api.dto.PasteClassesRequestDTO;
2727
import org.rdfarchitect.database.GraphIdentifier;
2828
import org.rdfarchitect.services.ExpandURIUseCase;
2929
import org.rdfarchitect.services.update.classes.CopyClassUseCase;
@@ -37,76 +37,60 @@
3737
import org.springframework.web.bind.annotation.RequestMapping;
3838
import org.springframework.web.bind.annotation.RestController;
3939

40-
import java.util.UUID;
40+
import java.util.List;
4141

4242
@RestController
43-
@RequestMapping("api/datasets/{datasetName}/graphs/{graphURI}/classes/{classUUID}/copy")
43+
@RequestMapping("api/datasets/{targetDatasetName}/graphs/{targetGraphURI}/paste")
4444
@RequiredArgsConstructor
45-
public class CopyClassRESTController {
45+
public class PasteRESTController {
4646

47-
private static final Logger logger = LoggerFactory.getLogger(CopyClassRESTController.class);
47+
private static final Logger logger = LoggerFactory.getLogger(PasteRESTController.class);
4848

4949
private final ExpandURIUseCase expandURIUseCase;
5050
private final CopyClassUseCase copyClassUseCase;
5151

5252
@Operation(
53-
summary = "copy a class",
54-
description = "Create a copy of a class in the specified graph")
53+
summary = "paste classes",
54+
description =
55+
"Create copies of one or more previously copied classes in the target graph.")
5556
@PostMapping
56-
public CopyClassResponseDTO copyClass(
57+
public List<CopyClassResponseDTO> pasteClasses(
5758
@Parameter(description = "The name/url of the inquirer.")
5859
@RequestHeader(
5960
value = HttpHeaders.ORIGIN,
6061
required = false,
6162
defaultValue = "unknown")
6263
String originURL,
63-
@Parameter(description = "The literal name of the dataset.") @PathVariable
64-
String datasetName,
64+
@Parameter(description = "The literal name of the target dataset.") @PathVariable
65+
String targetDatasetName,
6566
@Parameter(
6667
description =
67-
"The url encoded uri of the graph, or \"default\" to access the default graph.")
68+
"The url encoded uri of the target graph, or \"default\" to access the default graph.")
6869
@PathVariable
69-
String graphURI,
70-
@Parameter(description = "The uuid of the class.") @PathVariable String classUUID,
70+
String targetGraphURI,
7171
@io.swagger.v3.oas.annotations.parameters.RequestBody(
7272
required = true,
7373
description =
74-
"Contains the information of the target where the class should be copied to. Also includes if the class should be copied only abstract or "
75-
+ "fully.")
74+
"The target package, copy options and the list of source classes to paste.")
7675
@RequestBody
77-
CopyClassRequestDTO copyClassRequest) {
76+
PasteClassesRequestDTO pasteRequest) {
7877
logger.info(
79-
"Received POST request: \"/api/datasets/{{}}/graphs/{{}}/classes/{{}}/copy\" from \"{}\".",
80-
datasetName,
81-
graphURI,
82-
classUUID,
78+
"Received POST request: \"/api/datasets/{{}}/graphs/{{}}/paste\" for {} class(es) from \"{}\".",
79+
targetDatasetName,
80+
targetGraphURI,
81+
pasteRequest.getSources() == null ? 0 : pasteRequest.getSources().size(),
8382
originURL);
8483

85-
var extendedGraphURI = expandURIUseCase.expandUri(datasetName, graphURI);
86-
var graphIdentifier = new GraphIdentifier(datasetName, extendedGraphURI);
84+
var targetExtendedGraphURI = expandURIUseCase.expandUri(targetDatasetName, targetGraphURI);
85+
var targetGraphIdentifier = new GraphIdentifier(targetDatasetName, targetExtendedGraphURI);
8786

88-
var targetExtendedGraphURI =
89-
expandURIUseCase.expandUri(
90-
copyClassRequest.getTargetDatasetName(),
91-
copyClassRequest.getTargetGraphURI());
92-
var targetGraphIdentifier =
93-
new GraphIdentifier(
94-
copyClassRequest.getTargetDatasetName(), targetExtendedGraphURI);
95-
96-
var response =
97-
copyClassUseCase.copyClass(
98-
graphIdentifier,
99-
UUID.fromString(classUUID),
100-
targetGraphIdentifier,
101-
copyClassRequest);
87+
var responses = copyClassUseCase.copyClasses(pasteRequest, targetGraphIdentifier);
10288

10389
logger.info(
104-
"Sending response to POST request: \"/api/datasets/{{}}/graphs/{{}}/classes/{{}}/copy\" to \"{}\".",
105-
datasetName,
106-
graphURI,
107-
classUUID,
90+
"Sending response to POST request: \"/api/datasets/{{}}/graphs/{{}}/paste\" to \"{}\".",
91+
targetDatasetName,
92+
targetGraphURI,
10893
originURL);
109-
110-
return response;
94+
return responses;
11195
}
11296
}

0 commit comments

Comments
 (0)