Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
7f8c27e
chore: include string match enum
otaviojava Aug 10, 2025
5b55c03
chore: include heeader at String match enum
otaviojava Aug 10, 2025
faf0307
feat: include the implementation on String match
otaviojava Aug 10, 2025
fbb7045
docs: include javadoc on spring match documentation
otaviojava Aug 10, 2025
dbf5d36
docs: enhance documentation on Stringmatch
otaviojava Aug 10, 2025
72a99cc
test: initial structure on String match test
otaviojava Aug 11, 2025
861e488
test: create stsring match test
otaviojava Aug 11, 2025
7847c79
feat: update query aql converter to support contains and start with
otaviojava Aug 11, 2025
08739c5
chore: hide the apply method on string match
otaviojava Aug 11, 2025
be87404
test: include find contains
otaviojava Aug 11, 2025
39c6f2f
test: update test on arango db to support the new keyworlds
otaviojava Aug 11, 2025
297fa37
chore: update arangodb driver to version 7.22.0
otaviojava Aug 11, 2025
30b8b42
docs: update changelog to include arangodb info
otaviojava Aug 11, 2025
faa2e29
docs: update changelog with info
otaviojava Aug 11, 2025
dccdb31
chore: update apache cassandra driver to 4.19.0
otaviojava Aug 11, 2025
31910a8
docs: update description on changelog
otaviojava Aug 11, 2025
cae714a
chore: update couchbase on version 3.9.0
otaviojava Aug 11, 2025
2a58fda
docs: update changelog on couchbase
otaviojava Aug 11, 2025
516bc49
feat: update n1query builder
otaviojava Aug 11, 2025
fbbc930
feat: include support with contains on end with on ES
otaviojava Aug 11, 2025
e25fbdf
feat: include conditions to mongodb
otaviojava Aug 11, 2025
ed2a9e2
feat: fix like on colleciton name on mongodb
otaviojava Aug 11, 2025
2d87330
feaet: include new conditions to mongodb
otaviojava Aug 11, 2025
86c59b2
feat: include n4oj library
otaviojava Aug 12, 2025
b6da230
chore: update neo4j library to 5.28.9
otaviojava Aug 12, 2025
368ceb1
feat: include condition on
otaviojava Aug 12, 2025
4cf8a26
feat: include conditions on neo4jquery builder
otaviojava Aug 12, 2025
c2ec503
feat: include Neo4j database manager
otaviojava Aug 12, 2025
af37dd4
feat: update neo4jquery builder
otaviojava Aug 12, 2025
ab395bd
feat: include liketo cypher reger
otaviojava Aug 12, 2025
b0ed392
test: update like cypher regex
otaviojava Aug 12, 2025
40ca408
feat: update orientdb query
otaviojava Aug 12, 2025
91044b5
docs: update changelog version on orientdb version
otaviojava Aug 12, 2025
a2dfec1
feat: update and include new conditions on orientedb
otaviojava Aug 12, 2025
a8fa117
feat: update module
otaviojava Aug 12, 2025
d0a80d9
chore: amazon aws to version 2.32.21
otaviojava Aug 14, 2025
d51ce56
ES version to 8.19.1
otaviojava Aug 14, 2025
c38d7ad
docs: update documentation on changelog
otaviojava Aug 14, 2025
fdf8774
chore: update apache hbase to version 2.6.3
otaviojava Aug 14, 2025
6bf0eac
docs: update hbase version on documentation
otaviojava Aug 14, 2025
2f58469
chore: update jedis to version 6.1.0
otaviojava Aug 14, 2025
8b5b9a6
docs: update maven driver to 6.1.0
otaviojava Aug 14, 2025
3796349
chore: update apache tinkerpop 3.7.4
otaviojava Aug 14, 2025
9e14b07
chore: update apache tinkerpop to version 3.7.4
otaviojava Aug 14, 2025
b638091
feat: create like to regex
otaviojava Aug 14, 2025
5564223
style: update document query conversor
otaviojava Aug 14, 2025
a70dba7
test: update on document query converter
otaviojava Aug 14, 2025
711516e
feat: update converter
otaviojava Aug 14, 2025
269ff5b
feat: update traversal on apache tinkerpop
otaviojava Aug 14, 2025
e65c520
feat: udpate traversal convertor
otaviojava Aug 14, 2025
67ef67e
test: include query on tinkerpop
otaviojava Aug 15, 2025
4aa16d8
test: include like condition
otaviojava Aug 15, 2025
7b16d09
test: include oracle nosql with like and conditions
otaviojava Aug 15, 2025
a1da2e1
chore: generate initial structure to ocnverter of Oracle nosql
otaviojava Aug 15, 2025
8291a2e
feat: convert nosql
otaviojava Aug 15, 2025
6768888
feat: update oracle nosql communication
otaviojava Aug 15, 2025
395e108
test: generate scenario on oracle nosql
otaviojava Aug 15, 2025
d8a97f9
feat: update oracle nosql converter
otaviojava Aug 15, 2025
a16349d
test: update oracle nosql to use the instance method
otaviojava Aug 15, 2025
437c928
chore: update query builder to support like and other keyworlds
otaviojava Aug 15, 2025
f6a4d37
feat: udpate on oracle nosql
otaviojava Aug 15, 2025
0e17889
feat: include start regex conditions
otaviojava Aug 15, 2025
7636546
style: remove imports onOracleNoSQLLikeConverter
otaviojava Aug 15, 2025
bf5863a
test: update scenarios with oracle NoSQL Like converter
otaviojava Aug 16, 2025
7768d34
feat: update abstract query builder
otaviojava Aug 16, 2025
816443f
feat: update implementation of abstractquery builder
otaviojava Aug 16, 2025
0675743
feat: include oracle nosql test
otaviojava Aug 16, 2025
20ef418
style: update on like to regex
otaviojava Aug 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version

