Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8ad8f24
docs: enhance arangodb template documentation
otaviojava Mar 2, 2025
1569858
docs: enhance aql annotation
otaviojava Mar 2, 2025
71aee3e
docs: enhance arangodb repository
otaviojava Mar 2, 2025
eeadb7d
feat: generate params utls class
otaviojava Mar 2, 2025
87eb0e7
feat: enhance documentation to param utils
otaviojava Mar 2, 2025
7215a90
feat: generate paramutil test
otaviojava Mar 2, 2025
16be55b
feat: update param util
otaviojava Mar 2, 2025
b533421
feat: update param
otaviojava Mar 2, 2025
60971ae
feat: enhance update
otaviojava Mar 2, 2025
8ed0f7b
docs: update cassandra template
otaviojava Mar 2, 2025
9105641
docs: enhance CQl documentation
otaviojava Mar 2, 2025
4dab2e5
docs: enhance documentaition
otaviojava Mar 2, 2025
32e23ca
feat: update cassandra documentation
otaviojava Mar 2, 2025
08bd462
docs: enhance couchbase template
otaviojava Mar 2, 2025
165c4c3
docs: enhance n1ql documentation
otaviojava Mar 2, 2025
d0dbace
docs: create couchbase repository
otaviojava Mar 2, 2025
6d554ea
feat: update param
otaviojava Mar 2, 2025
b25cdcf
feat: update param
otaviojava Mar 2, 2025
93b9ff8
docs: generate documentation at Couchdbmanager
otaviojava Mar 2, 2025
31cbfe4
docs: geneate ES template
otaviojava Mar 2, 2025
3bab504
docs: enhance documentation to HazelcastTemplate
otaviojava Mar 2, 2025
acc700e
docs: enhance hazelcast query documentation
otaviojava Mar 2, 2025
101300c
feat: update documentation at Hazelcastrepository
otaviojava Mar 2, 2025
bd6f460
feat: update test hazelcast
otaviojava Mar 2, 2025
0065cca
feat: update documentation on orientdb template
otaviojava Mar 2, 2025
2ac1687
docs: generate sql documentation on orientdb
otaviojava Mar 2, 2025
480a0d6
docs: generate orientdb repository
otaviojava Mar 2, 2025
296962b
feat: remove utils on orientdb
otaviojava Mar 2, 2025
6784ac1
docs: enhance and explain the change at changelog
otaviojava Mar 2, 2025
ee6abe0
docs: update documentation removing h3
otaviojava Mar 2, 2025
71e3a38
docs: remove p tag at javadoc documentation
otaviojava Mar 2, 2025
d8297b3
docs: fix cql documentation
otaviojava Mar 2, 2025
635c7fc
docs: enhance couchbase repository
otaviojava Mar 2, 2025
d5d5948
docs: enhance coubhase template
otaviojava Mar 2, 2025
de38073
docs: removes h2 at N1SQL annotation
otaviojava Mar 2, 2025
fd8763b
docs: fix hazelcast documentation
otaviojava Mar 2, 2025
dcd57f4
docs: enhance documentation at orientdb template
otaviojava Mar 2, 2025
97b3a97
docs: enhance documentation at sql hazelcast
otaviojava Mar 2, 2025
7ca340f
docs: enhance hazelcast templat
otaviojava Mar 2, 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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
- Update Couchbase client 3.7.6
- Update DynamoDB driver 2.29.45
- Update ArangoDb driver to 7.17.0
- At repositories params, use the Param annotation from Jakarta Data API.

=== Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,33 @@
import java.lang.annotation.Target;

