Skip to content

Commit

Permalink
dbeaver/pro#2651 Add all resource properties updating (#2747)
Browse files Browse the repository at this point in the history
* dbeaver/pro#2651 Add all resource properties updating

* dbeaver/pro#2651 Fix code style

---------

Co-authored-by: kseniaguzeeva <[email protected]>
  • Loading branch information
E1izabeth and kseniaguzeeva authored Jul 2, 2024
1 parent 8f740b7 commit 6efbd69
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,27 @@ public String setResourceProperty(
}
}

@NotNull
@Override
public String setResourceProperties(
@NotNull String projectId,
@NotNull String resourcePath,
@NotNull Map<String, Object> properties
) throws DBException {
try (var projectLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) {
validateResourcePath(resourcePath);
BaseWebProjectImpl webProject = getWebProject(projectId, false);
doFileWriteOperation(projectId, webProject.getMetadataFilePath(),
() -> {
log.debug("Updating resource '" + resourcePath + "' properties in project '" + projectId + "'");
webProject.setResourceProperties(resourcePath, properties);
return null;
}
);
return DEFAULT_CHANGE_ID;
}
}

private void validateResourcePath(String resourcePath) throws DBException {
var fullPath = Paths.get(resourcePath);
for (Path path : fullPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public RMResource[] listResources(@NotNull WebSession webSession,
* @param resourcePath the resource path
* @param propertyName the property name
* @param propertyValue the property value
* @return the resource property
* @return true on success
* @throws DBException the db exception
*/
@NotNull
Expand Down

0 comments on commit 6efbd69

Please sign in to comment.