Skip to content
Merged
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 @@ -21,7 +21,7 @@ public record UserProfile(
Integer maxAllowedBuilds,
UUID spreadsheetConfigCollectionId,
UUID networkVisualizationParameterId,
UUID diagramConfigId
UUID workspaceId
) {
public static final String DEFAULT_PROFILE_NAME = "default profile";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class UserProfileEntity {
@Column(name = "networkVisualizationParameterId")
private UUID networkVisualizationParameterId;

@Column(name = "diagramConfigId")
private UUID diagramConfigId;
@Column(name = "workspaceId")
private UUID workspaceId;
}

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public List<UserProfile> getProfiles(String userId, boolean checkLinksValidity)
e.getVoltageInitParameterId(),
e.getSpreadsheetConfigCollectionId(),
e.getNetworkVisualizationParameterId(),
e.getDiagramConfigId()))
e.getWorkspaceId()))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Set<UUID> existingUuids = directoryService.getExistingElements(allUuidsInAllProfiles, userId);
Expand Down Expand Up @@ -97,8 +97,8 @@ public List<UserProfile> getProfiles(String userId, boolean checkLinksValidity)
if (BooleanUtils.toBooleanDefaultIfNull(allLinksValid, true) && p.getNetworkVisualizationParameterId() != null) {
allLinksValid = !missingUuids.contains(p.getNetworkVisualizationParameterId());
}
if (BooleanUtils.toBooleanDefaultIfNull(allLinksValid, true) && p.getDiagramConfigId() != null) {
allLinksValid = !missingUuids.contains(p.getDiagramConfigId());
if (BooleanUtils.toBooleanDefaultIfNull(allLinksValid, true) && p.getWorkspaceId() != null) {
allLinksValid = !missingUuids.contains(p.getWorkspaceId());
}
return toDto(p, allLinksValid);
})
Expand Down Expand Up @@ -126,7 +126,7 @@ public void updateProfile(UUID profileUuid, UserProfile userProfile) {
profile.setMaxAllowedBuilds(userProfile.maxAllowedBuilds());
profile.setSpreadsheetConfigCollectionId(userProfile.spreadsheetConfigCollectionId());
profile.setNetworkVisualizationParameterId(userProfile.networkVisualizationParameterId());
profile.setDiagramConfigId(userProfile.diagramConfigId());
profile.setWorkspaceId(userProfile.workspaceId());
}

@Transactional
Expand Down Expand Up @@ -161,7 +161,7 @@ private UserProfile toDto(final UserProfileEntity entity, Boolean allLinksValid)
entity.getSecurityAnalysisParameterId(), entity.getSensitivityAnalysisParameterId(),
entity.getShortcircuitParameterId(), entity.getVoltageInitParameterId(),
allLinksValid, entity.getMaxAllowedCases(), entity.getMaxAllowedBuilds(), entity.getSpreadsheetConfigCollectionId(),
entity.getNetworkVisualizationParameterId(), entity.getDiagramConfigId());
entity.getNetworkVisualizationParameterId(), entity.getWorkspaceId());
}

private UserProfileEntity toEntity(final UserProfile userProfile) {
Expand All @@ -178,7 +178,7 @@ private UserProfileEntity toEntity(final UserProfile userProfile) {
Optional.ofNullable(userProfile.maxAllowedBuilds()).orElse(applicationProps.getDefaultMaxAllowedBuilds()),
userProfile.spreadsheetConfigCollectionId(),
userProfile.networkVisualizationParameterId(),
userProfile.diagramConfigId()
userProfile.workspaceId()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="labidiayo (generated)" id="1769097683810-1">
<addColumn tableName="user_profile">
<column name="workspace_id" type="uuid"/>
</addColumn>
</changeSet>
<changeSet author="labidiayo (generated)" id="1769097683810-2">
<dropColumn columnName="diagram_config_id" tableName="user_profile"/>
</changeSet>
</databaseChangeLog>
3 changes: 3 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ databaseChangeLog:
- include:
file: changesets/changelog_20251031T110224Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20260122T160112Z.xml
relativeToChangelogFile: true
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ private void createProfile(String profileName, Integer maxAllowedCases, Integer
assertEquals(maxAllowedBuilds, createdProfile.get().getMaxAllowedBuilds());
assertNull(createdProfile.get().getSpreadsheetConfigCollectionId());
assertNull(createdProfile.get().getNetworkVisualizationParameterId());
assertNull(createdProfile.get().getDiagramConfigId());
}

private void createUser(String userSub) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ void testGetUserProfileNotFound() throws Exception {
assertNull(profile.allLinksValid());
assertNull(profile.spreadsheetConfigCollectionId());
assertNull(profile.networkVisualizationParameterId());
assertNull(profile.diagramConfigId());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ void testCreateProfile() throws Exception {
assertEquals(15, userProfiles.get(0).maxAllowedBuilds());
assertNull(userProfiles.get(0).spreadsheetConfigCollectionId());
assertNull(userProfiles.get(0).networkVisualizationParameterId());
assertNull(userProfiles.get(0).diagramConfigId());

createProfile(PROFILE_2, ADMIN_USER, USER_ADMIN_ROLE, null, null, HttpStatus.CREATED);
createProfile(PROFILE_1, ADMIN_USER, USER_ADMIN_ROLE, null, null, HttpStatus.BAD_REQUEST); // profile already exists
Expand Down Expand Up @@ -291,7 +290,6 @@ private void updateProfile(boolean validParameters) throws Exception {
assertEquals(11, userProfiles.get(0).maxAllowedBuilds());
assertEquals(spreadsheetConfigCollectionUuid, userProfiles.get(0).spreadsheetConfigCollectionId());
assertEquals(networkVisualizationParametersUuid, userProfiles.get(0).networkVisualizationParameterId());
assertEquals(diagramConfigUuid, userProfiles.get(0).diagramConfigId());

// profiles list (without validity flag)
userProfiles = getProfileList(false);
Expand Down Expand Up @@ -332,7 +330,6 @@ private UUID createProfile(String profileName, String userName, String userRole,
assertNull(profile1.get().getVoltageInitParameterId()); // no voltage init params by dft
assertNull(profile1.get().getSpreadsheetConfigCollectionId()); // no spreadsheet config collection by dft
assertNull(profile1.get().getNetworkVisualizationParameterId()); // no network visualization params by dft
assertNull(profile1.get().getDiagramConfigId()); // no diagram config by dft
return profile1.get().getId();
}
return null;
Expand Down Expand Up @@ -389,7 +386,6 @@ private void updateProfile(UserProfile newData, String userName, String userRole
assertNull(updatedProfile.allLinksValid()); // validity not set in this case
assertEquals(newData.spreadsheetConfigCollectionId(), updatedProfile.spreadsheetConfigCollectionId());
assertEquals(newData.networkVisualizationParameterId(), updatedProfile.networkVisualizationParameterId());
assertEquals(newData.diagramConfigId(), updatedProfile.diagramConfigId());
}
}
}