== [Unreleased]

=== Changed

- Update ArangoDB driver to 7.22.0
- Update Apache Cassandra driver to 4.19.0
- Update Couchbase driver to 3.9.0
- Update Neo4J driver to 5.28.9
- Update OrientDB driver to 3.2.43
- Update Elasticsearch driver to 8.19.1
- Update Apache Hbase to version 2.6.3
- Update Jedis version to 6.1.0
- Update Apache Tinkerpop core to 3.7.4

=== Added

- Include support to Contains, StartsWith, EndsWith for NoSQL databases

== [1.1.9] - 2025-07-30

=== Fixed
Expand Down
2 changes: 1 addition & 1 deletion jnosql-arangodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<description>The Eclipse JNoSQL layer to ArangoDB</description>

<properties>
<arango.driver>7.21.0</arango.driver>
<arango.driver>7.22.0</arango.driver>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import jakarta.data.Sort;
import org.eclipse.jnosql.communication.TypeReference;
import org.eclipse.jnosql.communication.ValueUtil;
import org.eclipse.jnosql.communication.driver.StringMatch;
import org.eclipse.jnosql.communication.semistructured.CriteriaCondition;
import org.eclipse.jnosql.communication.semistructured.DeleteQuery;
import org.eclipse.jnosql.communication.semistructured.Element;
Expand Down Expand Up @@ -153,6 +154,15 @@ private static void definesCondition(CriteriaCondition condition,
case LIKE:
appendCondition(aql, params, entity, document, LIKE);
return;
case CONTAINS:
appendCondition(aql, params, entity, Element.of(document.name(), StringMatch.CONTAINS.format(document.get(String.class))), LIKE);
return;
case STARTS_WITH:
appendCondition(aql, params, entity, Element.of(document.name(), StringMatch.STARTS_WITH.format(document.get(String.class))), LIKE);
return;
case ENDS_WITH:
appendCondition(aql, params, entity, Element.of(document.name(), StringMatch.ENDS_WITH.format(document.get(String.class))), LIKE);
return;
case AND:

for (CriteriaCondition dc : document.get(new TypeReference<List<CriteriaCondition>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@
import org.assertj.core.api.SoftAssertions;
import org.eclipse.jnosql.communication.TypeReference;
import org.eclipse.jnosql.communication.semistructured.CommunicationEntity;
import org.eclipse.jnosql.communication.semistructured.CriteriaCondition;
import org.eclipse.jnosql.communication.semistructured.DeleteQuery;
import org.eclipse.jnosql.communication.semistructured.Element;
import org.eclipse.jnosql.communication.semistructured.Elements;
import org.eclipse.jnosql.communication.semistructured.SelectQuery;
import org.eclipse.jnosql.mapping.semistructured.MappingQuery;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -404,6 +407,51 @@ void shouldFindBetween2() {
});
}

@Test
void shouldFindContains() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.contains(Element.of("name",
"lia")), COLLECTION_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

@Test
void shouldStartsWith() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.startsWith(Element.of("name",
"Pol")), COLLECTION_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

@Test
void shouldEndsWith() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.endsWith(Element.of("name",
"ana")), COLLECTION_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

private CommunicationEntity getEntity() {
CommunicationEntity entity = CommunicationEntity.of(COLLECTION_NAME);
Map<String, Object> map = new HashMap<>();
Expand Down
6 changes: 3 additions & 3 deletions jnosql-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<description>The Eclipse JNoSQL layer to Cassandra</description>

<properties>
<casandra.driver.version>4.17.0</casandra.driver.version>
<casandra.driver.version>4.19.0</casandra.driver.version>

</properties>
<dependencies>
Expand All @@ -43,12 +43,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<groupId>org.apache.cassandra</groupId>
<artifactId>java-driver-core</artifactId>
<version>${casandra.driver.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<groupId>org.apache.cassandra</groupId>
<artifactId>java-driver-query-builder</artifactId>
<version>${casandra.driver.version}</version>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion jnosql-couchbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>java-client</artifactId>
<version>3.8.3</version>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.couchbase.client.java.json.JsonObject;
import jakarta.data.Direction;
import org.eclipse.jnosql.communication.TypeReference;
import org.eclipse.jnosql.communication.driver.StringMatch;
import org.eclipse.jnosql.communication.semistructured.CriteriaCondition;
import org.eclipse.jnosql.communication.semistructured.Element;
import org.eclipse.jnosql.communication.semistructured.SelectQuery;
Expand Down Expand Up @@ -113,6 +114,15 @@ private void condition(CriteriaCondition condition, StringBuilder n1ql, JsonObje
case LIKE:
predicate(n1ql, " LIKE ", document, params);
return;
case CONTAINS:
predicate(n1ql, " LIKE ", Element.of(document.name(), StringMatch.CONTAINS.format(document.get(String.class))), params);
return;
case STARTS_WITH:
predicate(n1ql, " LIKE ", Element.of(document.name(), StringMatch.STARTS_WITH.format(document.get(String.class))), params);
return;
case ENDS_WITH:
predicate(n1ql, " LIKE ", Element.of(document.name(), StringMatch.ENDS_WITH.format(document.get(String.class))), params);
return;
case NOT:
n1ql.append(" NOT ");
condition(document.get(CriteriaCondition.class), n1ql, params, ids);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
import org.eclipse.jnosql.communication.TypeReference;
import org.eclipse.jnosql.communication.keyvalue.BucketManager;
import org.eclipse.jnosql.communication.semistructured.CommunicationEntity;
import org.eclipse.jnosql.communication.semistructured.CriteriaCondition;
import org.eclipse.jnosql.communication.semistructured.DeleteQuery;
import org.eclipse.jnosql.communication.semistructured.Element;
import org.eclipse.jnosql.communication.semistructured.Elements;
import org.eclipse.jnosql.communication.semistructured.SelectQuery;
import org.eclipse.jnosql.mapping.semistructured.MappingQuery;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -294,6 +297,51 @@ void shouldUpdateNull(){
});
}

@Test
void shouldFindContains() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.contains(Element.of("name",
"lia")), COLLECTION_PERSON_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

@Test
void shouldStartsWith() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.startsWith(Element.of("name",
"Pol")), COLLECTION_PERSON_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

@Test
void shouldEndsWith() {
var entity = getEntity();

entityManager.insert(entity);
var query = new MappingQuery(Collections.emptyList(), 0L, 0L, CriteriaCondition.endsWith(Element.of("name",
"ana")), COLLECTION_PERSON_NAME, Collections.emptyList());

var result = entityManager.select(query).toList();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(result).hasSize(1);
softly.assertThat(result.get(0).find("name").orElseThrow().get(String.class)).isEqualTo("Poliana");
});
}