/**
* To a dynamic query on ArangoDBRepository and ArangoDBRepositoryAsync interfaces.
* Annotation to define a dynamic AQL (ArangoDB Query Language) query for methods
* in the {@link ArangoDBRepository} interface.
* This annotation enables executing custom AQL queries directly from repository methods,
* similar to how queries are defined in other JNoSQL repositories.
*
* Example usage:
* <pre>{@code
* @AQL("FOR p IN Person RETURN p")
* List<Person> findAll();
* }</pre>
*
*Parameterized query:
* <pre>{@code
* @AQL("FOR p IN Person FILTER p.name == @name RETURN p")
* List<Person> findByName(@Param("name") String name);
* }</pre>
*
* @see ArangoDBRepository
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AQL {

/**
* The AQL query string to be executed.
*
* @return the AQL query
*/
String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.jnosql.mapping.core.query.AbstractRepository;
import org.eclipse.jnosql.mapping.core.repository.DynamicReturn;
import org.eclipse.jnosql.mapping.document.DocumentTemplate;
import org.eclipse.jnosql.mapping.driver.ParamUtil;
import org.eclipse.jnosql.mapping.metadata.EntitiesMetadata;
import org.eclipse.jnosql.mapping.metadata.EntityMetadata;
import org.eclipse.jnosql.mapping.semistructured.query.AbstractSemiStructuredRepositoryProxy;
Expand Down Expand Up @@ -93,7 +94,7 @@ public Object invoke(Object instance, Method method, Object[] args) throws Throw
AQL aql = method.getAnnotation(AQL.class);
if (Objects.nonNull(aql)) {
Stream<T> result;
Map<String, Object> params = ParamUtil.getParams(args, method);
Map<String, Object> params = ParamUtil.INSTANCE.getParams(args, method);
if (params.isEmpty()) {
result = template.aql(aql.value(), emptyMap());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,25 @@


/**
* The arangodb {@link NoSQLRepository}
* A repository interface for ArangoDB, extending the generic {@link NoSQLRepository}.
* This repository supports executing custom AQL queries via the {@link AQL} annotation.
*
* Example usage:
* <pre>{@code
* @Repository
* public interface PersonRepository extends ArangoDBRepository<Person, String> {
*
* @AQL("FOR p IN Person RETURN p")
* List<Person> findAll();
*
* @AQL("FOR p IN Person FILTER p.name == @name RETURN p")
* List<Person> findByName(@Param("name") String name);
* }
* }</pre>
*
* @param <T> the entity type
* @param <K> the id entity type
* @param <K> the entity ID type
* @see AQL
*/
public interface ArangoDBRepository<T, K> extends NoSQLRepository<T, K> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,62 +21,71 @@
import java.util.Map;
import java.util.stream.Stream;
/**
* A template specialization for ArangoDB that includes capabilities for executing ArangoDB query language, AQL.
* This template extends {@link DocumentTemplate} and provides methods for executing AQL queries with various
* options.
* A specialized {@link DocumentTemplate} for ArangoDB, providing methods to execute
* queries using the ArangoDB Query Language (AQL).
*
* This template allows executing AQL queries with named parameters and supports
* result serialization either through Eclipse JNoSQL or directly via ArangoDB.
*/
public interface ArangoDBTemplate extends DocumentTemplate {

/**
* Executes an ArangoDB query using the ArangoDB Query Language (AQL).
*
* <p>Example query: {@code FOR u IN users FILTER u.status == @status RETURN u}</p>
* <p>Example query:</p>
* <pre>{@code
* FOR u IN users FILTER u.status == @status RETURN u
* }</pre>
*
* <p>The conversion from the query result to entities will happen at the Eclipse JNoSQL side.
* It will utilize and consider all the annotations supported by Eclipse JNoSQL.</p>
* <p>The conversion of query results to entity objects is handled by Eclipse JNoSQL,
* applying all supported annotations.</p>
*
* @param <T> the entity class
* @param query the AQL query
* @param params the named parameters for the query
* @param <T> the entity type
* @param query the AQL query string
* @param params a map containing named parameters for the query
* @return a {@link Stream} of entities representing the query result
* @throws NullPointerException when either the query or params are null
* @throws NullPointerException if {@code query} or {@code params} is {@code null}
*/
<T> Stream<T> aql(String query, Map<String, Object> params);

/**
* Executes an ArangoDB query using the ArangoDB Query Language (AQL).
* Executes an ArangoDB query using AQL with direct serialization via ArangoDB.
*
* <p>Example query: {@code FOR u IN users FILTER u.status == @status RETURN u}</p>
* <p>Example query:</p>
* <pre>{@code
* FOR u IN users FILTER u.status == @status RETURN u
* }</pre>
*
* <p>The serialization of the query result will happen at the ArangoDB side using
* {@link com.arangodb.ArangoDatabase#query(String, Class)}. This serialization does not have any converter support
* at the mapper side,
* thus it will ignore any annotations that Eclipse JNoSQL has.</p>
* <p>The serialization of query results is performed directly by ArangoDB using
* {@link com.arangodb.ArangoDatabase#query(String, Class)}, bypassing Eclipse JNoSQL
* converters. Consequently, annotations supported by Eclipse JNoSQL are ignored.</p>
*
* @param query the AQL query
* @param params the named parameters for the query
* @param type the type of the result
* @param <T> the type
* @return a {@link Stream} of the specified type representing the query result
* @throws NullPointerException when either the query or params are null
* @param <T> the expected result type
* @param query the AQL query string
* @param params a map containing named parameters for the query
* @param type the target class for result serialization
* @return a {@link Stream} of results of type {@code T}
* @throws NullPointerException if {@code query}, {@code params}, or {@code type} is {@code null}
*/
<T> Stream<T> aql(String query, Map<String, Object> params, Class<T> type);

/**
* Executes an ArangoDB query using the ArangoDB Query Language (AQL) with an empty parameter map.
* Executes an ArangoDB query using AQL with an empty parameter map.
*
* <p>Example query: {@code FOR u IN users FILTER u.status == @status RETURN u}</p>
* <p>Example query:</p>
* <pre>{@code
* FOR u IN users FILTER u.status == @status RETURN u
* }</pre>
*
* <p>The serialization of the query result will happen at the ArangoDB side using
* {@link com.arangodb.ArangoDatabase#query(String, Class)}. This serialization does not have any converter support
* at the mapper side,
* thus it will ignore any annotations that Eclipse JNoSQL has.</p>
* <p>The serialization of query results is performed directly by ArangoDB using
* {@link com.arangodb.ArangoDatabase#query(String, Class)}. This means that
* Eclipse JNoSQL annotations will not be considered.</p>
*
* @param query the AQL query
* @param type the type of the result
* @param <T> the type
* @return a {@link Stream} of the specified type representing the query result
* @throws NullPointerException when either the query or type are null
* @param <T> the expected result type
* @param query the AQL query string
* @param type the target class for result serialization
* @return a {@link Stream} of results of type {@code T}
* @throws NullPointerException if {@code query} or {@code type} is {@code null}
*/
<T> Stream<T> aql(String query, Class<T> type);
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package org.eclipse.jnosql.databases.arangodb.mapping;

import jakarta.data.repository.Param;
import jakarta.inject.Inject;
import org.assertj.core.api.Assertions;
import org.eclipse.jnosql.mapping.core.Converters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@
import java.lang.annotation.Target;

/**
* Annotation used to define a dynamic CQL query method in CassandraRepository and CassandraRepositoryAsync interfaces.
* Annotation used to define a dynamic CQL query method in {@link CassandraRepository}.
* Methods annotated with {@code @CQL} allow the execution of custom Cassandra Query Language (CQL) statements
* within repository interfaces.
* Example usage:
* <pre>{@code
* @CQL("SELECT * FROM users WHERE username = :username")
* List<User> findByUsername(@Param("username") String username);
* }</pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CQL {

/**
* The CQL query string.
* The CQL query string to be executed.
*
* @return the CQL query string
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,25 @@
import org.eclipse.jnosql.mapping.NoSQLRepository;

/**
* The Cassandra {@link NoSQLRepository}
* A Cassandra-specific extension of {@link NoSQLRepository}, providing repository-style data access.
* This interface extends the generic {@link NoSQLRepository}, allowing seamless integration with Cassandra's
* schema-less NoSQL database model while leveraging query capabilities provided by {@link CQL}.
*
* <p>Example usage:</p>
* <pre>{@code
* @Repository
* public interface UserRepository extends CassandraRepository<User, String> {
*
* @CQL("SELECT * FROM users WHERE username = :username")
* List<User> findByUsername(@Param("username") String username);
*
* @CQL("DELETE FROM users WHERE id = :id")
* void deleteById(@Param("id") String id);
* }
* }</pre>
*
* @param <T> the entity type
* @param <K> the id entity type
* @param <K> the primary key type of the entity
*/
public interface CassandraRepository<T, K> extends NoSQLRepository<T, K> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.jnosql.mapping.core.Converters;
import org.eclipse.jnosql.mapping.core.query.AbstractRepository;
import org.eclipse.jnosql.mapping.core.repository.DynamicReturn;
import org.eclipse.jnosql.mapping.driver.ParamUtil;
import org.eclipse.jnosql.mapping.metadata.EntitiesMetadata;
import org.eclipse.jnosql.mapping.metadata.EntityMetadata;
import org.eclipse.jnosql.mapping.semistructured.query.AbstractSemiStructuredRepositoryProxy;
Expand Down Expand Up @@ -91,7 +92,7 @@ public Object invoke(Object instance, Method method, Object[] args) throws Throw
if (Objects.nonNull(cql)) {

Stream<T> result;
Map<String, Object> values = CQLObjectUtil.getValues(args, method);
Map<String, Object> values = ParamUtil.INSTANCE.getParams(args, method);
if (!values.isEmpty()) {
result = template.cql(cql.value(), values);
} else if (args == null || args.length == 0) {
Expand Down
Loading