Skip to content
Open
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
14 changes: 14 additions & 0 deletions src/main/java/org/gridsuite/network/map/NetworkMapController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
*/
package org.gridsuite.network.map;

import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.gridsuite.network.map.dto.ElementInfos;
import org.gridsuite.network.map.dto.View;
import org.gridsuite.network.map.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
Expand Down Expand Up @@ -128,6 +130,18 @@ public class NetworkMapController {
return networkMapService.getLccConverterStations(networkUuid, variantId, substationsIds);
}

@GetMapping(value = "/networks/{networkUuid}/elements/list_view", produces = APPLICATION_JSON_VALUE)
@Operation(summary = "Get network elements")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Elements description")})
@JsonView(View.ListView.class)
public @ResponseBody List<ElementInfos> getListViewElementsInfos(@Parameter(description = "Network UUID") @PathVariable("networkUuid") UUID networkUuid,
@Parameter(description = "Variant Id") @RequestParam(name = "variantId", required = false) String variantId,
@Parameter(description = "Substations id") @RequestParam(name = "substationsIds", required = false) List<String> substationsIds,
@Parameter(description = "Element type") @RequestParam(name = "elementType") ElementType elementType,
@Parameter(description = "Info type") @RequestParam(name = "infoType") ElementInfos.InfoType infoType) {
return networkMapService.getElementsInfos(networkUuid, variantId, substationsIds, elementType, infoType);
}

@GetMapping(value = "/networks/{networkUuid}/elements", produces = APPLICATION_JSON_VALUE)
@Operation(summary = "Get network elements")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Elements description")})
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/gridsuite/network/map/dto/ElementInfos.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.gridsuite.network.map.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonView;
import com.powsybl.iidm.network.*;
import lombok.Getter;
import lombok.experimental.SuperBuilder;
Expand All @@ -32,9 +33,11 @@ public enum InfoType { //LevelOfDetail
TAB
}

@JsonView({View.ListView.class})
private String id;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonView({View.ListView.class})
private String name;

public static ElementInfos toData(Identifiable<?> identifiable) {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/gridsuite/network/map/dto/View.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2023, 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.network.map.dto;

/**
* @author Slimane Amar <slimane.amar at rte-france.com>
*/
public class View {
public static interface ListView {
}

public static interface MapView {
}

public static interface TabView {
}

public static interface FormView {
}
}