├── .github └── workflows │ ├── jakarta-data-tck-runner.yml │ ├── jakarta-nosql-tck-runner.yml │ ├── java-17.yml │ └── java-21.yml ├── .gitignore ├── CHANGELOG.adoc ├── CONTRIBUTING.adoc ├── LICENSE ├── README.adoc ├── jnosql-data-tck-runner ├── README.adoc ├── logging.properties ├── pom.xml └── src │ └── test │ └── java │ └── org │ └── eclipse │ └── jnosql │ └── tck │ ├── DocumentDatabase.java │ ├── MyEntityTests.java │ └── MyNoSQLEntityTests.java ├── jnosql-jakarta-persistence ├── README.adoc ├── jnosql-jakarta-persistence-data-tck-runner │ ├── README.adoc │ ├── logging.properties │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── tck │ │ │ └── jakartapersistence │ │ │ ├── EntityManagerProducer.java │ │ │ ├── JNoSqlEntitySelectedTests.java │ │ │ ├── JNoSqlEntityTests.java │ │ │ ├── JNoSqlPersistenceEntityTests.java │ │ │ ├── JNoSqlSignatureTests.java │ │ │ └── TransactionExtension.java │ │ └── resources │ │ └── META-INF │ │ └── persistence.xml ├── jnosql-jakarta-persistence-driver │ ├── README.adoc │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── eclipse │ │ │ │ └── jnosql │ │ │ │ └── jakartapersistence │ │ │ │ ├── communication │ │ │ │ ├── PersistenceClassScanner.java │ │ │ │ ├── PersistenceClassScannerSingleton.java │ │ │ │ ├── PersistenceDatabaseManager.java │ │ │ │ └── PersistenceRepositoryFilter.java │ │ │ │ └── mapping │ │ │ │ ├── BaseQueryParser.java │ │ │ │ ├── DeleteQueryParser.java │ │ │ │ ├── PersistenceDocumentTemplate.java │ │ │ │ ├── PersistencePreparedStatement.java │ │ │ │ ├── SelectQueryParser.java │ │ │ │ ├── repository │ │ │ │ ├── JakartaPersistenceRepositoryProxy.java │ │ │ │ └── RepositoryPersistenceBean.java │ │ │ │ └── spi │ │ │ │ └── JakartaPersistenceExtension.java │ │ └── resources │ │ │ └── META-INF │ │ │ ├── beans.xml │ │ │ └── services │ │ │ └── jakarta.enterprise.inject.spi.Extension │ │ └── test │ │ ├── java │ │ └── ee │ │ │ └── omnifish │ │ │ └── jnosql │ │ │ └── jakartapersistence │ │ │ ├── EntityManagerProducer.java │ │ │ ├── Person.java │ │ │ ├── PersonRepository.java │ │ │ └── PersonRepositoryTest.java │ │ └── resources │ │ └── META-INF │ │ └── persistence.xml └── pom.xml ├── jnosql-lite ├── .gitignore ├── README.adoc ├── mapping-lite-column-test │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── lite │ │ │ └── mapping │ │ │ └── entities │ │ │ ├── Actor.java │ │ │ ├── ActorBuilder.java │ │ │ ├── Address.java │ │ │ ├── AppointmentBook.java │ │ │ ├── Citizen.java │ │ │ ├── City.java │ │ │ ├── Contact.java │ │ │ ├── ContactType.java │ │ │ ├── Director.java │ │ │ ├── Download.java │ │ │ ├── Job.java │ │ │ ├── Money.java │ │ │ ├── MoneyConverter.java │ │ │ ├── Movie.java │ │ │ ├── Person.java │ │ │ ├── PersonBuilder.java │ │ │ ├── PersonCrudRepository.java │ │ │ ├── PersonRepository.java │ │ │ ├── UserScope.java │ │ │ ├── Vendor.java │ │ │ ├── Wine.java │ │ │ ├── WineFactory.java │ │ │ ├── Worker.java │ │ │ ├── ZipCode.java │ │ │ ├── inheritance │ │ │ ├── EmailNotification.java │ │ │ ├── LargeProject.java │ │ │ ├── Notification.java │ │ │ ├── NotificationReader.java │ │ │ ├── Project.java │ │ │ ├── ProjectManager.java │ │ │ ├── SmallProject.java │ │ │ ├── SmsNotification.java │ │ │ └── SocialMediaNotification.java │ │ │ └── record │ │ │ ├── Guest.java │ │ │ ├── Hotel.java │ │ │ ├── HotelManager.java │ │ │ └── Room.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ └── entities │ │ ├── ColumnEntityConverterInheritanceTest.java │ │ ├── ColumnEntityConverterRecordTest.java │ │ ├── ColumnEntityConverterTest.java │ │ ├── PersonCrudRepositoryTest.java │ │ └── PersonRepositoryTest.java ├── mapping-lite-core-test │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── lite │ │ │ └── mapping │ │ │ └── entities │ │ │ ├── Actor.java │ │ │ ├── Animal.java │ │ │ ├── Car.java │ │ │ ├── Computer.java │ │ │ ├── ComputerAddress.java │ │ │ ├── CustomAnnotation.java │ │ │ ├── Director.java │ │ │ ├── Money.java │ │ │ ├── MoneyConverter.java │ │ │ ├── Movie.java │ │ │ ├── Order.java │ │ │ ├── Orders.java │ │ │ ├── Person.java │ │ │ ├── Product.java │ │ │ ├── User.java │ │ │ ├── Wine.java │ │ │ ├── WineFactory.java │ │ │ ├── Worker.java │ │ │ ├── inheritance │ │ │ ├── EmailNotification.java │ │ │ ├── LargeProject.java │ │ │ ├── Notification.java │ │ │ ├── Project.java │ │ │ ├── SmallProject.java │ │ │ ├── SmsNotification.java │ │ │ └── SocialMediaNotification.java │ │ │ └── record │ │ │ ├── Apartment.java │ │ │ ├── Building.java │ │ │ ├── DocumentRecord.java │ │ │ ├── Guest.java │ │ │ ├── Hotel.java │ │ │ ├── House.java │ │ │ └── Room.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ └── entities │ │ ├── ActorTest.java │ │ ├── AnimalTest.java │ │ ├── CarTest.java │ │ ├── ComputerTest.java │ │ ├── EntitiesMetadataTest.java │ │ ├── MovieTest.java │ │ ├── OrderTest.java │ │ ├── OrdersTest.java │ │ ├── PersonTest.java │ │ ├── UserTest.java │ │ ├── WineTest.java │ │ ├── WorkerTest.java │ │ ├── inheritance │ │ ├── EmailNotificationTest.java │ │ ├── LargeProjectTest.java │ │ ├── NotificationTest.java │ │ ├── ProjectTest.java │ │ ├── SMSNotificationTest.java │ │ ├── SmallProjectTest.java │ │ └── SocialMediaNotificationTest.java │ │ └── record │ │ ├── ApartmentTest.java │ │ ├── BuildingTest.java │ │ ├── DocumentRecordTest.java │ │ ├── GuestTest.java │ │ ├── HotelTest.java │ │ └── RoomTest.java ├── mapping-lite-document-test │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── lite │ │ │ └── mapping │ │ │ └── entities │ │ │ ├── Actor.java │ │ │ ├── ActorBuilder.java │ │ │ ├── Address.java │ │ │ ├── AppointmentBook.java │ │ │ ├── Citizen.java │ │ │ ├── City.java │ │ │ ├── Contact.java │ │ │ ├── ContactType.java │ │ │ ├── Director.java │ │ │ ├── Download.java │ │ │ ├── Job.java │ │ │ ├── Money.java │ │ │ ├── MoneyConverter.java │ │ │ ├── Movie.java │ │ │ ├── Person.java │ │ │ ├── PersonBuilder.java │ │ │ ├── PersonCrudRepository.java │ │ │ ├── PersonRepository.java │ │ │ ├── UserScope.java │ │ │ ├── Vendor.java │ │ │ ├── Wine.java │ │ │ ├── WineFactory.java │ │ │ ├── Worker.java │ │ │ ├── ZipCode.java │ │ │ ├── inheritance │ │ │ ├── EmailNotification.java │ │ │ ├── LargeProject.java │ │ │ ├── Notification.java │ │ │ ├── NotificationReader.java │ │ │ ├── Project.java │ │ │ ├── ProjectManager.java │ │ │ ├── SmallProject.java │ │ │ ├── SmsNotification.java │ │ │ └── SocialMediaNotification.java │ │ │ └── record │ │ │ ├── Guest.java │ │ │ ├── Hotel.java │ │ │ ├── HotelManager.java │ │ │ └── Room.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ └── entities │ │ ├── DocumentEntityConverterInheritanceTest.java │ │ ├── DocumentEntityConverterRecordTest.java │ │ ├── DocumentEntityConverterTest.java │ │ ├── PersonCrudRepositoryTest.java │ │ └── PersonRepositoryTest.java ├── mapping-lite-graph-test │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── lite │ │ │ └── mapping │ │ │ └── entities │ │ │ ├── Actor.java │ │ │ ├── ActorBuilder.java │ │ │ ├── Address.java │ │ │ ├── AppointmentBook.java │ │ │ ├── Citizen.java │ │ │ ├── City.java │ │ │ ├── Contact.java │ │ │ ├── ContactType.java │ │ │ ├── Director.java │ │ │ ├── Download.java │ │ │ ├── Job.java │ │ │ ├── Money.java │ │ │ ├── MoneyConverter.java │ │ │ ├── Movie.java │ │ │ ├── Person.java │ │ │ ├── PersonBuilder.java │ │ │ ├── PersonCrudRepository.java │ │ │ ├── PersonRepository.java │ │ │ ├── UserScope.java │ │ │ ├── Vendor.java │ │ │ ├── Wine.java │ │ │ ├── WineFactory.java │ │ │ ├── Worker.java │ │ │ ├── ZipCode.java │ │ │ ├── inheritance │ │ │ ├── EmailNotification.java │ │ │ ├── LargeProject.java │ │ │ ├── Notification.java │ │ │ ├── NotificationReader.java │ │ │ ├── Project.java │ │ │ ├── ProjectManager.java │ │ │ ├── SmallProject.java │ │ │ ├── SmsNotification.java │ │ │ └── SocialMediaNotification.java │ │ │ └── record │ │ │ ├── Guest.java │ │ │ ├── Hotel.java │ │ │ ├── HotelManager.java │ │ │ └── Room.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ └── entities │ │ ├── GraphEntityConverterInheritanceTest.java │ │ ├── GraphEntityConverterRecordTest.java │ │ ├── GraphEntityConverterTest.java │ │ ├── PersonCrudRepositoryTest.java │ │ └── PersonRepositoryTest.java ├── mapping-lite-key-value-test │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── lite │ │ │ └── mapping │ │ │ └── entities │ │ │ ├── Car.java │ │ │ ├── Job.java │ │ │ ├── Money.java │ │ │ ├── MoneyConverter.java │ │ │ ├── Person.java │ │ │ ├── PersonBuilder.java │ │ │ ├── PersonRepository.java │ │ │ ├── Plate.java │ │ │ ├── PlateConverter.java │ │ │ ├── User.java │ │ │ ├── UserCrudRepository.java │ │ │ ├── UserRepository.java │ │ │ └── Worker.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ └── entities │ │ ├── KeyValueEntityConverterTest.java │ │ ├── PersonRepositoryTest.java │ │ ├── UserCrudRepositoryLiteKeyValueTest.java │ │ └── UserRepositoryLiteKeyValueTest.java ├── mapping-lite-processor │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── eclipse │ │ │ │ └── jnosql │ │ │ │ └── lite │ │ │ │ └── mapping │ │ │ │ ├── BaseMappingModel.java │ │ │ │ ├── ClassAnalyzer.java │ │ │ │ ├── CollectionUtil.java │ │ │ │ ├── ConstructorMetamodel.java │ │ │ │ ├── EntitiesMetadataModel.java │ │ │ │ ├── EntityModel.java │ │ │ │ ├── EntityProcessor.java │ │ │ │ ├── FieldAnalyzer.java │ │ │ │ ├── FieldModel.java │ │ │ │ ├── MetadataAppender.java │ │ │ │ ├── ParameterAnalyzer.java │ │ │ │ ├── ParameterModel.java │ │ │ │ ├── ParameterResult.java │ │ │ │ ├── ProcessorUtil.java │ │ │ │ ├── ValidationException.java │ │ │ │ ├── ValueAnnotationModel.java │ │ │ │ ├── metadata │ │ │ │ ├── CollectionSupplierProvider.java │ │ │ │ ├── DefaultConstructorMetadata.java │ │ │ │ ├── DequeSupplier.java │ │ │ │ ├── ListSupplier.java │ │ │ │ ├── LiteClassConverter.java │ │ │ │ ├── LiteClassScanner.java │ │ │ │ ├── LiteConstructorBuilder.java │ │ │ │ ├── LiteConstructorBuilderSupplier.java │ │ │ │ ├── LiteConstructorMetadata.java │ │ │ │ ├── LiteEntityMetadata.java │ │ │ │ ├── SetSupplier.java │ │ │ │ └── TreeSetSupplier.java │ │ │ │ └── repository │ │ │ │ ├── AnnotationOperationMethodBuilder.java │ │ │ │ ├── AnnotationQueryRepositoryReturnType.java │ │ │ │ ├── DatabaseSupport.java │ │ │ │ ├── KeyValueMethodBuilder.java │ │ │ │ ├── KeyValueMethodGenerator.java │ │ │ │ ├── KeyValueRepositoryMetadata.java │ │ │ │ ├── MethodGenerator.java │ │ │ │ ├── MethodMetadata.java │ │ │ │ ├── MethodMetadataOperationType.java │ │ │ │ ├── MethodQueryRepositoryReturnType.java │ │ │ │ ├── Parameter.java │ │ │ │ ├── RepositoryAnalyzer.java │ │ │ │ ├── RepositoryElement.java │ │ │ │ ├── RepositoryMetadata.java │ │ │ │ ├── RepositoryProcessor.java │ │ │ │ ├── RepositoryTemplateType.java │ │ │ │ ├── RepositoryUtil.java │ │ │ │ ├── SemiStructureMethodGenerator.java │ │ │ │ ├── SemiStructureRepositoryMetadata.java │ │ │ │ └── SemistructuredMethodBuilder.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── javax.annotation.processing.Processor │ │ │ ├── constructor_metadata.mustache │ │ │ ├── entities_metadata.mustache │ │ │ ├── entity_metadata.mustache │ │ │ ├── field_array_metadata.mustache │ │ │ ├── field_collection_metadata.mustache │ │ │ ├── field_map_metadata.mustache │ │ │ ├── field_metadata.mustache │ │ │ ├── parameter_array_metadata.mustache │ │ │ ├── parameter_collection_metadata.mustache │ │ │ ├── parameter_map_metadata.mustache │ │ │ ├── parameter_metadata.mustache │ │ │ ├── repository_key-value.mustache │ │ │ └── repository_semi_structure.mustache │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── lite │ │ └── mapping │ │ ├── CollectionUtilTest.java │ │ ├── LiteClassConverterTest.java │ │ ├── LiteClassScannerTest.java │ │ └── LiteConstructorBuilderSupplierTest.java └── pom.xml ├── jnosql-mapping-validation ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── mapping │ │ │ └── validation │ │ │ ├── EntityObserver.java │ │ │ └── MappingValidator.java │ └── resources │ │ └── META-INF │ │ └── beans.xml │ └── test │ ├── java │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── mapping │ │ └── validation │ │ ├── BucketManagerSupplier.java │ │ ├── ColumnTemplateValidationTest.java │ │ ├── Computer.java │ │ ├── ConstructorValidationTest.java │ │ ├── DatabaseMockProducer.java │ │ ├── DocumentTemplateValidationTest.java │ │ ├── KeyValueTemplateValidationTest.java │ │ ├── Person.java │ │ ├── PersonBuilder.java │ │ └── User.java │ └── resources │ └── META-INF │ └── beans.xml ├── jnosql-nosql-tck-runner ├── pom.xml └── src │ └── test │ ├── java │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── tck │ │ ├── DocumentDatabase.java │ │ └── JNoSQLTemplateSupplier.java │ └── resources │ └── META-INF │ ├── microprofile-config.properties │ └── services │ └── jakarta.nosql.tck.TemplateSupplier ├── jnosql-static-metamodel ├── jnosql-metamodel-processor │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── eclipse │ │ │ └── jnosql │ │ │ └── metamodel │ │ │ └── processor │ │ │ ├── BaseMappingModel.java │ │ │ ├── ClassAnalyzer.java │ │ │ ├── EntityModel.java │ │ │ ├── EntityProcessor.java │ │ │ ├── FieldAnalyzer.java │ │ │ ├── FieldModel.java │ │ │ ├── ProcessorUtil.java │ │ │ └── ValidationException.java │ │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── javax.annotation.processing.Processor │ │ └── metamodel.mustache ├── jnosql-metamodel-sample │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── eclipse │ │ │ └── jnsoql │ │ │ └── entities │ │ │ ├── Car.java │ │ │ ├── Checkout.java │ │ │ ├── Fruit.java │ │ │ ├── Person.java │ │ │ └── Product.java │ │ └── test │ │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnsoql │ │ └── entities │ │ ├── CarTest.java │ │ ├── CheckoutTest.java │ │ ├── FruitTest.java │ │ └── PersonTest.java └── pom.xml ├── jnosql-tinkerpop-connections ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── eclipse │ │ └── jnosql │ │ └── mapping │ │ └── tinkerpop │ │ └── connections │ │ ├── ArangoDBGraphConfiguration.java │ │ ├── ArangoDBGraphConfigurations.java │ │ ├── JanusGraphConfiguration.java │ │ ├── Neo4JEmbeddedGraphConfiguration.java │ │ ├── Neo4JGraphConfiguration.java │ │ ├── Neo4JGraphConfigurations.java │ │ ├── TitanGraphConfiguration.java │ │ └── package-info.java │ └── test │ └── resources │ └── META-INF │ └── beans.xml ├── pmd └── pmd-rules.xml └── pom.xml /.github/workflows/jakarta-data-tck-runner.yml: -------------------------------------------------------------------------------- 1 | name: Run Jakarta Data TCK 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 1,3,5' #Monday, Wednesday, Friday at Midnight 6 | 7 | #TODO update to run on pull request/merge 8 | #on: 9 | # push: 10 | # branches: [ main ] 11 | # pull_request: 12 | # branches: [ main ] 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | java-version: [17, 21] 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: actions/setup-java@v3 23 | with: 24 | distribution: 'temurin' 25 | java-version: ${{ matrix.java-version }} 26 | cache: maven 27 | - name: Running Jakarta Data TCK tests 28 | # TODO start and stop mongo container 29 | run: mvn test --file jnosql-data-tck-runner/pom.xml 30 | -------------------------------------------------------------------------------- /.github/workflows/jakarta-nosql-tck-runner.yml: -------------------------------------------------------------------------------- 1 | name: Run Jakarta NoSQL TCK 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 1,3,5' #Monday, Wednesday, Friday at Midnight 6 | 7 | #TODO update to run on pull request/merge 8 | #on: 9 | # push: 10 | # branches: [ main ] 11 | # pull_request: 12 | # branches: [ main ] 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | java-version: [17, 21] 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: actions/setup-java@v3 23 | with: 24 | distribution: 'temurin' 25 | java-version: ${{ matrix.java-version }} 26 | cache: maven 27 | - name: Running Jakarta NoSQL TCK tests 28 | # TODO start and stop mongo container 29 | run: mvn test --file jnosql-nosql-tck-runner/pom.xml 30 | -------------------------------------------------------------------------------- /.github/workflows/java-17.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java 17 CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Set up JDK 17 20 | uses: actions/setup-java@v4 21 | with: 22 | distribution: 'temurin' 23 | java-version: 17 24 | - name: Build with Maven 25 | run: mvn -B package --file pom.xml 26 | -------------------------------------------------------------------------------- /.github/workflows/java-21.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java 21 CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Set up JDK 21 20 | uses: actions/setup-java@v4 21 | with: 22 | distribution: 'temurin' 23 | java-version: 21 24 | - name: Build with Maven 25 | run: mvn -B package --file pom.xml 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.idea 10 | *.log 11 | .classpath 12 | -project 13 | /.resourceCache 14 | /.project 15 | /.idea 16 | .settings/ 17 | **/.DS_Store 18 | /.quarkus/ 19 | -------------------------------------------------------------------------------- /jnosql-data-tck-runner/README.adoc: -------------------------------------------------------------------------------- 1 | = Jakarta Data TCK Eclipse JNoSQL Implementation 2 | :toc: auto 3 | 4 | This project runs the Jakarta Data Technology Compatibility Kit (TCK) on standalone mode with Eclipse JNoSQL. Before running this project it is recommended to read the documentation located in the base link:https://github.com/jakartaee/data/blob/main/tck-dist/src/main/asciidoc/data-tck-reference-guide.adoc[TCK distribution project, _target=_blank]. 5 | 6 | == Overview 7 | 8 | This project is configured specifically to allow the feature developers to run the TCK against the Eclipse JNoSQL implementation. 9 | 10 | == Running the TCK for Verification 11 | 12 | First start up a Mongo DB instance. You can do this by running the following command: 13 | 14 | [source,shell] 15 | ---- 16 | docker run -d -p 27017:27017 --name mongodb mongo 17 | ---- 18 | 19 | Then, run the following command to execute the TCK: 20 | 21 | [source,shell] 22 | ---- 23 | mvn clean test -B -Djnosql.document.database=mongo -Djnosql.mongodb.host=localhost:27017 24 | ---- 25 | -------------------------------------------------------------------------------- /jnosql-data-tck-runner/logging.properties: -------------------------------------------------------------------------------- 1 | #Handlers we plan to use 2 | handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler 3 | 4 | #Global logger - By default only log warnings 5 | .level=WARNING 6 | 7 | #Jakarta Data TCK logger - By default log everything for ee.jakarta.tck.data 8 | ee.jakarta.tck.data.level=ALL 9 | 10 | # Arquillian and JNoSQL - By default log everything, might reduce after development is complete. 11 | org.jboss.level=ALL 12 | org.eclipse.jnosql.level=ALL 13 | 14 | #Formatting for the simple formatter 15 | java.util.logging.SimpleFormatter.class.log=true 16 | java.util.logging.SimpleFormatter.class.full=false 17 | java.util.logging.SimpleFormatter.class.length=10 18 | 19 | java.util.logging.SimpleFormatter.level.log=true 20 | 21 | java.util.logging.SimpleFormatter.method.log=true 22 | java.util.logging.SimpleFormatter.method.length=30 23 | 24 | java.util.logging.SimpleFormatter.thread.log=true 25 | java.util.logging.SimpleFormatter.thread.length=3 26 | 27 | java.util.logging.SimpleFormatter.time.log=true 28 | java.util.logging.SimpleFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] 29 | 30 | java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %4$.1s %3$s %5$s %n 31 | 32 | # Log warnings to console 33 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 34 | java.util.logging.ConsoleHandler.level=WARNING 35 | 36 | # Log everything else to file 37 | java.util.logging.FileHandler.pattern=target/DataTCK%g%u.log 38 | java.util.logging.FileHandler.limit = 500000 39 | java.util.logging.FileHandler.count = 5 40 | java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter 41 | java.util.logging.FileHandler.level=CONFIG -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-data-tck-runner/README.adoc: -------------------------------------------------------------------------------- 1 | = Jakarta Data TCK Eclipse JNoSQL Implementation via Jakarta Persistence 2 | :toc: auto 3 | 4 | This project runs the Jakarta Data Technology Compatibility Kit (TCK) on standalone mode with Eclipse JNoSQL with the Jakarta Persistence connector. It uses EclipseLink and Derby DB as an implementation for Jakarta Persistence. Before running this project it is recommended to read the documentation located in the base link:https://github.com/jakartaee/data/blob/main/tck-dist/src/main/asciidoc/data-tck-reference-guide.adoc[TCK distribution project, _target=_blank]. 5 | 6 | == Overview 7 | 8 | This project is configured specifically to allow the feature developers to run the TCK against the Eclipse JNoSQL implementation with the Jakarta Persistence backend. 9 | 10 | == Running the TCK for Verification 11 | 12 | Run the following command to execute the TCK: 13 | 14 | [source,shell] 15 | ---- 16 | mvn clean test -B 17 | ---- 18 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-data-tck-runner/logging.properties: -------------------------------------------------------------------------------- 1 | #Handlers we plan to use 2 | handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler 3 | 4 | #Global logger - By default only log warnings 5 | .level=WARNING 6 | 7 | #Jakarta Data TCK logger - By default log everything for ee.jakarta.tck.data 8 | ee.jakarta.tck.data.level=ALL 9 | 10 | # Arquillian and JNoSQL - By default log everything, might reduce after development is complete. 11 | org.jboss.level=ALL 12 | org.eclipse.jnosql.level=ALL 13 | 14 | #Formatting for the simple formatter 15 | java.util.logging.SimpleFormatter.class.log=true 16 | java.util.logging.SimpleFormatter.class.full=false 17 | java.util.logging.SimpleFormatter.class.length=10 18 | 19 | java.util.logging.SimpleFormatter.level.log=true 20 | 21 | java.util.logging.SimpleFormatter.method.log=true 22 | java.util.logging.SimpleFormatter.method.length=30 23 | 24 | java.util.logging.SimpleFormatter.thread.log=true 25 | java.util.logging.SimpleFormatter.thread.length=3 26 | 27 | java.util.logging.SimpleFormatter.time.log=true 28 | java.util.logging.SimpleFormatter.time.format=[MM/dd/yyyy HH:mm:ss:SSS z] 29 | 30 | java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %4$.1s %3$s %5$s %n 31 | 32 | # Log warnings to console 33 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 34 | java.util.logging.ConsoleHandler.level=WARNING 35 | 36 | # Log everything else to file 37 | java.util.logging.FileHandler.pattern=target/DataTCK%g%u.log 38 | java.util.logging.FileHandler.limit = 500000 39 | java.util.logging.FileHandler.count = 5 40 | java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter 41 | java.util.logging.FileHandler.level=CONFIG -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-data-tck-runner/src/test/java/org/eclipse/jnosql/tck/jakartapersistence/EntityManagerProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Ondro Mihalyi 14 | */ 15 | package org.eclipse.jnosql.tck.jakartapersistence; 16 | 17 | import jakarta.enterprise.context.ApplicationScoped; 18 | import jakarta.enterprise.inject.Disposes; 19 | import jakarta.enterprise.inject.Produces; 20 | import jakarta.persistence.EntityManager; 21 | import jakarta.persistence.Persistence; 22 | 23 | @ApplicationScoped 24 | public class EntityManagerProducer { 25 | @Produces 26 | @ApplicationScoped 27 | public EntityManager createEntityManager() { 28 | return Persistence.createEntityManagerFactory("testPersistenceUnit") 29 | .createEntityManager(); 30 | } 31 | 32 | public void closeEntityManager(@Disposes EntityManager entityManager) { 33 | entityManager.close(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-data-tck-runner/src/test/java/org/eclipse/jnosql/tck/jakartapersistence/JNoSqlSignatureTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Ondro Mihalyi 14 | */ 15 | package org.eclipse.jnosql.tck.jakartapersistence; 16 | 17 | import ee.jakarta.tck.data.standalone.signature.SignatureTests; 18 | 19 | public class JNoSqlSignatureTests extends SignatureTests { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-data-tck-runner/src/test/java/org/eclipse/jnosql/tck/jakartapersistence/TransactionExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Ondro Mihalyi 14 | */ 15 | package org.eclipse.jnosql.tck.jakartapersistence; 16 | 17 | import jakarta.enterprise.inject.spi.CDI; 18 | import jakarta.persistence.EntityManager; 19 | import org.junit.jupiter.api.extension.AfterEachCallback; 20 | import org.junit.jupiter.api.extension.BeforeEachCallback; 21 | import org.junit.jupiter.api.extension.ExtensionContext; 22 | 23 | public class TransactionExtension implements BeforeEachCallback, AfterEachCallback { 24 | 25 | @Override 26 | public void beforeEach(ExtensionContext context) throws Exception { 27 | getEntityManager().getTransaction().begin(); 28 | } 29 | 30 | private static EntityManager getEntityManager() { 31 | return CDI.current().select(EntityManager.class).get(); 32 | } 33 | 34 | @Override 35 | public void afterEach(ExtensionContext context) throws Exception { 36 | getEntityManager().getTransaction().commit(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/README.adoc: -------------------------------------------------------------------------------- 1 | = Eclipse JNoSQL driver implementation for Jakarta Persistence 2 | :toc: auto 3 | 4 | This project provides a driver for Eclipse JNoSQL that supports Jakarta Persistence entities over a Jakarta Persistence provider. -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/main/java/org/eclipse/jnosql/jakartapersistence/mapping/BaseQueryParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 9 | * 10 | * You may elect to redistribute this code under either of these licenses. 11 | * 12 | * Contributors: 13 | * 14 | * Ondro Mihalyi 15 | */ 16 | package org.eclipse.jnosql.jakartapersistence.mapping; 17 | 18 | import jakarta.persistence.EntityManager; 19 | import jakarta.persistence.metamodel.EntityType; 20 | import org.eclipse.jnosql.jakartapersistence.communication.PersistenceDatabaseManager; 21 | 22 | class BaseQueryParser { 23 | 24 | protected final PersistenceDatabaseManager manager; 25 | 26 | protected BaseQueryParser(PersistenceDatabaseManager manager) { 27 | this.manager = manager; 28 | } 29 | 30 | protected EntityType findEntityType(String entityName) { 31 | return manager.findEntityType(entityName); 32 | } 33 | 34 | protected EntityManager entityManager() { 35 | return manager.getEntityManager(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/main/java/org/eclipse/jnosql/jakartapersistence/mapping/repository/JakartaPersistenceRepositoryProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * and Apache License v2.0 which accompanies this distribution. 7 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 8 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 9 | * 10 | * You may elect to redistribute this code under either of these licenses. 11 | * 12 | * Contributors: 13 | * 14 | * Ondro Mihalyi 15 | */ 16 | package org.eclipse.jnosql.jakartapersistence.mapping.repository; 17 | 18 | import java.lang.reflect.Method; 19 | import org.eclipse.jnosql.jakartapersistence.mapping.PersistenceDocumentTemplate; 20 | import org.eclipse.jnosql.mapping.core.Converters; 21 | import org.eclipse.jnosql.mapping.metadata.EntitiesMetadata; 22 | import org.eclipse.jnosql.mapping.semistructured.query.SemiStructuredRepositoryProxy; 23 | 24 | public class JakartaPersistenceRepositoryProxy extends SemiStructuredRepositoryProxy { 25 | 26 | public JakartaPersistenceRepositoryProxy(PersistenceDocumentTemplate template, EntitiesMetadata entities, Class repositoryType, Converters converters) { 27 | super(template, entities, repositoryType, converters); 28 | } 29 | 30 | @Override 31 | protected Object executeCursorPagination(Object instance, Method method, Object[] params) { 32 | // We need to override this because SemiStructuredRepositoryProxy 33 | // expects the semistructured.PreparedStatement template 34 | throw new UnsupportedOperationException("Not supported yet."); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 23 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | # All rights reserved. This program and the accompanying materials 4 | # are made available under the terms of the Eclipse Public License v1.0 5 | # and Apache License v2.0 which accompanies this distribution. 6 | # The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | # and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | # 9 | # You may elect to redistribute this code under either of these licenses. 10 | # 11 | # Contributors: 12 | # 13 | # Ondro Mihalyi 14 | # 15 | org.eclipse.jnosql.jakartapersistence.mapping.spi.JakartaPersistenceExtension -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/test/java/ee/omnifish/jnosql/jakartapersistence/EntityManagerProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Ondro Mihalyi 14 | */ 15 | package ee.omnifish.jnosql.jakartapersistence; 16 | 17 | import jakarta.enterprise.context.ApplicationScoped; 18 | import jakarta.enterprise.inject.Disposes; 19 | import jakarta.enterprise.inject.Produces; 20 | import jakarta.persistence.EntityManager; 21 | import jakarta.persistence.Persistence; 22 | 23 | @ApplicationScoped 24 | public class EntityManagerProducer { 25 | @Produces 26 | @ApplicationScoped 27 | public EntityManager createEntityManager() { 28 | return Persistence.createEntityManagerFactory("testPersistenceUnit") 29 | .createEntityManager(); 30 | } 31 | 32 | public void closeEntityManager(@Disposes EntityManager entityManager) { 33 | entityManager.close(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/jnosql-jakarta-persistence-driver/src/test/java/ee/omnifish/jnosql/jakartapersistence/PersonRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Ondro Mihalyi 14 | */ 15 | package ee.omnifish.jnosql.jakartapersistence; 16 | 17 | import jakarta.data.repository.CrudRepository; 18 | import jakarta.data.repository.Repository; 19 | import java.util.List; 20 | import java.util.Set; 21 | 22 | @Repository 23 | public interface PersonRepository extends CrudRepository { 24 | long countAll(); 25 | long countByNameNotNull(); 26 | List findByNameAndAgeLessThanEqual(String name, long age); 27 | List findByNameIn(Set names); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /jnosql-jakarta-persistence/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | Eclipse JNoSQL Jakarta Persistence Parent 21 | 22 | org.eclipse.jnosql.mapping 23 | jnosql-mapping-extensions 24 | 1.1.5--SNAPSHOT 25 | 26 | jnosql-jakarta-persistence-parent 27 | pom 28 | 29 | jnosql-jakarta-persistence-driver 30 | jnosql-jakarta-persistence-data-tck-runner 31 | 32 | -------------------------------------------------------------------------------- /jnosql-lite/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/README.adoc: -------------------------------------------------------------------------------- 1 | = JNoSQL Lite implementation 2 | :toc: auto 3 | 4 | An experimental implementation that uses Java Annotation Processing instead of Reflection. 5 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ContactType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | public enum ContactType { 18 | MOBILE, PHONE, EMAIL 19 | } 20 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Download.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity("download") 22 | public class Download { 23 | 24 | @Id 25 | private Long id; 26 | 27 | @Column 28 | private byte[] contents; 29 | 30 | public Long getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | public byte[] getContents() { 39 | if(contents != null) { 40 | byte[] copiedArray = new byte[contents.length]; 41 | System.arraycopy(contents, 0, copiedArray, 0, contents.length); 42 | return copiedArray; 43 | } 44 | return new byte[0]; 45 | } 46 | 47 | public void setContents(byte[] contents) { 48 | if(contents != null) { 49 | this.contents = new byte[contents.length]; 50 | System.arraycopy(contents, 0, this.contents, 0, contents.length); 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Embeddable; 20 | 21 | import java.util.Objects; 22 | 23 | @Embeddable 24 | public class Job { 25 | 26 | @Column 27 | private String description; 28 | 29 | @Column 30 | private String city; 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public String getCity() { 41 | return city; 42 | } 43 | 44 | public void setCity(String city) { 45 | this.city = city; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) { 51 | return true; 52 | } 53 | if (o == null || getClass() != o.getClass()) { 54 | return false; 55 | } 56 | Job job = (Job) o; 57 | return Objects.equals(description, job.description); 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Objects.hashCode(description); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.AttributeConverter; 19 | 20 | public class MoneyConverter implements AttributeConverter { 21 | 22 | 23 | @Override 24 | public String convertToDatabaseColumn(Money attribute) { 25 | return attribute.toString(); 26 | } 27 | 28 | @Override 29 | public Money convertToEntityAttribute(String dbData) { 30 | return Money.parse(dbData); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PersonBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import java.util.List; 18 | 19 | public class PersonBuilder { 20 | private long id; 21 | private String name; 22 | private int age; 23 | private List phones; 24 | private String ignore; 25 | 26 | public PersonBuilder withId(long id) { 27 | this.id = id; 28 | return this; 29 | } 30 | 31 | public PersonBuilder withName(String name) { 32 | this.name = name; 33 | return this; 34 | } 35 | 36 | public PersonBuilder withAge() { 37 | this.age = 10; 38 | return this; 39 | } 40 | 41 | public PersonBuilder withAge(int age) { 42 | this.age = age; 43 | return this; 44 | } 45 | 46 | 47 | public PersonBuilder withPhones(List phones) { 48 | this.phones = phones; 49 | return this; 50 | } 51 | 52 | public PersonBuilder withIgnore() { 53 | this.ignore = "Just Ignore"; 54 | return this; 55 | } 56 | 57 | public Person build() { 58 | return new Person(id, name, age, phones, ignore); 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PersonCrudRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Maximillian Arruda 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.data.repository.Param; 18 | import jakarta.data.repository.Query; 19 | import jakarta.data.repository.Repository; 20 | import org.eclipse.jnosql.mapping.NoSQLRepository; 21 | 22 | import java.util.List; 23 | 24 | @Repository 25 | public interface PersonCrudRepository extends NoSQLRepository { 26 | 27 | List findByName(String name); 28 | 29 | @Query("select * from Person where name = @name") 30 | List query(@Param("name") String name); 31 | 32 | boolean existsByName(String name); 33 | 34 | long countByName(String name); 35 | 36 | void deleteByName(String name); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/UserScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | @Entity 26 | public class UserScope { 27 | 28 | @Id 29 | private String userName; 30 | 31 | @Column("scope") 32 | private String scope; 33 | 34 | @Column("properties") 35 | private Map properties = new HashMap<>(); 36 | 37 | public String getUserName() { 38 | return userName; 39 | } 40 | 41 | public String getScope() { 42 | return scope; 43 | } 44 | 45 | public Map getProperties() { 46 | return properties; 47 | } 48 | 49 | public void setUserName(String userName) { 50 | this.userName = userName; 51 | } 52 | 53 | public void setScope(String scope) { 54 | this.scope = scope; 55 | } 56 | 57 | public void setProperties(Map properties) { 58 | this.properties = properties; 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Vendor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.Collections; 22 | import java.util.Set; 23 | 24 | @Entity("vendors") 25 | public class Vendor { 26 | 27 | @Id 28 | private String name; 29 | 30 | @Column 31 | private Set prefixes; 32 | 33 | Vendor() { 34 | } 35 | 36 | public Vendor(String name) { 37 | this.name = name; 38 | prefixes = Collections.emptySet(); 39 | } 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(String name) { 46 | this.name = name; 47 | } 48 | 49 | public Set getPrefixes() { 50 | return prefixes; 51 | } 52 | 53 | public void setPrefixes(Set prefixes) { 54 | this.prefixes = prefixes; 55 | } 56 | 57 | public void add(String prefix) { 58 | this.prefixes.add(prefix); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Worker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Convert; 21 | 22 | @Entity 23 | public class Worker { 24 | 25 | @Column 26 | private String name; 27 | 28 | @Column 29 | private Job job; 30 | 31 | @Column("money") 32 | @Convert(MoneyConverter.class) 33 | private Money salary; 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public Job getJob() { 44 | return job; 45 | } 46 | 47 | public void setJob(Job job) { 48 | this.job = job; 49 | } 50 | 51 | public Money getSalary() { 52 | return salary; 53 | } 54 | 55 | public void setSalary(Money salary) { 56 | this.salary = salary; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ZipCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | @Entity 21 | public class ZipCode { 22 | 23 | @Column 24 | private String zip; 25 | 26 | @Column 27 | private String plusFour; 28 | 29 | 30 | public String getZip() { 31 | return zip; 32 | } 33 | 34 | public void setZip(String zip) { 35 | this.zip = zip; 36 | } 37 | 38 | public String getPlusFour() { 39 | return plusFour; 40 | } 41 | 42 | public void setPlusFour(String plusFour) { 43 | this.plusFour = plusFour; 44 | } 45 | 46 | 47 | @Override 48 | public String toString() { 49 | return "ZipCode{" + "zip='" + zip + '\'' + 50 | ", plusFour='" + plusFour + '\'' + 51 | '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/EmailNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Email") 24 | public class EmailNotification extends Notification { 25 | 26 | @Column 27 | private String email; 28 | 29 | public String getEmail() { 30 | return email; 31 | } 32 | 33 | public void setEmail(String email) { 34 | this.email = email; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to email sms to the email: " + email; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/LargeProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | import java.math.BigDecimal; 23 | 24 | @Entity 25 | @DiscriminatorValue("Large") 26 | public class LargeProject extends Project { 27 | 28 | @Column 29 | private BigDecimal budget; 30 | 31 | public void setBudget(BigDecimal budget) { 32 | this.budget = budget; 33 | } 34 | 35 | public BigDecimal getBudget() { 36 | return budget; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmallProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Small") 24 | public class SmallProject extends Project { 25 | 26 | @Column 27 | private String investor; 28 | 29 | public String getInvestor() { 30 | return investor; 31 | } 32 | 33 | public void setInvestor(String investor) { 34 | this.investor = investor; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmsNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("SMS") 24 | public class SmsNotification extends Notification { 25 | 26 | @Column 27 | private String phone; 28 | 29 | public String getPhone() { 30 | return phone; 31 | } 32 | 33 | public void setPhone(String phone) { 34 | this.phone = phone; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to via sms to the phone: " + phone; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SocialMediaNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | public class SocialMediaNotification extends Notification { 23 | 24 | @Column 25 | private String nickname; 26 | 27 | public String getNickname() { 28 | return nickname; 29 | } 30 | 31 | public void setNickname(String nickname) { 32 | this.nickname = nickname; 33 | } 34 | 35 | @Override 36 | public String send() { 37 | return "Sending message to via social media to the nickname: " + nickname; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Guest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | import java.util.List; 21 | 22 | @Embeddable 23 | public record Guest(@Column String name, @Column String document, @Column List phones) { 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Hotel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Hotel(@Id String number, @Column HotelManager manager) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/HotelManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | @Embeddable(Embeddable.EmbeddableType.GROUPING) 21 | public record HotelManager(@Column String name, @Column String document) { 22 | } 23 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-column-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Room.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Room(@Id int number, @Column Guest guest) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/pom.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 18 | 4.0.0 19 | 20 | 21 | org.eclipse.jnosql.lite 22 | jnosql-lite-parent 23 | 1.1.9-SNAPSHOT 24 | 25 | 26 | mapping-lite-core-test 27 | jar 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.eclipse.jnosql.lite 35 | mapping-lite-processor 36 | ${project.version} 37 | provided 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Actor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | 19 | import jakarta.nosql.Column; 20 | import jakarta.nosql.Entity; 21 | 22 | import java.util.Map; 23 | 24 | 25 | @Entity 26 | public class Actor extends Person { 27 | 28 | @Column 29 | private Map movieCharacter; 30 | 31 | 32 | Actor() { 33 | } 34 | 35 | public Map getMovieCharacter() { 36 | return movieCharacter; 37 | } 38 | 39 | public void setMovieCharacter(Map movieCharacter) { 40 | this.movieCharacter = movieCharacter; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity("car") 22 | public class Car { 23 | 24 | @Id 25 | private String name; 26 | 27 | @Column 28 | private String model; 29 | 30 | Car() { 31 | } 32 | 33 | 34 | String getName() { 35 | return name; 36 | } 37 | 38 | void setName(String name) { 39 | this.name = name; 40 | } 41 | 42 | protected String getModel() { 43 | return model; 44 | } 45 | 46 | protected void setModel(String model) { 47 | this.model = model; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Computer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.List; 22 | 23 | @Entity 24 | public class Computer { 25 | 26 | 27 | @Id 28 | private String id; 29 | 30 | @Column 31 | private ComputerAddress address; 32 | 33 | @Column 34 | private List users; 35 | 36 | 37 | public String getId() { 38 | return id; 39 | } 40 | 41 | public void setId(String id) { 42 | this.id = id; 43 | } 44 | 45 | public ComputerAddress getAddress() { 46 | return address; 47 | } 48 | 49 | public void setAddress(ComputerAddress address) { 50 | this.address = address; 51 | } 52 | 53 | public List getUsers() { 54 | return users; 55 | } 56 | 57 | public void setUsers(List users) { 58 | this.users = users; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ComputerAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | @Embeddable 21 | public class ComputerAddress { 22 | 23 | @Column 24 | private String city; 25 | 26 | @Column 27 | private String country; 28 | 29 | public String getCity() { 30 | return city; 31 | } 32 | 33 | public void setCity(String city) { 34 | this.city = city; 35 | } 36 | 37 | public String getCountry() { 38 | return country; 39 | } 40 | 41 | public void setCountry(String country) { 42 | this.country = country; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/CustomAnnotation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) 19 | @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) 20 | public @interface CustomAnnotation { 21 | 22 | String value(); 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Director.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Embeddable; 18 | 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | @Embeddable 23 | public class Director { 24 | 25 | private String name; 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Director{" + 38 | "name='" + name + '\'' + 39 | '}'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Money.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import java.math.BigDecimal; 18 | 19 | public record Money(String currency, BigDecimal bigDecimal) { 20 | 21 | public static Money of(String dbData) { 22 | String[] values = dbData.split(" "); 23 | String currency = values[0]; 24 | BigDecimal value = BigDecimal.valueOf(Double.parseDouble(values[1])); 25 | return new Money(currency, value); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return currency + " " + bigDecimal.toString(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.AttributeConverter; 18 | 19 | import java.util.Objects; 20 | 21 | public class MoneyConverter implements AttributeConverter { 22 | @Override 23 | public String convertToDatabaseColumn(Money attribute) { 24 | if (Objects.nonNull(attribute)) { 25 | return attribute.toString(); 26 | } 27 | return null; 28 | } 29 | 30 | @Override 31 | public Money convertToEntityAttribute(String dbData) { 32 | if (Objects.nonNull(dbData)) { 33 | return Money.of(dbData); 34 | } 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Movie.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | @Entity 21 | public class Movie { 22 | 23 | @Column 24 | private String title; 25 | 26 | @Column 27 | private Director director; 28 | 29 | public String getTitle() { 30 | return title; 31 | } 32 | 33 | public void setTitle(String title) { 34 | this.title = title; 35 | } 36 | 37 | public Director getDirector() { 38 | return director; 39 | } 40 | 41 | public void setDirector(Director director) { 42 | this.director = director; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "Movie{" + 48 | "title='" + title + '\'' + 49 | ", director=" + director + 50 | '}'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public class Order { 23 | 24 | @Id 25 | private String id; 26 | 27 | @Column 28 | private String[] users; 29 | 30 | @Column 31 | private Product[] products; 32 | 33 | public String getId() { 34 | return id; 35 | } 36 | 37 | public void setId(String id) { 38 | this.id = id; 39 | } 40 | 41 | public String[] getUsers() { 42 | return users; 43 | } 44 | 45 | public void setUsers(String[] users) { 46 | this.users = users; 47 | } 48 | 49 | public Product[] getProducts() { 50 | return products; 51 | } 52 | 53 | public void setProducts(Product[] products) { 54 | this.products = products; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Orders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | import java.util.List; 21 | import java.util.Objects; 22 | 23 | @Entity 24 | public class Orders { 25 | 26 | @Column 27 | private String user; 28 | 29 | @Column 30 | private List items; 31 | 32 | public String getUser() { 33 | return user; 34 | } 35 | 36 | public void setUser(String user) { 37 | this.user = user; 38 | } 39 | 40 | public List getItems() { 41 | return items; 42 | } 43 | 44 | public void setItems(List items) { 45 | this.items = items; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) { 51 | return true; 52 | } 53 | if (o == null || getClass() != o.getClass()) { 54 | return false; 55 | } 56 | Orders that = (Orders) o; 57 | return Objects.equals(user, that.user); 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Objects.hashCode(user); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Convert; 20 | 21 | @Entity 22 | public class Product { 23 | 24 | @Column 25 | private String name; 26 | 27 | @Column 28 | @Convert(MoneyConverter.class) 29 | private Money value; 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public Money getValue() { 40 | return value; 41 | } 42 | 43 | public void setValue(Money value) { 44 | this.value = value; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.List; 22 | 23 | 24 | @Entity 25 | public class User { 26 | 27 | @Id 28 | private long id; 29 | 30 | @Column 31 | private String name; 32 | 33 | @Column 34 | private int age; 35 | 36 | @Column 37 | private List phones; 38 | 39 | 40 | public long getId() { 41 | return id; 42 | } 43 | 44 | public void setId(long id) { 45 | this.id = id; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | 56 | public int getAge() { 57 | return age; 58 | } 59 | 60 | public void setAge(int age) { 61 | this.age = age; 62 | } 63 | 64 | public List getPhones() { 65 | return phones; 66 | } 67 | 68 | public void setPhones(List phones) { 69 | this.phones = phones; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Worker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Entity; 18 | 19 | import jakarta.nosql.Column; 20 | import jakarta.nosql.Convert; 21 | 22 | @Entity 23 | public class Worker extends Person { 24 | 25 | @Column 26 | @Convert(MoneyConverter.class) 27 | private Money salary; 28 | 29 | public Money getSalary() { 30 | return salary; 31 | } 32 | 33 | public void setSalary(Money salary) { 34 | this.salary = salary; 35 | } 36 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/EmailNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.DiscriminatorValue; 20 | 21 | import jakarta.nosql.Entity; 22 | 23 | @Entity 24 | @DiscriminatorValue("Email") 25 | public class EmailNotification extends Notification { 26 | 27 | @Column 28 | private String email; 29 | 30 | public String getEmail() { 31 | return email; 32 | } 33 | 34 | public void setEmail(String email) { 35 | this.email = email; 36 | } 37 | 38 | @Override 39 | public String send() { 40 | return "Sending message to email sms to the email: " + email; 41 | } 42 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/LargeProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.DiscriminatorValue; 19 | import jakarta.nosql.Entity; 20 | 21 | import java.math.BigDecimal; 22 | 23 | @Entity 24 | @DiscriminatorValue("Large") 25 | public class LargeProject extends Project { 26 | 27 | @Column 28 | private BigDecimal budget; 29 | 30 | public void setBudget(BigDecimal budget) { 31 | this.budget = budget; 32 | } 33 | 34 | public BigDecimal getBudget() { 35 | return budget; 36 | } 37 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmallProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.DiscriminatorValue; 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | @DiscriminatorValue("Small") 23 | public class SmallProject extends Project { 24 | 25 | @Column 26 | private String investor; 27 | 28 | public String getInvestor() { 29 | return investor; 30 | } 31 | 32 | public void setInvestor(String investor) { 33 | this.investor = investor; 34 | } 35 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmsNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.DiscriminatorValue; 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | @DiscriminatorValue("SMS") 23 | public class SmsNotification extends Notification { 24 | 25 | @Column 26 | private String phone; 27 | 28 | public String getPhone() { 29 | return phone; 30 | } 31 | 32 | public void setPhone(String phone) { 33 | this.phone = phone; 34 | } 35 | 36 | @Override 37 | public String send() { 38 | return "Sending message to via sms to the phone: " + phone; 39 | } 40 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SocialMediaNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | @Entity 21 | public class SocialMediaNotification extends Notification { 22 | 23 | @Column 24 | private String nickname; 25 | 26 | public String getNickname() { 27 | return nickname; 28 | } 29 | 30 | public void setNickname(String nickname) { 31 | this.nickname = nickname; 32 | } 33 | 34 | @Override 35 | public String send() { 36 | return "Sending message to via social media to the nickname: " + nickname; 37 | } 38 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Apartment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.List; 22 | 23 | @Entity 24 | public record Apartment(@Id Long id, @Column List guests) { 25 | } 26 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Building.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.Map; 22 | 23 | @Entity 24 | public record Building(@Id Long id, @Column Map guests) { 25 | } 26 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/DocumentRecord.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Convert; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | import org.eclipse.jnosql.lite.mapping.entities.Money; 22 | import org.eclipse.jnosql.lite.mapping.entities.MoneyConverter; 23 | 24 | import java.util.Map; 25 | 26 | @Entity 27 | public record DocumentRecord(@Id String id, @Column Map data, @Column @Convert(MoneyConverter.class) Money money) { 28 | } 29 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Guest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | import java.util.List; 21 | 22 | @Embeddable 23 | public record Guest(@Column String name, @Column String document, @Column List phones) { 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Hotel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.Map; 22 | 23 | @Entity 24 | public record Hotel(@Id String document, @Column Map socialMedias, @Column String[] cities) { 25 | } 26 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/House.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record House(@Id Long id, @Column Guest[] guest) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-core-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Room.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Room(@Id int number, @Column Guest guest) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ContactType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | public enum ContactType { 18 | MOBILE, PHONE, EMAIL 19 | } 20 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Download.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity("download") 22 | public class Download { 23 | 24 | @Id 25 | private Long id; 26 | 27 | @Column 28 | private byte[] contents; 29 | 30 | public Long getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | public byte[] getContents() { 39 | if(contents != null) { 40 | byte[] copiedArray = new byte[contents.length]; 41 | System.arraycopy(contents, 0, copiedArray, 0, contents.length); 42 | return copiedArray; 43 | } 44 | return new byte[0]; 45 | } 46 | 47 | public void setContents(byte[] contents) { 48 | if(contents != null) { 49 | this.contents = new byte[contents.length]; 50 | System.arraycopy(contents, 0, this.contents, 0, contents.length); 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Embeddable; 20 | 21 | import java.util.Objects; 22 | 23 | @Embeddable 24 | public class Job { 25 | 26 | @Column 27 | private String description; 28 | 29 | @Column 30 | private String city; 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public String getCity() { 41 | return city; 42 | } 43 | 44 | public void setCity(String city) { 45 | this.city = city; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) { 51 | return true; 52 | } 53 | if (o == null || getClass() != o.getClass()) { 54 | return false; 55 | } 56 | Job job = (Job) o; 57 | return Objects.equals(description, job.description); 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Objects.hashCode(description); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.AttributeConverter; 19 | 20 | public class MoneyConverter implements AttributeConverter { 21 | 22 | 23 | @Override 24 | public String convertToDatabaseColumn(Money attribute) { 25 | return attribute.toString(); 26 | } 27 | 28 | @Override 29 | public Money convertToEntityAttribute(String dbData) { 30 | return Money.parse(dbData); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PersonBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import java.util.List; 18 | 19 | public class PersonBuilder { 20 | private long id; 21 | private String name; 22 | private int age; 23 | private List phones; 24 | private String ignore; 25 | 26 | public PersonBuilder withId(long id) { 27 | this.id = id; 28 | return this; 29 | } 30 | 31 | public PersonBuilder withName(String name) { 32 | this.name = name; 33 | return this; 34 | } 35 | 36 | public PersonBuilder withAge() { 37 | this.age = 10; 38 | return this; 39 | } 40 | 41 | public PersonBuilder withAge(int age) { 42 | this.age = age; 43 | return this; 44 | } 45 | 46 | 47 | public PersonBuilder withPhones(List phones) { 48 | this.phones = phones; 49 | return this; 50 | } 51 | 52 | public PersonBuilder withIgnore() { 53 | this.ignore = "Just Ignore"; 54 | return this; 55 | } 56 | 57 | public Person build() { 58 | return new Person(id, name, age, phones, ignore); 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/UserScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | @Entity 26 | public class UserScope { 27 | 28 | @Id 29 | private String userName; 30 | 31 | @Column("scope") 32 | private String scope; 33 | 34 | @Column("properties") 35 | private Map properties = new HashMap<>(); 36 | 37 | public String getUserName() { 38 | return userName; 39 | } 40 | 41 | public String getScope() { 42 | return scope; 43 | } 44 | 45 | public Map getProperties() { 46 | return properties; 47 | } 48 | 49 | public void setUserName(String userName) { 50 | this.userName = userName; 51 | } 52 | 53 | public void setScope(String scope) { 54 | this.scope = scope; 55 | } 56 | 57 | public void setProperties(Map properties) { 58 | this.properties = properties; 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Vendor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.Collections; 22 | import java.util.Set; 23 | 24 | @Entity("vendors") 25 | public class Vendor { 26 | 27 | @Id 28 | private String name; 29 | 30 | @Column 31 | private Set prefixes; 32 | 33 | Vendor() { 34 | } 35 | 36 | public Vendor(String name) { 37 | this.name = name; 38 | prefixes = Collections.emptySet(); 39 | } 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(String name) { 46 | this.name = name; 47 | } 48 | 49 | public Set getPrefixes() { 50 | return prefixes; 51 | } 52 | 53 | public void setPrefixes(Set prefixes) { 54 | this.prefixes = prefixes; 55 | } 56 | 57 | public void add(String prefix) { 58 | this.prefixes.add(prefix); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Worker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Convert; 21 | 22 | @Entity 23 | public class Worker { 24 | 25 | @Column 26 | private String name; 27 | 28 | @Column 29 | private Job job; 30 | 31 | @Column("money") 32 | @Convert(MoneyConverter.class) 33 | private Money salary; 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public Job getJob() { 44 | return job; 45 | } 46 | 47 | public void setJob(Job job) { 48 | this.job = job; 49 | } 50 | 51 | public Money getSalary() { 52 | return salary; 53 | } 54 | 55 | public void setSalary(Money salary) { 56 | this.salary = salary; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ZipCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | @Entity 21 | public class ZipCode { 22 | 23 | @Column 24 | private String zip; 25 | 26 | @Column 27 | private String plusFour; 28 | 29 | 30 | public String getZip() { 31 | return zip; 32 | } 33 | 34 | public void setZip(String zip) { 35 | this.zip = zip; 36 | } 37 | 38 | public String getPlusFour() { 39 | return plusFour; 40 | } 41 | 42 | public void setPlusFour(String plusFour) { 43 | this.plusFour = plusFour; 44 | } 45 | 46 | 47 | @Override 48 | public String toString() { 49 | return "ZipCode{" + "zip='" + zip + '\'' + 50 | ", plusFour='" + plusFour + '\'' + 51 | '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/EmailNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Email") 24 | public class EmailNotification extends Notification { 25 | 26 | @Column 27 | private String email; 28 | 29 | public String getEmail() { 30 | return email; 31 | } 32 | 33 | public void setEmail(String email) { 34 | this.email = email; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to email sms to the email: " + email; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/LargeProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | import java.math.BigDecimal; 23 | 24 | @Entity 25 | @DiscriminatorValue("Large") 26 | public class LargeProject extends Project { 27 | 28 | @Column 29 | private BigDecimal budget; 30 | 31 | public void setBudget(BigDecimal budget) { 32 | this.budget = budget; 33 | } 34 | 35 | public BigDecimal getBudget() { 36 | return budget; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmallProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Small") 24 | public class SmallProject extends Project { 25 | 26 | @Column 27 | private String investor; 28 | 29 | public String getInvestor() { 30 | return investor; 31 | } 32 | 33 | public void setInvestor(String investor) { 34 | this.investor = investor; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmsNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("SMS") 24 | public class SmsNotification extends Notification { 25 | 26 | @Column 27 | private String phone; 28 | 29 | public String getPhone() { 30 | return phone; 31 | } 32 | 33 | public void setPhone(String phone) { 34 | this.phone = phone; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to via sms to the phone: " + phone; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SocialMediaNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | public class SocialMediaNotification extends Notification { 23 | 24 | @Column 25 | private String nickname; 26 | 27 | public String getNickname() { 28 | return nickname; 29 | } 30 | 31 | public void setNickname(String nickname) { 32 | this.nickname = nickname; 33 | } 34 | 35 | @Override 36 | public String send() { 37 | return "Sending message to via social media to the nickname: " + nickname; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Guest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | import java.util.List; 21 | 22 | @Embeddable 23 | public record Guest(@Column String name, @Column String document, @Column List phones) { 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Hotel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Hotel(@Id String number, @Column HotelManager manager) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/HotelManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | @Embeddable(Embeddable.EmbeddableType.GROUPING) 21 | public record HotelManager(@Column String name, @Column String document) { 22 | } 23 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-document-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Room.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Room(@Id int number, @Column Guest guest) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ContactType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | public enum ContactType { 18 | MOBILE, PHONE, EMAIL 19 | } 20 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Download.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity("download") 22 | public class Download { 23 | 24 | @Id 25 | private Long id; 26 | 27 | @Column 28 | private byte[] contents; 29 | 30 | public Long getId() { 31 | return id; 32 | } 33 | 34 | public void setId(Long id) { 35 | this.id = id; 36 | } 37 | 38 | public byte[] getContents() { 39 | if(contents != null) { 40 | byte[] copiedArray = new byte[contents.length]; 41 | System.arraycopy(contents, 0, copiedArray, 0, contents.length); 42 | return copiedArray; 43 | } 44 | return new byte[0]; 45 | } 46 | 47 | public void setContents(byte[] contents) { 48 | if(contents != null) { 49 | this.contents = new byte[contents.length]; 50 | System.arraycopy(contents, 0, this.contents, 0, contents.length); 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Job.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Embeddable; 20 | 21 | import java.util.Objects; 22 | 23 | @Embeddable 24 | public class Job { 25 | 26 | @Column 27 | private String description; 28 | 29 | @Column 30 | private String city; 31 | 32 | public String getDescription() { 33 | return description; 34 | } 35 | 36 | public void setDescription(String description) { 37 | this.description = description; 38 | } 39 | 40 | public String getCity() { 41 | return city; 42 | } 43 | 44 | public void setCity(String city) { 45 | this.city = city; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) { 51 | return true; 52 | } 53 | if (o == null || getClass() != o.getClass()) { 54 | return false; 55 | } 56 | Job job = (Job) o; 57 | return Objects.equals(description, job.description); 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Objects.hashCode(description); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.AttributeConverter; 19 | 20 | public class MoneyConverter implements AttributeConverter { 21 | 22 | 23 | @Override 24 | public String convertToDatabaseColumn(Money attribute) { 25 | return attribute.toString(); 26 | } 27 | 28 | @Override 29 | public Money convertToEntityAttribute(String dbData) { 30 | return Money.parse(dbData); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PersonBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import java.util.List; 18 | 19 | public class PersonBuilder { 20 | private long id; 21 | private String name; 22 | private int age; 23 | private List phones; 24 | private String ignore; 25 | 26 | public PersonBuilder withId(long id) { 27 | this.id = id; 28 | return this; 29 | } 30 | 31 | public PersonBuilder withName(String name) { 32 | this.name = name; 33 | return this; 34 | } 35 | 36 | public PersonBuilder withAge() { 37 | this.age = 10; 38 | return this; 39 | } 40 | 41 | public PersonBuilder withAge(int age) { 42 | this.age = age; 43 | return this; 44 | } 45 | 46 | 47 | public PersonBuilder withPhones(List phones) { 48 | this.phones = phones; 49 | return this; 50 | } 51 | 52 | public PersonBuilder withIgnore() { 53 | this.ignore = "Just Ignore"; 54 | return this; 55 | } 56 | 57 | public Person build() { 58 | return new Person(id, name, age, phones, ignore); 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/UserScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | @Entity 26 | public class UserScope { 27 | 28 | @Id 29 | private String userName; 30 | 31 | @Column("scope") 32 | private String scope; 33 | 34 | @Column("properties") 35 | private Map properties = new HashMap<>(); 36 | 37 | public String getUserName() { 38 | return userName; 39 | } 40 | 41 | public String getScope() { 42 | return scope; 43 | } 44 | 45 | public Map getProperties() { 46 | return properties; 47 | } 48 | 49 | public void setUserName(String userName) { 50 | this.userName = userName; 51 | } 52 | 53 | public void setScope(String scope) { 54 | this.scope = scope; 55 | } 56 | 57 | public void setProperties(Map properties) { 58 | this.properties = properties; 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Vendor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | import java.util.Collections; 22 | import java.util.Set; 23 | 24 | @Entity("vendors") 25 | public class Vendor { 26 | 27 | @Id 28 | private String name; 29 | 30 | @Column 31 | private Set prefixes; 32 | 33 | Vendor() { 34 | } 35 | 36 | public Vendor(String name) { 37 | this.name = name; 38 | prefixes = Collections.emptySet(); 39 | } 40 | 41 | public String getName() { 42 | return name; 43 | } 44 | 45 | public void setName(String name) { 46 | this.name = name; 47 | } 48 | 49 | public Set getPrefixes() { 50 | return prefixes; 51 | } 52 | 53 | public void setPrefixes(Set prefixes) { 54 | this.prefixes = prefixes; 55 | } 56 | 57 | public void add(String prefix) { 58 | this.prefixes.add(prefix); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Worker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Convert; 21 | 22 | @Entity 23 | public class Worker { 24 | 25 | @Column 26 | private String name; 27 | 28 | @Column 29 | private Job job; 30 | 31 | @Column("money") 32 | @Convert(MoneyConverter.class) 33 | private Money salary; 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public Job getJob() { 44 | return job; 45 | } 46 | 47 | public void setJob(Job job) { 48 | this.job = job; 49 | } 50 | 51 | public Money getSalary() { 52 | return salary; 53 | } 54 | 55 | public void setSalary(Money salary) { 56 | this.salary = salary; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/ZipCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | 20 | @Entity 21 | public class ZipCode { 22 | 23 | @Column 24 | private String zip; 25 | 26 | @Column 27 | private String plusFour; 28 | 29 | 30 | public String getZip() { 31 | return zip; 32 | } 33 | 34 | public void setZip(String zip) { 35 | this.zip = zip; 36 | } 37 | 38 | public String getPlusFour() { 39 | return plusFour; 40 | } 41 | 42 | public void setPlusFour(String plusFour) { 43 | this.plusFour = plusFour; 44 | } 45 | 46 | 47 | @Override 48 | public String toString() { 49 | return "ZipCode{" + "zip='" + zip + '\'' + 50 | ", plusFour='" + plusFour + '\'' + 51 | '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/EmailNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Email") 24 | public class EmailNotification extends Notification { 25 | 26 | @Column 27 | private String email; 28 | 29 | public String getEmail() { 30 | return email; 31 | } 32 | 33 | public void setEmail(String email) { 34 | this.email = email; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to email sms to the email: " + email; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/LargeProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | import java.math.BigDecimal; 23 | 24 | @Entity 25 | @DiscriminatorValue("Large") 26 | public class LargeProject extends Project { 27 | 28 | @Column 29 | private BigDecimal budget; 30 | 31 | public void setBudget(BigDecimal budget) { 32 | this.budget = budget; 33 | } 34 | 35 | public BigDecimal getBudget() { 36 | return budget; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmallProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("Small") 24 | public class SmallProject extends Project { 25 | 26 | @Column 27 | private String investor; 28 | 29 | public String getInvestor() { 30 | return investor; 31 | } 32 | 33 | public void setInvestor(String investor) { 34 | this.investor = investor; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SmsNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.DiscriminatorValue; 21 | 22 | @Entity 23 | @DiscriminatorValue("SMS") 24 | public class SmsNotification extends Notification { 25 | 26 | @Column 27 | private String phone; 28 | 29 | public String getPhone() { 30 | return phone; 31 | } 32 | 33 | public void setPhone(String phone) { 34 | this.phone = phone; 35 | } 36 | 37 | @Override 38 | public String send() { 39 | return "Sending message to via sms to the phone: " + phone; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/inheritance/SocialMediaNotification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | 16 | package org.eclipse.jnosql.lite.mapping.entities.inheritance; 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | 21 | @Entity 22 | public class SocialMediaNotification extends Notification { 23 | 24 | @Column 25 | private String nickname; 26 | 27 | public String getNickname() { 28 | return nickname; 29 | } 30 | 31 | public void setNickname(String nickname) { 32 | this.nickname = nickname; 33 | } 34 | 35 | @Override 36 | public String send() { 37 | return "Sending message to via social media to the nickname: " + nickname; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Guest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | import java.util.List; 21 | 22 | @Embeddable 23 | public record Guest(@Column String name, @Column String document, @Column List phones) { 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Hotel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Hotel(@Id String number, @Column HotelManager manager) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/HotelManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | @Embeddable(Embeddable.EmbeddableType.GROUPING) 21 | public record HotelManager(@Column String name, @Column String document) { 22 | } 23 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-graph-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/record/Room.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities.record; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public record Room(@Id int number, @Column Guest guest) { 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.nosql.Entity; 18 | import jakarta.nosql.Id; 19 | import jakarta.nosql.Convert; 20 | 21 | @Entity 22 | public class Car { 23 | 24 | @Id 25 | @Convert(PlateConverter.class) 26 | private Plate plate; 27 | 28 | private String name; 29 | 30 | 31 | public Plate getPlate() { 32 | return plate; 33 | } 34 | 35 | public void setPlate(Plate plate) { 36 | this.plate = plate; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "Car{" + 50 | "plate=" + plate + 51 | ", name='" + name + '\'' + 52 | '}'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/MoneyConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.AttributeConverter; 19 | 20 | public class MoneyConverter implements AttributeConverter { 21 | 22 | 23 | @Override 24 | public String convertToDatabaseColumn(Money attribute) { 25 | return attribute.toString(); 26 | } 27 | 28 | @Override 29 | public Money convertToEntityAttribute(String dbData) { 30 | return Money.parse(dbData); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PersonBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import java.util.List; 18 | 19 | public class PersonBuilder { 20 | private long id; 21 | private String name; 22 | private int age; 23 | private List phones; 24 | private String ignore; 25 | 26 | public PersonBuilder withId(long id) { 27 | this.id = id; 28 | return this; 29 | } 30 | 31 | public PersonBuilder withName(String name) { 32 | this.name = name; 33 | return this; 34 | } 35 | 36 | public PersonBuilder withAge() { 37 | this.age = 10; 38 | return this; 39 | } 40 | 41 | public PersonBuilder withAge(int age) { 42 | this.age = age; 43 | return this; 44 | } 45 | 46 | 47 | public PersonBuilder withPhones(List phones) { 48 | this.phones = phones; 49 | return this; 50 | } 51 | 52 | public PersonBuilder withIgnore() { 53 | this.ignore = "Just Ignore"; 54 | return this; 55 | } 56 | 57 | public Person build() { 58 | return new Person(id, name, age, phones, ignore); 59 | } 60 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/PlateConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.AttributeConverter; 19 | 20 | public class PlateConverter implements AttributeConverter { 21 | 22 | @Override 23 | public String convertToDatabaseColumn(Plate attribute) { 24 | return attribute.toString(); 25 | } 26 | 27 | @Override 28 | public Plate convertToEntityAttribute(String dbData) { 29 | return Plate.of(dbData); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/UserCrudRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Maximillian Arruda 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.data.repository.CrudRepository; 18 | import jakarta.data.repository.Repository; 19 | 20 | import java.util.List; 21 | 22 | @Repository 23 | public interface UserCrudRepository extends CrudRepository { 24 | 25 | List findByName(String name); 26 | } 27 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/UserRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | import jakarta.data.repository.Repository; 18 | import org.eclipse.jnosql.mapping.NoSQLRepository; 19 | 20 | import java.util.List; 21 | 22 | @Repository 23 | public interface UserRepository extends NoSQLRepository { 24 | 25 | List findByName(String name); 26 | } 27 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-key-value-test/src/main/java/org/eclipse/jnosql/lite/mapping/entities/Worker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Convert; 21 | 22 | @Entity 23 | public class Worker { 24 | 25 | @Column 26 | private String name; 27 | 28 | @Column 29 | private Job job; 30 | 31 | @Column("money") 32 | @Convert(MoneyConverter.class) 33 | private Money salary; 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public Job getJob() { 44 | return job; 45 | } 46 | 47 | public void setJob(Job job) { 48 | this.job = job; 49 | } 50 | 51 | public Money getSalary() { 52 | return salary; 53 | } 54 | 55 | public void setSalary(Money salary) { 56 | this.salary = salary; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/BaseMappingModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | import java.time.LocalDateTime; 18 | 19 | abstract class BaseMappingModel { 20 | 21 | public LocalDateTime getNow() { 22 | return LocalDateTime.now(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/EntitiesMetadataModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | import java.util.List; 18 | 19 | class EntitiesMetadataModel extends BaseMappingModel { 20 | 21 | private final List entities; 22 | 23 | public EntitiesMetadataModel(List entities) { 24 | this.entities = entities; 25 | } 26 | 27 | public List getEntities() { 28 | return entities; 29 | } 30 | 31 | public String getQualified() { 32 | return "org.eclipse.jnosql.lite.mapping.metadata.LiteEntitiesMetadata"; 33 | } 34 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/ParameterResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | public record ParameterResult(String className, String type) { 18 | } 19 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/ValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | 18 | import jakarta.data.exceptions.MappingException; 19 | 20 | /** 21 | * A custom exception class for handling validation-related errors. 22 | * This exception class extends the MappingException class, allowing 23 | * it to inherit exception handling features and behaviors from its parent class. 24 | */ 25 | public class ValidationException extends MappingException { 26 | 27 | /** 28 | * Constructs a ValidationException with the specified error message. 29 | * 30 | * @param message The error message describing the reason for the exception. 31 | */ 32 | public ValidationException(String message) { 33 | super(message); 34 | } 35 | 36 | /** 37 | * Constructs a ValidationException with the specified error message and cause. 38 | * 39 | * @param message The error message describing the reason for the exception. 40 | * @param cause The underlying cause of the exception, which can be another exception. 41 | */ 42 | public ValidationException(String message, Throwable cause) { 43 | super(message, cause); 44 | } 45 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/ValueAnnotationModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | /** 18 | * A simple record representing a key-value pair for annotation models. 19 | * This class encapsulates a pair of strings: a key and a corresponding value. 20 | */ 21 | record ValueAnnotationModel(String key, String value) { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/CollectionSupplierProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import jakarta.data.exceptions.MappingException; 18 | import org.eclipse.jnosql.mapping.metadata.CollectionSupplier; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | final class CollectionSupplierProvider { 24 | 25 | private static final List> SUPPLIER; 26 | 27 | static { 28 | SUPPLIER = new ArrayList<>(); 29 | SUPPLIER.add(new DequeSupplier()); 30 | SUPPLIER.add(new ListSupplier()); 31 | SUPPLIER.add(new SetSupplier()); 32 | SUPPLIER.add(new TreeSetSupplier()); 33 | } 34 | 35 | private CollectionSupplierProvider() { 36 | } 37 | 38 | static CollectionSupplier find(Class collectionType) { 39 | return SUPPLIER.stream() 40 | .filter(c -> c.test(collectionType)) 41 | .findFirst() 42 | .orElseThrow(() -> new MappingException("There is not support the collection type: " + collectionType)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/DequeSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.CollectionSupplier; 18 | 19 | import java.util.Deque; 20 | import java.util.LinkedList; 21 | import java.util.Queue; 22 | 23 | /** 24 | * An implementation of {@link CollectionSupplier} to {@link LinkedList} 25 | */ 26 | public class DequeSupplier implements CollectionSupplier> { 27 | 28 | @Override 29 | public boolean test(Class type) { 30 | return Deque.class.equals(type) || Queue.class.equals(type); 31 | } 32 | 33 | @Override 34 | public LinkedList get() { 35 | return new LinkedList<>(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/ListSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.CollectionSupplier; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Collection; 21 | import java.util.List; 22 | 23 | /** 24 | * An implementation of {@link CollectionSupplier} to {@link ArrayList} 25 | */ 26 | public class ListSupplier implements CollectionSupplier> { 27 | @Override 28 | public boolean test(Class type) { 29 | return List.class.equals(type) || 30 | Iterable.class.equals(type) 31 | || Collection.class.equals(type); 32 | } 33 | 34 | @Override 35 | public ArrayList get() { 36 | return new ArrayList<>(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/LiteClassConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.ClassConverter; 18 | import org.eclipse.jnosql.mapping.metadata.EntityMetadata; 19 | 20 | /** 21 | * The lite implementation of {@link ClassConverter} 22 | */ 23 | public final class LiteClassConverter implements ClassConverter { 24 | 25 | @Override 26 | public EntityMetadata apply(Class aClass) { 27 | throw new UnsupportedOperationException("The lite implementation does not support this operation"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/LiteConstructorBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.ConstructorBuilder; 18 | import org.eclipse.jnosql.mapping.metadata.ParameterMetaData; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | public class LiteConstructorBuilder implements ConstructorBuilder { 24 | 25 | private final LiteConstructorMetadata metadata; 26 | 27 | private final List values = new ArrayList<>(); 28 | 29 | public LiteConstructorBuilder(LiteConstructorMetadata metadata) { 30 | this.metadata = metadata; 31 | } 32 | 33 | @Override 34 | public List parameters() { 35 | return metadata.parameters(); 36 | } 37 | 38 | @Override 39 | public void add(Object value) { 40 | this.values.add(value); 41 | } 42 | 43 | @Override 44 | public void addEmptyParameter() { 45 | this.values.add(null); 46 | } 47 | 48 | @Override 49 | public T build() { 50 | return metadata.build(values.toArray()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/LiteConstructorBuilderSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.ConstructorBuilder; 18 | import org.eclipse.jnosql.mapping.metadata.ConstructorBuilderSupplier; 19 | import org.eclipse.jnosql.mapping.metadata.ConstructorMetadata; 20 | 21 | import java.util.Objects; 22 | 23 | /** 24 | * A supplier of constructor avoiding reflection. 25 | */ 26 | public class LiteConstructorBuilderSupplier implements ConstructorBuilderSupplier { 27 | 28 | @Override 29 | public ConstructorBuilder apply(ConstructorMetadata constructorMetadata) { 30 | Objects.requireNonNull(constructorMetadata, "constructorMetadata is required"); 31 | if(constructorMetadata instanceof LiteConstructorMetadata) { 32 | return new LiteConstructorBuilder((LiteConstructorMetadata) constructorMetadata); 33 | } else { 34 | throw new UnsupportedOperationException("Eclipse JNoSQL Lite does not support reflection, including the use of constructors."); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/LiteConstructorMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.ConstructorMetadata; 18 | 19 | public interface LiteConstructorMetadata extends ConstructorMetadata { 20 | 21 | T build(Object[] parameters); 22 | } 23 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/LiteEntityMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.EntityMetadata; 18 | 19 | /** 20 | * The lite version of {@link EntityMetadata} 21 | */ 22 | public interface LiteEntityMetadata extends EntityMetadata { 23 | 24 | /** 25 | * @return true if the entity has the {@link jakarta.nosql.Entity} annotation 26 | */ 27 | boolean isEntity(); 28 | } 29 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/SetSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.CollectionSupplier; 18 | 19 | import java.util.HashSet; 20 | import java.util.Set; 21 | 22 | 23 | /** 24 | * An implementation of {@link CollectionSupplier} to {@link HashSet} 25 | */ 26 | public class SetSupplier implements CollectionSupplier> { 27 | 28 | @Override 29 | public boolean test(Class type) { 30 | return Set.class.equals(type); 31 | } 32 | 33 | @Override 34 | public HashSet get() { 35 | return new HashSet<>(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/metadata/TreeSetSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.metadata; 16 | 17 | import org.eclipse.jnosql.mapping.metadata.CollectionSupplier; 18 | 19 | import java.util.NavigableSet; 20 | import java.util.SortedSet; 21 | import java.util.TreeSet; 22 | 23 | /** 24 | * An implementation of {@link CollectionSupplier} to {@link TreeSet} 25 | */ 26 | public class TreeSetSupplier implements CollectionSupplier> { 27 | 28 | @Override 29 | public boolean test(Class type) { 30 | return NavigableSet.class.equals(type) 31 | || SortedSet.class.equals(type); 32 | } 33 | 34 | @Override 35 | public TreeSet get() { 36 | return new TreeSet<>(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/KeyValueMethodGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | import java.util.List; 18 | 19 | class KeyValueMethodGenerator implements MethodGenerator { 20 | 21 | private final MethodMetadata metadata; 22 | KeyValueMethodGenerator(MethodMetadata metadata) { 23 | this.metadata = metadata; 24 | } 25 | 26 | @Override 27 | public List getLines() { 28 | KeyValueMethodBuilder methodBuilder = KeyValueMethodBuilder.of(this.metadata); 29 | return methodBuilder.apply(this.metadata); 30 | } 31 | 32 | @Override 33 | public boolean hasReturn() { 34 | KeyValueMethodBuilder methodBuilder = KeyValueMethodBuilder.of(this.metadata); 35 | return !KeyValueMethodBuilder.NOT_SUPPORTED.equals(methodBuilder) 36 | && 37 | !metadata.getReturnType().equals(Void.TYPE.getName()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/KeyValueRepositoryMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otavio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | class KeyValueRepositoryMetadata extends RepositoryMetadata { 18 | 19 | KeyValueRepositoryMetadata(RepositoryElement element) { 20 | super(element, "KeyValue"); 21 | } 22 | 23 | @Override 24 | String getClassName() { 25 | return this.getElement().getSimpleName() + "LiteKeyValue"; 26 | } 27 | 28 | @Override 29 | RepositoryTemplateType getTemplateType() { 30 | return RepositoryTemplateType.KEY_VALUE; 31 | } 32 | 33 | @Override 34 | public MethodGenerator apply(MethodMetadata metadata) { 35 | return new KeyValueMethodGenerator(metadata); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/MethodGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | import java.util.List; 18 | 19 | public interface MethodGenerator { 20 | 21 | List getLines(); 22 | 23 | boolean hasReturn(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/RepositoryTemplateType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | import com.github.mustachejava.DefaultMustacheFactory; 18 | import com.github.mustachejava.Mustache; 19 | import com.github.mustachejava.MustacheFactory; 20 | 21 | import java.util.function.Supplier; 22 | 23 | enum RepositoryTemplateType implements Supplier { 24 | SEMI_STRUCTURE("repository_semi_structure.mustache"), 25 | KEY_VALUE("repository_key-value.mustache"); 26 | 27 | private final Mustache template; 28 | 29 | RepositoryTemplateType(String fileName) { 30 | MustacheFactory factory = new DefaultMustacheFactory(); 31 | this.template = factory.compile(fileName); 32 | } 33 | 34 | @Override 35 | public Mustache get() { 36 | return template; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/SemiStructureMethodGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | import java.util.List; 18 | 19 | class SemiStructureMethodGenerator implements MethodGenerator { 20 | 21 | private final MethodMetadata metadata; 22 | 23 | SemiStructureMethodGenerator(MethodMetadata metadata) { 24 | this.metadata = metadata; 25 | } 26 | 27 | @Override 28 | public List getLines() { 29 | var methodBuilder = SemiStructuredMethodBuilder.of(this.metadata); 30 | return methodBuilder.apply(this.metadata); 31 | } 32 | 33 | @Override 34 | public boolean hasReturn() { 35 | return !metadata.getReturnType().equals(Void.TYPE.getName()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/java/org/eclipse/jnosql/lite/mapping/repository/SemiStructureRepositoryMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Otavio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping.repository; 16 | 17 | import java.util.Locale; 18 | 19 | class SemiStructureRepositoryMetadata extends RepositoryMetadata { 20 | 21 | private final String provider; 22 | 23 | SemiStructureRepositoryMetadata(RepositoryElement element, String provider) { 24 | super(element, provider.toUpperCase(Locale.ENGLISH)); 25 | this.provider = provider; 26 | } 27 | 28 | @Override 29 | String getClassName() { 30 | return this.getElement().getSimpleName() + "Lite" + provider; 31 | } 32 | 33 | @Override 34 | RepositoryTemplateType getTemplateType() { 35 | return RepositoryTemplateType.SEMI_STRUCTURE; 36 | } 37 | 38 | @Override 39 | public MethodGenerator apply(MethodMetadata metadata) { 40 | return new SemiStructureMethodGenerator(metadata); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | org.eclipse.jnosql.lite.mapping.EntityProcessor 2 | org.eclipse.jnosql.lite.mapping.repository.RepositoryProcessor -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/main/resources/constructor_metadata.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package {{packageName}}; 16 | 17 | import org.eclipse.jnosql.lite.mapping.metadata.LiteConstructorMetadata; 18 | import org.eclipse.jnosql.mapping.metadata.ParameterMetaData; 19 | 20 | import javax.annotation.processing.Generated; 21 | import java.util.List; 22 | import java.util.ArrayList; 23 | 24 | @Generated(value= "JNoSQL Lite ConstructorMetadata Generator", date = "{{now}}") 25 | public final class {{className}} implements LiteConstructorMetadata { 26 | 27 | private final List parameters = new ArrayList<>(); 28 | 29 | public {{className}}() { 30 | {{#parameters}} 31 | this.parameters.add(new {{.}}()); 32 | {{/parameters}} 33 | } 34 | 35 | @Override 36 | public boolean isDefault() { 37 | return false; 38 | } 39 | 40 | @Override 41 | public List parameters() { 42 | return parameters; 43 | } 44 | 45 | @Override 46 | public T build(Object[] parameters) { 47 | return (T) new {{entityName}}({{constructorParameters}}); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/test/java/org/eclipse/jnosql/lite/mapping/LiteClassConverterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | import org.eclipse.jnosql.lite.mapping.metadata.LiteClassConverter; 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.junit.jupiter.api.Assertions.assertThrows; 21 | 22 | 23 | class LiteClassConverterTest { 24 | 25 | @Test 26 | void shouldThrowException() { 27 | LiteClassConverter converter = new LiteClassConverter(); 28 | 29 | assertThrows(UnsupportedOperationException.class, () -> converter.apply(String.class)); 30 | } 31 | } -------------------------------------------------------------------------------- /jnosql-lite/mapping-lite-processor/src/test/java/org/eclipse/jnosql/lite/mapping/LiteConstructorBuilderSupplierTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.lite.mapping; 16 | 17 | import org.eclipse.jnosql.lite.mapping.metadata.LiteConstructorBuilderSupplier; 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.junit.jupiter.api.Assertions.*; 21 | 22 | class LiteConstructorBuilderSupplierTest { 23 | 24 | @Test 25 | void shouldReturnExceptionWhenApply() { 26 | LiteConstructorBuilderSupplier supplier = new LiteConstructorBuilderSupplier(); 27 | assertThrows(NullPointerException.class, () -> supplier.apply(null)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | test-output/ 7 | /doc 8 | *.iml 9 | *.log 10 | .classpath 11 | -project 12 | /.resourceCache 13 | /.project 14 | /.idea 15 | .settings/ 16 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/main/java/org/eclipse/jnosql/mapping/validation/EntityObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.mapping.validation; 16 | 17 | 18 | import org.eclipse.jnosql.mapping.EntityPostPersist; 19 | import org.eclipse.jnosql.mapping.EntityPrePersist; 20 | import org.eclipse.jnosql.mapping.reflection.ConstructorEvent; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.enterprise.event.Observes; 24 | import jakarta.inject.Inject; 25 | 26 | @ApplicationScoped 27 | class EntityObserver { 28 | 29 | @Inject 30 | private MappingValidator validator; 31 | 32 | void validate(@Observes EntityPrePersist entity) { 33 | this.validator.validate(entity.get()); 34 | } 35 | 36 | void validate(@Observes EntityPostPersist entity) { 37 | this.validator.validate(entity.get()); 38 | } 39 | 40 | void validate(@Observes ConstructorEvent event) { 41 | this.validator.validate(event); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/test/java/org/eclipse/jnosql/mapping/validation/BucketManagerSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.mapping.validation; 16 | 17 | import jakarta.annotation.Priority; 18 | import jakarta.enterprise.context.ApplicationScoped; 19 | import jakarta.enterprise.inject.Alternative; 20 | import jakarta.enterprise.inject.Produces; 21 | import jakarta.interceptor.Interceptor; 22 | import org.eclipse.jnosql.communication.keyvalue.BucketManager; 23 | import org.mockito.Mockito; 24 | 25 | import java.util.function.Supplier; 26 | 27 | @ApplicationScoped 28 | @Alternative 29 | @Priority(Interceptor.Priority.APPLICATION) 30 | class BucketManagerSupplier implements Supplier { 31 | 32 | @Produces 33 | @Override 34 | public BucketManager get() { 35 | return Mockito.mock(BucketManager.class); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/test/java/org/eclipse/jnosql/mapping/validation/Computer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.mapping.validation; 16 | 17 | import jakarta.validation.constraints.Min; 18 | import jakarta.validation.constraints.NotNull; 19 | import jakarta.validation.constraints.Size; 20 | 21 | public record Computer(String name, int version, String model) { 22 | 23 | public Computer(@NotNull String name, @Min(2020) int version, 24 | @NotNull @Size(min = 2, max = 4) String model) { 25 | this.name = name; 26 | this.version = version; 27 | this.model = model; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/test/java/org/eclipse/jnosql/mapping/validation/PersonBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.mapping.validation; 16 | 17 | import java.math.BigDecimal; 18 | import java.util.List; 19 | 20 | public class PersonBuilder { 21 | 22 | private String name; 23 | 24 | private Integer age; 25 | 26 | private BigDecimal salary; 27 | 28 | private List phones; 29 | 30 | public PersonBuilder withName(String name) { 31 | this.name = name; 32 | return this; 33 | } 34 | 35 | public PersonBuilder withAge(Integer age) { 36 | this.age = age; 37 | return this; 38 | } 39 | 40 | public PersonBuilder withSalary(BigDecimal salary) { 41 | this.salary = salary; 42 | return this; 43 | } 44 | 45 | public PersonBuilder withPhones(List phones) { 46 | this.phones = phones; 47 | return this; 48 | } 49 | 50 | public Person build() { 51 | return new Person(name, age, salary, phones); 52 | } 53 | } -------------------------------------------------------------------------------- /jnosql-mapping-validation/src/test/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /jnosql-nosql-tck-runner/src/test/java/org/eclipse/jnosql/tck/JNoSQLTemplateSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Maximillian Arruda 14 | */ 15 | package org.eclipse.jnosql.tck; 16 | 17 | import jakarta.enterprise.inject.se.SeContainerInitializer; 18 | import jakarta.enterprise.inject.spi.CDI; 19 | import jakarta.nosql.Template; 20 | import jakarta.nosql.tck.TemplateSupplier; 21 | import org.eclipse.jnosql.databases.mongodb.communication.MongoDBDocumentConfigurations; 22 | import org.eclipse.jnosql.mapping.core.config.MappingConfigurations; 23 | 24 | import static org.eclipse.jnosql.tck.DocumentDatabase.INSTANCE; 25 | 26 | public class JNoSQLTemplateSupplier implements TemplateSupplier { 27 | 28 | public static final String DATABASE_NAME = "tck"; 29 | 30 | static { 31 | System.setProperty(MongoDBDocumentConfigurations.HOST.get() + ".1", INSTANCE.host()); 32 | System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), DATABASE_NAME); 33 | SeContainerInitializer.newInstance().initialize(); 34 | } 35 | 36 | @Override 37 | public Template get() { 38 | return CDI.current().select(Template.class).get(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /jnosql-nosql-tck-runner/src/test/resources/META-INF/microprofile-config.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2022 Contributors to the Eclipse Foundation 3 | # All rights reserved. This program and the accompanying materials 4 | # are made available under the terms of the Eclipse Public License v1.0 5 | # and Apache License v2.0 which accompanies this distribution. 6 | # The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | # and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | # 9 | # You may elect to redistribute this code under either of these licenses. 10 | # 11 | 12 | #jnosql.document.database=olympus 13 | #jnosql.mongodb.host.1=localhost:27017 14 | #jnosql.mongodb.user=root 15 | #jnosql.mongodb.password=example 16 | #jnosql.mongodb.authentication.source=admin -------------------------------------------------------------------------------- /jnosql-nosql-tck-runner/src/test/resources/META-INF/services/jakarta.nosql.tck.TemplateSupplier: -------------------------------------------------------------------------------- 1 | org.eclipse.jnosql.tck.JNoSQLTemplateSupplier -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-processor/src/main/java/org/eclipse/jnosql/metamodel/processor/BaseMappingModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.metamodel.processor; 16 | 17 | import java.time.LocalDateTime; 18 | 19 | abstract class BaseMappingModel { 20 | 21 | public LocalDateTime getNow() { 22 | return LocalDateTime.now(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-processor/src/main/java/org/eclipse/jnosql/metamodel/processor/ValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnosql.metamodel.processor; 16 | 17 | 18 | import jakarta.data.exceptions.MappingException; 19 | 20 | /** 21 | * A custom exception class for handling validation-related errors. 22 | * This exception class extends the MappingException class, allowing 23 | * it to inherit exception handling features and behaviors from its parent class. 24 | */ 25 | public class ValidationException extends MappingException { 26 | 27 | /** 28 | * Constructs a ValidationException with the specified error message. 29 | * 30 | * @param message The error message describing the reason for the exception. 31 | */ 32 | public ValidationException(String message) { 33 | super(message); 34 | } 35 | 36 | /** 37 | * Constructs a ValidationException with the specified error message and cause. 38 | * 39 | * @param message The error message describing the reason for the exception. 40 | * @param cause The underlying cause of the exception, which can be another exception. 41 | */ 42 | public ValidationException(String message, Throwable cause) { 43 | super(message, cause); 44 | } 45 | } -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | org.eclipse.jnosql.metamodel.processor.EntityProcessor -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-processor/src/main/resources/metamodel.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package {{packageName}}; 16 | 17 | import jakarta.data.metamodel.StaticMetamodel; 18 | import javax.annotation.processing.Generated; 19 | {{#containsStringAttribute}} 20 | import jakarta.data.metamodel.TextAttribute; 21 | import jakarta.data.metamodel.impl.TextAttributeRecord; 22 | {{/containsStringAttribute}} 23 | {{#containsSortableAttribute}} 24 | import jakarta.data.metamodel.SortableAttribute; 25 | import jakarta.data.metamodel.impl.SortableAttributeRecord; 26 | {{/containsSortableAttribute}} 27 | //CHECKSTYLE:OFF 28 | @StaticMetamodel({{entity}}.class) 29 | @Generated(value = "The StaticMetamodel of the class {{entity}} provider by Eclipse JNoSQL", date = "{{now}}") 30 | public interface {{className}} { 31 | 32 | {{#fields}} 33 | String {{constantName}} = "{{name}}"; 34 | {{/fields}} 35 | 36 | {{#fields}} 37 | {{className}}<{{entity}}> {{fieldName}} = new {{implementation}}<>({{constantName}}); 38 | {{/fields}} 39 | 40 | } 41 | //CHECKSTYLE:ON -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/pom.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 18 | 4.0.0 19 | 20 | 21 | org.eclipse.jnosql.metamodel 22 | jnosql-static-metamodel-parent 23 | 1.1.9-SNAPSHOT 24 | 25 | 26 | mapping-lite-sample 27 | jar 28 | 29 | 30 | 31 | 32 | 33 | 34 | ${project.groupId} 35 | mapping-metamodel-processor 36 | ${project.version} 37 | provided 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/main/java/org/eclipse/jnsoql/entities/Car.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Entity; 19 | import jakarta.nosql.Id; 20 | 21 | @Entity 22 | public class Car { 23 | 24 | @Id 25 | private String id; 26 | 27 | @Column 28 | private Person driver; 29 | } 30 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/main/java/org/eclipse/jnsoql/entities/Checkout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | import java.util.List; 23 | 24 | @Entity 25 | public class Checkout { 26 | 27 | @Id 28 | private Long id; 29 | 30 | @Column 31 | private List products; 32 | } 33 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/main/java/org/eclipse/jnsoql/entities/Fruit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | @Entity 23 | public class Fruit { 24 | 25 | @Id 26 | private String id; 27 | 28 | @Column 29 | private String name; 30 | 31 | @Column 32 | private boolean isTasty; 33 | 34 | @Column 35 | private Boolean isHealthy; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/main/java/org/eclipse/jnsoql/entities/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | 18 | import jakarta.nosql.Column; 19 | import jakarta.nosql.Entity; 20 | import jakarta.nosql.Id; 21 | 22 | @Entity 23 | public class Person { 24 | 25 | @Id 26 | private String id; 27 | 28 | @Column 29 | private String name; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/main/java/org/eclipse/jnsoql/entities/Product.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import jakarta.nosql.Column; 18 | import jakarta.nosql.Embeddable; 19 | 20 | import java.math.BigDecimal; 21 | 22 | @Embeddable 23 | public class Product { 24 | 25 | @Column 26 | private String name; 27 | 28 | @Column 29 | private BigDecimal price; 30 | } 31 | -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/test/java/org/eclipse/jnsoql/entities/CarTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import org.assertj.core.api.SoftAssertions; 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.junit.jupiter.api.Assertions.*; 21 | 22 | class CarTest { 23 | 24 | 25 | @Test 26 | void shouldGenerateStaticMetamodel() { 27 | SoftAssertions.assertSoftly(softly -> { 28 | assertNotNull(_Car.id); 29 | assertNotNull(_Car.driver); 30 | assertNotNull(_Car.driver_id); 31 | assertNotNull(_Car.driver_name); 32 | }); 33 | } 34 | } -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/test/java/org/eclipse/jnsoql/entities/CheckoutTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import org.assertj.core.api.SoftAssertions; 18 | import org.junit.jupiter.api.Test; 19 | 20 | class CheckoutTest { 21 | 22 | 23 | @Test 24 | void shouldGenerateStaticMetamodel() { 25 | 26 | SoftAssertions.assertSoftly(softly -> { 27 | softly.assertThat(_Checkout.id).isNotNull(); 28 | softly.assertThat(_Checkout.products).isNotNull(); 29 | softly.assertThat(_Checkout.products_name).isNotNull(); 30 | softly.assertThat(_Checkout.products_name).isNotNull(); 31 | }); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/test/java/org/eclipse/jnsoql/entities/FruitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import jakarta.data.Sort; 18 | import jakarta.data.metamodel.SortableAttribute; 19 | import jakarta.data.metamodel.TextAttribute; 20 | import org.assertj.core.api.SoftAssertions; 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | 25 | class FruitTest { 26 | 27 | 28 | @Test 29 | void shouldGetId(){ 30 | var id = _Fruit.id; 31 | 32 | SoftAssertions.assertSoftly(soft -> { 33 | soft.assertThat(id.name()).isEqualTo("_id"); 34 | soft.assertThat(id.desc()).isEqualTo(Sort.desc("_id")); 35 | soft.assertThat(_Fruit.ID).isEqualTo("_id"); 36 | soft.assertThat(id).isInstanceOf(TextAttribute.class); 37 | soft.assertThat(_Fruit.name).isInstanceOf(TextAttribute.class); 38 | soft.assertThat(_Fruit.isTasty).isInstanceOf(SortableAttribute.class); 39 | soft.assertThat(_Fruit.isHealthy).isInstanceOf(SortableAttribute.class); 40 | }); 41 | } 42 | } -------------------------------------------------------------------------------- /jnosql-static-metamodel/jnosql-metamodel-sample/src/test/java/org/eclipse/jnsoql/entities/PersonTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Otávio Santana and others 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * and Apache License v2.0 which accompanies this distribution. 6 | * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html 7 | * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. 8 | * 9 | * You may elect to redistribute this code under either of these licenses. 10 | * 11 | * Contributors: 12 | * 13 | * Otavio Santana 14 | */ 15 | package org.eclipse.jnsoql.entities; 16 | 17 | import org.assertj.core.api.SoftAssertions; 18 | import org.junit.jupiter.api.Test; 19 | 20 | 21 | class PersonTest { 22 | 23 | 24 | @Test 25 | void shouldGenerateStaticMetamodel() { 26 | SoftAssertions.assertSoftly(softly -> { 27 | softly.assertThat(_Person.id).isNotNull(); 28 | softly.assertThat(_Person.name).isNotNull(); 29 | }); 30 | } 31 | } -------------------------------------------------------------------------------- /jnosql-tinkerpop-connections/src/test/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /pmd/pmd-rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 12 | 13 | --------------------------------------------------------------------------------