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

Add rule management component. #6204

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

malithie
Copy link
Member

Proposed changes in this pull request

Resolves wso2/product-is#22026

This PR adds the rule management service component.

@malithie
Copy link
Member Author

Quality Gate Passed Quality Gate passed

Issues 7 New issues 0 Accepted issues

Measures 0 Security Hotspots 0.0% Coverage on New Code 0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Applicable suggestions are addressed

Copy link

sonarcloud bot commented Dec 12, 2024

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 85.41667% with 56 lines in your changes missing coverage. Please review.

Project coverage is 41.20%. Comparing base (00e6969) to head (6f0c7a3).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
...ement/internal/RuleManagementServiceComponent.java 0.00% 25 Missing ⚠️
...ule/management/dao/impl/RuleManagementDAOImpl.java 86.20% 16 Missing ⚠️
...identity/rule/management/cache/RuleCacheEntry.java 66.66% 2 Missing ⚠️
...n/identity/rule/management/cache/RuleCacheKey.java 75.00% 1 Missing and 1 partial ⚠️
...agement/dao/impl/CacheBackedRuleManagementDAO.java 93.75% 0 Missing and 2 partials ⚠️
...ement/exception/RuleManagementClientException.java 50.00% 2 Missing ⚠️
...ement/exception/RuleManagementServerException.java 50.00% 2 Missing ⚠️
...ule/management/model/internal/ANDCombinedRule.java 89.47% 1 Missing and 1 partial ⚠️
...rule/management/model/internal/ORCombinedRule.java 93.10% 1 Missing and 1 partial ⚠️
...gement/service/impl/RuleManagementServiceImpl.java 95.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6204      +/-   ##
============================================
- Coverage     45.40%   41.20%   -4.20%     
- Complexity    13941    15555    +1614     
============================================
  Files          1620     1816     +196     
  Lines        100555   123703   +23148     
  Branches      16846    21751    +4905     
============================================
+ Hits          45658    50978    +5320     
- Misses        48146    65207   +17061     
- Partials       6751     7518     +767     
Flag Coverage Δ
unit 28.02% <85.41%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

template.executeInsert(RuleSQLConstants.Query.ADD_RULE,
statement -> {
statement.setString(RuleSQLConstants.Column.UUID, rule.getId());
statement.setBlob(RuleSQLConstants.Column.RULE_INDEX, ruleJson);
Copy link
Contributor

Choose a reason for hiding this comment

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


/**
* Add a new Rule.
* @param rule Rule object
Copy link
Contributor

Choose a reason for hiding this comment

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

Check formatting.
Add a new line between the description and params.

Check other places as well

*
* @param ruleId Rule ID
* @param tenantId Tenant ID
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing @throws line.
Check other places

public void addRule(Rule rule, int tenantId) throws RuleManagementException {

try {
addRuleToDB(rule, tenantId);
Copy link
Contributor

@ashanthamara ashanthamara Dec 13, 2024

Choose a reason for hiding this comment

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

If we want to do following tasks in one transaction, then we need to initiate the jdbcTemplate.withTransaction() from this level

public void updateRule(Rule rule, int tenantId) throws RuleManagementException {

try {
updateRuleInDB(rule, tenantId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above comment

);

CREATE TABLE IF NOT EXISTS IDN_RULE_REFERENCES (
ID INTEGER NOT NULL AUTO_INCREMENT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix formatting

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.

Implement rule management service
3 participants