-
Notifications
You must be signed in to change notification settings - Fork 544
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
Add method to delete all the resources belongs to a given resource type in a tenant. #5030
Add method to delete all the resources belongs to a given resource type in a tenant. #5030
Conversation
if (log.isDebugEnabled()) { | ||
log.debug("No resource found for the resourceTypeId: " + resourceTypeId); | ||
} | ||
throw handleClientException(ConfigurationConstants.ErrorMessages.ERROR_CODE_RESOURCES_DOES_NOT_EXISTS, null); |
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.
Why are we passing a null value here. If the value is not needed, let's create an overloaded method instead of passing a null
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.
Addressed with 89229d9
@@ -451,6 +451,16 @@ private void validateSearchRequest(Condition condition) throws ConfigurationMana | |||
} | |||
} | |||
|
|||
@Override | |||
public void deleteResourcesByType (String resourceTypeName) throws ConfigurationManagementException { |
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.
Formatting error
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.
Addressed with 89229d9
List<Resource> resourceList = configurationDAO.getResourcesByType(tenantId, resourceTypeId); | ||
if (resourceList.isEmpty()) { | ||
if (log.isDebugEnabled()) { | ||
log.debug("No resource found for the resourceTypeId: " + resourceTypeId); |
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.
Add more content for this log. The tenant may be?
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.
Addressed with 89229d9
if (log.isDebugEnabled()) { | ||
log.debug("No resource found for the resourceTypeId: " + resourceTypeId); | ||
} |
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.
Not a good practice to have a if block just for a log
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.
Can't we return the method?
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.
Addressed with 89229d9
*/ | ||
default void deleteResourcesByType(int tenantId, String resourceTypeId) throws ConfigurationManagementException { | ||
|
||
throw new ConfigurationManagementException("This method is not implemented", null); |
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.
Why are we passing null here? IMO this is not a good practice
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.
Don't we need to throw a NotImplementedException here?
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.
Addressed with 89229d9
PR builder started |
PR builder completed |
PR builder started |
PR builder completed |
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.
Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/6625833876
Proposed changes in this pull request
ConfigurationManager
component for delete all the resources belongs to a given resource type in a tenant.When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation