Skip to content

Commit

Permalink
enabled delete siarddk entry without deleting the siard file
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 committed Nov 27, 2024
1 parent 3417af8 commit abb1ce4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ private void populateNavigationPanels() {
if (ApplicationType.getType().equals(ViewerConstants.APPLICATION_ENV_SERVER)) {
DatabaseService.Util.call((Set<String> databasePermissions) -> {
ContextService.Util.call((Set<AuthorizationGroup> authorizationGroups) -> {
permissionsNavigationPanel = PermissionsNavigationPanel.getInstance(database, databasePermissions, authorizationGroups);
permissionsNavigationPanel = PermissionsNavigationPanel.getInstance(database, databasePermissions,
authorizationGroups);
if (permissionsNavigationPanel.hasPermissionsOrGroups()) {
navigationPanels.add(permissionsNavigationPanel.build());
}
Expand Down Expand Up @@ -207,21 +208,16 @@ private void setupFooterButtons() {
if (ApplicationType.getType().equals(ViewerConstants.APPLICATION_ENV_DESKTOP)) {
message = messages.SIARDHomePageTextForDeleteAllFromDesktop();
}
if (database.getVersion().equals(ViewerConstants.SIARD_DK_1007) || database.getVersion().equals(ViewerConstants.SIARD_DK_128)) {
Dialogs.showInformationDialog(messages.SIARDHomePageDialogTitleForDelete(),
"SIARD deletion only supports SIARD version 2.1.", messages.basicActionUnderstood(), "btn btn-link");
} else {
CommonDialogs.showConfirmDialog(messages.SIARDHomePageDialogTitleForDelete(), message,
messages.basicActionCancel(), messages.basicActionConfirm(), CommonDialogs.Level.DANGER, "500px",
new DefaultAsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (result) {
deleteAll();
}
CommonDialogs.showConfirmDialog(messages.SIARDHomePageDialogTitleForDelete(), message,
messages.basicActionCancel(), messages.basicActionConfirm(), CommonDialogs.Level.DANGER, "500px",
new DefaultAsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
if (result) {
deleteAll();
}
});
}
}
});
} else if (ViewerDatabaseStatus.INGESTING.equals(database.getStatus())) {
Dialogs.showInformationDialog(messages.SIARDManagerPageInformationDialogTitle(),
messages.SIARDManagerPageTextForWaitForFinishing(), messages.basicActionClose(), "btn btn-link");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,17 +886,20 @@ public static boolean deleteAll(String databaseUUID)

ViewerDatabase database = solrManager.retrieve(ViewerDatabase.class, databaseUUID);

if (ViewerFactory.getViewerConfiguration().getApplicationEnvironment()
.equals(ViewerConstants.APPLICATION_ENV_SERVER)) {
String siardPath = database.getPath();
final boolean deleteSiard = !ViewerConfiguration.getInstance().getViewerConfigurationAsBoolean(false,
ViewerConfiguration.PROPERTY_DISABLE_SIARD_DELETION);
if (StringUtils.isNotBlank(siardPath) && Paths.get(siardPath).toFile().exists() && deleteSiard) {
deleteSIARDFileFromPath(siardPath, databaseUUID);
if (!database.getVersion().equals(ViewerConstants.SIARD_DK_1007)
&& !database.getVersion().equals(ViewerConstants.SIARD_DK_128)) {
if (ViewerFactory.getViewerConfiguration().getApplicationEnvironment()
.equals(ViewerConstants.APPLICATION_ENV_SERVER)) {
String siardPath = database.getPath();
final boolean deleteSiard = !ViewerConfiguration.getInstance().getViewerConfigurationAsBoolean(false,
ViewerConfiguration.PROPERTY_DISABLE_SIARD_DELETION);
if (StringUtils.isNotBlank(siardPath) && Paths.get(siardPath).toFile().exists() && deleteSiard) {
deleteSIARDFileFromPath(siardPath, databaseUUID);
}
}
}

ViewerFactory.getConfigurationManager().deleteDatabaseFolder(databaseUUID);
ViewerFactory.getConfigurationManager().deleteDatabaseFolder(databaseUUID);
}

String reportPath = database.getValidatorReportPath();
if (StringUtils.isNotBlank(reportPath) && Paths.get(reportPath).toFile().exists()) {
Expand Down

0 comments on commit abb1ce4

Please sign in to comment.