private CommunicationEntity getEntity() {
CommunicationEntity entity = CommunicationEntity.of(COLLECTION_PERSON_NAME);
Map<String, Object> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright (c) 2025 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.eclipse.jnosql.communication.driver;

import java.util.Objects;


/**
* Represents strategies for matching string values in database queries,
* typically for SQL {@code LIKE} clauses or NoSQL regex-like searches.
* <p>
* Each constant defines a specific way to wrap the given value
* with wildcard symbols ({@code %}) to produce a matching pattern.
* </p>
* <p>
* Example usage:
* <pre>{@code
* String pattern = StringMatch.CONTAINS.format("Ota"); // "%Ota%"
* }</pre>
*/
public enum StringMatch {

/**
* Exact match.
* <p>
* The given value will be used as-is, without adding any wildcards.
* For SQL, this corresponds to {@code column = 'value'}.
* </p>
*/
DEFAULT {
@Override
public String apply(String value) {
return value;
}
},

/**
* Contains match.
* <p>
* The given value will be wrapped with wildcards on both sides:
* {@code %value%}. For SQL, this corresponds to
* {@code column LIKE '%value%'}.
* </p>
*/
CONTAINS {
@Override
public String apply(String value) {
return "%" + value + "%";
}
},

/**
* Starts-with match.
* <p>
* The given value will be followed by a wildcard:
* {@code value%}. For SQL, this corresponds to
* {@code column LIKE 'value%'}.
* </p>
*/
STARTS_WITH {
@Override
public String apply(String value) {
return value + "%";
}
},

/**
* Ends-with match.
* <p>
* The given value will be preceded by a wildcard:
* {@code %value}. For SQL, this corresponds to
* {@code column LIKE '%value'}.
* </p>
*/
ENDS_WITH {
@Override
public String apply(String value) {
return "%" + value;
}
};

/**
* Applies the match strategy to the given value, producing a pattern string.
*
* @param value the value to be transformed into a pattern
* @return the pattern string, with wildcards applied according to the match strategy
*/
abstract String apply(String value);

/**
* Formats the given value by applying the match strategy.
* <p>
* This method ensures the value is not {@code null} before applying the strategy.
* </p>
*
* @param value the value to be transformed into a pattern
* @return the pattern string, with wildcards applied according to the match strategy
* @throws NullPointerException if {@code value} is {@code null}
*/
public String format(String value) {
Objects.requireNonNull(value, "value cannot be null");
return apply(value);
}

}
Loading