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

Pagination / filter / ordering #86

Merged
merged 108 commits into from
Nov 9, 2023
Merged

Conversation

klesaulnier
Copy link
Contributor

No description provided.

LE SAULNIER Kevin added 30 commits October 4, 2023 09:54
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
LE SAULNIER Kevin added 16 commits November 6, 2023 10:09
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Copy link
Contributor

@Tristan-WorkGH Tristan-WorkGH left a comment

Choose a reason for hiding this comment

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

just some (optional) updates on javadoc, still good for me

@@ -7,12 +13,15 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

public interface CommonLimitViolationRepository<T> {
/**
* Returns specification depending on {filters}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Returns specification depending on {filters}
* Returns specification depending on {@code filters}<br/>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Comment on lines 23 to 24
* This interface is common for both SubjectLimitViolationRepository and ContingencyRepository
* except for <i>addPredicate</i> which need to be implemented
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* This interface is common for both SubjectLimitViolationRepository and ContingencyRepository
* except for <i>addPredicate</i> which need to be implemented
* This interface is common for both {@link SubjectLimitViolationRepository} and {@link ContingencyRepository}
* except for {@link #addPredicate(CriteriaBuilder, Root, List, ResourceFilterDTO) addPredicate}
* which need to be implemented

Comment on lines 12 to 22
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

/**
* An object that can be used to filter data with the JPA Criteria API (via Spring Specification)
* @param dataType the type of data we want to filter (text, number)
* @param type the type of filter (contains, startsWith...)
* @param value the value of the filter
* @param column the column / field on which the filter will be applied
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Dangling Javadoc comment

You can't have 2 javadoc blocks on same element

Suggested change
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/
/**
* An object that can be used to filter data with the JPA Criteria API (via Spring Specification)
* @param dataType the type of data we want to filter (text, number)
* @param type the type of filter (contains, startsWith...)
* @param value the value of the filter
* @param column the column / field on which the filter will be applied
*/
/**
* An object that can be used to filter data with the JPA Criteria API (via Spring Specification)
* @param dataType the type of data we want to filter (text, number)
* @param type the type of filter (contains, startsWith...)
* @param value the value of the filter
* @param column the column / field on which the filter will be applied
*
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +16 to +19
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/
/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

import java.util.List;
import java.util.UUID;
import java.util.*;

/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

}

/**
* returns atomic predicate depending on filter.dataType() and filter.type()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* returns atomic predicate depending on filter.dataType() and filter.type()
* Returns atomic {@link Predicate} depending on {@code filter.dataType()} and {@code filter.type()}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +64 to +65
*/
private static Predicate filterToAtomicPredicate(CriteriaBuilder criteriaBuilder, Expression<?> expression, ResourceFilterDTO filter, Object value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
*/
private static Predicate filterToAtomicPredicate(CriteriaBuilder criteriaBuilder, Expression<?> expression, ResourceFilterDTO filter, Object value) {
* @throws UnsupportedOperationException if {@link ResourceFilterDTO.DataType filter.type} not supported or {@code filter.value} is {@code null}
*/
private static Predicate filterToAtomicPredicate(CriteriaBuilder criteriaBuilder, Expression<?> expression, ResourceFilterDTO filter, Object value) throws UnsupportedOperationException {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

case EQUALS -> criteriaBuilder.equal(criteriaBuilder.upper(stringExpression), stringValue.toUpperCase());
};
} else {
throw new UnsupportedOperationException("Not implemented");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new UnsupportedOperationException("Not implemented");
throw new UnsupportedOperationException("Not supported type " + filter.dataType());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


import java.util.List;
import java.util.UUID;

/**
* @author Kevin Le Saulnier <kevin.lesaulnier at rte-france.com>
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

import static com.vladmihalcea.sql.SQLStatementCountValidator.reset;
import static org.assertj.core.api.Assertions.assertThat;
import static org.gridsuite.securityanalysis.server.SecurityAnalysisProviderMock.*;
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
/**

Copy link
Contributor

@achour94 achour94 left a comment

Choose a reason for hiding this comment

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

test OK

Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

86.8% 86.8% Coverage
0.0% 0.0% Duplication

@klesaulnier klesaulnier merged commit c6fcec8 into main Nov 9, 2023
4 checks passed
@klesaulnier klesaulnier deleted the pagination_filter_ordering branch November 9, 2023 13:42
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.

5 participants