Repository navigation
Releases
6.3.0
What's Changed
- Version 6.3.0 - Removal of the % from the beginning of queries by @rogerio-costa-monkey in #26
Removal of the %
-
The % at the beginning of the filter for queries using LIKE has been removed.
-
Removal of operators: CONTAINS, ENDS_WITH, DOES_NOT_CONTAIN, DOES_NOT_END_WITH.
Maven
<dependency>
<groupId>br.com.monkey.sdk</groupId>
<artifactId>monkey-specification-search</artifactId>
<version>6.3.0</version>
</dependency>Full Changelog: 6.2.0...6.3.0
6.2.0
What's Changed
- Version 6.2.0 - Add required keys to SearchParameter by @FelipeAdorno in #25
Required keys
@SearchParameter agora aceita required, que obriga a busca a filtrar pelas chaves informadas (com qualquer operador). Se faltar alguma chave, ou se o parâmetro search estiver ausente, a requisição retorna BadRequestException (Search parameter must filter by: <keys>).
@SearchParameter(required = InvoiceEntries_.EXTERNAL_ID) Specification<InvoiceEntries> searchMaven
<dependency>
<groupId>br.com.monkey.sdk</groupId>
<artifactId>monkey-specification-search</artifactId>
<version>6.2.0</version>
</dependency>Full Changelog: 6.1.0...6.2.0
6.1.0
What's Changed
- [SPPL-2086] - Made like and notLike searches case insensitive by @FKlahn in #21
- [SUP-2969] Update Testcontainers MySQL dependency to 1.21.4 and MySQL image to 8.4.9 by @caiomerottimk in #22
- COR-4223 - Corrigir problemas do Codacy no backend Java by @maestro-monkey in #24
New Contributors
- @FKlahn made their first contribution in #21
- @caiomerottimk made their first contribution in #22
- @maestro-monkey made their first contribution in #24
Full Changelog: 6.0.0...6.1.0
4.1.0
The % at the beginning of the filter for queries using LIKE has been removed.
Removal of operators: CONTAINS, ENDS_WITH, DOES_NOT_CONTAIN, DOES_NOT_END_WITH.
6.0.0
MonkeyJpaRepository
Using MonkeyJpaRepository, the findAll method with a Specification (using groupBy) and Pageable will return a Page<T> where getTotalElements() correctly reflects the number of grouped items.
To use this feature, follow the steps below:
1. Apply MonkeyJpaRepository in Repository
When creating the repository, extend from MonkeyJpaRepository instead of JpaRepository to ensure counting is performed correctly.
interface PayableRepository extends MonkeyJpaRepository<Payable, PayableId>, JpaSpecificationExecutor<Payable> {}2. Add a @Import in MysqlIntegrationContainerConfiguration
This is necessary to ensure that, when running tests, the custom implementation is properly loaded.
@Import({ MonkeyJpaRepositoriesAutoConfiguration.class })5..0.0
IN Operator
You can now use the IN operator with monkey-specification-search.
How to use:
?search=car.field4 IN ['foo','bar'] OR field IN [1,2]4.0.0
CustomSpecificationSearch
With CustomSpecificationSearch, you can execute specifications using a request parameter. Follow the steps below to use it:
1. Create a Custom Specification
Define a custom specification for your model. For example, to create a specification that checks if a product is in one of two specific states:
public static Specification<Product> readyToUse() {
return (root, criteriaQuery, criteriaBuilder) -> {
return criteriaBuilder.or(
criteriaBuilder.equal(root.get(Product_.status), ENUM_STATUS_1),
criteriaBuilder.equal(root.get(Product_.status), ENUM_STATUS_2)
);
};
}2. Add a @Configuration Class to Your Project
Create a class annotated with @Configuration to register the custom specification in CustomSpecificationSearch:
@Configuration
class MonkeySpecificationSearchConfiguration {
@PostConstruct
void customSpecification() {
CustomSpecificationSearch.getInstance().add("productReadyToUse", ProductSpecification.readyToUse());
}
}3. Call the API Using the Custom Predicate
You can now call your API using the customPredicate as a search parameter. For example:
GET: host/v2/products?search=customPredicate:readyToUse
3.0
This release was created to works alongside with spring boot 3.x.x