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

Make case name independent of file name #17

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

celmhari
Copy link
Contributor

Currently, the case import server uses the filename as the case name. This leads to extensions in case names.
For example: import caseFile.xml.gz will lead to case name caseFile.xml.gz.
The goal is to allow the client to choose a case name different that the file name.

Signed-off-by: EL-MHARI Charaf <charaf.elmhari@rte-france.com>
When not given or empty, use filename as case name

Signed-off-by: EL-MHARI Charaf <charaf.elmhari@rte-france.com>
Signed-off-by: EL-MHARI Charaf <charaf.elmhari@rte-france.com>
String targetDirectory = getTargetDirectory(caseOrigin);
UUID caseUuid = caseService.importCase(caseFile);
var caseElementAttributes = new ElementAttributes(caseUuid, caseFile.getOriginalFilename(), CASE, new AccessRightsAttributes(false), userId, 0L, null);
String caseName = caseNameParam == null || caseNameParam.trim().isEmpty() ? caseFile.getOriginalFilename() : caseNameParam;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String caseName = caseNameParam == null || caseNameParam.trim().isEmpty() ? caseFile.getOriginalFilename() : caseNameParam;
String caseName = caseNameParam == null || caseNameParam.trim().isEmpty() ? DataSourceUtil.getBaseName(Paths.get(caseFile.getOriginalFilename())) : caseNameParam;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would avoid to have this extensions in the name in gridexplore for example. But maybe it rather should be done in case-server

Signed-off-by: EL-MHARI Charaf <charaf.elmhari@rte-france.com>
Copy link

@celmhari celmhari merged commit 1fd0f36 into main Sep 23, 2024
3 checks passed
@celmhari celmhari deleted the feature/case_name_different_from_filename branch September 23, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants