-
Notifications
You must be signed in to change notification settings - Fork 1
add max allowed computations #102
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,89 @@ | ||
| /* | ||
| /** | ||
| * 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.useradmin.server.dto; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.UUID; | ||
|
|
||
| public record UserProfile( | ||
| UUID id, | ||
| String name, | ||
| UUID loadFlowParameterId, | ||
| UUID securityAnalysisParameterId, | ||
| UUID sensitivityAnalysisParameterId, | ||
| UUID shortcircuitParameterId, | ||
| UUID pccMinParameterId, | ||
| UUID voltageInitParameterId, | ||
| Boolean allLinksValid, | ||
| Integer maxAllowedCases, | ||
| Integer maxAllowedBuilds, | ||
| UUID spreadsheetConfigCollectionId, | ||
| UUID networkVisualizationParameterId, | ||
| UUID workspaceId | ||
| ) { | ||
| /** | ||
| * @author Etienne Lesot <etienne.lesot at rte-france.com> | ||
| */ | ||
| @Getter | ||
| @Builder | ||
| public final class UserProfile { | ||
| public static final String DEFAULT_PROFILE_NAME = "default profile"; | ||
| public static final String MAX_ALLOWED_CASES = "maxAllowedCases"; | ||
| public static final String MAX_ALLOWED_BUILD = "maxAllowedBuilds"; | ||
| public static final String MAX_ALLOWED_LOADFLOW = "maxAllowedLoadflow"; | ||
| public static final String MAX_ALLOWED_SECURITY = "maxAllowedSecurity"; | ||
| public static final String MAX_ALLOWED_SENSITIVITY = "maxAllowedSensitivity"; | ||
| public static final String MAX_ALLOWED_SHORT_CIRCUIT = "maxAllowedShortCircuit"; | ||
| public static final String MAX_ALLOWED_VOLTAGE_INIT = "maxAllowedVoltageInit"; | ||
| public static final String MAX_ALLOWED_PCC_MIN = "maxAllowedPccMin"; | ||
| public static final String MAX_ALLOWED_STATE_ESTIMATION = "maxAllowedStateEstimation"; | ||
| public static final String MAX_ALLOWED_BALANCE_ADJUSTEMENT = "maxAllowedBalanceAdjustement"; | ||
| public static final String MAX_ALLOWED_DYNAMIC_SIMULATION = "maxAllowedDynamicSimulation"; | ||
| public static final String MAX_ALLOWED_DYNAMIC_SECURITY = "maxAllowedDynamicSecurity"; | ||
| public static final String MAX_ALLOWED_DYNAMIC_MARGIN = "maxAllowedDynamicMargin"; | ||
| private final UUID id; | ||
| private final String name; | ||
| private final UUID loadFlowParameterId; | ||
| private final UUID securityAnalysisParameterId; | ||
| private final UUID sensitivityAnalysisParameterId; | ||
| private final UUID shortcircuitParameterId; | ||
| private final UUID pccMinParameterId; | ||
| private final UUID voltageInitParameterId; | ||
| private final Boolean allLinksValid; | ||
| private final Map<String, Integer> maxAllowValuesMap; | ||
| private final UUID spreadsheetConfigCollectionId; | ||
| private final UUID networkVisualizationParameterId; | ||
| private final UUID workspaceId; | ||
|
|
||
| public UserProfile( | ||
|
Check warning on line 51 in src/main/java/org/gridsuite/useradmin/server/dto/UserProfile.java
|
||
| UUID id, | ||
| String name, | ||
| UUID loadFlowParameterId, | ||
| UUID securityAnalysisParameterId, | ||
| UUID sensitivityAnalysisParameterId, | ||
| UUID shortcircuitParameterId, | ||
| UUID pccMinParameterId, | ||
| UUID voltageInitParameterId, | ||
| Boolean allLinksValid, | ||
| Map<String, Integer> maxAllowValuesMap, | ||
| UUID spreadsheetConfigCollectionId, | ||
| UUID networkVisualizationParameterId, | ||
| UUID workspaceId | ||
| ) { | ||
| this.id = id; | ||
| this.name = name; | ||
| this.loadFlowParameterId = loadFlowParameterId; | ||
| this.securityAnalysisParameterId = securityAnalysisParameterId; | ||
| this.sensitivityAnalysisParameterId = sensitivityAnalysisParameterId; | ||
| this.shortcircuitParameterId = shortcircuitParameterId; | ||
| this.pccMinParameterId = pccMinParameterId; | ||
| this.voltageInitParameterId = voltageInitParameterId; | ||
| this.allLinksValid = allLinksValid; | ||
| this.maxAllowValuesMap = maxAllowValuesMap == null ? new HashMap<>() : new HashMap<>(maxAllowValuesMap); | ||
| this.spreadsheetConfigCollectionId = spreadsheetConfigCollectionId; | ||
| this.networkVisualizationParameterId = networkVisualizationParameterId; | ||
| this.workspaceId = workspaceId; | ||
|
|
||
| } | ||
|
|
||
| public Map<String, Integer> getMaxAllowValuesMap() { | ||
| return Collections.unmodifiableMap(maxAllowValuesMap); | ||
| } | ||
|
|
||
| public static UserProfile createDefaultProfile(Integer maxAllowedCases, Integer maxAllowedBuilds) { | ||
| return new UserProfile( | ||
| null, | ||
| DEFAULT_PROFILE_NAME, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| null, | ||
| maxAllowedCases, | ||
| maxAllowedBuilds, | ||
| null, | ||
| null, | ||
| null | ||
| ); | ||
| public static UserProfile createDefaultProfile(Map<String, Integer> maxAllowValues) { | ||
| return UserProfile.builder().name(DEFAULT_PROFILE_NAME).maxAllowValuesMap(maxAllowValues).build(); | ||
|
Comment on lines
+20
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift This breaks the existing The DTO no longer exposes top-level 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
404 response is documented but unreachable on the new quota endpoints.
At Lines 151-237, each handler always returns
ResponseEntity.ok(...), and the delegated service path falls back to defaults instead of signaling not found. The@ApiResponse(responseCode = "404")on these endpoints is therefore inconsistent with actual behavior. Align the contract by either removing 404 from docs or explicitly returning 404 for unknown users/profiles.🤖 Prompt for AI Agents