Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add element description edition #69

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ public ResponseEntity<List<ElementAttributes>> getElementsMetadata(@RequestParam
@PutMapping(value = "/explore/filters/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Modify a filter")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The filter has been successfully modified")})
public ResponseEntity<Void> changeFilter(@PathVariable UUID id, @RequestBody String filter, @RequestHeader("userId") String userId, @RequestParam("name") String name) {
exploreService.updateFilter(id, filter, userId, name);
public ResponseEntity<Void> changeFilter(@PathVariable UUID id, @RequestBody ElementInfos filter, @RequestHeader("userId") String userId) {
exploreService.updateFilter(id, filter, userId);
return ResponseEntity.ok().build();
}

Expand All @@ -262,12 +262,11 @@ public ResponseEntity<Void> changeFilter(@PathVariable UUID id, @RequestBody Str
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The contingency list have been modified successfully")})
public ResponseEntity<Void> updateContingencyList(
@PathVariable UUID id,
@RequestParam(name = "name") String name,
@RequestParam(name = "contingencyListType") ContingencyListType contingencyListType,
@RequestBody String content,
@RequestBody ElementInfos contingencyList,
@RequestHeader("userId") String userId) {

exploreService.updateContingencyList(id, content, userId, name, contingencyListType);
exploreService.updateContingencyList(id, contingencyList, userId, contingencyListType);
return ResponseEntity.ok().build();
}

Expand Down
27 changes: 27 additions & 0 deletions src/main/java/org/gridsuite/explore/server/dto/ElementInfos.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.explore.server.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* @author Seddik Yengui <seddik.yengui at rte-france.com>
*/

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor

public class ElementInfos {
private ElementAttributes elementAttributes;
private String elementContent;
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ public void deleteElement(UUID id, String userId) {
}
}

public void updateFilter(UUID id, String filter, String userId, String name) {
filterService.updateFilter(id, filter, userId);
updateElementName(id, name, userId);
public void updateFilter(UUID id, ElementInfos filter, String userId) {
filterService.updateFilter(id, filter.getElementContent(), userId);
directoryService.updateElement(id, filter.getElementAttributes(), userId);
}

public void updateContingencyList(UUID id, String content, String userId, String name, ContingencyListType contingencyListType) {
contingencyListService.updateContingencyList(id, content, userId, getProperPath(contingencyListType));
updateElementName(id, name, userId);
public void updateContingencyList(UUID id, ElementInfos contingencyList, String userId, ContingencyListType contingencyListType) {
contingencyListService.updateContingencyList(id, contingencyList.getElementContent(), userId, getProperPath(contingencyListType));
directoryService.updateElement(id, contingencyList.getElementAttributes(), userId);
}

private void updateElementName(UUID id, String name, String userId) {
Expand Down
Loading