From 47feb15244b6614cf173fedcb1ef7e392b4ccfe6 Mon Sep 17 00:00:00 2001 From: Gerrit Meier Date: Fri, 7 Jul 2023 13:39:00 +0200 Subject: [PATCH] GH-2763 - De-Lombok all the things. Closes #2763 --- lombok.config | 2 - pom.xml | 12 - .../mapping/callback/ImmutableSample.java | 102 ++- .../imperative/Neo4jTemplateIT.java | 112 ++- .../neo4j/integration/issues/IssuesIT.java | 26 +- .../integration/issues/ReactiveIssuesIT.java | 21 +- .../neo4j/integration/issues/TestBase.java | 9 +- .../issues/events/EventsPublisherIT.java | 71 +- .../issues/events/Neo4jObject.java | 63 +- .../issues/events/Neo4jObjectService.java | 12 +- .../issues/gh2168/DomainObject.java | 37 +- .../issues/gh2168/GeneratedValueStrategy.java | 2 +- .../issues/gh2168/UnrelatedObject.java | 22 +- .../neo4j/integration/issues/gh2244/Step.java | 3 +- .../issues/gh2289/RangeRelation.java | 114 ++- .../issues/gh2289/RangeRelationRO.java | 116 ++- .../neo4j/integration/issues/gh2289/Sku.java | 54 +- .../integration/issues/gh2289/SkuRO.java | 104 ++- .../integration/issues/gh2323/Person.java | 3 +- .../integration/issues/gh2326/BaseEntity.java | 3 +- .../integration/issues/gh2328/Entity2328.java | 24 +- .../issues/gh2415/BaseNodeEntity.java | 130 ++- .../integration/issues/gh2415/Credential.java | 108 ++- .../integration/issues/gh2415/NodeEntity.java | 131 ++- .../integration/issues/gh2459/PetOwner.java | 25 +- .../integration/issues/gh2474/CityModel.java | 132 ++- .../issues/gh2474/CityModelDTO.java | 228 +++++- .../issues/gh2474/CityModelRepository.java | 4 +- .../issues/gh2474/JobRelationship.java | 90 +- .../issues/gh2474/PersonModel.java | 98 ++- .../issues/gh2493/TestConverter.java | 4 +- .../integration/issues/gh2493/TestData.java | 21 +- .../integration/issues/gh2493/TestObject.java | 25 +- .../issues/gh2498/DomainModel.java | 4 +- .../neo4j/integration/issues/gh2498/Edge.java | 73 +- .../integration/issues/gh2498/Vertex.java | 102 ++- .../integration/issues/gh2500/Device.java | 43 +- .../integration/issues/gh2500/Group.java | 52 +- .../gh2526/AccountingMeasurementMeta.java | 135 ++- .../integration/issues/gh2526/DataPoint.java | 75 +- .../integration/issues/gh2526/Measurand.java | 44 +- .../issues/gh2526/MeasurementMeta.java | 139 +++- .../integration/issues/gh2526/Variable.java | 84 +- .../issues/gh2530/SomeStringGenerator.java | 8 +- .../issues/gh2572/GH2572Child.java | 33 +- .../issues/gh2572/GH2572Parent.java | 33 +- .../issues/gh2572/GH2572Repository.java | 12 +- .../gh2572/ReactiveGH2572Repository.java | 8 +- .../integration/issues/gh2576/College.java | 3 +- .../issues/gh2576/CollegeRepository.java | 16 +- .../integration/issues/gh2576/Student.java | 3 +- .../integration/issues/gh2579/ColumnNode.java | 109 ++- .../issues/gh2579/TableAndColumnRelation.java | 72 +- .../integration/issues/gh2579/TableNode.java | 128 ++- .../issues/gh2579/TableRepository.java | 28 +- .../issues/gh2622/GH2622Repository.java | 3 +- .../issues/gh2622/MePointingTowardsMe.java | 1 + .../integration/issues/gh2632/Movie.java | 3 +- .../ReactiveConnectionAcquisitionIT.java | 90 +- .../integration/issues/gh2639/Developer.java | 2 +- .../issues/gh2727/FirstLevelEntity.java | 126 ++- .../issues/gh2727/OrderedRelation.java | 63 +- .../issues/gh2727/SecondLevelEntity.java | 126 ++- .../issues/gh2727/ThirdLevelEntity.java | 111 ++- .../issues/gh2728/AbstractTestBase.java | 2 +- .../gh2728/TestEntityWithAssignedId1.java | 35 +- .../gh2728/TestEntityWithAssignedId2.java | 16 +- .../TestEntityWithGeneratedDeprecatedId1.java | 37 +- .../TestEntityWithGeneratedDeprecatedId2.java | 18 +- .../projections/NestedProjectionsIT.java | 3 +- .../issues/projections/model/CentralNode.java | 91 ++- .../issues/projections/model/SourceNodeA.java | 94 ++- .../issues/projections/model/SourceNodeB.java | 92 ++- .../repository/CustomRepositoryImpl.java | 17 +- .../ImperativeElementIdIT.java | 12 +- .../integration/properties/DomainClasses.java | 237 +++++- .../reactive/ReactiveNeo4jTemplateIT.java | 191 +++-- .../shared/common/AbstractPet.java | 10 +- .../shared/common/AllArgsCtorNoBuilder.java | 5 +- .../integration/shared/common/AltHobby.java | 5 +- .../common/AltLikedByPersonRelationship.java | 2 +- .../integration/shared/common/AltPerson.java | 4 +- .../common/AnotherThingWithAssignedId.java | 3 +- .../shared/common/AuditingITBase.java | 8 +- .../shared/common/BidirectionalEnd.java | 10 +- .../shared/common/BidirectionalStart.java | 7 +- .../neo4j/integration/shared/common/Book.java | 3 +- .../neo4j/integration/shared/common/Club.java | 4 +- .../shared/common/DeepRelationships.java | 13 +- .../shared/common/DoritoEatingPerson.java | 121 ++- .../shared/common/DtoPersonProjection.java | 71 +- ...nProjectionContainingAdditionalFields.java | 113 ++- .../common/DynamicRelationshipsITBase.java | 18 +- .../integration/shared/common/Editor.java | 3 +- .../common/EntitiesWithDynamicLabels.java | 84 +- .../shared/common/EntityWithConvertedId.java | 3 +- ...tityWithPrimitiveConstructorArguments.java | 4 +- .../EntityWithRelationshipPropertiesPath.java | 12 +- .../integration/shared/common/Flight.java | 3 +- .../integration/shared/common/Friend.java | 7 +- .../integration/shared/common/Hobby.java | 4 +- .../shared/common/IdGeneratorsITBase.java | 2 +- .../common/ImmutableAuditableThing.java | 153 +++- ...mmutableAuditableThingWithGeneratedId.java | 153 +++- .../shared/common/ImmutablePerson.java | 3 +- .../common/ImmutablePersonWithAssignedId.java | 22 +- ...utablePersonWithExternallyGeneratedId.java | 22 +- .../ImmutablePersonWithGeneratedId.java | 25 +- .../ImmutableSecondPersonWithAssignedId.java | 2 +- ...SecondPersonWithExternallyGeneratedId.java | 22 +- .../ImmutableSecondPersonWithGeneratedId.java | 25 +- .../common/ImmutableVersionedThing.java | 27 +- .../shared/common/Inheritance.java | 80 +- .../common/Multiple1O1Relationships.java | 4 +- .../shared/common/MultipleLabels.java | 17 +- .../common/MultipleRelationshipsThing.java | 4 +- .../shared/common/MutableChild.java | 3 +- .../shared/common/MutableParent.java | 3 +- .../shared/common/OneToOneSource.java | 126 ++- .../shared/common/OneToOneTarget.java | 49 +- .../integration/shared/common/ParentNode.java | 3 +- .../integration/shared/common/Person.java | 17 +- .../common/PersonWithAllConstructor.java | 207 ++++- .../common/PersonWithNoConstructor.java | 53 +- .../shared/common/PersonWithRelationship.java | 14 +- .../PersonWithRelationshipWithProperties.java | 16 +- ...PersonWithRelationshipWithProperties2.java | 7 +- .../shared/common/PersonWithRelatives.java | 4 +- .../PersonWithStringlyTypedRelatives.java | 4 +- .../shared/common/PersonWithWither.java | 23 +- .../neo4j/integration/shared/common/Pet.java | 84 +- .../shared/common/ProjectionTestBase.java | 3 +- ...nshipsAsConstructorParametersEntities.java | 14 +- .../shared/common/SameIdProperty.java | 459 ++++++++++- .../shared/common/SimilarThing.java | 13 +- .../common/SimpleEntityWithRelationshipA.java | 4 +- .../common/SimpleEntityWithRelationshipB.java | 4 +- .../common/SimpleEntityWithRelationshipC.java | 4 +- .../common/ThingWithAllCypherTypes.java | 396 ++++++++- .../common/ThingWithAllCypherTypes2.java | 151 +++- .../common/ThingWithAllSpatialTypes.java | 198 ++++- .../shared/common/ThingWithAssignedId.java | 6 +- .../common/ThingWithFixedGeneratedId.java | 4 +- .../shared/common/ThingWithGeneratedId.java | 4 +- .../common/ThingWithIdGeneratedByBean.java | 4 +- .../shared/common/ThingWithSequence.java | 4 +- .../shared/common/ThingWithUUIDID.java | 4 +- .../shared/common/VersionedThing.java | 10 +- .../common/VersionedThingWithAssignedId.java | 9 +- .../conversion/Neo4jConversionsITBase.java | 68 +- .../shared/conversion/PersonWithCustomId.java | 100 ++- .../ThingWithAllAdditionalTypes.java | 772 +++++++++++++++++- .../query/Neo4jNestedMapEntityWriterTest.java | 157 +++- .../data/neo4j/test/Neo4jExtension.java | 31 +- 154 files changed, 7383 insertions(+), 1209 deletions(-) delete mode 100644 lombok.config diff --git a/lombok.config b/lombok.config deleted file mode 100644 index b94b2470c..000000000 --- a/lombok.config +++ /dev/null @@ -1,2 +0,0 @@ -lombok.nonNull.exceptionType = IllegalArgumentException - diff --git a/pom.xml b/pom.xml index ff6c7c907..5b082e6a6 100644 --- a/pom.xml +++ b/pom.xml @@ -523,18 +523,6 @@ maven-jar-plugin ${maven-jar-plugin.version} - - org.projectlombok - lombok-maven-plugin - - - - org.projectlombok - lombok - ${lombok} - - - org.codehaus.mojo flatten-maven-plugin diff --git a/src/test/java/org/springframework/data/neo4j/core/mapping/callback/ImmutableSample.java b/src/test/java/org/springframework/data/neo4j/core/mapping/callback/ImmutableSample.java index 869c5f21b..856b9650b 100644 --- a/src/test/java/org/springframework/data/neo4j/core/mapping/callback/ImmutableSample.java +++ b/src/test/java/org/springframework/data/neo4j/core/mapping/callback/ImmutableSample.java @@ -15,27 +15,99 @@ */ package org.springframework.data.neo4j.core.mapping.callback; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; -import lombok.With; - -import java.util.Date; - import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.LastModifiedDate; +import java.util.Date; + /** * @author Michael J. Simons */ -@Value -@With -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class ImmutableSample { +public final class ImmutableSample { - @Id String id; - @CreatedDate Date created; - @LastModifiedDate Date modified; + @Id + private final String id; + @CreatedDate + private final Date created; + @LastModifiedDate + private final Date modified; + + public ImmutableSample(String id, Date created, Date modified) { + this.id = id; + this.created = created; + this.modified = modified; + } + + public ImmutableSample() { + this.id = null; + this.created = null; + this.modified = null; + } + + public String getId() { + return this.id; + } + + public Date getCreated() { + return this.created; + } + + public Date getModified() { + return this.modified; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ImmutableSample)) { + return false; + } + final ImmutableSample other = (ImmutableSample) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$created = this.getCreated(); + final Object other$created = other.getCreated(); + if (this$created == null ? other$created != null : !this$created.equals(other$created)) { + return false; + } + final Object this$modified = this.getModified(); + final Object other$modified = other.getModified(); + if (this$modified == null ? other$modified != null : !this$modified.equals(other$modified)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $created = this.getCreated(); + result = result * PRIME + ($created == null ? 43 : $created.hashCode()); + final Object $modified = this.getModified(); + result = result * PRIME + ($modified == null ? 43 : $modified.hashCode()); + return result; + } + + public String toString() { + return "ImmutableSample(id=" + this.getId() + ", created=" + this.getCreated() + ", modified=" + this.getModified() + ")"; + } + + public ImmutableSample withId(String newId) { + return this.id == newId ? this : new ImmutableSample(newId, this.created, this.modified); + } + + public ImmutableSample withCreated(Date newCreated) { + return this.created == newCreated ? this : new ImmutableSample(this.id, newCreated, this.modified); + } + + public ImmutableSample withModified(Date newModified) { + return this.modified == newModified ? this : new ImmutableSample(this.id, this.created, newModified); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/imperative/Neo4jTemplateIT.java b/src/test/java/org/springframework/data/neo4j/integration/imperative/Neo4jTemplateIT.java index a9255d941..88c5796ce 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/imperative/Neo4jTemplateIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/imperative/Neo4jTemplateIT.java @@ -15,23 +15,6 @@ */ package org.springframework.data.neo4j.integration.imperative; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; - -import lombok.Data; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.BiPredicate; -import java.util.function.Function; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.neo4j.cypherdsl.core.Cypher; @@ -50,7 +33,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.dao.IncorrectResultSizeDataAccessException; import org.springframework.data.mapping.PropertyPath; -import org.springframework.data.neo4j.test.Neo4jImperativeTestConfiguration; import org.springframework.data.neo4j.core.DatabaseSelectionProvider; import org.springframework.data.neo4j.core.Neo4jTemplate; import org.springframework.data.neo4j.core.mapping.Neo4jPersistentProperty; @@ -63,10 +45,26 @@ import org.springframework.data.neo4j.integration.shared.common.PersonWithAssign import org.springframework.data.neo4j.integration.shared.common.ThingWithGeneratedId; import org.springframework.data.neo4j.test.BookmarkCapture; import org.springframework.data.neo4j.test.Neo4jExtension.Neo4jConnectionSupport; +import org.springframework.data.neo4j.test.Neo4jImperativeTestConfiguration; import org.springframework.data.neo4j.test.Neo4jIntegrationTest; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiPredicate; +import java.util.function.Function; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; + /** * @author Gerrit Meier * @author Michael J. Simons @@ -354,14 +352,88 @@ class Neo4jTemplateIT { return predicate; } - @Data static class DtoPersonProjection { - /** The ID is required in a project that should be saved. */ + /** + * The ID is required in a project that should be saved. + */ private final Long id; private String lastName; private String firstName; + + DtoPersonProjection(Long id) { + this.id = id; + } + + public Long getId() { + return this.id; + } + + public String getLastName() { + return this.lastName; + } + + public String getFirstName() { + return this.firstName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DtoPersonProjection)) { + return false; + } + final DtoPersonProjection other = (DtoPersonProjection) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$lastName = this.getLastName(); + final Object other$lastName = other.getLastName(); + if (this$lastName == null ? other$lastName != null : !this$lastName.equals(other$lastName)) { + return false; + } + final Object this$firstName = this.getFirstName(); + final Object other$firstName = other.getFirstName(); + if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof DtoPersonProjection; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $lastName = this.getLastName(); + result = result * PRIME + ($lastName == null ? 43 : $lastName.hashCode()); + final Object $firstName = this.getFirstName(); + result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode()); + return result; + } + + public String toString() { + return "Neo4jTemplateIT.DtoPersonProjection(id=" + this.getId() + ", lastName=" + this.getLastName() + ", firstName=" + this.getFirstName() + ")"; + } } @Test // GH-2215 diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/IssuesIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/IssuesIT.java index acf11b869..84bd1105d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/IssuesIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/IssuesIT.java @@ -160,6 +160,7 @@ import org.springframework.data.neo4j.test.Neo4jImperativeTestConfiguration; import org.springframework.data.neo4j.test.Neo4jIntegrationTest; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Transactional; /** * @author Michael J. Simons @@ -307,7 +308,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2415") void saveWithProjectionImplementedByEntity(@Autowired Neo4jMappingContext mappingContext, - @Autowired Neo4jTemplate neo4jTemplate) { + @Autowired Neo4jTemplate neo4jTemplate) { Neo4jPersistentEntity metaData = mappingContext.getPersistentEntity(BaseNodeEntity.class); NodeEntity nodeEntity = neo4jTemplate @@ -461,6 +462,7 @@ class IssuesIT extends TestBase { }); } + @Transactional // otherwise the relationships will add up @RepeatedTest(5) @Tag("GH-2289") @Tag("GH-2294") @@ -534,7 +536,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2326") void saveShouldAddAllLabels(@Autowired AnimalRepository animalRepository, - @Autowired BookmarkCapture bookmarkCapture) { + @Autowired BookmarkCapture bookmarkCapture) { List animals = Arrays.asList(new AbstractLevel2.AbstractLevel3.Concrete1(), new AbstractLevel2.AbstractLevel3.Concrete2()); @@ -547,7 +549,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2326") void saveAllShouldAddAllLabels(@Autowired AnimalRepository animalRepository, - @Autowired BookmarkCapture bookmarkCapture) { + @Autowired BookmarkCapture bookmarkCapture) { List animals = Arrays.asList(new AbstractLevel2.AbstractLevel3.Concrete1(), new AbstractLevel2.AbstractLevel3.Concrete2()); @@ -718,7 +720,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2493") void saveOneShouldWork(@Autowired Driver driver, @Autowired BookmarkCapture bookmarkCapture, - @Autowired TestObjectRepository repository) { + @Autowired TestObjectRepository repository) { TestObject testObject = new TestObject(new TestData(4711, "Foobar")); testObject = repository.save(testObject); @@ -730,7 +732,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2493") void saveAllShouldWork(@Autowired Driver driver, @Autowired BookmarkCapture bookmarkCapture, - @Autowired TestObjectRepository repository) { + @Autowired TestObjectRepository repository) { TestObject testObject = new TestObject(new TestData(4711, "Foobar")); testObject = repository.saveAll(Collections.singletonList(testObject)).get(0); @@ -819,7 +821,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2533") void projectionWorksForDynamicRelationshipsOnSave(@Autowired GH2533Repository repository, - @Autowired Neo4jTemplate neo4jTemplate) { + @Autowired Neo4jTemplate neo4jTemplate) { EntitiesAndProjections.GH2533Entity rootEntity = createData(repository); rootEntity = repository.findByIdWithLevelOneLinks(rootEntity.id).get(); @@ -839,7 +841,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2533") void saveRelatedEntityWithRelationships(@Autowired GH2533Repository repository, - @Autowired Neo4jTemplate neo4jTemplate) { + @Autowired Neo4jTemplate neo4jTemplate) { EntitiesAndProjections.GH2533Entity rootEntity = createData(repository); neo4jTemplate.saveAs(rootEntity, EntitiesAndProjections.GH2533EntityWithRelationshipToEntity.class); @@ -906,7 +908,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2576") - void listOfMapsShouldBeUsableAsArguments(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { + void listOfMapsShouldBeUsableAsArguments(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { var student = template.save(new Student("S1")); var college = template.save(new College("C1")); @@ -920,7 +922,7 @@ class IssuesIT extends TestBase { @Test @Tag("GH-2576") - void listOfMapsShouldBeUsableAsArgumentsWithWorkaround(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { + void listOfMapsShouldBeUsableAsArgumentsWithWorkaround(@Autowired Neo4jTemplate template, @Autowired CollegeRepository collegeRepository) { var student = template.save(new Student("S1")); var college = template.save(new College("C1")); @@ -997,7 +999,7 @@ class IssuesIT extends TestBase { languageRelationships.add(perlRelationship); Developer harry = new Developer("Harry", languageRelationships); - List team = Arrays.asList(greg, roy, craig, harry); + List team = Arrays.asList(greg, roy, craig, harry); Company acme = new Company("ACME", team); companyRepository.save(acme); @@ -1114,7 +1116,7 @@ class IssuesIT extends TestBase { @Override public PlatformTransactionManager transactionManager(Driver driver, - DatabaseSelectionProvider databaseNameProvider) { + DatabaseSelectionProvider databaseNameProvider) { BookmarkCapture bookmarkCapture = bookmarkCapture(); return new Neo4jTransactionManager(driver, databaseNameProvider, @@ -1213,7 +1215,7 @@ class IssuesIT extends TestBase { } private static void assertThatTestObjectHasBeenCreated(Driver driver, BookmarkCapture bookmarkCapture, - TestObject testObject) { + TestObject testObject) { try (Session session = driver.session(bookmarkCapture.createSessionConfig())) { Map arguments = new HashMap<>(); arguments.put("id", testObject.getId()); diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/ReactiveIssuesIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/ReactiveIssuesIT.java index 83c5f5561..ab5f84a20 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/ReactiveIssuesIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/ReactiveIssuesIT.java @@ -17,6 +17,7 @@ package org.springframework.data.neo4j.integration.issues; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.BeforeEach; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -86,7 +87,6 @@ class ReactiveIssuesIT extends TestBase { try (Transaction transaction = session.beginTransaction()) { transaction.run("MATCH (n) detach delete n"); - setupGH2289(transaction); setupGH2328(transaction); setupGH2572(transaction); @@ -96,6 +96,17 @@ class ReactiveIssuesIT extends TestBase { } } + @BeforeEach + void setup(@Autowired BookmarkCapture bookmarkCapture) { + try (Session session = neo4jConnectionSupport.getDriver().session(bookmarkCapture.createSessionConfig())) { + try (Transaction transaction = session.beginTransaction()) { + setupGH2289(transaction); + transaction.commit(); + } + bookmarkCapture.seedWith(session.lastBookmarks()); + } + } + @RepeatedTest(23) @Tag("GH-2289") void testNewRelation(@Autowired ReactiveSkuRepository skuRepo) { @@ -204,7 +215,7 @@ class ReactiveIssuesIT extends TestBase { @Test @Tag("GH-2326") void saveShouldAddAllLabels(@Autowired ReactiveAnimalRepository animalRepository, - @Autowired BookmarkCapture bookmarkCapture) { + @Autowired BookmarkCapture bookmarkCapture) { List ids = new ArrayList<>(); List animals = Arrays.asList(new AbstractLevel2.AbstractLevel3.Concrete1(), @@ -222,7 +233,7 @@ class ReactiveIssuesIT extends TestBase { @Test @Tag("GH-2326") void saveAllShouldAddAllLabels(@Autowired ReactiveAnimalRepository animalRepository, - @Autowired BookmarkCapture bookmarkCapture) { + @Autowired BookmarkCapture bookmarkCapture) { List ids = new ArrayList<>(); List animals = Arrays.asList(new AbstractLevel2.AbstractLevel3.Concrete1(), @@ -314,7 +325,7 @@ class ReactiveIssuesIT extends TestBase { @Test @Tag("GH-2498") void shouldNotDeleteFreshlyCreatedRelationships(@Autowired Driver driver, @Autowired - ReactiveNeo4jTemplate template) { + ReactiveNeo4jTemplate template) { Group group = new Group(); group.setName("test"); @@ -432,7 +443,7 @@ class ReactiveIssuesIT extends TestBase { @Override public ReactiveTransactionManager reactiveTransactionManager(Driver driver, - ReactiveDatabaseSelectionProvider databaseSelectionProvider) { + ReactiveDatabaseSelectionProvider databaseSelectionProvider) { BookmarkCapture bookmarkCapture = bookmarkCapture(); return new ReactiveNeo4jTransactionManager(driver, databaseSelectionProvider, diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/TestBase.java b/src/test/java/org/springframework/data/neo4j/integration/issues/TestBase.java index 011745257..1acc9d595 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/TestBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/TestBase.java @@ -48,7 +48,7 @@ abstract class TestBase { @BeforeEach protected final void beforeEach(@Autowired BookmarkCapture bookmarkCapture) { try (Session session = neo4jConnectionSupport.getDriver().session(bookmarkCapture.createSessionConfig()); - Transaction transaction = session.beginTransaction() + Transaction transaction = session.beginTransaction() ) { List labelsToDelete = List.of("AbstractBase", "AccountingMeasurementMeta", "Application", "BaseNodeEntity", "CityModel", "ConcreteImplementationOne", "ConcreteImplementationTwo", @@ -100,9 +100,10 @@ abstract class TestBase { } protected static void setupGH2289(QueryRunner queryRunner) { + queryRunner.run("MATCH (s:SKU_RO) DETACH DELETE s").consume(); for (int i = 0; i < 4; ++i) { queryRunner.run("CREATE (s:SKU_RO {number: $i, name: $n})", - Values.parameters("i", i, "n", new String(new char[] { (char) ('A' + i) }))).consume(); + Values.parameters("i", i, "n", new String(new char[]{(char) ('A' + i)}))).consume(); } } @@ -170,7 +171,7 @@ abstract class TestBase { } protected static void assertSingleApplicationNodeWithMultipleWorkflows(Driver driver, - BookmarkCapture bookmarkCapture) { + BookmarkCapture bookmarkCapture) { try (Session session = driver.session(bookmarkCapture.createSessionConfig())) { Record record = session.executeRead( @@ -182,7 +183,7 @@ abstract class TestBase { } protected static void assertMultipleApplicationsNodeWithASingleWorkflow(Driver driver, - BookmarkCapture bookmarkCapture) { + BookmarkCapture bookmarkCapture) { try (Session session = driver.session(bookmarkCapture.createSessionConfig())) { List records = session.executeRead( diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/events/EventsPublisherIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/events/EventsPublisherIT.java index fa9a67123..86367f73e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/events/EventsPublisherIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/events/EventsPublisherIT.java @@ -15,17 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.events; -import static org.assertj.core.api.Assertions.assertThat; - -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -import java.util.Collection; -import java.util.Collections; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicBoolean; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.neo4j.driver.Driver; @@ -52,6 +41,13 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.event.TransactionPhase; import org.springframework.transaction.event.TransactionalEventListener; +import java.util.Collection; +import java.util.Collections; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Michael J. Simons */ @@ -73,7 +69,8 @@ class EventsPublisherIT { static AtomicBoolean receivedAfterCommitEvent = new AtomicBoolean(false); - @Test // GH-2580 + @Test + // GH-2580 void beforeAndAfterCommitEventsShouldWork(@Autowired Neo4jObjectService service) { service.save("foobar"); @@ -81,13 +78,15 @@ class EventsPublisherIT { assertThat(receivedAfterCommitEvent).isTrue(); } - @Slf4j @Component - @RequiredArgsConstructor static class Neo4jObjectListener { private final Neo4jObjectService service; + Neo4jObjectListener(Neo4jObjectService service) { + this.service = service; + } + @TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) public void onBeforeCommit(Neo4jMessage message) { Optional optionalNeo4jObject = service.findById(message.getMessageId()); @@ -139,9 +138,51 @@ class EventsPublisherIT { } } - @Data static class Neo4jMessage { private final String messageId; + + Neo4jMessage(String messageId) { + this.messageId = messageId; + } + + public String getMessageId() { + return this.messageId; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Neo4jMessage)) { + return false; + } + final Neo4jMessage other = (Neo4jMessage) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$messageId = this.getMessageId(); + final Object other$messageId = other.getMessageId(); + if (this$messageId == null ? other$messageId != null : !this$messageId.equals(other$messageId)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof Neo4jMessage; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $messageId = this.getMessageId(); + result = result * PRIME + ($messageId == null ? 43 : $messageId.hashCode()); + return result; + } + + public String toString() { + return "EventsPublisherIT.Neo4jMessage(messageId=" + this.getMessageId() + ")"; + } } @Repository diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObject.java b/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObject.java index 7367a7370..2c48bd24d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObject.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObject.java @@ -15,10 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.events; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; @@ -26,13 +22,60 @@ import org.springframework.data.neo4j.core.schema.Property; /** * @author Michael J. Simons */ -@Data -@NoArgsConstructor -@AllArgsConstructor @Node(primaryLabel = "Neo4jObject") public class Neo4jObject { - @Id - @Property(name = "id") - private String id; + @Id + @Property(name = "id") + private String id; + + public Neo4jObject(String id) { + this.id = id; + } + + public Neo4jObject() { + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Neo4jObject)) { + return false; + } + final Neo4jObject other = (Neo4jObject) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof Neo4jObject; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + public String toString() { + return "Neo4jObject(id=" + this.getId() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObjectService.java b/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObjectService.java index 1dc0a5c3d..1e4a14ce1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObjectService.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/events/Neo4jObjectService.java @@ -15,25 +15,27 @@ */ package org.springframework.data.neo4j.integration.issues.events; -import lombok.AllArgsConstructor; - -import java.util.Optional; - import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + /** * @author Michael J. Simons */ @Service @Transactional -@AllArgsConstructor public class Neo4jObjectService { private final EventsPublisherIT.Neo4jObjectRepository neo4jObjectRepository; private final ApplicationEventPublisher publisher; + public Neo4jObjectService(EventsPublisherIT.Neo4jObjectRepository neo4jObjectRepository, ApplicationEventPublisher publisher) { + this.neo4jObjectRepository = neo4jObjectRepository; + this.publisher = publisher; + } + public Optional findById(String id) { return neo4jObjectRepository.findById(id); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/DomainObject.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/DomainObject.java index bac013094..a23279a9f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/DomainObject.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/DomainObject.java @@ -15,9 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2168; -import lombok.Getter; -import lombok.Setter; - import org.springframework.data.neo4j.core.convert.ConvertWith; import org.springframework.data.neo4j.core.schema.CompositeProperty; import org.springframework.data.neo4j.core.schema.GeneratedValue; @@ -29,8 +26,6 @@ import org.springframework.data.neo4j.core.schema.Property; * @author Michael J. Simons */ @Node -@Getter -@Setter public class DomainObject { @Id @@ -46,4 +41,36 @@ public class DomainObject { @ConvertWith(converterRef = "converterBean") private UnrelatedObject storedAsAnotherSingleProperty = new UnrelatedObject(); + + public String getId() { + return this.id; + } + + public UnrelatedObject getStoredAsMultipleProperties() { + return this.storedAsMultipleProperties; + } + + public UnrelatedObject getStoredAsSingleProperty() { + return this.storedAsSingleProperty; + } + + public UnrelatedObject getStoredAsAnotherSingleProperty() { + return this.storedAsAnotherSingleProperty; + } + + public void setId(String id) { + this.id = id; + } + + public void setStoredAsMultipleProperties(UnrelatedObject storedAsMultipleProperties) { + this.storedAsMultipleProperties = storedAsMultipleProperties; + } + + public void setStoredAsSingleProperty(UnrelatedObject storedAsSingleProperty) { + this.storedAsSingleProperty = storedAsSingleProperty; + } + + public void setStoredAsAnotherSingleProperty(UnrelatedObject storedAsAnotherSingleProperty) { + this.storedAsAnotherSingleProperty = storedAsAnotherSingleProperty; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/GeneratedValueStrategy.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/GeneratedValueStrategy.java index f247ee9cd..f773c634f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/GeneratedValueStrategy.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/GeneratedValueStrategy.java @@ -27,6 +27,6 @@ public final class GeneratedValueStrategy implements IdGenerator { @Override public String generateId(String primaryLabel, Object entity) { return "Please use something that one randomly create conflicting ids :) " + - ThreadLocalRandom.current().nextLong(); + ThreadLocalRandom.current().nextLong(); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/UnrelatedObject.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/UnrelatedObject.java index 29d009588..df170d67c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/UnrelatedObject.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/UnrelatedObject.java @@ -15,14 +15,10 @@ */ package org.springframework.data.neo4j.integration.issues.gh2168; -import lombok.Getter; -import lombok.Setter; - /** * @author Michael J. Simons */ -@Getter -@Setter +@SuppressWarnings("HiddenField") public class UnrelatedObject { private boolean aBooleanValue; @@ -36,4 +32,20 @@ public class UnrelatedObject { this.aBooleanValue = aBooleanValue; this.aLongValue = aLongValue; } + + public boolean isABooleanValue() { + return this.aBooleanValue; + } + + public Long getALongValue() { + return this.aLongValue; + } + + public void setABooleanValue(boolean aBooleanValue) { + this.aBooleanValue = aBooleanValue; + } + + public void setALongValue(Long aLongValue) { + this.aLongValue = aLongValue; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2244/Step.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2244/Step.java index a40a4eb5b..c1fc7d735 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2244/Step.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2244/Step.java @@ -25,7 +25,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public abstract class Step { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; public Long getId() { diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelation.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelation.java index 1cde2f24d..f396b4851 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelation.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelation.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2289; -import lombok.Data; - import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.RelationshipId; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -25,17 +23,20 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * @author Michael J. Simons */ -@Data // lombok @RelationshipProperties public class RangeRelation { @RelationshipId private Long id; - @Property private double minDelta; - @Property private double maxDelta; - @Property private RelationType relationType; + @Property + private double minDelta; + @Property + private double maxDelta; + @Property + private RelationType relationType; - @TargetNode private Sku targetSku; + @TargetNode + private Sku targetSku; public RangeRelation(Sku targetSku, double minDelta, double maxDelta, RelationType relationType) { this.targetSku = targetSku; @@ -43,4 +44,103 @@ public class RangeRelation { this.maxDelta = maxDelta; this.relationType = relationType; } + + public Long getId() { + return this.id; + } + + public double getMinDelta() { + return this.minDelta; + } + + public double getMaxDelta() { + return this.maxDelta; + } + + public RelationType getRelationType() { + return this.relationType; + } + + public Sku getTargetSku() { + return this.targetSku; + } + + public void setId(Long id) { + this.id = id; + } + + public void setMinDelta(double minDelta) { + this.minDelta = minDelta; + } + + public void setMaxDelta(double maxDelta) { + this.maxDelta = maxDelta; + } + + public void setRelationType(RelationType relationType) { + this.relationType = relationType; + } + + public void setTargetSku(Sku targetSku) { + this.targetSku = targetSku; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof RangeRelation)) { + return false; + } + final RangeRelation other = (RangeRelation) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + if (Double.compare(this.getMinDelta(), other.getMinDelta()) != 0) { + return false; + } + if (Double.compare(this.getMaxDelta(), other.getMaxDelta()) != 0) { + return false; + } + final Object this$relationType = this.getRelationType(); + final Object other$relationType = other.getRelationType(); + if (this$relationType == null ? other$relationType != null : !this$relationType.equals(other$relationType)) { + return false; + } + final Object this$targetSku = this.getTargetSku(); + final Object other$targetSku = other.getTargetSku(); + if (this$targetSku == null ? other$targetSku != null : !this$targetSku.equals(other$targetSku)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof RangeRelation; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final long $minDelta = Double.doubleToLongBits(this.getMinDelta()); + result = result * PRIME + (int) ($minDelta >>> 32 ^ $minDelta); + final long $maxDelta = Double.doubleToLongBits(this.getMaxDelta()); + result = result * PRIME + (int) ($maxDelta >>> 32 ^ $maxDelta); + final Object $relationType = this.getRelationType(); + result = result * PRIME + ($relationType == null ? 43 : $relationType.hashCode()); + final Object $targetSku = this.getTargetSku(); + result = result * PRIME + ($targetSku == null ? 43 : $targetSku.hashCode()); + return result; + } + + public String toString() { + return "RangeRelation(id=" + this.getId() + ", minDelta=" + this.getMinDelta() + ", maxDelta=" + this.getMaxDelta() + ", relationType=" + this.getRelationType() + ", targetSku=" + this.getTargetSku() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelationRO.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelationRO.java index a50bab6b7..22e3e09db 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelationRO.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/RangeRelationRO.java @@ -15,9 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2289; -import lombok.Data; -import lombok.EqualsAndHashCode; - import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.RelationshipId; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -26,19 +23,21 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * @author Michael J. Simons */ -@Data // lombok @RelationshipProperties public class RangeRelationRO { - @EqualsAndHashCode.Exclude @RelationshipId private Long id; - @Property private double minDelta; - @Property private double maxDelta; - @Property private RelationType relationType; + @Property + private double minDelta; + @Property + private double maxDelta; + @Property + private RelationType relationType; - @TargetNode private SkuRO targetSku; + @TargetNode + private SkuRO targetSku; public RangeRelationRO(SkuRO targetSku, double minDelta, double maxDelta, RelationType relationType) { this.targetSku = targetSku; @@ -46,4 +45,103 @@ public class RangeRelationRO { this.maxDelta = maxDelta; this.relationType = relationType; } + + public Long getId() { + return this.id; + } + + public double getMinDelta() { + return this.minDelta; + } + + public double getMaxDelta() { + return this.maxDelta; + } + + public RelationType getRelationType() { + return this.relationType; + } + + public SkuRO getTargetSku() { + return this.targetSku; + } + + public void setId(Long id) { + this.id = id; + } + + public void setMinDelta(double minDelta) { + this.minDelta = minDelta; + } + + public void setMaxDelta(double maxDelta) { + this.maxDelta = maxDelta; + } + + public void setRelationType(RelationType relationType) { + this.relationType = relationType; + } + + public void setTargetSku(SkuRO targetSku) { + this.targetSku = targetSku; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof RangeRelationRO)) { + return false; + } + final RangeRelationRO other = (RangeRelationRO) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + if (Double.compare(this.getMinDelta(), other.getMinDelta()) != 0) { + return false; + } + if (Double.compare(this.getMaxDelta(), other.getMaxDelta()) != 0) { + return false; + } + final Object this$relationType = this.getRelationType(); + final Object other$relationType = other.getRelationType(); + if (this$relationType == null ? other$relationType != null : !this$relationType.equals(other$relationType)) { + return false; + } + final Object this$targetSku = this.getTargetSku(); + final Object other$targetSku = other.getTargetSku(); + if (this$targetSku == null ? other$targetSku != null : !this$targetSku.equals(other$targetSku)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof RangeRelationRO; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final long $minDelta = Double.doubleToLongBits(this.getMinDelta()); + result = result * PRIME + (int) ($minDelta >>> 32 ^ $minDelta); + final long $maxDelta = Double.doubleToLongBits(this.getMaxDelta()); + result = result * PRIME + (int) ($maxDelta >>> 32 ^ $maxDelta); + final Object $relationType = this.getRelationType(); + result = result * PRIME + ($relationType == null ? 43 : $relationType.hashCode()); + final Object $targetSku = this.getTargetSku(); + result = result * PRIME + ($targetSku == null ? 43 : $targetSku.hashCode()); + return result; + } + + public String toString() { + return "RangeRelationRO(id=" + this.getId() + ", minDelta=" + this.getMinDelta() + ", maxDelta=" + this.getMaxDelta() + ", relationType=" + this.getRelationType() + ", targetSku=" + this.getTargetSku() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/Sku.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/Sku.java index e4a380892..9e96e7b97 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/Sku.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/Sku.java @@ -15,27 +15,23 @@ */ package org.springframework.data.neo4j.integration.issues.gh2289; -import lombok.Getter; -import lombok.Setter; - -import java.util.HashSet; -import java.util.Set; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.HashSet; +import java.util.Set; + /** * @author Michael J. Simons */ @Node("SKU") -@Getter // lombok -@Setter public class Sku { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; @Property("number") @@ -71,4 +67,44 @@ public class Sku { ", name='" + name + '}'; } + + public Long getId() { + return this.id; + } + + public Long getNumber() { + return this.number; + } + + public String getName() { + return this.name; + } + + public Set getRangeRelationsOut() { + return this.rangeRelationsOut; + } + + public Set getRangeRelationsIn() { + return this.rangeRelationsIn; + } + + public void setId(Long id) { + this.id = id; + } + + public void setNumber(Long number) { + this.number = number; + } + + public void setName(String name) { + this.name = name; + } + + public void setRangeRelationsOut(Set rangeRelationsOut) { + this.rangeRelationsOut = rangeRelationsOut; + } + + public void setRangeRelationsIn(Set rangeRelationsIn) { + this.rangeRelationsIn = rangeRelationsIn; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/SkuRO.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/SkuRO.java index df1f88d93..0825602f8 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/SkuRO.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2289/SkuRO.java @@ -15,13 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2289; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -import java.util.HashSet; -import java.util.Set; - import org.springframework.data.annotation.ReadOnlyProperty; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -29,25 +22,23 @@ import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.HashSet; +import java.util.Set; + /** * @author Michael J. Simons */ @Node("SKU_RO") -@Getter // lombok -@Setter -@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class SkuRO { - @Id @GeneratedValue - @EqualsAndHashCode.Include + @Id + @GeneratedValue private Long id; @Property("number") - @EqualsAndHashCode.Include private Long number; @Property(value = "name", readOnly = true) - @EqualsAndHashCode.Include private String name; @Relationship(type = "RANGE_RELATION_TO", direction = Relationship.Direction.OUTGOING) @@ -67,4 +58,89 @@ public class SkuRO { rangeRelationsOut.add(relationOut); return relationOut; } + + public Long getId() { + return this.id; + } + + public Long getNumber() { + return this.number; + } + + public String getName() { + return this.name; + } + + public Set getRangeRelationsOut() { + return this.rangeRelationsOut; + } + + public Set getRangeRelationsIn() { + return this.rangeRelationsIn; + } + + public void setId(Long id) { + this.id = id; + } + + public void setNumber(Long number) { + this.number = number; + } + + public void setName(String name) { + this.name = name; + } + + public void setRangeRelationsOut(Set rangeRelationsOut) { + this.rangeRelationsOut = rangeRelationsOut; + } + + public void setRangeRelationsIn(Set rangeRelationsIn) { + this.rangeRelationsIn = rangeRelationsIn; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof SkuRO)) { + return false; + } + final SkuRO other = (SkuRO) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$number = this.getNumber(); + final Object other$number = other.getNumber(); + if (this$number == null ? other$number != null : !this$number.equals(other$number)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof SkuRO; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $number = this.getNumber(); + result = result * PRIME + ($number == null ? 43 : $number.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2323/Person.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2323/Person.java index 3a2514c20..69b4573d1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2323/Person.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2323/Person.java @@ -29,7 +29,8 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class Person { - @Id @GeneratedValue(GeneratedValue.UUIDGenerator.class) + @Id + @GeneratedValue(GeneratedValue.UUIDGenerator.class) private String id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2326/BaseEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2326/BaseEntity.java index f5b1d53de..841052beb 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2326/BaseEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2326/BaseEntity.java @@ -24,7 +24,8 @@ import org.springframework.data.neo4j.core.support.UUIDStringGenerator; */ public abstract class BaseEntity { - @Id @GeneratedValue(UUIDStringGenerator.class) + @Id + @GeneratedValue(UUIDStringGenerator.class) private String id; public String getId() { diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2328/Entity2328.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2328/Entity2328.java index 5e5454c52..20ae3bc77 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2328/Entity2328.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2328/Entity2328.java @@ -15,26 +15,34 @@ */ package org.springframework.data.neo4j.integration.issues.gh2328; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -import java.util.UUID; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; +import java.util.UUID; + /** * @author Michael J. Simons * @soundtrack Motörhead - Better Motörhead Than Dead - Live At Hammersmith */ @Node -@Getter -@RequiredArgsConstructor public class Entity2328 { - @Id @GeneratedValue + @Id + @GeneratedValue private UUID id; private final String name; + + public Entity2328(String name) { + this.name = name; + } + + public UUID getId() { + return this.id; + } + + public String getName() { + return this.name; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/BaseNodeEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/BaseNodeEntity.java index b64b5321f..eef751d6e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/BaseNodeEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/BaseNodeEntity.java @@ -15,14 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2415; -import lombok.AccessLevel; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.NonFinal; -import lombok.experimental.SuperBuilder; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -31,24 +23,132 @@ import org.springframework.data.neo4j.core.support.UUIDStringGenerator; /** * @author Andreas Berger */ +@SuppressWarnings("HiddenField") @Node -@NonFinal -@Data -@Setter(AccessLevel.PRIVATE) -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@EqualsAndHashCode(onlyExplicitlyIncluded = true) -@SuperBuilder(toBuilder = true) public class BaseNodeEntity { @Id @GeneratedValue(UUIDStringGenerator.class) - @EqualsAndHashCode.Include private String nodeId; private String name; + protected BaseNodeEntity() { + } + + protected BaseNodeEntity(BaseNodeEntityBuilder b) { + this.nodeId = b.nodeId; + this.name = b.name; + } + + public static BaseNodeEntityBuilder builder() { + return new BaseNodeEntityBuilderImpl(); + } + @Override public String toString() { return getClass().getSimpleName() + " - " + getName() + " (" + getNodeId() + ")"; } + + public String getNodeId() { + return this.nodeId; + } + + public String getName() { + return this.name; + } + + private void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + private void setName(String name) { + this.name = name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof BaseNodeEntity)) { + return false; + } + final BaseNodeEntity other = (BaseNodeEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$nodeId = this.getNodeId(); + final Object other$nodeId = other.getNodeId(); + if (this$nodeId == null ? other$nodeId != null : !this$nodeId.equals(other$nodeId)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof BaseNodeEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $nodeId = this.getNodeId(); + result = result * PRIME + ($nodeId == null ? 43 : $nodeId.hashCode()); + return result; + } + + public BaseNodeEntityBuilder toBuilder() { + return new BaseNodeEntityBuilderImpl().$fillValuesFrom(this); + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class BaseNodeEntityBuilder> { + private String nodeId; + private String name; + + private static void $fillValuesFromInstanceIntoBuilder(BaseNodeEntity instance, BaseNodeEntityBuilder b) { + b.nodeId(instance.nodeId); + b.name(instance.name); + } + + public B nodeId(String nodeId) { + this.nodeId = nodeId; + return self(); + } + + public B name(String name) { + this.name = name; + return self(); + } + + protected B $fillValuesFrom(C instance) { + BaseNodeEntityBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "BaseNodeEntity.BaseNodeEntityBuilder(nodeId=" + this.nodeId + ", name=" + this.name + ")"; + } + } + + private static final class BaseNodeEntityBuilderImpl extends BaseNodeEntityBuilder { + private BaseNodeEntityBuilderImpl() { + } + + protected BaseNodeEntityBuilderImpl self() { + return this; + } + + public BaseNodeEntity build() { + return new BaseNodeEntity(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/Credential.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/Credential.java index a3eaa05f1..1ecf93ae8 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/Credential.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/Credential.java @@ -15,37 +15,113 @@ */ package org.springframework.data.neo4j.integration.issues.gh2415; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Value; -import lombok.With; - +import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.data.annotation.Immutable; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.support.UUIDStringGenerator; -import com.fasterxml.jackson.annotation.JsonIgnore; - /** * @author Andreas Berger */ +@SuppressWarnings("HiddenField") @Node -@Value -@With -@AllArgsConstructor -@EqualsAndHashCode(onlyExplicitlyIncluded = true) @Immutable -@Builder(toBuilder = true) -public class Credential { +public final class Credential { @JsonIgnore @Id @GeneratedValue(UUIDStringGenerator.class) - @EqualsAndHashCode.Include + private final String id; - String name; + private final String name; + + public Credential(String id, String name) { + this.id = id; + this.name = name; + } + + public static CredentialBuilder builder() { + return new CredentialBuilder(); + } + + public String getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public String toString() { + return "Credential(id=" + this.getId() + ", name=" + this.getName() + ")"; + } + + public Credential withId(String id) { + return this.id == id ? this : new Credential(id, this.name); + } + + public Credential withName(String name) { + return this.name == name ? this : new Credential(this.id, name); + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Credential)) { + return false; + } + final Credential other = (Credential) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + public CredentialBuilder toBuilder() { + return new CredentialBuilder().id(this.id).name(this.name); + } + + /** + * the builder + */ + public static class CredentialBuilder { + private String id; + private String name; + + CredentialBuilder() { + } + + @JsonIgnore + public CredentialBuilder id(String id) { + this.id = id; + return this; + } + + public CredentialBuilder name(String name) { + this.name = name; + return this; + } + + public Credential build() { + return new Credential(this.id, this.name); + } + + public String toString() { + return "Credential.CredentialBuilder(id=" + this.id + ", name=" + this.name + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/NodeEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/NodeEntity.java index 4eb46fb25..b4c3a1fa0 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/NodeEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2415/NodeEntity.java @@ -15,29 +15,17 @@ */ package org.springframework.data.neo4j.integration.issues.gh2415; -import lombok.AccessLevel; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; - -import java.util.Set; - +import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Set; /** * @author Andreas Berger */ +@SuppressWarnings("HiddenField") @Node -@Data -@Setter(AccessLevel.PRIVATE) -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true) -@SuperBuilder(toBuilder = true) public class NodeEntity extends BaseNodeEntity implements NodeWithDefinedCredentials { @JsonIgnore @@ -47,8 +35,121 @@ public class NodeEntity extends BaseNodeEntity implements NodeWithDefinedCredent @Relationship(type = "HAS_CREDENTIAL") private Set definedCredentials; + protected NodeEntity() { + } + + protected NodeEntity(NodeEntityBuilder b) { + super(b); + this.children = b.children; + this.definedCredentials = b.definedCredentials; + } + + public static NodeEntityBuilder builder() { + return new NodeEntityBuilderImpl(); + } + @Override public String toString() { return super.toString(); } + + public Set getChildren() { + return this.children; + } + + public Set getDefinedCredentials() { + return this.definedCredentials; + } + + @JsonIgnore + private void setChildren(Set children) { + this.children = children; + } + + private void setDefinedCredentials(Set definedCredentials) { + this.definedCredentials = definedCredentials; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof NodeEntity)) { + return false; + } + final NodeEntity other = (NodeEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + if (!super.equals(o)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof NodeEntity; + } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public NodeEntityBuilder toBuilder() { + return new NodeEntityBuilderImpl().$fillValuesFrom(this); + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class NodeEntityBuilder> extends BaseNodeEntityBuilder { + private Set children; + private Set definedCredentials; + + private static void $fillValuesFromInstanceIntoBuilder(NodeEntity instance, NodeEntityBuilder b) { + b.children(instance.children); + b.definedCredentials(instance.definedCredentials); + } + + @JsonIgnore + public B children(Set children) { + this.children = children; + return self(); + } + + public B definedCredentials(Set definedCredentials) { + this.definedCredentials = definedCredentials; + return self(); + } + + protected B $fillValuesFrom(C instance) { + super.$fillValuesFrom(instance); + NodeEntityBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "NodeEntity.NodeEntityBuilder(super=" + super.toString() + ", children=" + this.children + ", definedCredentials=" + this.definedCredentials + ")"; + } + } + + private static final class NodeEntityBuilderImpl extends NodeEntityBuilder { + private NodeEntityBuilderImpl() { + } + + protected NodeEntityBuilderImpl self() { + return this; + } + + public NodeEntity build() { + return new NodeEntity(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2459/PetOwner.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2459/PetOwner.java index 556dd780d..a432363bc 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2459/PetOwner.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2459/PetOwner.java @@ -15,26 +15,37 @@ */ package org.springframework.data.neo4j.integration.issues.gh2459; -import lombok.Getter; -import lombok.Setter; - -import java.util.List; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.List; + /** * Labels are written out on purpose for the test. * * @author Gerrit Meier */ @Node("PetOwner") -@Getter -@Setter public abstract class PetOwner { @Id private String uuid; @Relationship(type = "hasPet") private List pets; + + public String getUuid() { + return this.uuid; + } + + public List getPets() { + return this.pets; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public void setPets(List pets) { + this.pets = pets; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModel.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModel.java index 0a0e19be5..27e407480 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModel.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModel.java @@ -15,23 +15,20 @@ */ package org.springframework.data.neo4j.integration.issues.gh2474; -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** * @author Stephen Jackson */ @Node -@Data public class CityModel { @Id @GeneratedValue(generatorClass = GeneratedValue.UUIDGenerator.class) @@ -50,4 +47,125 @@ public class CityModel { @Property("exotic.property") private String exoticProperty; + + public CityModel() { + } + + public UUID getCityId() { + return this.cityId; + } + + public PersonModel getMayor() { + return this.mayor; + } + + public List getCitizens() { + return this.citizens; + } + + public List getCityEmployees() { + return this.cityEmployees; + } + + public String getName() { + return this.name; + } + + public String getExoticProperty() { + return this.exoticProperty; + } + + public void setCityId(UUID cityId) { + this.cityId = cityId; + } + + public void setMayor(PersonModel mayor) { + this.mayor = mayor; + } + + public void setCitizens(List citizens) { + this.citizens = citizens; + } + + public void setCityEmployees(List cityEmployees) { + this.cityEmployees = cityEmployees; + } + + public void setName(String name) { + this.name = name; + } + + public void setExoticProperty(String exoticProperty) { + this.exoticProperty = exoticProperty; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof CityModel)) { + return false; + } + final CityModel other = (CityModel) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$cityId = this.getCityId(); + final Object other$cityId = other.getCityId(); + if (this$cityId == null ? other$cityId != null : !this$cityId.equals(other$cityId)) { + return false; + } + final Object this$mayor = this.getMayor(); + final Object other$mayor = other.getMayor(); + if (this$mayor == null ? other$mayor != null : !this$mayor.equals(other$mayor)) { + return false; + } + final Object this$citizens = this.getCitizens(); + final Object other$citizens = other.getCitizens(); + if (this$citizens == null ? other$citizens != null : !this$citizens.equals(other$citizens)) { + return false; + } + final Object this$cityEmployees = this.getCityEmployees(); + final Object other$cityEmployees = other.getCityEmployees(); + if (this$cityEmployees == null ? other$cityEmployees != null : !this$cityEmployees.equals(other$cityEmployees)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$exoticProperty = this.getExoticProperty(); + final Object other$exoticProperty = other.getExoticProperty(); + if (this$exoticProperty == null ? other$exoticProperty != null : !this$exoticProperty.equals(other$exoticProperty)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof CityModel; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $cityId = this.getCityId(); + result = result * PRIME + ($cityId == null ? 43 : $cityId.hashCode()); + final Object $mayor = this.getMayor(); + result = result * PRIME + ($mayor == null ? 43 : $mayor.hashCode()); + final Object $citizens = this.getCitizens(); + result = result * PRIME + ($citizens == null ? 43 : $citizens.hashCode()); + final Object $cityEmployees = this.getCityEmployees(); + result = result * PRIME + ($cityEmployees == null ? 43 : $cityEmployees.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $exoticProperty = this.getExoticProperty(); + result = result * PRIME + ($exoticProperty == null ? 43 : $exoticProperty.hashCode()); + return result; + } + + public String toString() { + return "CityModel(cityId=" + this.getCityId() + ", mayor=" + this.getMayor() + ", citizens=" + this.getCitizens() + ", cityEmployees=" + this.getCityEmployees() + ", name=" + this.getName() + ", exoticProperty=" + this.getExoticProperty() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelDTO.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelDTO.java index 0bf765c7a..6ae69e79a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelDTO.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelDTO.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2474; -import lombok.Data; - import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -24,7 +22,6 @@ import java.util.UUID; /** * @author Stephen Jackson */ -@Data public class CityModelDTO { private UUID cityId; private String name; @@ -34,19 +31,230 @@ public class CityModelDTO { public List citizens = new ArrayList<>(); public List cityEmployees = new ArrayList<>(); - /** - * Nested projection - */ - @Data - public static class PersonModelDTO { - private UUID personId; + public CityModelDTO() { + } + + public UUID getCityId() { + return this.cityId; + } + + public String getName() { + return this.name; + } + + public String getExoticProperty() { + return this.exoticProperty; + } + + public PersonModelDTO getMayor() { + return this.mayor; + } + + public List getCitizens() { + return this.citizens; + } + + public List getCityEmployees() { + return this.cityEmployees; + } + + public void setCityId(UUID cityId) { + this.cityId = cityId; + } + + public void setName(String name) { + this.name = name; + } + + public void setExoticProperty(String exoticProperty) { + this.exoticProperty = exoticProperty; + } + + public void setMayor(PersonModelDTO mayor) { + this.mayor = mayor; + } + + public void setCitizens(List citizens) { + this.citizens = citizens; + } + + public void setCityEmployees(List cityEmployees) { + this.cityEmployees = cityEmployees; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof CityModelDTO)) { + return false; + } + final CityModelDTO other = (CityModelDTO) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$cityId = this.getCityId(); + final Object other$cityId = other.getCityId(); + if (this$cityId == null ? other$cityId != null : !this$cityId.equals(other$cityId)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$exoticProperty = this.getExoticProperty(); + final Object other$exoticProperty = other.getExoticProperty(); + if (this$exoticProperty == null ? other$exoticProperty != null : !this$exoticProperty.equals(other$exoticProperty)) { + return false; + } + final Object this$mayor = this.getMayor(); + final Object other$mayor = other.getMayor(); + if (this$mayor == null ? other$mayor != null : !this$mayor.equals(other$mayor)) { + return false; + } + final Object this$citizens = this.getCitizens(); + final Object other$citizens = other.getCitizens(); + if (this$citizens == null ? other$citizens != null : !this$citizens.equals(other$citizens)) { + return false; + } + final Object this$cityEmployees = this.getCityEmployees(); + final Object other$cityEmployees = other.getCityEmployees(); + if (this$cityEmployees == null ? other$cityEmployees != null : !this$cityEmployees.equals(other$cityEmployees)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof CityModelDTO; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $cityId = this.getCityId(); + result = result * PRIME + ($cityId == null ? 43 : $cityId.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $exoticProperty = this.getExoticProperty(); + result = result * PRIME + ($exoticProperty == null ? 43 : $exoticProperty.hashCode()); + final Object $mayor = this.getMayor(); + result = result * PRIME + ($mayor == null ? 43 : $mayor.hashCode()); + final Object $citizens = this.getCitizens(); + result = result * PRIME + ($citizens == null ? 43 : $citizens.hashCode()); + final Object $cityEmployees = this.getCityEmployees(); + result = result * PRIME + ($cityEmployees == null ? 43 : $cityEmployees.hashCode()); + return result; + } + + public String toString() { + return "CityModelDTO(cityId=" + this.getCityId() + ", name=" + this.getName() + ", exoticProperty=" + this.getExoticProperty() + ", mayor=" + this.getMayor() + ", citizens=" + this.getCitizens() + ", cityEmployees=" + this.getCityEmployees() + ")"; + } + + /** + * Nested projection + */ + public static class PersonModelDTO { + private UUID personId; + + public PersonModelDTO() { + } + + public UUID getPersonId() { + return this.personId; + } + + public void setPersonId(UUID personId) { + this.personId = personId; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PersonModelDTO)) { + return false; + } + final PersonModelDTO other = (PersonModelDTO) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$personId = this.getPersonId(); + final Object other$personId = other.getPersonId(); + if (this$personId == null ? other$personId != null : !this$personId.equals(other$personId)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PersonModelDTO; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $personId = this.getPersonId(); + result = result * PRIME + ($personId == null ? 43 : $personId.hashCode()); + return result; + } + + public String toString() { + return "CityModelDTO.PersonModelDTO(personId=" + this.getPersonId() + ")"; + } } /** * Nested projection */ - @Data public static class JobRelationshipDTO { private PersonModelDTO person; + + public JobRelationshipDTO() { + } + + public PersonModelDTO getPerson() { + return this.person; + } + + public void setPerson(PersonModelDTO person) { + this.person = person; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof JobRelationshipDTO)) { + return false; + } + final JobRelationshipDTO other = (JobRelationshipDTO) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$person = this.getPerson(); + final Object other$person = other.getPerson(); + if (this$person == null ? other$person != null : !this$person.equals(other$person)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof JobRelationshipDTO; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $person = this.getPerson(); + result = result * PRIME + ($person == null ? 43 : $person.hashCode()); + return result; + } + + public String toString() { + return "CityModelDTO.JobRelationshipDTO(person=" + this.getPerson() + ")"; + } } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelRepository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelRepository.java index 42a28c077..71b7777ad 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelRepository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/CityModelRepository.java @@ -32,8 +32,8 @@ public interface CityModelRepository extends Neo4jRepository { Optional findByCityId(UUID cityId); @Query("" - + "MATCH (n:CityModel)" - + "RETURN n :#{orderBy(#sort)}") + + "MATCH (n:CityModel)" + + "RETURN n :#{orderBy(#sort)}") List customQuery(Sort sort); long deleteAllByExoticProperty(String property); diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/JobRelationship.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/JobRelationship.java index d6f057a0d..38456487f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/JobRelationship.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/JobRelationship.java @@ -15,7 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2474; -import lombok.Data; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -25,14 +24,89 @@ import org.springframework.data.neo4j.core.schema.TargetNode; * @author Stephen Jackson */ @RelationshipProperties -@Data public class JobRelationship { - @Id - @GeneratedValue - private Long id; + @Id + @GeneratedValue + private Long id; - @TargetNode - private PersonModel person; + @TargetNode + private PersonModel person; - private String jobTitle; + private String jobTitle; + + public JobRelationship() { + } + + public Long getId() { + return this.id; + } + + public PersonModel getPerson() { + return this.person; + } + + public String getJobTitle() { + return this.jobTitle; + } + + public void setId(Long id) { + this.id = id; + } + + public void setPerson(PersonModel person) { + this.person = person; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof JobRelationship)) { + return false; + } + final JobRelationship other = (JobRelationship) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$person = this.getPerson(); + final Object other$person = other.getPerson(); + if (this$person == null ? other$person != null : !this$person.equals(other$person)) { + return false; + } + final Object this$jobTitle = this.getJobTitle(); + final Object other$jobTitle = other.getJobTitle(); + if (this$jobTitle == null ? other$jobTitle != null : !this$jobTitle.equals(other$jobTitle)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof JobRelationship; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $person = this.getPerson(); + result = result * PRIME + ($person == null ? 43 : $person.hashCode()); + final Object $jobTitle = this.getJobTitle(); + result = result * PRIME + ($jobTitle == null ? 43 : $jobTitle.hashCode()); + return result; + } + + public String toString() { + return "JobRelationship(id=" + this.getId() + ", person=" + this.getPerson() + ", jobTitle=" + this.getJobTitle() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/PersonModel.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/PersonModel.java index 528009026..53156414e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/PersonModel.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2474/PersonModel.java @@ -15,19 +15,16 @@ */ package org.springframework.data.neo4j.integration.issues.gh2474; -import lombok.Data; - -import java.util.UUID; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; +import java.util.UUID; + /** * @author Stephen Jackson */ @Node -@Data public class PersonModel { @Id @GeneratedValue(generatorClass = GeneratedValue.UUIDGenerator.class) @@ -36,4 +33,95 @@ public class PersonModel { private String address; private String name; private String favoriteFood; + + public PersonModel() { + } + + public UUID getPersonId() { + return this.personId; + } + + public String getAddress() { + return this.address; + } + + public String getName() { + return this.name; + } + + public String getFavoriteFood() { + return this.favoriteFood; + } + + public void setPersonId(UUID personId) { + this.personId = personId; + } + + public void setAddress(String address) { + this.address = address; + } + + public void setName(String name) { + this.name = name; + } + + public void setFavoriteFood(String favoriteFood) { + this.favoriteFood = favoriteFood; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PersonModel)) { + return false; + } + final PersonModel other = (PersonModel) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$personId = this.getPersonId(); + final Object other$personId = other.getPersonId(); + if (this$personId == null ? other$personId != null : !this$personId.equals(other$personId)) { + return false; + } + final Object this$address = this.getAddress(); + final Object other$address = other.getAddress(); + if (this$address == null ? other$address != null : !this$address.equals(other$address)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$favoriteFood = this.getFavoriteFood(); + final Object other$favoriteFood = other.getFavoriteFood(); + if (this$favoriteFood == null ? other$favoriteFood != null : !this$favoriteFood.equals(other$favoriteFood)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PersonModel; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $personId = this.getPersonId(); + result = result * PRIME + ($personId == null ? 43 : $personId.hashCode()); + final Object $address = this.getAddress(); + result = result * PRIME + ($address == null ? 43 : $address.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $favoriteFood = this.getFavoriteFood(); + result = result * PRIME + ($favoriteFood == null ? 43 : $favoriteFood.hashCode()); + return result; + } + + public String toString() { + return "PersonModel(personId=" + this.getPersonId() + ", address=" + this.getAddress() + ", name=" + this.getName() + ", favoriteFood=" + this.getFavoriteFood() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestConverter.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestConverter.java index 252f45938..cce3b0271 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestConverter.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestConverter.java @@ -32,7 +32,7 @@ public class TestConverter implements Neo4jPersistentPropertyToMapConverter decompose(TestData property, - Neo4jConversionService neo4jConversionService) { + Neo4jConversionService neo4jConversionService) { if (property == null) { return Map.of(); @@ -43,7 +43,7 @@ public class TestConverter implements Neo4jPersistentPropertyToMapConverter source, - Neo4jConversionService neo4jConversionService) { + Neo4jConversionService neo4jConversionService) { TestData data = new TestData(); if (source.get(NUM) != null) { data.setNum(source.get(NUM).asInt()); diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestData.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestData.java index 675b29ab1..0239e004c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestData.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestData.java @@ -15,14 +15,9 @@ */ package org.springframework.data.neo4j.integration.issues.gh2493; -import lombok.Getter; -import lombok.Setter; - /** * @author Michael J. Simons */ -@Getter -@Setter public class TestData { private int num; @@ -36,4 +31,20 @@ public class TestData { this.num = num; this.string = string; } + + public int getNum() { + return this.num; + } + + public String getString() { + return this.string; + } + + public void setNum(int num) { + this.num = num; + } + + public void setString(String string) { + this.string = string; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestObject.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestObject.java index fc0127f58..fd50fc004 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestObject.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2493/TestObject.java @@ -15,9 +15,7 @@ */ package org.springframework.data.neo4j.integration.issues.gh2493; -import lombok.Getter; -import lombok.Setter; - +import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.data.neo4j.core.schema.CompositeProperty; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -25,14 +23,10 @@ import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.support.UUIDStringGenerator; -import com.fasterxml.jackson.annotation.JsonIgnore; - /** * @author Michael J. Simons */ @Node -@Getter -@Setter public class TestObject { @Id @@ -48,4 +42,21 @@ public class TestObject { super(); data = aData; } + + public String getId() { + return this.id; + } + + public TestData getData() { + return this.data; + } + + public void setId(String id) { + this.id = id; + } + + @JsonIgnore + public void setData(TestData data) { + this.data = data; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/DomainModel.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/DomainModel.java index 766a8ecc0..f4a482f89 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/DomainModel.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/DomainModel.java @@ -27,7 +27,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class DomainModel { - @Id @GeneratedValue UUID id; + @Id + @GeneratedValue + UUID id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Edge.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Edge.java index e24a8dd4f..48d660499 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Edge.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Edge.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2498; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -29,16 +23,73 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * @author Michael J. Simons */ +@SuppressWarnings("HiddenField") @RelationshipProperties -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder(toBuilder = true) public class Edge { @Id @GeneratedValue Long id; @TargetNode Vertex vertex; + + public Edge(Long id, Vertex vertex) { + this.id = id; + this.vertex = vertex; + } + + public Edge() { + } + + public static EdgeBuilder builder() { + return new EdgeBuilder(); + } + + public Long getId() { + return this.id; + } + + public Vertex getVertex() { + return this.vertex; + } + + public void setId(Long id) { + this.id = id; + } + + public void setVertex(Vertex vertex) { + this.vertex = vertex; + } + + public EdgeBuilder toBuilder() { + return new EdgeBuilder().id(this.id).vertex(this.vertex); + } + + /** + * the builder + */ + public static class EdgeBuilder { + private Long id; + private Vertex vertex; + + EdgeBuilder() { + } + + public EdgeBuilder id(Long id) { + this.id = id; + return this; + } + + public EdgeBuilder vertex(Vertex vertex) { + this.vertex = vertex; + return this; + } + + public Edge build() { + return new Edge(this.id, this.vertex); + } + + public String toString() { + return "Edge.EdgeBuilder(id=" + this.id + ", vertex=" + this.vertex + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Vertex.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Vertex.java index 36deba3ee..6640e1e9c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Vertex.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2498/Vertex.java @@ -15,33 +15,99 @@ */ package org.springframework.data.neo4j.integration.issues.gh2498; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.List; + /** * @author Michael J. Simons */ -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor +@SuppressWarnings("HiddenField") @Node("Vertex") -@Builder(toBuilder = true) public class Vertex { - @Id - @GeneratedValue - Long id; - String name; - @Relationship(type = "CONNECTED_TO", direction = Relationship.Direction.INCOMING) + @Id + @GeneratedValue + Long id; + String name; + @Relationship(type = "CONNECTED_TO", direction = Relationship.Direction.INCOMING) List edges; + + public Vertex(Long id, String name, List edges) { + this.id = id; + this.name = name; + this.edges = edges; + } + + public Vertex() { + } + + public static VertexBuilder builder() { + return new VertexBuilder(); + } + + public Long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public List getEdges() { + return this.edges; + } + + public void setId(Long id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setEdges(List edges) { + this.edges = edges; + } + + public VertexBuilder toBuilder() { + return new VertexBuilder().id(this.id).name(this.name).edges(this.edges); + } + + /** + * the builder + */ + public static class VertexBuilder { + private Long id; + private String name; + private List edges; + + VertexBuilder() { + } + + public VertexBuilder id(Long id) { + this.id = id; + return this; + } + + public VertexBuilder name(String name) { + this.name = name; + return this; + } + + public VertexBuilder edges(List edges) { + this.edges = edges; + return this; + } + + public Vertex build() { + return new Vertex(this.id, this.name, this.edges); + } + + public String toString() { + return "Vertex.VertexBuilder(id=" + this.id + ", name=" + this.name + ", edges=" + this.edges + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Device.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Device.java index 5a5ceba17..89d9e764c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Device.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Device.java @@ -15,23 +15,18 @@ */ package org.springframework.data.neo4j.integration.issues.gh2500; -import lombok.Getter; -import lombok.Setter; - -import java.util.LinkedHashSet; -import java.util.Set; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.LinkedHashSet; +import java.util.Set; + /** * @author Michael J. Simons */ @Node -@Getter -@Setter public class Device { @Id @@ -65,4 +60,36 @@ public class Device { result = 31 * result + (name != null ? name.hashCode() : 0); return result; } + + public Long getId() { + return this.id; + } + + public Long getVersion() { + return this.version; + } + + public String getName() { + return this.name; + } + + public Set getGroups() { + return this.groups; + } + + public void setId(Long id) { + this.id = id; + } + + public void setVersion(Long version) { + this.version = version; + } + + public void setName(String name) { + this.name = name; + } + + public void setGroups(Set groups) { + this.groups = groups; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Group.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Group.java index a3a32db0e..4f3262c3b 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Group.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2500/Group.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2500; -import lombok.Getter; -import lombok.Setter; - -import java.util.LinkedHashSet; -import java.util.Set; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -29,12 +23,13 @@ import org.springframework.data.neo4j.core.schema.Relationship; import org.springframework.data.neo4j.core.support.UUIDStringGenerator; import org.springframework.lang.NonNull; +import java.util.LinkedHashSet; +import java.util.Set; + /** * @author Michael J. Simons */ @Node -@Getter -@Setter public class Group { @Id @@ -77,4 +72,45 @@ public class Group { result = 31 * result + name.hashCode(); return result; } + + public String getId() { + return this.id; + } + + public Long getVersion() { + return this.version; + } + + @NonNull + public String getName() { + return this.name; + } + + public Set getDevices() { + return this.devices; + } + + public Set getGroups() { + return this.groups; + } + + public void setId(String id) { + this.id = id; + } + + public void setVersion(Long version) { + this.version = version; + } + + public void setName(@NonNull String name) { + this.name = name; + } + + public void setDevices(Set devices) { + this.devices = devices; + } + + public void setGroups(Set groups) { + this.groups = groups; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/AccountingMeasurementMeta.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/AccountingMeasurementMeta.java index c7071d99d..6ce025507 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/AccountingMeasurementMeta.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/AccountingMeasurementMeta.java @@ -15,31 +15,138 @@ */ package org.springframework.data.neo4j.integration.issues.gh2526; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; - import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; /** * Defining most concrete entity */ +@SuppressWarnings("HiddenField") @Node -@Data -@Setter(AccessLevel.PRIVATE) -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor(access = AccessLevel.PROTECTED) -@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true) -@SuperBuilder(toBuilder = true) public class AccountingMeasurementMeta extends MeasurementMeta { private String formula; @Relationship(type = "WEIGHTS", direction = Relationship.Direction.OUTGOING) private MeasurementMeta baseMeasurement; + + protected AccountingMeasurementMeta(String formula, MeasurementMeta baseMeasurement) { + this.formula = formula; + this.baseMeasurement = baseMeasurement; + } + + protected AccountingMeasurementMeta() { + } + + protected AccountingMeasurementMeta(AccountingMeasurementMetaBuilder b) { + super(b); + this.formula = b.formula; + this.baseMeasurement = b.baseMeasurement; + } + + public static AccountingMeasurementMetaBuilder builder() { + return new AccountingMeasurementMetaBuilderImpl(); + } + + public String getFormula() { + return this.formula; + } + + public MeasurementMeta getBaseMeasurement() { + return this.baseMeasurement; + } + + public String toString() { + return "AccountingMeasurementMeta(formula=" + this.getFormula() + ", baseMeasurement=" + this.getBaseMeasurement() + ")"; + } + + private void setFormula(String formula) { + this.formula = formula; + } + + private void setBaseMeasurement(MeasurementMeta baseMeasurement) { + this.baseMeasurement = baseMeasurement; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof AccountingMeasurementMeta)) { + return false; + } + final AccountingMeasurementMeta other = (AccountingMeasurementMeta) o; + if (!other.canEqual((Object) this)) { + return false; + } + if (!super.equals(o)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof AccountingMeasurementMeta; + } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public AccountingMeasurementMetaBuilder toBuilder() { + return new AccountingMeasurementMetaBuilderImpl().$fillValuesFrom(this); + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class AccountingMeasurementMetaBuilder> extends MeasurementMetaBuilder { + private String formula; + private MeasurementMeta baseMeasurement; + + private static void $fillValuesFromInstanceIntoBuilder(AccountingMeasurementMeta instance, AccountingMeasurementMetaBuilder b) { + b.formula(instance.formula); + b.baseMeasurement(instance.baseMeasurement); + } + + public B formula(String formula) { + this.formula = formula; + return self(); + } + + public B baseMeasurement(MeasurementMeta baseMeasurement) { + this.baseMeasurement = baseMeasurement; + return self(); + } + + protected B $fillValuesFrom(C instance) { + super.$fillValuesFrom(instance); + AccountingMeasurementMetaBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "AccountingMeasurementMeta.AccountingMeasurementMetaBuilder(super=" + super.toString() + ", formula=" + this.formula + ", baseMeasurement=" + this.baseMeasurement + ")"; + } + } + + private static final class AccountingMeasurementMetaBuilderImpl extends AccountingMeasurementMetaBuilder { + private AccountingMeasurementMetaBuilderImpl() { + } + + protected AccountingMeasurementMetaBuilderImpl self() { + return this; + } + + public AccountingMeasurementMeta build() { + return new AccountingMeasurementMeta(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/DataPoint.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/DataPoint.java index e4d350c55..9496705db 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/DataPoint.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/DataPoint.java @@ -15,11 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2526; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Value; -import lombok.With; - import org.springframework.data.annotation.Immutable; import org.springframework.data.neo4j.core.schema.RelationshipId; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -28,20 +23,76 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * Relationship with properties between measurement and measurand */ +@SuppressWarnings("HiddenField") @RelationshipProperties -@Value -@With -@AllArgsConstructor @Immutable -@EqualsAndHashCode(onlyExplicitlyIncluded = true) -public class DataPoint { +public final class DataPoint { @RelationshipId + private final Long id; - boolean manual; + private final boolean manual; @TargetNode - @EqualsAndHashCode.Include + private final Measurand measurand; + + public DataPoint(Long id, boolean manual, Measurand measurand) { + this.id = id; + this.manual = manual; + this.measurand = measurand; + } + + public Long getId() { + return this.id; + } + + public boolean isManual() { + return this.manual; + } + + public Measurand getMeasurand() { + return this.measurand; + } + + public String toString() { + return "DataPoint(id=" + this.getId() + ", manual=" + this.isManual() + ", measurand=" + this.getMeasurand() + ")"; + } + + public DataPoint withId(Long id) { + return this.id == id ? this : new DataPoint(id, this.manual, this.measurand); + } + + public DataPoint withManual(boolean manual) { + return this.manual == manual ? this : new DataPoint(this.id, manual, this.measurand); + } + + public DataPoint withMeasurand(Measurand measurand) { + return this.measurand == measurand ? this : new DataPoint(this.id, this.manual, measurand); + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DataPoint)) { + return false; + } + final DataPoint other = (DataPoint) o; + final Object this$measurand = this.getMeasurand(); + final Object other$measurand = other.getMeasurand(); + if (this$measurand == null ? other$measurand != null : !this$measurand.equals(other$measurand)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $measurand = this.getMeasurand(); + result = result * PRIME + ($measurand == null ? 43 : $measurand.hashCode()); + return result; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Measurand.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Measurand.java index 0a09469c9..48331a624 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Measurand.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Measurand.java @@ -15,9 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2526; -import lombok.AllArgsConstructor; -import lombok.Value; - import org.springframework.data.annotation.Immutable; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -26,11 +23,46 @@ import org.springframework.data.neo4j.core.schema.Node; * Target node */ @Node -@Value -@AllArgsConstructor @Immutable -public class Measurand { +public final class Measurand { @Id + private final String measurandId; + + public Measurand(String measurandId) { + this.measurandId = measurandId; + } + + public String getMeasurandId() { + return this.measurandId; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Measurand)) { + return false; + } + final Measurand other = (Measurand) o; + final Object this$measurandId = this.getMeasurandId(); + final Object other$measurandId = other.getMeasurandId(); + if (this$measurandId == null ? other$measurandId != null : !this$measurandId.equals(other$measurandId)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $measurandId = this.getMeasurandId(); + result = result * PRIME + ($measurandId == null ? 43 : $measurandId.hashCode()); + return result; + } + + public String toString() { + return "Measurand(measurandId=" + this.getMeasurandId() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/MeasurementMeta.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/MeasurementMeta.java index 403da8ff7..4c3c5c499 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/MeasurementMeta.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/MeasurementMeta.java @@ -15,30 +15,17 @@ */ package org.springframework.data.neo4j.integration.issues.gh2526; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; - -import java.util.Set; - import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; import org.springframework.data.neo4j.integration.issues.gh2415.BaseNodeEntity; +import java.util.Set; + /** * Defining relationship to measurand */ +@SuppressWarnings("HiddenField") @Node -@Data -@Setter(AccessLevel.PRIVATE) -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor(access = AccessLevel.PROTECTED) -@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true) -@SuperBuilder(toBuilder = true) public class MeasurementMeta extends BaseNodeEntity { @Relationship(type = "IS_MEASURED_BY", direction = Relationship.Direction.INCOMING) @@ -46,4 +33,124 @@ public class MeasurementMeta extends BaseNodeEntity { @Relationship(type = "USES", direction = Relationship.Direction.OUTGOING) private Set variables; + + protected MeasurementMeta(Set dataPoints, Set variables) { + this.dataPoints = dataPoints; + this.variables = variables; + } + + protected MeasurementMeta() { + } + + protected MeasurementMeta(MeasurementMetaBuilder b) { + super(b); + this.dataPoints = b.dataPoints; + this.variables = b.variables; + } + + public static MeasurementMetaBuilder builder() { + return new MeasurementMetaBuilderImpl(); + } + + public Set getDataPoints() { + return this.dataPoints; + } + + public Set getVariables() { + return this.variables; + } + + public String toString() { + return "MeasurementMeta(dataPoints=" + this.getDataPoints() + ", variables=" + this.getVariables() + ")"; + } + + private void setDataPoints(Set dataPoints) { + this.dataPoints = dataPoints; + } + + private void setVariables(Set variables) { + this.variables = variables; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof MeasurementMeta)) { + return false; + } + final MeasurementMeta other = (MeasurementMeta) o; + if (!other.canEqual((Object) this)) { + return false; + } + if (!super.equals(o)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof MeasurementMeta; + } + + public int hashCode() { + int result = super.hashCode(); + return result; + } + + public MeasurementMetaBuilder toBuilder() { + return new MeasurementMetaBuilderImpl().$fillValuesFrom(this); + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class MeasurementMetaBuilder> extends BaseNodeEntityBuilder { + private Set dataPoints; + private Set variables; + + private static void $fillValuesFromInstanceIntoBuilder(MeasurementMeta instance, MeasurementMetaBuilder b) { + b.dataPoints(instance.dataPoints); + b.variables(instance.variables); + } + + public B dataPoints(Set dataPoints) { + this.dataPoints = dataPoints; + return self(); + } + + public B variables(Set variables) { + this.variables = variables; + return self(); + } + + protected B $fillValuesFrom(C instance) { + super.$fillValuesFrom(instance); + MeasurementMetaBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "MeasurementMeta.MeasurementMetaBuilder(super=" + super.toString() + ", dataPoints=" + this.dataPoints + ", variables=" + this.variables + ")"; + } + } + + private static final class MeasurementMetaBuilderImpl extends MeasurementMetaBuilder { + private MeasurementMetaBuilderImpl() { + } + + protected MeasurementMetaBuilderImpl self() { + return this; + } + + public MeasurementMeta build() { + return new MeasurementMeta(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Variable.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Variable.java index 7f6c4b238..d50c400cc 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Variable.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2526/Variable.java @@ -15,11 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2526; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Value; -import lombok.With; - import org.springframework.data.annotation.Immutable; import org.springframework.data.neo4j.core.schema.RelationshipId; import org.springframework.data.neo4j.core.schema.RelationshipProperties; @@ -28,20 +23,25 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * Second type of relationship */ +@SuppressWarnings("HiddenField") @RelationshipProperties -@Value -@With -@AllArgsConstructor -@EqualsAndHashCode @Immutable -public class Variable { +public final class Variable { @RelationshipId + private final Long id; @TargetNode + private final MeasurementMeta measurement; - String variable; + private final String variable; + + public Variable(Long id, MeasurementMeta measurement, String variable) { + this.id = id; + this.measurement = measurement; + this.variable = variable; + } public static Variable create(MeasurementMeta measurement, String variable) { return new Variable(null, measurement, variable); @@ -51,4 +51,66 @@ public class Variable { public String toString() { return variable + ": " + measurement.getNodeId(); } + + public Long getId() { + return this.id; + } + + public MeasurementMeta getMeasurement() { + return this.measurement; + } + + public String getVariable() { + return this.variable; + } + + public Variable withId(Long id) { + return this.id == id ? this : new Variable(id, this.measurement, this.variable); + } + + public Variable withMeasurement(MeasurementMeta measurement) { + return this.measurement == measurement ? this : new Variable(this.id, measurement, this.variable); + } + + public Variable withVariable(String variable) { + return this.variable == variable ? this : new Variable(this.id, this.measurement, variable); + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Variable)) { + return false; + } + final Variable other = (Variable) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$measurement = this.getMeasurement(); + final Object other$measurement = other.getMeasurement(); + if (this$measurement == null ? other$measurement != null : !this$measurement.equals(other$measurement)) { + return false; + } + final Object this$variable = this.getVariable(); + final Object other$variable = other.getVariable(); + if (this$variable == null ? other$variable != null : !this$variable.equals(other$variable)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $measurement = this.getMeasurement(); + result = result * PRIME + ($measurement == null ? 43 : $measurement.hashCode()); + final Object $variable = this.getVariable(); + result = result * PRIME + ($variable == null ? 43 : $variable.hashCode()); + return result; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2530/SomeStringGenerator.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2530/SomeStringGenerator.java index 3ff8f3cf4..b5a57be87 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2530/SomeStringGenerator.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2530/SomeStringGenerator.java @@ -24,8 +24,8 @@ import java.util.UUID; */ public class SomeStringGenerator implements IdGenerator { - @Override - public String generateId(String primaryLabel, Object entity) { - return primaryLabel + UUID.randomUUID(); - } + @Override + public String generateId(String primaryLabel, Object entity) { + return primaryLabel + UUID.randomUUID(); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Child.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Child.java index 3c94e8b4f..5a0fcf062 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Child.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Child.java @@ -15,25 +15,40 @@ */ package org.springframework.data.neo4j.integration.issues.gh2572; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; /** * @author Michael J. Simons */ -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor @Node public class GH2572Child extends GH2572BaseEntity { private String name; @Relationship(value = "IS_PET", direction = Relationship.Direction.OUTGOING) private GH2572Parent owner; + + public GH2572Child(String name, GH2572Parent owner) { + this.name = name; + this.owner = owner; + } + + public GH2572Child() { + } + + public String getName() { + return this.name; + } + + public GH2572Parent getOwner() { + return this.owner; + } + + public void setName(String name) { + this.name = name; + } + + public void setOwner(GH2572Parent owner) { + this.owner = owner; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Parent.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Parent.java index 4b8b653a5..65afec6b8 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Parent.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Parent.java @@ -15,24 +15,39 @@ */ package org.springframework.data.neo4j.integration.issues.gh2572; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - import org.springframework.data.neo4j.core.schema.Node; /** * @author Michael J. Simons */ -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor @Node public class GH2572Parent extends GH2572BaseEntity { private String name; private int age; + + public GH2572Parent(String name, int age) { + this.name = name; + this.age = age; + } + + public GH2572Parent() { + } + + public String getName() { + return this.name; + } + + public int getAge() { + return this.age; + } + + public void setName(String name) { + this.name = name; + } + + public void setAge(int age) { + this.age = age; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Repository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Repository.java index 5c8cbf826..ef6f02196 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Repository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/GH2572Repository.java @@ -27,17 +27,17 @@ import org.springframework.data.neo4j.repository.query.Query; public interface GH2572Repository extends Neo4jRepository { @Query("MATCH(person:GH2572Parent {id: $id}) " - + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " - + "RETURN dog") + + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " + + "RETURN dog") List getDogsForPerson(String id); @Query("MATCH(person:GH2572Parent {id: $id}) " - + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " - + "RETURN dog ORDER BY dog.name ASC LIMIT 1") + + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " + + "RETURN dog ORDER BY dog.name ASC LIMIT 1") Optional findOneDogForPerson(String id); @Query("MATCH(person:GH2572Parent {id: $id}) " - + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " - + "RETURN dog ORDER BY dog.name ASC LIMIT 1") + + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " + + "RETURN dog ORDER BY dog.name ASC LIMIT 1") GH2572Child getOneDogForPerson(String id); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/ReactiveGH2572Repository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/ReactiveGH2572Repository.java index 9b45b7c67..396f7fe9d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/ReactiveGH2572Repository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2572/ReactiveGH2572Repository.java @@ -27,12 +27,12 @@ import org.springframework.data.neo4j.repository.query.Query; public interface ReactiveGH2572Repository extends ReactiveNeo4jRepository { @Query("MATCH(person:GH2572Parent {id: $id}) " - + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " - + "RETURN dog") + + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " + + "RETURN dog") Flux getDogsForPerson(String id); @Query("MATCH(person:GH2572Parent {id: $id}) " - + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " - + "RETURN dog ORDER BY dog.name ASC LIMIT 1") + + "OPTIONAL MATCH (person)<-[:IS_PET]-(dog:GH2572Child) " + + "RETURN dog ORDER BY dog.name ASC LIMIT 1") Mono findOneDogForPerson(String id); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/College.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/College.java index c2a879a5a..7a4de4ece 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/College.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/College.java @@ -26,7 +26,8 @@ import org.springframework.data.neo4j.core.support.UUIDStringGenerator; @Node public class College { - @Id @GeneratedValue(UUIDStringGenerator.class) + @Id + @GeneratedValue(UUIDStringGenerator.class) private String guid; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/CollegeRepository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/CollegeRepository.java index 259b176c0..eaa4d96de 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/CollegeRepository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/CollegeRepository.java @@ -28,18 +28,18 @@ import org.springframework.data.neo4j.repository.query.Query; public interface CollegeRepository extends Neo4jRepository { @Query(""" - UNWIND $0 AS row - MATCH (student:Student{guid:row.stuGuid}) - MATCH (college:College{guid:row.collegeGuid}) - CREATE (student)<-[:STUDENT_OF]-(college) RETURN student.guid""" + UNWIND $0 AS row + MATCH (student:Student{guid:row.stuGuid}) + MATCH (college:College{guid:row.collegeGuid}) + CREATE (student)<-[:STUDENT_OF]-(college) RETURN student.guid""" ) List addStudentToCollege(List> list); @Query(""" - UNWIND $0 AS row - MATCH (student:Student{guid:row.stuGuid}) - MATCH (college:College{guid:row.collegeGuid}) - CREATE (student)<-[:STUDENT_OF]-(college) RETURN student.guid""" + UNWIND $0 AS row + MATCH (student:Student{guid:row.stuGuid}) + MATCH (college:College{guid:row.collegeGuid}) + CREATE (student)<-[:STUDENT_OF]-(college) RETURN student.guid""" ) List addStudentToCollegeWorkaround(List list); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/Student.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/Student.java index 3514b6dad..5cfb751d9 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/Student.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2576/Student.java @@ -27,7 +27,8 @@ import org.springframework.data.neo4j.core.support.UUIDStringGenerator; @Node public class Student { - @Id @GeneratedValue(UUIDStringGenerator.class) + @Id + @GeneratedValue(UUIDStringGenerator.class) private String guid; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/ColumnNode.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/ColumnNode.java index 76ef35722..eea32438c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/ColumnNode.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/ColumnNode.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2579; -import lombok.Data; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -24,7 +22,6 @@ import org.springframework.data.neo4j.core.schema.Node; /** * @author Michael J. Simons */ -@Data @Node("Column") public class ColumnNode { @@ -39,4 +36,110 @@ public class ColumnNode { private String tableName; private String name; + + public ColumnNode() { + } + + public Long getId() { + return this.id; + } + + public String getSourceName() { + return this.sourceName; + } + + public String getSchemaName() { + return this.schemaName; + } + + public String getTableName() { + return this.tableName; + } + + public String getName() { + return this.name; + } + + public void setId(Long id) { + this.id = id; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public void setName(String name) { + this.name = name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ColumnNode)) { + return false; + } + final ColumnNode other = (ColumnNode) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$sourceName = this.getSourceName(); + final Object other$sourceName = other.getSourceName(); + if (this$sourceName == null ? other$sourceName != null : !this$sourceName.equals(other$sourceName)) { + return false; + } + final Object this$schemaName = this.getSchemaName(); + final Object other$schemaName = other.getSchemaName(); + if (this$schemaName == null ? other$schemaName != null : !this$schemaName.equals(other$schemaName)) { + return false; + } + final Object this$tableName = this.getTableName(); + final Object other$tableName = other.getTableName(); + if (this$tableName == null ? other$tableName != null : !this$tableName.equals(other$tableName)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof ColumnNode; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $sourceName = this.getSourceName(); + result = result * PRIME + ($sourceName == null ? 43 : $sourceName.hashCode()); + final Object $schemaName = this.getSchemaName(); + result = result * PRIME + ($schemaName == null ? 43 : $schemaName.hashCode()); + final Object $tableName = this.getTableName(); + result = result * PRIME + ($tableName == null ? 43 : $tableName.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + public String toString() { + return "ColumnNode(id=" + this.getId() + ", sourceName=" + this.getSourceName() + ", schemaName=" + this.getSchemaName() + ", tableName=" + this.getTableName() + ", name=" + this.getName() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableAndColumnRelation.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableAndColumnRelation.java index 8612bbe6f..994212a22 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableAndColumnRelation.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableAndColumnRelation.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2579; -import lombok.Data; - import org.springframework.data.neo4j.core.schema.RelationshipId; import org.springframework.data.neo4j.core.schema.RelationshipProperties; import org.springframework.data.neo4j.core.schema.TargetNode; @@ -24,13 +22,73 @@ import org.springframework.data.neo4j.core.schema.TargetNode; /** * @author Michael J. Simons */ -@Data @RelationshipProperties public class TableAndColumnRelation { - @RelationshipId - private Long id; + @RelationshipId + private Long id; - @TargetNode - private ColumnNode columnNode; + @TargetNode + private ColumnNode columnNode; + + public TableAndColumnRelation() { + } + + public Long getId() { + return this.id; + } + + public ColumnNode getColumnNode() { + return this.columnNode; + } + + public void setId(Long id) { + this.id = id; + } + + public void setColumnNode(ColumnNode columnNode) { + this.columnNode = columnNode; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof TableAndColumnRelation)) { + return false; + } + final TableAndColumnRelation other = (TableAndColumnRelation) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$columnNode = this.getColumnNode(); + final Object other$columnNode = other.getColumnNode(); + if (this$columnNode == null ? other$columnNode != null : !this$columnNode.equals(other$columnNode)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof TableAndColumnRelation; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $columnNode = this.getColumnNode(); + result = result * PRIME + ($columnNode == null ? 43 : $columnNode.hashCode()); + return result; + } + + public String toString() { + return "TableAndColumnRelation(id=" + this.getId() + ", columnNode=" + this.getColumnNode() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableNode.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableNode.java index ee095f2c3..5f7dc2f5e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableNode.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableNode.java @@ -15,19 +15,16 @@ */ package org.springframework.data.neo4j.integration.issues.gh2579; -import lombok.Data; - -import java.util.List; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.List; + /** * @author Michael J. Simons */ -@Data @Node("Table") public class TableNode { @@ -45,4 +42,125 @@ public class TableNode { @Relationship(type = "BELONG", direction = Relationship.Direction.INCOMING) private List tableAndColumnRelation; + + public TableNode() { + } + + public Long getId() { + return this.id; + } + + public String getSourceName() { + return this.sourceName; + } + + public String getSchemaName() { + return this.schemaName; + } + + public String getName() { + return this.name; + } + + public String getTableComment() { + return this.tableComment; + } + + public List getTableAndColumnRelation() { + return this.tableAndColumnRelation; + } + + public void setId(Long id) { + this.id = id; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + public void setName(String name) { + this.name = name; + } + + public void setTableComment(String tableComment) { + this.tableComment = tableComment; + } + + public void setTableAndColumnRelation(List tableAndColumnRelation) { + this.tableAndColumnRelation = tableAndColumnRelation; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof TableNode)) { + return false; + } + final TableNode other = (TableNode) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$sourceName = this.getSourceName(); + final Object other$sourceName = other.getSourceName(); + if (this$sourceName == null ? other$sourceName != null : !this$sourceName.equals(other$sourceName)) { + return false; + } + final Object this$schemaName = this.getSchemaName(); + final Object other$schemaName = other.getSchemaName(); + if (this$schemaName == null ? other$schemaName != null : !this$schemaName.equals(other$schemaName)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$tableComment = this.getTableComment(); + final Object other$tableComment = other.getTableComment(); + if (this$tableComment == null ? other$tableComment != null : !this$tableComment.equals(other$tableComment)) { + return false; + } + final Object this$tableAndColumnRelation = this.getTableAndColumnRelation(); + final Object other$tableAndColumnRelation = other.getTableAndColumnRelation(); + if (this$tableAndColumnRelation == null ? other$tableAndColumnRelation != null : !this$tableAndColumnRelation.equals(other$tableAndColumnRelation)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof TableNode; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $sourceName = this.getSourceName(); + result = result * PRIME + ($sourceName == null ? 43 : $sourceName.hashCode()); + final Object $schemaName = this.getSchemaName(); + result = result * PRIME + ($schemaName == null ? 43 : $schemaName.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $tableComment = this.getTableComment(); + result = result * PRIME + ($tableComment == null ? 43 : $tableComment.hashCode()); + final Object $tableAndColumnRelation = this.getTableAndColumnRelation(); + result = result * PRIME + ($tableAndColumnRelation == null ? 43 : $tableAndColumnRelation.hashCode()); + return result; + } + + public String toString() { + return "TableNode(id=" + this.getId() + ", sourceName=" + this.getSourceName() + ", schemaName=" + this.getSchemaName() + ", name=" + this.getName() + ", tableComment=" + this.getTableComment() + ", tableAndColumnRelation=" + this.getTableAndColumnRelation() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableRepository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableRepository.java index 94f70083b..54937dc0a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableRepository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2579/TableRepository.java @@ -27,20 +27,20 @@ import org.springframework.data.repository.query.Param; public interface TableRepository extends Neo4jRepository { @Query(value = """ - UNWIND :#{#froms} AS col - WITH col.__properties__ AS col, :#{#to}.__properties__ AS to - MERGE (c:Column { - sourceName: col.sourceName, - schemaName: col.schemaName, - tableName: col.tableName, - name: col.name - }) - MERGE (t:Table { - sourceName: to.sourceName, - schemaName: to.schemaName, - name: to.name - }) - MERGE (c) -[r:BELONG]-> (t)""" + UNWIND :#{#froms} AS col + WITH col.__properties__ AS col, :#{#to}.__properties__ AS to + MERGE (c:Column { + sourceName: col.sourceName, + schemaName: col.schemaName, + tableName: col.tableName, + name: col.name + }) + MERGE (t:Table { + sourceName: to.sourceName, + schemaName: to.schemaName, + name: to.name + }) + MERGE (c) -[r:BELONG]-> (t)""" ) void mergeTableAndColumnRelations(@Param("froms") List froms, @Param("to") TableNode to); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/GH2622Repository.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/GH2622Repository.java index 0976e9f7a..0b8c2ea85 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/GH2622Repository.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/GH2622Repository.java @@ -20,4 +20,5 @@ import org.springframework.data.neo4j.repository.Neo4jRepository; /** * @author Gerrit Meier */ -public interface GH2622Repository extends Neo4jRepository { } +public interface GH2622Repository extends Neo4jRepository { +} diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/MePointingTowardsMe.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/MePointingTowardsMe.java index ebe95040b..2a972f3ba 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/MePointingTowardsMe.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2622/MePointingTowardsMe.java @@ -14,6 +14,7 @@ * limitations under the License. */ package org.springframework.data.neo4j.integration.issues.gh2622; + import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/Movie.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/Movie.java index ab6f814dd..b7a519481 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/Movie.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/Movie.java @@ -27,7 +27,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class Movie { - @Id @GeneratedValue + @Id + @GeneratedValue private UUID id; private String title; diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/ReactiveConnectionAcquisitionIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/ReactiveConnectionAcquisitionIT.java index 45772fb30..d357725cb 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/ReactiveConnectionAcquisitionIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2632/ReactiveConnectionAcquisitionIT.java @@ -71,11 +71,11 @@ class ReactiveConnectionAcquisitionIT { void connectionAcquisitionAfterErrorViaSDNTxManagerShouldWork(@Autowired MovieRepository movieRepository, @Autowired Driver driver) { UUID id = UUID.randomUUID(); Flux - .range(1, 5) - .flatMap(i -> movieRepository.findById(id).switchIfEmpty(Mono.error(new RuntimeException()))) - .then() - .as(StepVerifier::create) - .verifyError(); + .range(1, 5) + .flatMap(i -> movieRepository.findById(id).switchIfEmpty(Mono.error(new RuntimeException()))) + .then() + .as(StepVerifier::create) + .verifyError(); try (Session session = driver.session()) { long aNumber = session.run("RETURN 1").single().get(0).asLong(); @@ -83,25 +83,26 @@ class ReactiveConnectionAcquisitionIT { } } - @Test // GH-2632 + @Test + // GH-2632 void connectionAcquisitionAfterErrorViaImplicitTXShouldWork(@Autowired Driver driver) { Flux - .range(1, 5) - .flatMap( - i -> { - Query query = new Query("MATCH (p:Product) WHERE p.id = $id RETURN p.title", Collections.singletonMap("id", 0)); - return Flux.usingWhen( - Mono.fromSupplier(() -> driver.session(ReactiveSession.class)), - session -> Flux.from(session.run(query)) - .flatMap(result -> Flux.from(result.records())) - .map(record -> record.get(0).asString()), - session -> Mono.fromDirect(session.close()) - ).switchIfEmpty(Mono.error(new RuntimeException())); - } - ) - .then() - .as(StepVerifier::create) - .verifyError(); + .range(1, 5) + .flatMap( + i -> { + Query query = new Query("MATCH (p:Product) WHERE p.id = $id RETURN p.title", Collections.singletonMap("id", 0)); + return Flux.usingWhen( + Mono.fromSupplier(() -> driver.session(ReactiveSession.class)), + session -> Flux.from(session.run(query)) + .flatMap(result -> Flux.from(result.records())) + .map(record -> record.get(0).asString()), + session -> Mono.fromDirect(session.close()) + ).switchIfEmpty(Mono.error(new RuntimeException())); + } + ) + .then() + .as(StepVerifier::create) + .verifyError(); try (Session session = driver.session()) { long aNumber = session.run("RETURN 1").single().get(0).asLong(); @@ -112,26 +113,27 @@ class ReactiveConnectionAcquisitionIT { record SessionAndTx(ReactiveSession session, ReactiveTransaction tx) { } - @Test // GH-2632 + @Test + // GH-2632 void connectionAcquisitionAfterErrorViaExplicitTXShouldWork(@Autowired Driver driver) { Flux - .range(1, 5) - .flatMap( - i -> { - Mono f = Mono - .just(driver.session(ReactiveSession.class)) - .flatMap(s -> Mono.fromDirect(s.beginTransaction()).map(tx -> new SessionAndTx(s, tx))); - return Flux.usingWhen(f, - h -> Flux.from(h.tx.run("MATCH (n) WHERE false = true RETURN n")).flatMap(ReactiveResult::records), - h -> Mono.from(h.tx.commit()).then(Mono.from(h.session.close())), - (h, e) -> Mono.from(h.tx.rollback()).then(Mono.from(h.session.close())), - h -> Mono.from(h.tx.rollback()).then(Mono.from(h.session.close())) - ).switchIfEmpty(Mono.error(new RuntimeException())); - } - ) - .then() - .as(StepVerifier::create) - .verifyError(); + .range(1, 5) + .flatMap( + i -> { + Mono f = Mono + .just(driver.session(ReactiveSession.class)) + .flatMap(s -> Mono.fromDirect(s.beginTransaction()).map(tx -> new SessionAndTx(s, tx))); + return Flux.usingWhen(f, + h -> Flux.from(h.tx.run("MATCH (n) WHERE false = true RETURN n")).flatMap(ReactiveResult::records), + h -> Mono.from(h.tx.commit()).then(Mono.from(h.session.close())), + (h, e) -> Mono.from(h.tx.rollback()).then(Mono.from(h.session.close())), + h -> Mono.from(h.tx.rollback()).then(Mono.from(h.session.close())) + ).switchIfEmpty(Mono.error(new RuntimeException())); + } + ) + .then() + .as(StepVerifier::create) + .verifyError(); try (Session session = driver.session()) { long aNumber = session.run("RETURN 1").single().get(0).asLong(); @@ -147,10 +149,10 @@ class ReactiveConnectionAcquisitionIT { @Bean public Driver driver() { var config = org.neo4j.driver.Config.builder() - .withMaxConnectionPoolSize(2) - .withConnectionAcquisitionTimeout(2, TimeUnit.SECONDS) - .withLeakedSessionsLogging() - .build(); + .withMaxConnectionPoolSize(2) + .withConnectionAcquisitionTimeout(2, TimeUnit.SECONDS) + .withLeakedSessionsLogging() + .build(); return GraphDatabase.driver(neo4jConnectionSupport.url, neo4jConnectionSupport.authToken, config); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2639/Developer.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2639/Developer.java index a39408f93..a6bad9538 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2639/Developer.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2639/Developer.java @@ -46,7 +46,7 @@ public class Developer extends CompanyPerson { @Override public String toString() { return new StringJoiner(", ", Developer.class.getSimpleName() + "[", "]") - .add("name='" + name + "'") + .add("name='" + name + "'") .add("programmingLanguages=" + programmingLanguages) .toString(); } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/FirstLevelEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/FirstLevelEntity.java index 5eb16ada5..90fa098da 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/FirstLevelEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/FirstLevelEntity.java @@ -15,11 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2727; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -30,12 +25,8 @@ import java.util.List; /** * @author Gerrit Meier */ -@SuperBuilder -@NoArgsConstructor -@Getter -@Setter +@SuppressWarnings("HiddenField") @Node("FirstLevel") -@EqualsAndHashCode(of = {"id"}) public class FirstLevelEntity { @Id @GeneratedValue @@ -45,4 +36,119 @@ public class FirstLevelEntity { @Relationship("HasSecondLevel") private List secondLevelEntityRelationshipProperties; + + public FirstLevelEntity() { + } + + protected FirstLevelEntity(FirstLevelEntityBuilder b) { + this.id = b.id; + this.name = b.name; + this.secondLevelEntityRelationshipProperties = b.secondLevelEntityRelationshipProperties; + } + + public static FirstLevelEntityBuilder builder() { + return new FirstLevelEntityBuilderImpl(); + } + + public Long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public List getSecondLevelEntityRelationshipProperties() { + return this.secondLevelEntityRelationshipProperties; + } + + public void setId(Long id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setSecondLevelEntityRelationshipProperties(List secondLevelEntityRelationshipProperties) { + this.secondLevelEntityRelationshipProperties = secondLevelEntityRelationshipProperties; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof FirstLevelEntity)) { + return false; + } + final FirstLevelEntity other = (FirstLevelEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof FirstLevelEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class FirstLevelEntityBuilder> { + private Long id; + private String name; + private List secondLevelEntityRelationshipProperties; + + public B id(Long id) { + this.id = id; + return self(); + } + + public B name(String name) { + this.name = name; + return self(); + } + + public B secondLevelEntityRelationshipProperties(List secondLevelEntityRelationshipProperties) { + this.secondLevelEntityRelationshipProperties = secondLevelEntityRelationshipProperties; + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "FirstLevelEntity.FirstLevelEntityBuilder(id=" + this.id + ", name=" + this.name + ", secondLevelEntityRelationshipProperties=" + this.secondLevelEntityRelationshipProperties + ")"; + } + } + + private static final class FirstLevelEntityBuilderImpl extends FirstLevelEntityBuilder { + private FirstLevelEntityBuilderImpl() { + } + + protected FirstLevelEntityBuilderImpl self() { + return this; + } + + public FirstLevelEntity build() { + return new FirstLevelEntity(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/OrderedRelation.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/OrderedRelation.java index 52e84650c..0e47a8b96 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/OrderedRelation.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/OrderedRelation.java @@ -15,10 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2727; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.RelationshipId; @@ -29,22 +25,51 @@ import org.springframework.data.neo4j.core.schema.TargetNode; * @author Gerrit Meier * @param relationship properties type */ -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter @RelationshipProperties public class OrderedRelation implements Comparable> { - @RelationshipId - @GeneratedValue - private Long id; - @TargetNode - private T target; - @Property - private Integer order; + @RelationshipId + @GeneratedValue + private Long id; + @TargetNode + private T target; + @Property + private Integer order; - @Override - public int compareTo(final OrderedRelation o) { - return order - o.order; - } + public OrderedRelation(Long id, T target, Integer order) { + this.id = id; + this.target = target; + this.order = order; + } + + public OrderedRelation() { + } + + @Override + public int compareTo(final OrderedRelation o) { + return order - o.order; + } + + public Long getId() { + return this.id; + } + + public T getTarget() { + return this.target; + } + + public Integer getOrder() { + return this.order; + } + + public void setId(Long id) { + this.id = id; + } + + public void setTarget(T target) { + this.target = target; + } + + public void setOrder(Integer order) { + this.order = order; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/SecondLevelEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/SecondLevelEntity.java index 2cde6f9d6..ea94d8523 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/SecondLevelEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/SecondLevelEntity.java @@ -15,11 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2727; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -30,12 +25,8 @@ import java.util.List; /** * @author Gerrit Meier */ -@SuperBuilder -@NoArgsConstructor -@Getter -@Setter +@SuppressWarnings("HiddenField") @Node("SecondLevel") -@EqualsAndHashCode(of = {"id"}) public class SecondLevelEntity { @Id @GeneratedValue @@ -45,4 +36,119 @@ public class SecondLevelEntity { @Relationship("HasThirdLevel") private List thirdLevelEntityRelationshipProperties; + + public SecondLevelEntity() { + } + + protected SecondLevelEntity(SecondLevelEntityBuilder b) { + this.id = b.id; + this.someValue = b.someValue; + this.thirdLevelEntityRelationshipProperties = b.thirdLevelEntityRelationshipProperties; + } + + public static SecondLevelEntityBuilder builder() { + return new SecondLevelEntityBuilderImpl(); + } + + public Long getId() { + return this.id; + } + + public String getSomeValue() { + return this.someValue; + } + + public List getThirdLevelEntityRelationshipProperties() { + return this.thirdLevelEntityRelationshipProperties; + } + + public void setId(Long id) { + this.id = id; + } + + public void setSomeValue(String someValue) { + this.someValue = someValue; + } + + public void setThirdLevelEntityRelationshipProperties(List thirdLevelEntityRelationshipProperties) { + this.thirdLevelEntityRelationshipProperties = thirdLevelEntityRelationshipProperties; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof SecondLevelEntity)) { + return false; + } + final SecondLevelEntity other = (SecondLevelEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof SecondLevelEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class SecondLevelEntityBuilder> { + private Long id; + private String someValue; + private List thirdLevelEntityRelationshipProperties; + + public B id(Long id) { + this.id = id; + return self(); + } + + public B someValue(String someValue) { + this.someValue = someValue; + return self(); + } + + public B thirdLevelEntityRelationshipProperties(List thirdLevelEntityRelationshipProperties) { + this.thirdLevelEntityRelationshipProperties = thirdLevelEntityRelationshipProperties; + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "SecondLevelEntity.SecondLevelEntityBuilder(id=" + this.id + ", someValue=" + this.someValue + ", thirdLevelEntityRelationshipProperties=" + this.thirdLevelEntityRelationshipProperties + ")"; + } + } + + private static final class SecondLevelEntityBuilderImpl extends SecondLevelEntityBuilder { + private SecondLevelEntityBuilderImpl() { + } + + protected SecondLevelEntityBuilderImpl self() { + return this; + } + + public SecondLevelEntity build() { + return new SecondLevelEntity(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/ThirdLevelEntity.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/ThirdLevelEntity.java index fcfe6b978..65460b2da 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/ThirdLevelEntity.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2727/ThirdLevelEntity.java @@ -15,11 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.gh2727; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -27,16 +22,112 @@ import org.springframework.data.neo4j.core.schema.Node; /** * @author Gerrit Meier */ -@SuperBuilder -@NoArgsConstructor -@Getter -@Setter +@SuppressWarnings("HiddenField") @Node("ThirdLevel") -@EqualsAndHashCode(of = {"id"}) public class ThirdLevelEntity { @Id @GeneratedValue private Long id; private String someValue; + + public ThirdLevelEntity() { + } + + protected ThirdLevelEntity(ThirdLevelEntityBuilder b) { + this.id = b.id; + this.someValue = b.someValue; + } + + public static ThirdLevelEntityBuilder builder() { + return new ThirdLevelEntityBuilderImpl(); + } + + public Long getId() { + return this.id; + } + + public String getSomeValue() { + return this.someValue; + } + + public void setId(Long id) { + this.id = id; + } + + public void setSomeValue(String someValue) { + this.someValue = someValue; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ThirdLevelEntity)) { + return false; + } + final ThirdLevelEntity other = (ThirdLevelEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof ThirdLevelEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + /** + * the builder + * @param needed c type + * @param needed b type + */ + public static abstract class ThirdLevelEntityBuilder> { + private Long id; + private String someValue; + + public B id(Long id) { + this.id = id; + return self(); + } + + public B someValue(String someValue) { + this.someValue = someValue; + return self(); + } + + protected abstract B self(); + + public abstract C build(); + + public String toString() { + return "ThirdLevelEntity.ThirdLevelEntityBuilder(id=" + this.id + ", someValue=" + this.someValue + ")"; + } + } + + private static final class ThirdLevelEntityBuilderImpl extends ThirdLevelEntityBuilder { + private ThirdLevelEntityBuilderImpl() { + } + + protected ThirdLevelEntityBuilderImpl self() { + return this; + } + + public ThirdLevelEntity build() { + return new ThirdLevelEntity(this); + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/AbstractTestBase.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/AbstractTestBase.java index 3f953fbd9..859e69ece 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/AbstractTestBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/AbstractTestBase.java @@ -95,7 +95,7 @@ public abstract class AbstractTestBase { @Override public PlatformTransactionManager transactionManager(Driver driver, - DatabaseSelectionProvider databaseNameProvider) { + DatabaseSelectionProvider databaseNameProvider) { BookmarkCapture bookmarkCapture = bookmarkCapture(); return new Neo4jTransactionManager(driver, databaseNameProvider, Neo4jBookmarkManager.create(bookmarkCapture)); diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId1.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId1.java index a5206118a..99e70e3e1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId1.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId1.java @@ -26,25 +26,26 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class TestEntityWithAssignedId1 { - @Id - private String assignedId; + @Id + private String assignedId; - @Property("value_one") - private String valueOne; + @Property("value_one") + private String valueOne; - @Relationship("related_to") - private TestEntityWithAssignedId2 relatedEntity; + @Relationship("related_to") + private TestEntityWithAssignedId2 relatedEntity; - public TestEntityWithAssignedId1(String assignedId, String valueOne, TestEntityWithAssignedId2 relatedEntity) { - this.assignedId = assignedId; - this.valueOne = valueOne; - this.relatedEntity = relatedEntity; - } - public String getAssignedId() { - return assignedId; - } + public TestEntityWithAssignedId1(String assignedId, String valueOne, TestEntityWithAssignedId2 relatedEntity) { + this.assignedId = assignedId; + this.valueOne = valueOne; + this.relatedEntity = relatedEntity; + } - public TestEntityWithAssignedId2 getRelatedEntity() { - return relatedEntity; - } + public String getAssignedId() { + return assignedId; + } + + public TestEntityWithAssignedId2 getRelatedEntity() { + return relatedEntity; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId2.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId2.java index 475d0405f..fa5fecf8f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId2.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithAssignedId2.java @@ -25,14 +25,14 @@ import org.springframework.data.neo4j.core.schema.Property; @Node public class TestEntityWithAssignedId2 { - @Id - private String assignedId; + @Id + private String assignedId; - @Property("valueTwo") - private String valueTwo; + @Property("valueTwo") + private String valueTwo; - public TestEntityWithAssignedId2(String assignedId, String valueTwo) { - this.assignedId = assignedId; - this.valueTwo = valueTwo; - } + public TestEntityWithAssignedId2(String assignedId, String valueTwo) { + this.assignedId = assignedId; + this.valueTwo = valueTwo; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId1.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId1.java index 2a26529a6..5f58c787a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId1.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId1.java @@ -27,26 +27,27 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class TestEntityWithGeneratedDeprecatedId1 { - @Id - @GeneratedValue - private Long id; + @Id + @GeneratedValue + private Long id; - @Property("value_one") - private String valueOne; + @Property("value_one") + private String valueOne; - @Relationship("related_to") - private TestEntityWithGeneratedDeprecatedId2 relatedEntity; + @Relationship("related_to") + private TestEntityWithGeneratedDeprecatedId2 relatedEntity; - public TestEntityWithGeneratedDeprecatedId1(Long id, String valueOne, TestEntityWithGeneratedDeprecatedId2 relatedEntity) { - this.id = id; - this.valueOne = valueOne; - this.relatedEntity = relatedEntity; - } - public Long getId() { - return id; - } + public TestEntityWithGeneratedDeprecatedId1(Long id, String valueOne, TestEntityWithGeneratedDeprecatedId2 relatedEntity) { + this.id = id; + this.valueOne = valueOne; + this.relatedEntity = relatedEntity; + } - public TestEntityWithGeneratedDeprecatedId2 getRelatedEntity() { - return relatedEntity; - } + public Long getId() { + return id; + } + + public TestEntityWithGeneratedDeprecatedId2 getRelatedEntity() { + return relatedEntity; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId2.java b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId2.java index f716ccbf9..edafd60fb 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId2.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/gh2728/TestEntityWithGeneratedDeprecatedId2.java @@ -26,15 +26,15 @@ import org.springframework.data.neo4j.core.schema.Property; @Node public class TestEntityWithGeneratedDeprecatedId2 { - @Id - @GeneratedValue - private Long id; + @Id + @GeneratedValue + private Long id; - @Property("valueTwo") - private String valueTwo; + @Property("valueTwo") + private String valueTwo; - public TestEntityWithGeneratedDeprecatedId2(Long id, String valueTwo) { - this.id = id; - this.valueTwo = valueTwo; - } + public TestEntityWithGeneratedDeprecatedId2(Long id, String valueTwo) { + this.id = id; + this.valueTwo = valueTwo; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/NestedProjectionsIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/NestedProjectionsIT.java index 658307460..ded5d36d5 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/NestedProjectionsIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/NestedProjectionsIT.java @@ -70,7 +70,8 @@ class NestedProjectionsIT { } } - @RepeatedTest(20) // GH-2581 + @RepeatedTest(20) + // GH-2581 void excludedHopMustNotVanish(@Autowired SourceNodeARepository repository) { Optional optionalSourceNode = repository.findById("L-l1"); diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/CentralNode.java b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/CentralNode.java index 457cbe327..67c7036e0 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/CentralNode.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/CentralNode.java @@ -15,26 +15,18 @@ */ package org.springframework.data.neo4j.integration.issues.projections.model; -import java.util.Objects; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.Objects; + /** * @author Michael J. Simons */ -@Getter -@Builder -@NoArgsConstructor -@AllArgsConstructor +@SuppressWarnings("HiddenField") @Node public class CentralNode { @@ -42,14 +34,30 @@ public class CentralNode { @Property(name = "id") private String id; - @Version Long version; + @Version + Long version; private String name; @Relationship(value = "B_TO_CENTRAL", direction = Relationship.Direction.INCOMING) private SourceNodeB sourceNodeB; - @Override public boolean equals(Object o) { + public CentralNode(String id, Long version, String name, SourceNodeB sourceNodeB) { + this.id = id; + this.version = version; + this.name = name; + this.sourceNodeB = sourceNodeB; + } + + public CentralNode() { + } + + public static CentralNodeBuilder builder() { + return new CentralNodeBuilder(); + } + + @Override + public boolean equals(Object o) { if (this == o) { return true; } @@ -72,4 +80,61 @@ public class CentralNode { public void setName(String name) { this.name = name; } + + public String getId() { + return this.id; + } + + public Long getVersion() { + return this.version; + } + + public String getName() { + return this.name; + } + + public SourceNodeB getSourceNodeB() { + return this.sourceNodeB; + } + + /** + * the builder + */ + public static class CentralNodeBuilder { + private String id; + private Long version; + private String name; + private SourceNodeB sourceNodeB; + + CentralNodeBuilder() { + } + + public CentralNodeBuilder id(String id) { + this.id = id; + return this; + } + + public CentralNodeBuilder version(Long version) { + this.version = version; + return this; + } + + public CentralNodeBuilder name(String name) { + this.name = name; + return this; + } + + public CentralNodeBuilder sourceNodeB(SourceNodeB sourceNodeB) { + this.sourceNodeB = sourceNodeB; + return this; + } + + public CentralNode build() { + return new CentralNode(this.id, this.version, this.name, this.sourceNodeB); + } + + public String toString() { + return "CentralNode.CentralNodeBuilder(id=" + this.id + ", version=" + this.version + ", name=" + this.name + ", sourceNodeB=" + this.sourceNodeB + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeA.java b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeA.java index d28145373..cc8d5a97f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeA.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeA.java @@ -15,39 +15,47 @@ */ package org.springframework.data.neo4j.integration.issues.projections.model; -import java.util.Objects; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.Objects; + /** * @author Michael J. Simons */ -@Getter -@Builder -@NoArgsConstructor -@AllArgsConstructor +@SuppressWarnings("HiddenField") @Node public class SourceNodeA { @Id private String id; - @Version Long version; + @Version + Long version; private String value; @Relationship("A_TO_CENTRAL") private CentralNode centralNode; - @Override public boolean equals(Object o) { + public SourceNodeA(String id, Long version, String value, CentralNode centralNode) { + this.id = id; + this.version = version; + this.value = value; + this.centralNode = centralNode; + } + + public SourceNodeA() { + } + + public static SourceNodeABuilder builder() { + return new SourceNodeABuilder(); + } + + @Override + public boolean equals(Object o) { if (this == o) { return true; } @@ -58,11 +66,69 @@ public class SourceNodeA { return Objects.equals(id, sourceNodeA.id) && Objects.equals(value, sourceNodeA.value); } - @Override public int hashCode() { + @Override + public int hashCode() { return Objects.hash(id, value); } public void setValue(String value) { this.value = value; } + + public String getId() { + return this.id; + } + + public Long getVersion() { + return this.version; + } + + public String getValue() { + return this.value; + } + + public CentralNode getCentralNode() { + return this.centralNode; + } + + /** + * the builder + */ + public static class SourceNodeABuilder { + private String id; + private Long version; + private String value; + private CentralNode centralNode; + + SourceNodeABuilder() { + } + + public SourceNodeABuilder id(String id) { + this.id = id; + return this; + } + + public SourceNodeABuilder version(Long version) { + this.version = version; + return this; + } + + public SourceNodeABuilder value(String value) { + this.value = value; + return this; + } + + public SourceNodeABuilder centralNode(CentralNode centralNode) { + this.centralNode = centralNode; + return this; + } + + public SourceNodeA build() { + return new SourceNodeA(this.id, this.version, this.value, this.centralNode); + } + + public String toString() { + return "SourceNodeA.SourceNodeABuilder(id=" + this.id + ", version=" + this.version + ", value=" + this.value + ", centralNode=" + this.centralNode + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeB.java b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeB.java index 2c8d43f97..2de73dfc1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeB.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/model/SourceNodeB.java @@ -15,29 +15,20 @@ */ package org.springframework.data.neo4j.integration.issues.projections.model; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; - -import java.util.List; -import java.util.Objects; - +import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; +import java.util.Objects; /** * @author Michael J. Simons */ -@Getter -@Builder -@NoArgsConstructor -@AllArgsConstructor +@SuppressWarnings("HiddenField") @Node public class SourceNodeB { @@ -45,7 +36,8 @@ public class SourceNodeB { @Property(name = "id") private String id; - @Version Long version; + @Version + Long version; private String name; @@ -53,6 +45,20 @@ public class SourceNodeB { @Relationship("B_TO_CENTRAL") private List centralNodes; + public SourceNodeB(String id, Long version, String name, List centralNodes) { + this.id = id; + this.version = version; + this.name = name; + this.centralNodes = centralNodes; + } + + public SourceNodeB() { + } + + public static SourceNodeBBuilder builder() { + return new SourceNodeBBuilder(); + } + @Override public boolean equals(Object o) { if (this == o) { @@ -69,4 +75,62 @@ public class SourceNodeB { public int hashCode() { return Objects.hash(id, name); } + + public String getId() { + return this.id; + } + + public Long getVersion() { + return this.version; + } + + public String getName() { + return this.name; + } + + public List getCentralNodes() { + return this.centralNodes; + } + + /** + * the builder + */ + public static class SourceNodeBBuilder { + private String id; + private Long version; + private String name; + private List centralNodes; + + SourceNodeBBuilder() { + } + + public SourceNodeBBuilder id(String id) { + this.id = id; + return this; + } + + public SourceNodeBBuilder version(Long version) { + this.version = version; + return this; + } + + public SourceNodeBBuilder name(String name) { + this.name = name; + return this; + } + + @JsonIgnore + public SourceNodeBBuilder centralNodes(List centralNodes) { + this.centralNodes = centralNodes; + return this; + } + + public SourceNodeB build() { + return new SourceNodeB(this.id, this.version, this.name, this.centralNodes); + } + + public String toString() { + return "SourceNodeB.SourceNodeBBuilder(id=" + this.id + ", version=" + this.version + ", name=" + this.name + ", centralNodes=" + this.centralNodes + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/repository/CustomRepositoryImpl.java b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/repository/CustomRepositoryImpl.java index 76cfd110d..b2df11ce9 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/projections/repository/CustomRepositoryImpl.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/projections/repository/CustomRepositoryImpl.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.issues.projections.repository; -import lombok.AllArgsConstructor; - import org.springframework.data.neo4j.core.Neo4jOperations; import org.springframework.data.neo4j.integration.issues.projections.model.SourceNodeA; import org.springframework.data.neo4j.integration.issues.projections.projection.SourceNodeAProjection; @@ -24,13 +22,16 @@ import org.springframework.data.neo4j.integration.issues.projections.projection. /** * @author Michael J. Simons */ -@AllArgsConstructor class CustomRepositoryImpl implements CustomRepository { - private final Neo4jOperations neo4jOperations; + private final Neo4jOperations neo4jOperations; - @Override - public SourceNodeAProjection saveWithProjection(SourceNodeA sourceNodeA) { - return neo4jOperations.saveAs(sourceNodeA, SourceNodeAProjection.class); - } + CustomRepositoryImpl(Neo4jOperations neo4jOperations) { + this.neo4jOperations = neo4jOperations; + } + + @Override + public SourceNodeAProjection saveWithProjection(SourceNodeA sourceNodeA) { + return neo4jOperations.saveAs(sourceNodeA, SourceNodeAProjection.class); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/issues/pure_element_id/ImperativeElementIdIT.java b/src/test/java/org/springframework/data/neo4j/integration/issues/pure_element_id/ImperativeElementIdIT.java index 9e94eec50..b9b2ce23e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/issues/pure_element_id/ImperativeElementIdIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/issues/pure_element_id/ImperativeElementIdIT.java @@ -280,7 +280,7 @@ public class ImperativeElementIdIT extends AbstractElementIdTestBase { AND elementId(e) = $id3 RETURN count(*)"""; var count = session.run(adaptQueryTo44IfNecessary(query), - Map.of("v1", "owner", "v2", "end", "id1", owner.getId(), "id2", owner.getIntermediate().getId(), "id3", owner.getIntermediate().getEnd().getId())) + Map.of("v1", "owner", "v2", "end", "id1", owner.getId(), "id2", owner.getIntermediate().getId(), "id3", owner.getIntermediate().getEnd().getId())) .single().get(0).asLong(); assertThat(count).isEqualTo(1L); } @@ -311,11 +311,11 @@ public class ImperativeElementIdIT extends AbstractElementIdTestBase { try (var session = driver.session(bookmarkCapture.createSessionConfig())) { var count = session.run(adaptQueryTo44IfNecessary(""" - MATCH (n:NodeWithGeneratedId4 {value: $v1}) -[r:INTERMEDIATE]-> (i:Intermediate) -[:END]-> (e:NodeWithGeneratedId4 {value: $v2}) - WHERE elementId(n) = $id1 - AND elementId(i) = $id2 - AND elementId(e) = $id3 - RETURN count(*)"""), + MATCH (n:NodeWithGeneratedId4 {value: $v1}) -[r:INTERMEDIATE]-> (i:Intermediate) -[:END]-> (e:NodeWithGeneratedId4 {value: $v2}) + WHERE elementId(n) = $id1 + AND elementId(i) = $id2 + AND elementId(e) = $id3 + RETURN count(*)"""), Map.of("v1", "owner", "v2", "end", "id1", owner.getId(), "id2", owner.getIntermediate().getId(), "id3", owner.getIntermediate().getEnd().getId())) .single().get(0).asLong(); assertThat(count).isEqualTo(1L); diff --git a/src/test/java/org/springframework/data/neo4j/integration/properties/DomainClasses.java b/src/test/java/org/springframework/data/neo4j/integration/properties/DomainClasses.java index 7fe403e26..d6e83a917 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/properties/DomainClasses.java +++ b/src/test/java/org/springframework/data/neo4j/integration/properties/DomainClasses.java @@ -15,16 +15,6 @@ */ package org.springframework.data.neo4j.integration.properties; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -36,6 +26,12 @@ import org.springframework.data.neo4j.core.schema.RelationshipProperties; import org.springframework.data.neo4j.core.schema.TargetNode; import org.springframework.data.neo4j.core.support.DateLong; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @author Michael J. Simons * @soundtrack Metallica - Metallica @@ -45,16 +41,23 @@ final class DomainClasses { private DomainClasses() { } - @Getter @Setter abstract static class BaseClass { private String knownProperty; + + public String getKnownProperty() { + return this.knownProperty; + } + + public void setKnownProperty(String knownProperty) { + this.knownProperty = knownProperty; + } } @Node - @Getter @Setter static class IrrelevantSourceContainer { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; @Relationship(type = "RELATIONSHIP_PROPERTY_CONTAINER") @@ -64,79 +67,170 @@ final class DomainClasses { RelationshipPropertyContainer relationshipPropertyContainer) { this.relationshipPropertyContainer = relationshipPropertyContainer; } + + public Long getId() { + return this.id; + } + + public RelationshipPropertyContainer getRelationshipPropertyContainer() { + return this.relationshipPropertyContainer; + } + + public void setId(Long id) { + this.id = id; + } + + public void setRelationshipPropertyContainer(RelationshipPropertyContainer relationshipPropertyContainer) { + this.relationshipPropertyContainer = relationshipPropertyContainer; + } } @Node - @Getter @Setter static class DynRelSourc1 { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; @Relationship Map> rels = new HashMap<>(); + + public Long getId() { + return this.id; + } + + public Map> getRels() { + return this.rels; + } + + public void setId(Long id) { + this.id = id; + } + + public void setRels(Map> rels) { + this.rels = rels; + } } @Node - @Getter @Setter static class DynRelSourc2 { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; @Relationship Map rels = new HashMap<>(); + + public Long getId() { + return this.id; + } + + public Map getRels() { + return this.rels; + } + + public void setId(Long id) { + this.id = id; + } + + public void setRels(Map rels) { + this.rels = rels; + } } @Node static class IrrelevantTargetContainer { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; } @RelationshipProperties - @Getter @Setter static class RelationshipPropertyContainer extends BaseClass { - private @RelationshipId Long id; + private @RelationshipId Long id; @TargetNode private IrrelevantTargetContainer irrelevantTargetContainer; + + public Long getId() { + return this.id; + } + + public IrrelevantTargetContainer getIrrelevantTargetContainer() { + return this.irrelevantTargetContainer; + } + + public void setId(Long id) { + this.id = id; + } + + public void setIrrelevantTargetContainer(IrrelevantTargetContainer irrelevantTargetContainer) { + this.irrelevantTargetContainer = irrelevantTargetContainer; + } } @Node - @Getter @Setter static class SimpleGeneratedIDPropertyContainer extends BaseClass { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } } @Node - @Getter @Setter static class SimpleGeneratedIDPropertyContainerWithVersion extends SimpleGeneratedIDPropertyContainer { @Version private Long version; + + public Long getVersion() { + return this.version; + } + + public void setVersion(Long version) { + this.version = version; + } } @Node - @Getter @Setter static class SimplePropertyContainer extends BaseClass { @Id private String id; + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } } @Node - @Getter @Setter static class SimplePropertyContainerWithVersion extends SimplePropertyContainer { @Version private Long version; + + public Long getVersion() { + return this.version; + } + + public void setVersion(Long version) { + this.version = version; + } } @Node - @AllArgsConstructor - @Getter @Setter static class WeirdSource { @Id @@ -146,12 +240,33 @@ final class DomainClasses { @Relationship(type = "ITS_COMPLICATED") IrrelevantTargetContainer irrelevantTargetContainer; + + WeirdSource(Date myFineId, IrrelevantTargetContainer irrelevantTargetContainer) { + this.myFineId = myFineId; + this.irrelevantTargetContainer = irrelevantTargetContainer; + } + + public Date getMyFineId() { + return this.myFineId; + } + + public IrrelevantTargetContainer getIrrelevantTargetContainer() { + return this.irrelevantTargetContainer; + } + + public void setMyFineId(Date myFineId) { + this.myFineId = myFineId; + } + + public void setIrrelevantTargetContainer(IrrelevantTargetContainer irrelevantTargetContainer) { + this.irrelevantTargetContainer = irrelevantTargetContainer; + } } @Node - @Getter @Setter static class LonelySourceContainer { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; @Relationship(type = "RELATIONSHIP_PROPERTY_CONTAINER") @@ -174,5 +289,69 @@ final class DomainClasses { @Relationship Map dynEmptySingle = new HashMap<>(); + + public Long getId() { + return this.id; + } + + public RelationshipPropertyContainer getSingle() { + return this.single; + } + + public List getMultiNull() { + return this.multiNull; + } + + public List getMultiEmpty() { + return this.multiEmpty; + } + + public Map> getDynNullList() { + return this.dynNullList; + } + + public Map> getDynEmptyList() { + return this.dynEmptyList; + } + + public Map getDynNullSingle() { + return this.dynNullSingle; + } + + public Map getDynEmptySingle() { + return this.dynEmptySingle; + } + + public void setId(Long id) { + this.id = id; + } + + public void setSingle(RelationshipPropertyContainer single) { + this.single = single; + } + + public void setMultiNull(List multiNull) { + this.multiNull = multiNull; + } + + public void setMultiEmpty(List multiEmpty) { + this.multiEmpty = multiEmpty; + } + + public void setDynNullList(Map> dynNullList) { + this.dynNullList = dynNullList; + } + + public void setDynEmptyList(Map> dynEmptyList) { + this.dynEmptyList = dynEmptyList; + } + + public void setDynNullSingle(Map dynNullSingle) { + this.dynNullSingle = dynNullSingle; + } + + public void setDynEmptySingle(Map dynEmptySingle) { + this.dynEmptySingle = dynEmptySingle; + } } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jTemplateIT.java b/src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jTemplateIT.java index 49c4200d4..60612e7ad 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jTemplateIT.java +++ b/src/test/java/org/springframework/data/neo4j/integration/reactive/ReactiveNeo4jTemplateIT.java @@ -15,23 +15,6 @@ */ package org.springframework.data.neo4j.integration.reactive; -import static org.assertj.core.api.Assertions.assertThat; -import static org.neo4j.cypherdsl.core.Cypher.parameter; - -import lombok.Data; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.BiPredicate; -import java.util.function.Function; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -74,6 +57,21 @@ import org.springframework.data.neo4j.test.Neo4jIntegrationTest; import org.springframework.data.neo4j.test.Neo4jReactiveTestConfiguration; import org.springframework.transaction.ReactiveTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.BiPredicate; +import java.util.function.Function; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.neo4j.cypherdsl.core.Cypher.parameter; /** * @author Gerrit Meier @@ -95,7 +93,8 @@ class ReactiveNeo4jTemplateIT { private Long simonsId; private Long nullNullSchneider; - @Autowired ReactiveNeo4jTemplateIT(Driver driver, ReactiveNeo4jTemplate neo4jTemplate) { + @Autowired + ReactiveNeo4jTemplateIT(Driver driver, ReactiveNeo4jTemplate neo4jTemplate) { this.driver = driver; this.neo4jTemplate = neo4jTemplate; } @@ -129,11 +128,11 @@ class ReactiveNeo4jTemplateIT { transaction.run( "CREATE (root:NodeEntity:BaseNodeEntity{nodeId: 'root'}) " + - "CREATE (company:NodeEntity:BaseNodeEntity{nodeId: 'comp'}) " + - "CREATE (cred:Credential{id: 'uuid-1', name: 'Creds'}) " + - "CREATE (company)-[:CHILD_OF]->(root) " + - "CREATE (root)-[:HAS_CREDENTIAL]->(cred) " + - "CREATE (company)-[:WITH_CREDENTIAL]->(cred)"); + "CREATE (company:NodeEntity:BaseNodeEntity{nodeId: 'comp'}) " + + "CREATE (cred:Credential{id: 'uuid-1', name: 'Creds'}) " + + "CREATE (company)-[:CHILD_OF]->(root) " + + "CREATE (root)-[:HAS_CREDENTIAL]->(cred) " + + "CREATE (company)-[:WITH_CREDENTIAL]->(cred)"); transaction.commit(); @@ -294,7 +293,8 @@ class ReactiveNeo4jTemplateIT { } } - @Test // 2230 + @Test + // 2230 void findAllWithStatementWithoutParameters() { Node node = Cypher.node("PersonWithAllConstructor").named("n"); Statement statement = Cypher.match(node).where(node.property("name").isEqualTo(Cypher.parameter("name").withValue(TEST_PERSON1_NAME))) @@ -365,20 +365,94 @@ class ReactiveNeo4jTemplateIT { BiPredicate predicate = (path, property) -> false; predicate = predicate.or((path, property) -> property.getName().equals("lastName")); predicate = predicate.or((path, property) -> property.getName().equals("address") - || path.toDotPath().startsWith("address.") && property.getName().equals("street")); + || path.toDotPath().startsWith("address.") && property.getName().equals("street")); predicate = predicate.or((path, property) -> property.getName().equals("country") - || path.toDotPath().contains("address.country.") && property.getName().equals("name")); + || path.toDotPath().contains("address.country.") && property.getName().equals("name")); return predicate; } - @Data static class DtoPersonProjection { - /** The ID is required in a project that should be saved. */ + /** + * The ID is required in a project that should be saved. + */ private final Long id; private String lastName; private String firstName; + + DtoPersonProjection(Long id) { + this.id = id; + } + + public Long getId() { + return this.id; + } + + public String getLastName() { + return this.lastName; + } + + public String getFirstName() { + return this.firstName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DtoPersonProjection)) { + return false; + } + final DtoPersonProjection other = (DtoPersonProjection) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$lastName = this.getLastName(); + final Object other$lastName = other.getLastName(); + if (this$lastName == null ? other$lastName != null : !this$lastName.equals(other$lastName)) { + return false; + } + final Object this$firstName = this.getFirstName(); + final Object other$firstName = other.getFirstName(); + if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof DtoPersonProjection; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $lastName = this.getLastName(); + result = result * PRIME + ($lastName == null ? 43 : $lastName.hashCode()); + final Object $firstName = this.getFirstName(); + result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode()); + return result; + } + + public String toString() { + return "ReactiveNeo4jTemplateIT.DtoPersonProjection(id=" + this.getId() + ", lastName=" + this.getLastName() + ", firstName=" + this.getFirstName() + ")"; + } } @Test @@ -386,7 +460,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .flatMap(p -> { p.setFirstName("Micha"); p.setLastName("Simons"); @@ -406,7 +480,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2215 + @Test + // GH-2215 void saveProjectionShouldWork(@Autowired ReactiveNeo4jTemplate template) { template @@ -427,11 +502,12 @@ class ReactiveNeo4jTemplateIT { .as(StepVerifier::create) .expectNextMatches( person -> person.getFirstName().equals("Micha") && person.getLastName().equals("Simons") - && person.getAddress() != null) + && person.getAddress() != null) .verifyComplete(); } - @Test // GH-2215 + @Test + // GH-2215 void saveAllProjectionShouldWork(@Autowired ReactiveNeo4jTemplate template) { template @@ -452,7 +528,7 @@ class ReactiveNeo4jTemplateIT { .as(StepVerifier::create) .expectNextMatches( person -> person.getFirstName().equals("Micha") && person.getLastName().equals("Simons") - && person.getAddress() != null) + && person.getAddress() != null) .verifyComplete(); } @@ -461,7 +537,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .zipWith(template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", Collections.singletonMap("lastName", "Schnitzel"), Person.class)) .flatMapMany(t -> { @@ -497,7 +573,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .flatMap(p -> { p.setFirstName("Micha"); p.setLastName("Simons"); @@ -522,7 +598,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .zipWith(template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", Collections.singletonMap("lastName", "Schnitzel"), Person.class)) .flatMapMany(t -> { @@ -558,7 +634,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .flatMap(p -> { p.setFirstName("Micha"); p.setLastName("Simons"); @@ -582,7 +658,7 @@ class ReactiveNeo4jTemplateIT { void saveAsWithClosedProjectionOnSecondLevelShouldWork(@Autowired ReactiveNeo4jTemplate template) { template.findOne("MATCH (p:Person {lastName: $lastName})-[r:LIVES_AT]-(a:Address) RETURN p, collect(r), collect(a)", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .flatMapMany(p -> { p.getAddress().setCity("Braunschweig"); @@ -603,7 +679,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2420 + @Test + // GH-2420 void saveAsWithDynamicProjectionOnSecondLevelShouldWork(@Autowired ReactiveNeo4jTemplate template) { template.findOne("MATCH (p:Person {lastName: $lastName})-[r:LIVES_AT]-(a:Address) RETURN p, collect(r), collect(a)", @@ -633,7 +710,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2420 + @Test + // GH-2420 void saveAllAsWithDynamicProjectionOnSecondLevelShouldWork(@Autowired ReactiveNeo4jTemplate template) { template.findOne("MATCH (p:Person {lastName: $lastName})-[r:LIVES_AT]-(a:Address) RETURN p, collect(r), collect(a)", @@ -667,7 +745,7 @@ class ReactiveNeo4jTemplateIT { void saveAsWithClosedProjectionOnThreeLevelShouldWork(@Autowired ReactiveNeo4jTemplate template) { template.findOne("MATCH (p:Person {lastName: $lastName})-[r:LIVES_AT]-(a:Address)-[r2:BASED_IN]->(c:YetAnotherCountryEntity) RETURN p, collect(r), collect(r2), collect(a), collect(c)", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .flatMapMany(p -> { Person.Address.Country country = p.getAddress().getCountry(); @@ -689,7 +767,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2544 + @Test + // GH-2544 void saveAllAsWithEmptyList(@Autowired ReactiveNeo4jTemplate template) { template.saveAllAs(Collections.emptyList(), ClosedProjection.class) @@ -703,7 +782,8 @@ class ReactiveNeo4jTemplateIT { static class Y { } - @Test // GH-2544 + @Test + // GH-2544 void saveWeirdHierarchy(@Autowired ReactiveNeo4jTemplate template) { List things = new ArrayList<>(); @@ -720,7 +800,7 @@ class ReactiveNeo4jTemplateIT { // Using a query on purpose so that the address is null template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", - Collections.singletonMap("lastName", "Siemons"), Person.class) + Collections.singletonMap("lastName", "Siemons"), Person.class) .zipWith(template.findOne("MATCH (p:Person {lastName: $lastName}) RETURN p", Collections.singletonMap("lastName", "Schnitzel"), Person.class)) .flatMapMany(t -> { @@ -785,7 +865,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2270 + @Test + // GH-2270 void executableFindShouldWorkAllDomainObjectsProjectedDTOShouldWork() { neo4jTemplate.find(Person.class).as(DtoPersonProjection.class).all() @@ -796,7 +877,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2270 + @Test + // GH-2270 void executableFindShouldWorkOneDomainObjectsProjectedDTOShouldWork() { neo4jTemplate.find(Person.class).as(DtoPersonProjection.class) @@ -858,8 +940,8 @@ class ReactiveNeo4jTemplateIT { void statementShouldWork() { Node person = Cypher.node("Person"); Flux people = neo4jTemplate.find(Person.class).matching(Cypher.match(person) - .where(person.property("lastName").isEqualTo(Cypher.anonParameter("Siemons"))) - .returning(person).build()) + .where(person.property("lastName").isEqualTo(Cypher.anonParameter("Siemons"))) + .returning(person).build()) .all(); people.map(Person::getLastName).as(StepVerifier::create).expectNext("Siemons").verifyComplete(); } @@ -868,13 +950,14 @@ class ReactiveNeo4jTemplateIT { void statementWithParamsShouldWork() { Node person = Cypher.node("Person"); Flux people = neo4jTemplate.find(Person.class).matching(Cypher.match(person) - .where(person.property("lastName").isEqualTo(Cypher.parameter("lastName", "Siemons"))) - .returning(person).build(), Collections.singletonMap("lastName", "Schnitzel")) + .where(person.property("lastName").isEqualTo(Cypher.parameter("lastName", "Siemons"))) + .returning(person).build(), Collections.singletonMap("lastName", "Schnitzel")) .all(); people.map(Person::getLastName).as(StepVerifier::create).expectNext("Schnitzel").verifyComplete(); } - @Test // GH-2407 + @Test + // GH-2407 void shouldSaveAllAsWithAssignedIdProjected() { neo4jTemplate.findById("x", PersonWithAssignedId.class) @@ -896,7 +979,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2407 + @Test + // GH-2407 void shouldSaveAsWithAssignedIdProjected() { neo4jTemplate.findById("x", PersonWithAssignedId.class) @@ -918,7 +1002,8 @@ class ReactiveNeo4jTemplateIT { .verifyComplete(); } - @Test // GH-2415 + @Test + // GH-2415 void saveWithProjectionImplementedByEntity(@Autowired Neo4jMappingContext mappingContext) { Neo4jPersistentEntity metaData = mappingContext.getPersistentEntity(BaseNodeEntity.class); diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AbstractPet.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AbstractPet.java index bf43c8952..800fb5d25 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AbstractPet.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AbstractPet.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Getter; -import lombok.Setter; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -29,7 +27,13 @@ public abstract class AbstractPet { @GeneratedValue private Long id; - @Getter @Setter private String name; + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AllArgsCtorNoBuilder.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AllArgsCtorNoBuilder.java index 645c2c25b..6680d441c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AllArgsCtorNoBuilder.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AllArgsCtorNoBuilder.java @@ -21,12 +21,15 @@ import org.springframework.data.neo4j.core.schema.Node; /** * Must require ctor instantiation and must not have a builder. + * * @author Michael J. Simons */ @Node public class AllArgsCtorNoBuilder { - @Id @GeneratedValue public Long id; + @Id + @GeneratedValue + public Long id; private boolean aBoolean; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltHobby.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltHobby.java index 768fd11a9..cf6916c59 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltHobby.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltHobby.java @@ -28,7 +28,9 @@ import org.springframework.data.neo4j.core.schema.Relationship; */ @Node public class AltHobby { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; @@ -41,6 +43,7 @@ public class AltHobby { public List getMemberOf() { return memberOf; } + public Long getId() { return id; } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltLikedByPersonRelationship.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltLikedByPersonRelationship.java index 891179368..fd4c698c1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltLikedByPersonRelationship.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltLikedByPersonRelationship.java @@ -53,7 +53,7 @@ public class AltLikedByPersonRelationship { @Override public boolean equals(Object o) { - if (this == o) { + if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltPerson.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltPerson.java index 9e6938b5e..1c65374bd 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltPerson.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AltPerson.java @@ -27,7 +27,9 @@ import java.util.Objects; @Node public class AltPerson { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AnotherThingWithAssignedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AnotherThingWithAssignedId.java index 2474e1139..941e6bd8a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AnotherThingWithAssignedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AnotherThingWithAssignedId.java @@ -26,7 +26,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node("Thing2") public class AnotherThingWithAssignedId { - @Id private final Long theId; + @Id + private final Long theId; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AuditingITBase.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AuditingITBase.java index 03ab9dfff..90435e54c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/AuditingITBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/AuditingITBase.java @@ -59,13 +59,13 @@ public abstract class AuditingITBase { @BeforeEach protected void setupData() { try (Session session = driver.session(bookmarkCapture.createSessionConfig()); - Transaction transaction = session.beginTransaction()) { + Transaction transaction = session.beginTransaction()) { transaction.run("MATCH (n) detach delete n"); idOfExistingThing = transaction.run( - "CREATE (t:ImmutableAuditableThing {name: $name, createdBy: $createdBy, createdAt: $createdAt}) RETURN id(t) as id", - Values.parameters("name", EXISTING_THING_NAME, "createdBy", EXISTING_THING_CREATED_BY, "createdAt", - EXISTING_THING_CREATED_AT)) + "CREATE (t:ImmutableAuditableThing {name: $name, createdBy: $createdBy, createdAt: $createdAt}) RETURN id(t) as id", + Values.parameters("name", EXISTING_THING_NAME, "createdBy", EXISTING_THING_CREATED_BY, "createdAt", + EXISTING_THING_CREATED_AT)) .single().get("id").asLong(); transaction.run( diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalEnd.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalEnd.java index 454219519..ce1e4e62e 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalEnd.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalEnd.java @@ -26,14 +26,18 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class BidirectionalEnd { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; - @Relationship(type = "CONNECTED", direction = Relationship.Direction.INCOMING) private BidirectionalStart start; + @Relationship(type = "CONNECTED", direction = Relationship.Direction.INCOMING) + private BidirectionalStart start; @Relationship(type = "ANOTHER_CONNECTION", - direction = Relationship.Direction.INCOMING) private BidirectionalStart anotherStart; + direction = Relationship.Direction.INCOMING) + private BidirectionalStart anotherStart; public BidirectionalEnd(String name) { this.name = name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalStart.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalStart.java index a98e28da0..a52fee409 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalStart.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/BidirectionalStart.java @@ -28,11 +28,14 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class BidirectionalStart { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; - @Relationship("CONNECTED") private Set ends; + @Relationship("CONNECTED") + private Set ends; public BidirectionalStart(String name, Set ends) { this.name = name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Book.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Book.java index 26a18e39b..cf0d50939 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Book.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Book.java @@ -33,7 +33,8 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class Book { - @Id @GeneratedValue + @Id + @GeneratedValue private UUID id; private String title; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Club.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Club.java index aaf979e20..85e070301 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Club.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Club.java @@ -25,7 +25,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class Club { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DeepRelationships.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DeepRelationships.java index b1264f13e..2908d8e49 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DeepRelationships.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DeepRelationships.java @@ -26,13 +26,16 @@ public class DeepRelationships { // Let's build a looped chain here: // Type1->Type2->Type3->Type1->... + /** * Some type */ @Node public static class LoopingType1 { public LoopingType2 nextType; - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } /** @@ -41,7 +44,9 @@ public class DeepRelationships { @Node public static class LoopingType2 { public LoopingType3 nextType; - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } /** @@ -50,6 +55,8 @@ public class DeepRelationships { @Node public static class LoopingType3 { public LoopingType1 nextType; - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DoritoEatingPerson.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DoritoEatingPerson.java index e1207040a..338427fc2 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DoritoEatingPerson.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DoritoEatingPerson.java @@ -15,27 +15,18 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.ToString; - -import java.util.HashSet; -import java.util.Set; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.HashSet; +import java.util.Set; + /** * @author Michael J. Simons */ -@Data -@ToString(exclude = { "friends" }) @Node -@NoArgsConstructor -@AllArgsConstructor public class DoritoEatingPerson { @Id @@ -57,6 +48,112 @@ public class DoritoEatingPerson { this.name = name; } + public DoritoEatingPerson(long id, String name, boolean eatsDoritos, boolean friendsAlsoEatDoritos, Set friends) { + this.id = id; + this.name = name; + this.eatsDoritos = eatsDoritos; + this.friendsAlsoEatDoritos = friendsAlsoEatDoritos; + this.friends = friends; + } + + public DoritoEatingPerson() { + } + + public long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public boolean isEatsDoritos() { + return this.eatsDoritos; + } + + public boolean isFriendsAlsoEatDoritos() { + return this.friendsAlsoEatDoritos; + } + + public Set getFriends() { + return this.friends; + } + + public void setId(long id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setEatsDoritos(boolean eatsDoritos) { + this.eatsDoritos = eatsDoritos; + } + + public void setFriendsAlsoEatDoritos(boolean friendsAlsoEatDoritos) { + this.friendsAlsoEatDoritos = friendsAlsoEatDoritos; + } + + public void setFriends(Set friends) { + this.friends = friends; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DoritoEatingPerson)) { + return false; + } + final DoritoEatingPerson other = (DoritoEatingPerson) o; + if (!other.canEqual((Object) this)) { + return false; + } + if (this.getId() != other.getId()) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + if (this.isEatsDoritos() != other.isEatsDoritos()) { + return false; + } + if (this.isFriendsAlsoEatDoritos() != other.isFriendsAlsoEatDoritos()) { + return false; + } + final Object this$friends = this.getFriends(); + final Object other$friends = other.getFriends(); + if (this$friends == null ? other$friends != null : !this$friends.equals(other$friends)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof DoritoEatingPerson; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final long $id = this.getId(); + result = result * PRIME + (int) ($id >>> 32 ^ $id); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + result = result * PRIME + (this.isEatsDoritos() ? 79 : 97); + result = result * PRIME + (this.isFriendsAlsoEatDoritos() ? 79 : 97); + final Object $friends = this.getFriends(); + result = result * PRIME + ($friends == null ? 43 : $friends.hashCode()); + return result; + } + + public String toString() { + return "DoritoEatingPerson(id=" + this.getId() + ", name=" + this.getName() + ", eatsDoritos=" + this.isEatsDoritos() + ", friendsAlsoEatDoritos=" + this.isFriendsAlsoEatDoritos() + ")"; + } + /** * Projection containing ambiguous name */ diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjection.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjection.java index bf0cb0b24..6b10ff6f5 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjection.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjection.java @@ -15,15 +15,72 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Value; - /** * @author Michael J. Simon */ -@Value -public class DtoPersonProjection { +public final class DtoPersonProjection { - String name; - String sameValue; - String firstName; + private final String name; + private final String sameValue; + private final String firstName; + + public DtoPersonProjection(String name, String sameValue, String firstName) { + this.name = name; + this.sameValue = sameValue; + this.firstName = firstName; + } + + public String getName() { + return this.name; + } + + public String getSameValue() { + return this.sameValue; + } + + public String getFirstName() { + return this.firstName; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DtoPersonProjection)) { + return false; + } + final DtoPersonProjection other = (DtoPersonProjection) o; + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$sameValue = this.getSameValue(); + final Object other$sameValue = other.getSameValue(); + if (this$sameValue == null ? other$sameValue != null : !this$sameValue.equals(other$sameValue)) { + return false; + } + final Object this$firstName = this.getFirstName(); + final Object other$firstName = other.getFirstName(); + if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $sameValue = this.getSameValue(); + result = result * PRIME + ($sameValue == null ? 43 : $sameValue.hashCode()); + final Object $firstName = this.getFirstName(); + result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode()); + return result; + } + + public String toString() { + return "DtoPersonProjection(name=" + this.getName() + ", sameValue=" + this.getSameValue() + ", firstName=" + this.getFirstName() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjectionContainingAdditionalFields.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjectionContainingAdditionalFields.java index ac1d034f8..00b01cb08 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjectionContainingAdditionalFields.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DtoPersonProjectionContainingAdditionalFields.java @@ -15,23 +15,116 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Value; - import java.util.List; /** * @author Michael J. Simons */ -@Value -public class DtoPersonProjectionContainingAdditionalFields { +public final class DtoPersonProjectionContainingAdditionalFields { - String name; - String sameValue; - String firstName; + private final String name; + private final String sameValue; + private final String firstName; - List otherPeople; + private final List otherPeople; - Long someLongValue; + private final Long someLongValue; - List someDoubles; + private final List someDoubles; + + public DtoPersonProjectionContainingAdditionalFields(String name, String sameValue, String firstName, List otherPeople, Long someLongValue, List someDoubles) { + this.name = name; + this.sameValue = sameValue; + this.firstName = firstName; + this.otherPeople = otherPeople; + this.someLongValue = someLongValue; + this.someDoubles = someDoubles; + } + + public String getName() { + return this.name; + } + + public String getSameValue() { + return this.sameValue; + } + + public String getFirstName() { + return this.firstName; + } + + public List getOtherPeople() { + return this.otherPeople; + } + + public Long getSomeLongValue() { + return this.someLongValue; + } + + public List getSomeDoubles() { + return this.someDoubles; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DtoPersonProjectionContainingAdditionalFields)) { + return false; + } + final DtoPersonProjectionContainingAdditionalFields other = (DtoPersonProjectionContainingAdditionalFields) o; + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$sameValue = this.getSameValue(); + final Object other$sameValue = other.getSameValue(); + if (this$sameValue == null ? other$sameValue != null : !this$sameValue.equals(other$sameValue)) { + return false; + } + final Object this$firstName = this.getFirstName(); + final Object other$firstName = other.getFirstName(); + if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) { + return false; + } + final Object this$otherPeople = this.getOtherPeople(); + final Object other$otherPeople = other.getOtherPeople(); + if (this$otherPeople == null ? other$otherPeople != null : !this$otherPeople.equals(other$otherPeople)) { + return false; + } + final Object this$someLongValue = this.getSomeLongValue(); + final Object other$someLongValue = other.getSomeLongValue(); + if (this$someLongValue == null ? other$someLongValue != null : !this$someLongValue.equals(other$someLongValue)) { + return false; + } + final Object this$someDoubles = this.getSomeDoubles(); + final Object other$someDoubles = other.getSomeDoubles(); + if (this$someDoubles == null ? other$someDoubles != null : !this$someDoubles.equals(other$someDoubles)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $sameValue = this.getSameValue(); + result = result * PRIME + ($sameValue == null ? 43 : $sameValue.hashCode()); + final Object $firstName = this.getFirstName(); + result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode()); + final Object $otherPeople = this.getOtherPeople(); + result = result * PRIME + ($otherPeople == null ? 43 : $otherPeople.hashCode()); + final Object $someLongValue = this.getSomeLongValue(); + result = result * PRIME + ($someLongValue == null ? 43 : $someLongValue.hashCode()); + final Object $someDoubles = this.getSomeDoubles(); + result = result * PRIME + ($someDoubles == null ? 43 : $someDoubles.hashCode()); + return result; + } + + public String toString() { + return "DtoPersonProjectionContainingAdditionalFields(name=" + this.getName() + ", sameValue=" + this.getSameValue() + ", firstName=" + this.getFirstName() + ", otherPeople=" + this.getOtherPeople() + ", someLongValue=" + this.getSomeLongValue() + ", someDoubles=" + this.getSomeDoubles() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DynamicRelationshipsITBase.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DynamicRelationshipsITBase.java index c69b7c722..d2dfbfd5d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/DynamicRelationshipsITBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/DynamicRelationshipsITBase.java @@ -59,15 +59,15 @@ public abstract class DynamicRelationshipsITBase { try (Session session = driver.session(); Transaction transaction = session.beginTransaction()) { transaction.run("MATCH (n) detach delete n"); var cypher = """ - CREATE (t:%s {name: 'A'}) WITH t\s - CREATE (t) - [:HAS_WIFE] -> (w:Person {firstName: 'B'})\s - CREATE (t) - [:ACTIVE{performance:'average'}] -> (:Hobby {name: 'Biking'})\s - CREATE (t) - [:FOOTBALL{place:'Brunswick'}] -> (:Club {name: 'BTSV'})\s - CREATE (t) - [:HAS_DAUGHTER] -> (d:Person {firstName: 'C'}) WITH t\s - UNWIND ['Tom', 'Garfield'] AS cat CREATE (t) - [:CATS] -> (w:Pet {name: cat})\s - WITH DISTINCT t UNWIND ['Benji', 'Lassie'] AS dog\s - CREATE (t) - [:DOGS] -> (w:Pet {name: dog}) RETURN DISTINCT id(t) as id - """.formatted(labelOfTestSubject); + CREATE (t:%s {name: 'A'}) WITH t\s + CREATE (t) - [:HAS_WIFE] -> (w:Person {firstName: 'B'})\s + CREATE (t) - [:ACTIVE{performance:'average'}] -> (:Hobby {name: 'Biking'})\s + CREATE (t) - [:FOOTBALL{place:'Brunswick'}] -> (:Club {name: 'BTSV'})\s + CREATE (t) - [:HAS_DAUGHTER] -> (d:Person {firstName: 'C'}) WITH t\s + UNWIND ['Tom', 'Garfield'] AS cat CREATE (t) - [:CATS] -> (w:Pet {name: cat})\s + WITH DISTINCT t UNWIND ['Benji', 'Lassie'] AS dog\s + CREATE (t) - [:DOGS] -> (w:Pet {name: dog}) RETURN DISTINCT id(t) as id + """.formatted(labelOfTestSubject); idOfExistingPerson = transaction.run(cypher) .single().get("id").asLong(); transaction.commit(); diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Editor.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Editor.java index 80a90ded8..cb1165bb1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Editor.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Editor.java @@ -27,7 +27,8 @@ import org.springframework.data.neo4j.core.schema.Relationship; */ @Node public class Editor { - @Id @GeneratedValue + @Id + @GeneratedValue private UUID id; String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntitiesWithDynamicLabels.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntitiesWithDynamicLabels.java index 6ee010434..1d1e0ce2d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntitiesWithDynamicLabels.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntitiesWithDynamicLabels.java @@ -35,7 +35,9 @@ public final class EntitiesWithDynamicLabels { @Node public static class SuperNode { - @Id @GeneratedValue public Long id; + @Id + @GeneratedValue + public Long id; public SimpleDynamicLabels relatedTo; @@ -50,9 +52,12 @@ public final class EntitiesWithDynamicLabels { @Node public static class SimpleDynamicLabels { - @Id @GeneratedValue public Long id; + @Id + @GeneratedValue + public Long id; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; public Long getId() { return id; @@ -63,7 +68,8 @@ public final class EntitiesWithDynamicLabels { * Used for testing whether the inherited dynamic labels is populated. */ @Node - public static class InheritedSimpleDynamicLabels extends SimpleDynamicLabels {} + public static class InheritedSimpleDynamicLabels extends SimpleDynamicLabels { + } /** * Same as {@link SimpleDynamicLabels} but with an added version field. @@ -71,11 +77,15 @@ public final class EntitiesWithDynamicLabels { @Node public static class SimpleDynamicLabelsWithVersion { - @Id @GeneratedValue public Long id; + @Id + @GeneratedValue + public Long id; - @Version public Long myVersion; + @Version + public Long myVersion; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; public Long getId() { return id; @@ -88,9 +98,11 @@ public final class EntitiesWithDynamicLabels { @Node public static class SimpleDynamicLabelsWithBusinessId { - @Id public String id; + @Id + public String id; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; public String getId() { return id; @@ -103,11 +115,14 @@ public final class EntitiesWithDynamicLabels { @Node public static class SimpleDynamicLabelsWithBusinessIdAndVersion { - @Id public String id; + @Id + public String id; - @Version public Long myVersion; + @Version + public Long myVersion; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; public String getId() { return id; @@ -120,9 +135,12 @@ public final class EntitiesWithDynamicLabels { @Node public static class SimpleDynamicLabelsCtor { - @Id @GeneratedValue private final Long id; + @Id + @GeneratedValue + private final Long id; - @DynamicLabels public final Set moreLabels; + @DynamicLabels + public final Set moreLabels; public SimpleDynamicLabelsCtor(Long id, Set moreLabels) { this.id = id; @@ -136,26 +154,34 @@ public final class EntitiesWithDynamicLabels { @Node("Baz") public static class DynamicLabelsWithNodeLabel { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; } /** * Dynamic labels together with multiple labels. */ - @Node({ "Foo", "Bar" }) + @Node({"Foo", "Bar"}) public static class DynamicLabelsWithMultipleNodeLabels { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; } @Node static abstract class DynamicLabelsBaseClass { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } /** @@ -164,7 +190,8 @@ public final class EntitiesWithDynamicLabels { @Node public static class ExtendedBaseClass1 extends DynamicLabelsBaseClass { - @DynamicLabels public Set moreLabels; + @DynamicLabels + public Set moreLabels; } /** @@ -173,9 +200,11 @@ public final class EntitiesWithDynamicLabels { @Node public static class EntityWithCustomIdAndDynamicLabels { - @Id public String identifier; + @Id + public String identifier; - @DynamicLabels public Set myLabels; + @DynamicLabels + public Set myLabels; } /** @@ -183,7 +212,8 @@ public final class EntitiesWithDynamicLabels { */ @Node public static abstract class BaseEntityWithoutDynamicLabels { - @Id public String id; + @Id + public String id; } /** @@ -191,7 +221,8 @@ public final class EntitiesWithDynamicLabels { */ @Node public static abstract class AbstractBaseEntityWithDynamicLabels extends BaseEntityWithoutDynamicLabels { - @DynamicLabels public Set labels; + @DynamicLabels + public Set labels; } /** @@ -210,5 +241,6 @@ public final class EntitiesWithDynamicLabels { public String name; } - private EntitiesWithDynamicLabels() {} + private EntitiesWithDynamicLabels() { + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithConvertedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithConvertedId.java index 01ce0de58..182039453 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithConvertedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithConvertedId.java @@ -24,7 +24,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class EntityWithConvertedId { - @Id private IdentifyingEnum identifyingEnum; + @Id + private IdentifyingEnum identifyingEnum; public IdentifyingEnum getIdentifyingEnum() { return identifyingEnum; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithPrimitiveConstructorArguments.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithPrimitiveConstructorArguments.java index 6810495d7..bf354b554 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithPrimitiveConstructorArguments.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithPrimitiveConstructorArguments.java @@ -24,7 +24,9 @@ import org.springframework.data.neo4j.core.schema.Node; */ @Node public class EntityWithPrimitiveConstructorArguments { - @Id @GeneratedValue public Long id; + @Id + @GeneratedValue + public Long id; public final boolean someBooleanValue; public final int someIntValue; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithRelationshipPropertiesPath.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithRelationshipPropertiesPath.java index 66e5d6801..52c5c9fba 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithRelationshipPropertiesPath.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/EntityWithRelationshipPropertiesPath.java @@ -29,7 +29,9 @@ import org.springframework.data.neo4j.core.schema.TargetNode; @Node public class EntityWithRelationshipPropertiesPath { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; @Relationship("RelationshipA") private RelationshipPropertyA relationshipA; @@ -77,7 +79,9 @@ public class EntityWithRelationshipPropertiesPath { */ @Node public static class EntityA { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; @Relationship("RelationshipB") private RelationshipPropertyB relationshipB; @@ -92,7 +96,9 @@ public class EntityWithRelationshipPropertiesPath { */ @Node public static class EntityB { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Flight.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Flight.java index 57ba60f18..3347ef102 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Flight.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Flight.java @@ -26,7 +26,8 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class Flight { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Friend.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Friend.java index 5e2962ab7..1387af838 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Friend.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Friend.java @@ -28,11 +28,14 @@ import java.util.List; @Node public class Friend { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; - @Relationship("KNOWS") private List friends; + @Relationship("KNOWS") + private List friends; public Friend(String name) { this.name = name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Hobby.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Hobby.java index 9c0acb0e7..e3c8d51e4 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Hobby.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Hobby.java @@ -26,7 +26,9 @@ import org.springframework.data.neo4j.core.schema.Node; */ @Node public class Hobby { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/IdGeneratorsITBase.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/IdGeneratorsITBase.java index 76316d396..128653402 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/IdGeneratorsITBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/IdGeneratorsITBase.java @@ -52,7 +52,7 @@ public abstract class IdGeneratorsITBase { protected void setupData() { try (Session session = driver.session(bookmarkCapture.createSessionConfig()); - Transaction transaction = session.beginTransaction()) { + Transaction transaction = session.beginTransaction()) { transaction.run("MATCH (n) detach delete n"); transaction.run("CREATE (t:ThingWithGeneratedId {name: $name, theId: $theId}) RETURN id(t) as id", Values.parameters("name", EXISTING_THING_NAME, "theId", ID_OF_EXISTING_THING)); diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThing.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThing.java index f0ed8741b..ca5c8d7ae 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThing.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThing.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AllArgsConstructor; -import lombok.Value; -import lombok.With; - -import java.time.LocalDateTime; - import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.Id; @@ -30,24 +24,151 @@ import org.springframework.data.annotation.PersistenceCreator; import org.springframework.data.annotation.Persistent; import org.springframework.data.neo4j.core.schema.GeneratedValue; +import java.time.LocalDateTime; + /** * @author Michael J. Simons */ -@Value -@With -@AllArgsConstructor(onConstructor = @__(@PersistenceCreator)) @Persistent -public class ImmutableAuditableThing implements AuditableThing { +@SuppressWarnings("HiddenField") +public final class ImmutableAuditableThing implements AuditableThing { - @Id @GeneratedValue Long id; - @CreatedDate LocalDateTime createdAt; - @CreatedBy String createdBy; - @LastModifiedDate LocalDateTime modifiedAt; - @LastModifiedBy String modifiedBy; + @Id + @GeneratedValue + private final Long id; + @CreatedDate + private final LocalDateTime createdAt; + @CreatedBy + private final String createdBy; + @LastModifiedDate + private final LocalDateTime modifiedAt; + @LastModifiedBy + private final String modifiedBy; - String name; + private final String name; public ImmutableAuditableThing(String name) { this(null, null, null, null, null, name); } + + @PersistenceCreator + public ImmutableAuditableThing(Long id, LocalDateTime createdAt, String createdBy, LocalDateTime modifiedAt, String modifiedBy, String name) { + this.id = id; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.modifiedAt = modifiedAt; + this.modifiedBy = modifiedBy; + this.name = name; + } + + public Long getId() { + return this.id; + } + + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public LocalDateTime getModifiedAt() { + return this.modifiedAt; + } + + public String getModifiedBy() { + return this.modifiedBy; + } + + public String getName() { + return this.name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ImmutableAuditableThing)) { + return false; + } + final ImmutableAuditableThing other = (ImmutableAuditableThing) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$createdAt = this.getCreatedAt(); + final Object other$createdAt = other.getCreatedAt(); + if (this$createdAt == null ? other$createdAt != null : !this$createdAt.equals(other$createdAt)) { + return false; + } + final Object this$createdBy = this.getCreatedBy(); + final Object other$createdBy = other.getCreatedBy(); + if (this$createdBy == null ? other$createdBy != null : !this$createdBy.equals(other$createdBy)) { + return false; + } + final Object this$modifiedAt = this.getModifiedAt(); + final Object other$modifiedAt = other.getModifiedAt(); + if (this$modifiedAt == null ? other$modifiedAt != null : !this$modifiedAt.equals(other$modifiedAt)) { + return false; + } + final Object this$modifiedBy = this.getModifiedBy(); + final Object other$modifiedBy = other.getModifiedBy(); + if (this$modifiedBy == null ? other$modifiedBy != null : !this$modifiedBy.equals(other$modifiedBy)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $createdAt = this.getCreatedAt(); + result = result * PRIME + ($createdAt == null ? 43 : $createdAt.hashCode()); + final Object $createdBy = this.getCreatedBy(); + result = result * PRIME + ($createdBy == null ? 43 : $createdBy.hashCode()); + final Object $modifiedAt = this.getModifiedAt(); + result = result * PRIME + ($modifiedAt == null ? 43 : $modifiedAt.hashCode()); + final Object $modifiedBy = this.getModifiedBy(); + result = result * PRIME + ($modifiedBy == null ? 43 : $modifiedBy.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + public String toString() { + return "ImmutableAuditableThing(id=" + this.getId() + ", createdAt=" + this.getCreatedAt() + ", createdBy=" + this.getCreatedBy() + ", modifiedAt=" + this.getModifiedAt() + ", modifiedBy=" + this.getModifiedBy() + ", name=" + this.getName() + ")"; + } + + public ImmutableAuditableThing withId(Long id) { + return this.id == id ? this : new ImmutableAuditableThing(id, this.createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThing withCreatedAt(LocalDateTime createdAt) { + return this.createdAt == createdAt ? this : new ImmutableAuditableThing(this.id, createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThing withCreatedBy(String createdBy) { + return this.createdBy == createdBy ? this : new ImmutableAuditableThing(this.id, this.createdAt, createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThing withModifiedAt(LocalDateTime modifiedAt) { + return this.modifiedAt == modifiedAt ? this : new ImmutableAuditableThing(this.id, this.createdAt, this.createdBy, modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThing withModifiedBy(String modifiedBy) { + return this.modifiedBy == modifiedBy ? this : new ImmutableAuditableThing(this.id, this.createdAt, this.createdBy, this.modifiedAt, modifiedBy, this.name); + } + + public ImmutableAuditableThing withName(String name) { + return this.name == name ? this : new ImmutableAuditableThing(this.id, this.createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, name); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThingWithGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThingWithGeneratedId.java index d27417601..ee1579d5f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThingWithGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableAuditableThingWithGeneratedId.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AllArgsConstructor; -import lombok.Value; -import lombok.With; - -import java.time.LocalDateTime; - import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.Id; @@ -31,24 +25,151 @@ import org.springframework.data.annotation.Persistent; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.support.UUIDStringGenerator; +import java.time.LocalDateTime; + /** * @author Michael J. Simons */ -@Value -@With -@AllArgsConstructor(onConstructor = @__(@PersistenceCreator)) +@SuppressWarnings("HiddenField") @Persistent -public class ImmutableAuditableThingWithGeneratedId implements AuditableThing { +public final class ImmutableAuditableThingWithGeneratedId implements AuditableThing { - @Id @GeneratedValue(UUIDStringGenerator.class) String id; - @CreatedDate LocalDateTime createdAt; - @CreatedBy String createdBy; - @LastModifiedDate LocalDateTime modifiedAt; - @LastModifiedBy String modifiedBy; + @Id + @GeneratedValue(UUIDStringGenerator.class) + private final String id; + @CreatedDate + private final LocalDateTime createdAt; + @CreatedBy + private final String createdBy; + @LastModifiedDate + private final LocalDateTime modifiedAt; + @LastModifiedBy + private final String modifiedBy; - String name; + private final String name; public ImmutableAuditableThingWithGeneratedId(String name) { this(null, null, null, null, null, name); } + + @PersistenceCreator + public ImmutableAuditableThingWithGeneratedId(String id, LocalDateTime createdAt, String createdBy, LocalDateTime modifiedAt, String modifiedBy, String name) { + this.id = id; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.modifiedAt = modifiedAt; + this.modifiedBy = modifiedBy; + this.name = name; + } + + public String getId() { + return this.id; + } + + public LocalDateTime getCreatedAt() { + return this.createdAt; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public LocalDateTime getModifiedAt() { + return this.modifiedAt; + } + + public String getModifiedBy() { + return this.modifiedBy; + } + + public String getName() { + return this.name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ImmutableAuditableThingWithGeneratedId)) { + return false; + } + final ImmutableAuditableThingWithGeneratedId other = (ImmutableAuditableThingWithGeneratedId) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$createdAt = this.getCreatedAt(); + final Object other$createdAt = other.getCreatedAt(); + if (this$createdAt == null ? other$createdAt != null : !this$createdAt.equals(other$createdAt)) { + return false; + } + final Object this$createdBy = this.getCreatedBy(); + final Object other$createdBy = other.getCreatedBy(); + if (this$createdBy == null ? other$createdBy != null : !this$createdBy.equals(other$createdBy)) { + return false; + } + final Object this$modifiedAt = this.getModifiedAt(); + final Object other$modifiedAt = other.getModifiedAt(); + if (this$modifiedAt == null ? other$modifiedAt != null : !this$modifiedAt.equals(other$modifiedAt)) { + return false; + } + final Object this$modifiedBy = this.getModifiedBy(); + final Object other$modifiedBy = other.getModifiedBy(); + if (this$modifiedBy == null ? other$modifiedBy != null : !this$modifiedBy.equals(other$modifiedBy)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $createdAt = this.getCreatedAt(); + result = result * PRIME + ($createdAt == null ? 43 : $createdAt.hashCode()); + final Object $createdBy = this.getCreatedBy(); + result = result * PRIME + ($createdBy == null ? 43 : $createdBy.hashCode()); + final Object $modifiedAt = this.getModifiedAt(); + result = result * PRIME + ($modifiedAt == null ? 43 : $modifiedAt.hashCode()); + final Object $modifiedBy = this.getModifiedBy(); + result = result * PRIME + ($modifiedBy == null ? 43 : $modifiedBy.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + public String toString() { + return "ImmutableAuditableThingWithGeneratedId(id=" + this.getId() + ", createdAt=" + this.getCreatedAt() + ", createdBy=" + this.getCreatedBy() + ", modifiedAt=" + this.getModifiedAt() + ", modifiedBy=" + this.getModifiedBy() + ", name=" + this.getName() + ")"; + } + + public ImmutableAuditableThingWithGeneratedId withId(String id) { + return this.id == id ? this : new ImmutableAuditableThingWithGeneratedId(id, this.createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThingWithGeneratedId withCreatedAt(LocalDateTime createdAt) { + return this.createdAt == createdAt ? this : new ImmutableAuditableThingWithGeneratedId(this.id, createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThingWithGeneratedId withCreatedBy(String createdBy) { + return this.createdBy == createdBy ? this : new ImmutableAuditableThingWithGeneratedId(this.id, this.createdAt, createdBy, this.modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThingWithGeneratedId withModifiedAt(LocalDateTime modifiedAt) { + return this.modifiedAt == modifiedAt ? this : new ImmutableAuditableThingWithGeneratedId(this.id, this.createdAt, this.createdBy, modifiedAt, this.modifiedBy, this.name); + } + + public ImmutableAuditableThingWithGeneratedId withModifiedBy(String modifiedBy) { + return this.modifiedBy == modifiedBy ? this : new ImmutableAuditableThingWithGeneratedId(this.id, this.createdAt, this.createdBy, this.modifiedAt, modifiedBy, this.name); + } + + public ImmutableAuditableThingWithGeneratedId withName(String name) { + return this.name == name ? this : new ImmutableAuditableThingWithGeneratedId(this.id, this.createdAt, this.createdBy, this.modifiedAt, this.modifiedBy, name); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePerson.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePerson.java index 09a782aa5..2870c2548 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePerson.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePerson.java @@ -29,7 +29,8 @@ import org.springframework.data.neo4j.core.schema.Node; */ @Node public class ImmutablePerson { - @Id private final String name; + @Id + private final String name; private final List wasOnboardedBy; public ImmutablePerson(String name, List wasOnboardedBy) { diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithAssignedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithAssignedId.java index 36e4db3d1..63c07d3bc 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithAssignedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithAssignedId.java @@ -59,16 +59,16 @@ public class ImmutablePersonWithAssignedId { @PersistenceCreator public ImmutablePersonWithAssignedId( - Long id, - List wasOnboardedBy, - Set knownBy, - Map ratedBy, - Map> ratedByCollection, - ImmutablePersonWithAssignedId fallback, - ImmutablePersonWithAssignedIdRelationshipProperties relationshipProperties, - List relationshipPropertiesCollection, - Map relationshipPropertiesDynamic, - Map> relationshipPropertiesDynamicCollection) { + Long id, + List wasOnboardedBy, + Set knownBy, + Map ratedBy, + Map> ratedByCollection, + ImmutablePersonWithAssignedId fallback, + ImmutablePersonWithAssignedIdRelationshipProperties relationshipProperties, + List relationshipPropertiesCollection, + Map relationshipPropertiesDynamic, + Map> relationshipPropertiesDynamicCollection) { this.id = new Random().nextLong(); this.wasOnboardedBy = wasOnboardedBy; @@ -219,7 +219,7 @@ public class ImmutablePersonWithAssignedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithExternallyGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithExternallyGeneratedId.java index 08395f386..36f35e7e9 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithExternallyGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithExternallyGeneratedId.java @@ -59,16 +59,16 @@ public class ImmutablePersonWithExternallyGeneratedId { @PersistenceCreator public ImmutablePersonWithExternallyGeneratedId( - UUID id, - List wasOnboardedBy, - Set knownBy, - Map ratedBy, - Map> ratedByCollection, - ImmutablePersonWithExternallyGeneratedId fallback, - ImmutablePersonWithExternallyGeneratedIdRelationshipProperties relationshipProperties, - List relationshipPropertiesCollection, - Map relationshipPropertiesDynamic, - Map> relationshipPropertiesDynamicCollection) { + UUID id, + List wasOnboardedBy, + Set knownBy, + Map ratedBy, + Map> ratedByCollection, + ImmutablePersonWithExternallyGeneratedId fallback, + ImmutablePersonWithExternallyGeneratedIdRelationshipProperties relationshipProperties, + List relationshipPropertiesCollection, + Map relationshipPropertiesDynamic, + Map> relationshipPropertiesDynamicCollection) { this.id = id; this.wasOnboardedBy = wasOnboardedBy; @@ -219,7 +219,7 @@ public class ImmutablePersonWithExternallyGeneratedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithGeneratedId.java index 97a1a05c1..bba4b29b6 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutablePersonWithGeneratedId.java @@ -32,7 +32,8 @@ import java.util.Set; @Node public class ImmutablePersonWithGeneratedId { - @Id @GeneratedValue + @Id + @GeneratedValue public final Long id; @Relationship("ONBOARDED_BY") @@ -57,16 +58,16 @@ public class ImmutablePersonWithGeneratedId { @PersistenceCreator public ImmutablePersonWithGeneratedId( - Long id, - List wasOnboardedBy, - Set knownBy, - Map ratedBy, - Map> ratedByCollection, - ImmutablePersonWithGeneratedId fallback, - ImmutablePersonWithGeneratedIdRelationshipProperties relationshipProperties, - List relationshipPropertiesCollection, - Map relationshipPropertiesDynamic, - Map> relationshipPropertiesDynamicCollection) { + Long id, + List wasOnboardedBy, + Set knownBy, + Map ratedBy, + Map> ratedByCollection, + ImmutablePersonWithGeneratedId fallback, + ImmutablePersonWithGeneratedIdRelationshipProperties relationshipProperties, + List relationshipPropertiesCollection, + Map relationshipPropertiesDynamic, + Map> relationshipPropertiesDynamicCollection) { this.id = id; this.wasOnboardedBy = wasOnboardedBy; @@ -217,7 +218,7 @@ public class ImmutablePersonWithGeneratedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithAssignedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithAssignedId.java index 2931863d6..a272e07ea 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithAssignedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithAssignedId.java @@ -217,7 +217,7 @@ public class ImmutableSecondPersonWithAssignedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithExternallyGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithExternallyGeneratedId.java index 42430eebb..0f6487c3f 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithExternallyGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithExternallyGeneratedId.java @@ -59,16 +59,16 @@ public class ImmutableSecondPersonWithExternallyGeneratedId { @PersistenceCreator public ImmutableSecondPersonWithExternallyGeneratedId( - UUID id, - List wasOnboardedBy, - Set knownBy, - Map ratedBy, - Map> ratedByCollection, - ImmutableSecondPersonWithExternallyGeneratedId fallback, - ImmutablePersonWithExternallyGeneratedIdRelationshipProperties relationshipProperties, - List relationshipPropertiesCollection, - Map relationshipPropertiesDynamic, - Map> relationshipPropertiesDynamicCollection) { + UUID id, + List wasOnboardedBy, + Set knownBy, + Map ratedBy, + Map> ratedByCollection, + ImmutableSecondPersonWithExternallyGeneratedId fallback, + ImmutablePersonWithExternallyGeneratedIdRelationshipProperties relationshipProperties, + List relationshipPropertiesCollection, + Map relationshipPropertiesDynamic, + Map> relationshipPropertiesDynamicCollection) { this.id = id; this.wasOnboardedBy = wasOnboardedBy; @@ -219,7 +219,7 @@ public class ImmutableSecondPersonWithExternallyGeneratedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithGeneratedId.java index 73dd2d017..f214b7ad6 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableSecondPersonWithGeneratedId.java @@ -31,7 +31,8 @@ import java.util.Set; */ @Node public class ImmutableSecondPersonWithGeneratedId { - @Id @GeneratedValue + @Id + @GeneratedValue public final Long id; @Relationship("ONBOARDED_BY") @@ -56,16 +57,16 @@ public class ImmutableSecondPersonWithGeneratedId { @PersistenceCreator public ImmutableSecondPersonWithGeneratedId( - Long id, - List wasOnboardedBy, - Set knownBy, - Map ratedBy, - Map> ratedByCollection, - ImmutableSecondPersonWithGeneratedId fallback, - ImmutablePersonWithGeneratedIdRelationshipProperties relationshipProperties, - List relationshipPropertiesCollection, - Map relationshipPropertiesDynamic, - Map> relationshipPropertiesDynamicCollection) { + Long id, + List wasOnboardedBy, + Set knownBy, + Map ratedBy, + Map> ratedByCollection, + ImmutableSecondPersonWithGeneratedId fallback, + ImmutablePersonWithGeneratedIdRelationshipProperties relationshipProperties, + List relationshipPropertiesCollection, + Map relationshipPropertiesDynamic, + Map> relationshipPropertiesDynamicCollection) { this.id = id; this.wasOnboardedBy = wasOnboardedBy; @@ -216,6 +217,6 @@ public class ImmutableSecondPersonWithGeneratedId { Collections.emptyList(), Collections.emptyMap(), relationshipPropertiesDynamicCollection - ); + ); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableVersionedThing.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableVersionedThing.java index 3bb3741e8..3ae243b8a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableVersionedThing.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ImmutableVersionedThing.java @@ -15,9 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Getter; -import lombok.With; - import org.springframework.data.annotation.Version; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -25,18 +22,16 @@ import org.springframework.data.neo4j.core.schema.Node; /** * @author Michael J. Simons */ +@SuppressWarnings("HiddenField") @Node -@Getter public class ImmutableVersionedThing { @Id private final Long id; @Version - @With private final Long myVersion; - @With private final String name; public ImmutableVersionedThing(Long id, String name) { @@ -48,4 +43,24 @@ public class ImmutableVersionedThing { this.myVersion = myVersion; this.name = name; } + + public Long getId() { + return this.id; + } + + public Long getMyVersion() { + return this.myVersion; + } + + public String getName() { + return this.name; + } + + public ImmutableVersionedThing withMyVersion(Long myVersion) { + return this.myVersion == myVersion ? this : new ImmutableVersionedThing(this.id, myVersion, this.name); + } + + public ImmutableVersionedThing withName(String name) { + return this.name == name ? this : new ImmutableVersionedThing(this.id, this.myVersion, name); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Inheritance.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Inheritance.java index 8332dd16e..33beb2a2d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Inheritance.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Inheritance.java @@ -54,7 +54,9 @@ public class Inheritance { @Node("SomeInterface") // <.> public static class SomeInterfaceEntity implements SomeInterface { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; @@ -109,7 +111,9 @@ public class Inheritance { // Overrides omitted for brevity // end::interface2[] - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; @@ -349,12 +353,15 @@ public class Inheritance { return value; } } + /** * super base class */ @Node public static abstract class SuperBaseClass { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; public Long getId() { return id; @@ -450,16 +457,18 @@ public class Inheritance { /** * Base class with explicit primary and additional labels. */ - @Node({ "LabeledBaseClass", "And_another_one" }) + @Node({"LabeledBaseClass", "And_another_one"}) public static abstract class BaseClassWithLabels { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } /** * Class that also has explicit labels */ - @Node({ "ExtendingClassA", "And_yet_more_labels" }) + @Node({"ExtendingClassA", "And_yet_more_labels"}) public static class ExtendingClassWithLabelsA extends BaseClassWithLabels { private final String name; @@ -493,7 +502,7 @@ public class Inheritance { /** * Another class that also has explicit labels */ - @Node({ "ExtendingClassB", "And_other_labels" }) + @Node({"ExtendingClassB", "And_other_labels"}) public static class ExtendingClassWithLabelsB extends BaseClassWithLabels { private final String somethingElse; @@ -530,9 +539,12 @@ public class Inheritance { @Node public static class RelationshipToAbstractClass { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Relationship("HAS") private List things; + @Relationship("HAS") + private List things; public void setThings(List things) { this.things = things; @@ -544,13 +556,16 @@ public class Inheritance { } /** - * Abstract super base class with relationships + * Abstract super base class with relationships */ @Node("SuperBaseClassWithRelationship") public static abstract class SuperBaseClassWithRelationship { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Relationship("RELATED_TO") private List boing; + @Relationship("RELATED_TO") + private List boing; public void setBoing(List boing) { this.boing = boing; @@ -562,12 +577,13 @@ public class Inheritance { } /** - * Abstract base class with relationships + * Abstract base class with relationships */ @Node("BaseClassWithRelationship") public static abstract class BaseClassWithRelationship extends SuperBaseClassWithRelationship { - @Relationship("HAS") private List things; + @Relationship("HAS") + private List things; public void setThings(List things) { this.things = things; @@ -579,12 +595,13 @@ public class Inheritance { } /** - * Concrete implementation + * Concrete implementation */ @Node public static class ExtendingBaseClassWithRelationship extends BaseClassWithRelationship { - @Relationship("SOMETHING_ELSE") private List somethingConcrete; + @Relationship("SOMETHING_ELSE") + private List somethingConcrete; public void setSomethingConcrete(List somethingConcrete) { this.somethingConcrete = somethingConcrete; @@ -596,14 +613,18 @@ public class Inheritance { } // Same as above but with relationship properties instead of direct relationship links. + /** - * Abstract super base class with relationship properties + * Abstract super base class with relationship properties */ @Node("SuperBaseClassWithRelationshipProperties") public static abstract class SuperBaseClassWithRelationshipProperties { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Relationship("RELATED_TO") private List boing; + @Relationship("RELATED_TO") + private List boing; public void setBoing(List boing) { this.boing = boing; @@ -615,12 +636,13 @@ public class Inheritance { } /** - * Abstract base class with relationship properties + * Abstract base class with relationship properties */ @Node("BaseClassWithRelationshipProperties") public static abstract class BaseClassWithRelationshipProperties extends SuperBaseClassWithRelationshipProperties { - @Relationship("HAS") private List things; + @Relationship("HAS") + private List things; public void setThings(List things) { this.things = things; @@ -632,12 +654,13 @@ public class Inheritance { } /** - * Concrete implementation + * Concrete implementation */ @Node public static class ExtendingBaseClassWithRelationshipProperties extends BaseClassWithRelationshipProperties { - @Relationship("SOMETHING_ELSE") private List somethingConcrete; + @Relationship("SOMETHING_ELSE") + private List somethingConcrete; public void setSomethingConcrete(List somethingConcrete) { this.somethingConcrete = somethingConcrete; @@ -768,19 +791,22 @@ public class Inheritance { * company */ @Node("Company") - public static class Company extends Entity {} + public static class Company extends Entity { + } /** * site */ @Node("Site") - public static class Site extends Entity {} + public static class Site extends Entity { + } /** * building */ @Node("Building") - public static class Building extends Entity {} + public static class Building extends Entity { + } /** * Base entity for GH-2138 generic relationship in child class tests @@ -936,7 +962,7 @@ public class Inheritance { public final Long id; @Relationship("LIVES_IN") - public final Continent continent; + public final Continent continent; public ParentClassWithRelationship(Long id, Continent continent) { this.id = id; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Multiple1O1Relationships.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Multiple1O1Relationships.java index 143db95fd..da028fa4b 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Multiple1O1Relationships.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Multiple1O1Relationships.java @@ -27,7 +27,9 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class Multiple1O1Relationships { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleLabels.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleLabels.java index 0783e13e3..9fad0e592 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleLabels.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleLabels.java @@ -28,24 +28,29 @@ public class MultipleLabels { /** * An entity */ - @Node({ "A", "B", "C" }) + @Node({"A", "B", "C"}) public static class MultipleLabelsEntity { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Relationship(type = "HAS") public MultipleLabelsEntity otherMultipleLabelEntity; + @Relationship(type = "HAS") + public MultipleLabelsEntity otherMultipleLabelEntity; } /** * An entity */ - @Node({ "X", "Y", "Z" }) + @Node({"X", "Y", "Z"}) public static class MultipleLabelsEntityWithAssignedId { - @Id public Long id; + @Id + public Long id; public MultipleLabelsEntityWithAssignedId(Long id) { this.id = id; } - @Relationship(type = "HAS") public MultipleLabelsEntityWithAssignedId otherMultipleLabelEntity; + @Relationship(type = "HAS") + public MultipleLabelsEntityWithAssignedId otherMultipleLabelEntity; } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleRelationshipsThing.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleRelationshipsThing.java index de3897ed9..0a6f4c845 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleRelationshipsThing.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MultipleRelationshipsThing.java @@ -30,7 +30,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class MultipleRelationshipsThing { - @Id @GeneratedValue Long id; + @Id + @GeneratedValue + Long id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableChild.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableChild.java index a1d2adcf9..ead1a1030 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableChild.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableChild.java @@ -25,7 +25,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class MutableChild { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; public Long getId() { diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableParent.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableParent.java index 71fc575da..c1c6f0e14 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableParent.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/MutableParent.java @@ -27,7 +27,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class MutableParent { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; private List children; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneSource.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneSource.java index 9437f1705..46a9b97ea 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneSource.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneSource.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Data; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; @@ -27,7 +25,6 @@ import org.springframework.data.neo4j.core.schema.Relationship; * @author Michael J. Simons */ @Node -@Data public class OneToOneSource { @Id @@ -36,12 +33,133 @@ public class OneToOneSource { @Relationship("OWNS") private OneToOneTarget target; + public OneToOneSource() { + } + + public String getName() { + return this.name; + } + + public OneToOneTarget getTarget() { + return this.target; + } + + public void setName(String name) { + this.name = name; + } + + public void setTarget(OneToOneTarget target) { + this.target = target; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof OneToOneSource)) { + return false; + } + final OneToOneSource other = (OneToOneSource) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$target = this.getTarget(); + final Object other$target = other.getTarget(); + if (this$target == null ? other$target != null : !this$target.equals(other$target)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof OneToOneSource; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $target = this.getTarget(); + result = result * PRIME + ($target == null ? 43 : $target.hashCode()); + return result; + } + + public String toString() { + return "OneToOneSource(name=" + this.getName() + ", target=" + this.getTarget() + ")"; + } + /** * Simple DTO projection for OneToOneSource */ - @Data public static class OneToOneSourceProjection { String name; OneToOneTarget target; + + public OneToOneSourceProjection() { + } + + public String getName() { + return this.name; + } + + public OneToOneTarget getTarget() { + return this.target; + } + + public void setName(String name) { + this.name = name; + } + + public void setTarget(OneToOneTarget target) { + this.target = target; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof OneToOneSourceProjection)) { + return false; + } + final OneToOneSourceProjection other = (OneToOneSourceProjection) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$target = this.getTarget(); + final Object other$target = other.getTarget(); + if (this$target == null ? other$target != null : !this$target.equals(other$target)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof OneToOneSourceProjection; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $target = this.getTarget(); + result = result * PRIME + ($target == null ? 43 : $target.hashCode()); + return result; + } + + public String toString() { + return "OneToOneSource.OneToOneSourceProjection(name=" + this.getName() + ", target=" + this.getTarget() + ")"; + } } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneTarget.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneTarget.java index c414851e0..a6f6d0c2c 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneTarget.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/OneToOneTarget.java @@ -15,8 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Data; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -26,9 +24,54 @@ import org.springframework.data.neo4j.core.schema.Node; * @author Michael J. Simons */ @Node -@Data public class OneToOneTarget { @Id private String name; + + public OneToOneTarget() { + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof OneToOneTarget)) { + return false; + } + final OneToOneTarget other = (OneToOneTarget) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof OneToOneTarget; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + public String toString() { + return "OneToOneTarget(name=" + this.getName() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ParentNode.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ParentNode.java index cf48bf212..f0eb2d1bf 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ParentNode.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ParentNode.java @@ -25,7 +25,8 @@ import org.springframework.data.neo4j.core.schema.Node; */ @Node public class ParentNode { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; private String someAttribute; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Person.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Person.java index d92c768e0..18aa18518 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Person.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Person.java @@ -26,25 +26,30 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class Person { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String firstName; private String lastName; private int primitiveValue; // never used but always null - @Relationship("LIVES_AT") private Address address; + @Relationship("LIVES_AT") + private Address address; /** * Address of a person. */ @Node public static class Address { - @Id private Long id; + @Id + private Long id; private String zipCode; private String city; private String street; - @Relationship("BASED_IN") private Country country; + @Relationship("BASED_IN") + private Country country; public Long getId() { return id; @@ -83,7 +88,9 @@ public class Person { */ @Node("YetAnotherCountryEntity") public static class Country { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; private String countryCode; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithAllConstructor.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithAllConstructor.java index fd8a9ff93..46efedd8a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithAllConstructor.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithAllConstructor.java @@ -15,40 +15,32 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.With; - -import java.time.Instant; -import java.time.LocalDate; -import java.util.List; - import org.neo4j.driver.types.Point; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Property; +import java.time.Instant; +import java.time.LocalDate; +import java.util.List; + /** * @author Gerrit Meier * @author Michael J. Simons */ -@Getter -@Setter +@SuppressWarnings("HiddenField") @Node -@ToString -@AllArgsConstructor -@EqualsAndHashCode public class PersonWithAllConstructor { - @Id @GeneratedValue @With private final Long id; + @Id + @GeneratedValue + private final Long id; private final String name; - @Property("first_name") private String firstName; + @Property("first_name") + private String firstName; private final String sameValue; @@ -65,4 +57,183 @@ public class PersonWithAllConstructor { private final Point place; private final Instant createdAt; + + public PersonWithAllConstructor(Long id, String name, String firstName, String sameValue, Boolean cool, Long personNumber, LocalDate bornOn, String nullable, List things, Point place, Instant createdAt) { + this.id = id; + this.name = name; + this.firstName = firstName; + this.sameValue = sameValue; + this.cool = cool; + this.personNumber = personNumber; + this.bornOn = bornOn; + this.nullable = nullable; + this.things = things; + this.place = place; + this.createdAt = createdAt; + } + + public Long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public String getFirstName() { + return this.firstName; + } + + public String getSameValue() { + return this.sameValue; + } + + public Boolean getCool() { + return this.cool; + } + + public Long getPersonNumber() { + return this.personNumber; + } + + public LocalDate getBornOn() { + return this.bornOn; + } + + public String getNullable() { + return this.nullable; + } + + public List getThings() { + return this.things; + } + + public Point getPlace() { + return this.place; + } + + public Instant getCreatedAt() { + return this.createdAt; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public void setNullable(String nullable) { + this.nullable = nullable; + } + + public void setThings(List things) { + this.things = things; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PersonWithAllConstructor)) { + return false; + } + final PersonWithAllConstructor other = (PersonWithAllConstructor) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + final Object this$firstName = this.getFirstName(); + final Object other$firstName = other.getFirstName(); + if (this$firstName == null ? other$firstName != null : !this$firstName.equals(other$firstName)) { + return false; + } + final Object this$sameValue = this.getSameValue(); + final Object other$sameValue = other.getSameValue(); + if (this$sameValue == null ? other$sameValue != null : !this$sameValue.equals(other$sameValue)) { + return false; + } + final Object this$cool = this.getCool(); + final Object other$cool = other.getCool(); + if (this$cool == null ? other$cool != null : !this$cool.equals(other$cool)) { + return false; + } + final Object this$personNumber = this.getPersonNumber(); + final Object other$personNumber = other.getPersonNumber(); + if (this$personNumber == null ? other$personNumber != null : !this$personNumber.equals(other$personNumber)) { + return false; + } + final Object this$bornOn = this.getBornOn(); + final Object other$bornOn = other.getBornOn(); + if (this$bornOn == null ? other$bornOn != null : !this$bornOn.equals(other$bornOn)) { + return false; + } + final Object this$nullable = this.getNullable(); + final Object other$nullable = other.getNullable(); + if (this$nullable == null ? other$nullable != null : !this$nullable.equals(other$nullable)) { + return false; + } + final Object this$things = this.getThings(); + final Object other$things = other.getThings(); + if (this$things == null ? other$things != null : !this$things.equals(other$things)) { + return false; + } + final Object this$place = this.getPlace(); + final Object other$place = other.getPlace(); + if (this$place == null ? other$place != null : !this$place.equals(other$place)) { + return false; + } + final Object this$createdAt = this.getCreatedAt(); + final Object other$createdAt = other.getCreatedAt(); + if (this$createdAt == null ? other$createdAt != null : !this$createdAt.equals(other$createdAt)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PersonWithAllConstructor; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + final Object $firstName = this.getFirstName(); + result = result * PRIME + ($firstName == null ? 43 : $firstName.hashCode()); + final Object $sameValue = this.getSameValue(); + result = result * PRIME + ($sameValue == null ? 43 : $sameValue.hashCode()); + final Object $cool = this.getCool(); + result = result * PRIME + ($cool == null ? 43 : $cool.hashCode()); + final Object $personNumber = this.getPersonNumber(); + result = result * PRIME + ($personNumber == null ? 43 : $personNumber.hashCode()); + final Object $bornOn = this.getBornOn(); + result = result * PRIME + ($bornOn == null ? 43 : $bornOn.hashCode()); + final Object $nullable = this.getNullable(); + result = result * PRIME + ($nullable == null ? 43 : $nullable.hashCode()); + final Object $things = this.getThings(); + result = result * PRIME + ($things == null ? 43 : $things.hashCode()); + final Object $place = this.getPlace(); + result = result * PRIME + ($place == null ? 43 : $place.hashCode()); + final Object $createdAt = this.getCreatedAt(); + result = result * PRIME + ($createdAt == null ? 43 : $createdAt.hashCode()); + return result; + } + + public String toString() { + return "PersonWithAllConstructor(id=" + this.getId() + ", name=" + this.getName() + ", firstName=" + this.getFirstName() + ", sameValue=" + this.getSameValue() + ", cool=" + this.getCool() + ", personNumber=" + this.getPersonNumber() + ", bornOn=" + this.getBornOn() + ", nullable=" + this.getNullable() + ", things=" + this.getThings() + ", place=" + this.getPlace() + ", createdAt=" + this.getCreatedAt() + ")"; + } + + public PersonWithAllConstructor withId(Long id) { + return this.id == id ? this : new PersonWithAllConstructor(id, this.name, this.firstName, this.sameValue, this.cool, this.personNumber, this.bornOn, this.nullable, this.things, this.place, this.createdAt); + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithNoConstructor.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithNoConstructor.java index 9e03f4038..6feb5fb74 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithNoConstructor.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithNoConstructor.java @@ -15,10 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -27,17 +23,54 @@ import org.springframework.data.neo4j.core.schema.Property; /** * Example domain object with default constructor. */ -@Getter -@Setter @Node -@ToString public class PersonWithNoConstructor { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; - @Property("first_name") private String firstName; + @Property("first_name") + private String firstName; - @Property("mittlererName") private String middleName; + @Property("mittlererName") + private String middleName; + + public Long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public String getFirstName() { + return this.firstName; + } + + public String getMiddleName() { + return this.middleName; + } + + public void setId(Long id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + public String toString() { + return "PersonWithNoConstructor(id=" + this.getId() + ", name=" + this.getName() + ", firstName=" + this.getFirstName() + ", middleName=" + this.getMiddleName() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationship.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationship.java index ec9cc4861..d31e80500 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationship.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationship.java @@ -28,15 +28,20 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class PersonWithRelationship { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; - @Relationship("Has") private Hobby hobbies; + @Relationship("Has") + private Hobby hobbies; - @Relationship("Has") private List pets; + @Relationship("Has") + private List pets; - @Relationship(type = "Has", direction = Relationship.Direction.INCOMING) private Club club; + @Relationship(type = "Has", direction = Relationship.Direction.INCOMING) + private Club club; public Long getId() { return id; @@ -83,6 +88,7 @@ public class PersonWithRelationship { */ public interface PersonWithHobby { String getName(); + Hobby getHobbies(); } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties.java index 5f438ef90..298fa7b99 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties.java @@ -32,17 +32,23 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class PersonWithRelationshipWithProperties { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; - @Relationship("LIKES") private final List hobbies; + @Relationship("LIKES") + private final List hobbies; - @Relationship("WORKS_IN") private final WorksInClubRelationship club; + @Relationship("WORKS_IN") + private final WorksInClubRelationship club; - @Relationship("OWNS") private Set pets; + @Relationship("OWNS") + private Set pets; - @Relationship("OWNS") private List clubs; + @Relationship("OWNS") + private List clubs; @PersistenceCreator public PersonWithRelationshipWithProperties(Long id, String name, List hobbies, WorksInClubRelationship club) { diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties2.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties2.java index 28cbadf98..3c18128bf 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties2.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelationshipWithProperties2.java @@ -28,11 +28,14 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class PersonWithRelationshipWithProperties2 { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; - @Relationship("LIKES") private Set hobbies; + @Relationship("LIKES") + private Set hobbies; public PersonWithRelationshipWithProperties2(String name) { this.name = name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelatives.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelatives.java index cb991a098..5be6a8070 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelatives.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithRelatives.java @@ -57,7 +57,9 @@ public class PersonWithRelatives { FOOTBALL, BASEBALL } - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithStringlyTypedRelatives.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithStringlyTypedRelatives.java index 259d3baa1..e4a78547d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithStringlyTypedRelatives.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithStringlyTypedRelatives.java @@ -29,7 +29,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class PersonWithStringlyTypedRelatives { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithWither.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithWither.java index fb70011f9..974aa1692 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithWither.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/PersonWithWither.java @@ -15,10 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; @@ -27,13 +23,12 @@ import org.springframework.data.neo4j.core.schema.Node; * Example domain object that works with wither. Read more about this here. */ -@Getter -@Setter @Node -@ToString public class PersonWithWither { - @Id @GeneratedValue private final Long id; + @Id + @GeneratedValue + private final Long id; private final String name; @@ -49,4 +44,16 @@ public class PersonWithWither { public PersonWithWither withName(String newName) { return new PersonWithWither(this.id, newName); } + + public Long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public String toString() { + return "PersonWithWither(id=" + this.getId() + ", name=" + this.getName() + ")"; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Pet.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Pet.java index 5f19a71a2..877499062 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/Pet.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/Pet.java @@ -15,29 +15,24 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -import java.util.List; -import java.util.Set; - import org.springframework.data.annotation.PersistenceCreator; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; +import java.util.List; +import java.util.Set; + /** * @author Gerrit Meier */ -@RequiredArgsConstructor(onConstructor = @__(@PersistenceCreator)) -@Getter -@EqualsAndHashCode(of = { "id", "name" }) @Node public class Pet { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; @@ -46,13 +41,22 @@ public class Pet { this.id = id; } - @Relationship("Has") private Set hobbies; + @Relationship("Has") + private Set hobbies; - @Relationship("Has") private List friends; + @Relationship("Has") + private List friends; - @Relationship(value = "Hated_by", direction = Relationship.Direction.INCOMING) private List otherPets; + @Relationship(value = "Hated_by", direction = Relationship.Direction.INCOMING) + private List otherPets; - @Relationship("Has") private List things; + @Relationship("Has") + private List things; + + @PersistenceCreator + public Pet(String name) { + this.name = name; + } public Set getHobbies() { return hobbies; @@ -73,4 +77,54 @@ public class Pet { public Long getId() { return id; } + + public String getName() { + return this.name; + } + + public List getOtherPets() { + return this.otherPets; + } + + public List getThings() { + return this.things; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof Pet)) { + return false; + } + final Pet other = (Pet) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof Pet; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ProjectionTestBase.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ProjectionTestBase.java index f89939b78..519202c37 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ProjectionTestBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ProjectionTestBase.java @@ -23,7 +23,8 @@ import org.springframework.data.neo4j.core.schema.Id; */ public abstract class ProjectionTestBase { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/RelationshipsAsConstructorParametersEntities.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/RelationshipsAsConstructorParametersEntities.java index 9626bc18f..fb030466d 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/RelationshipsAsConstructorParametersEntities.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/RelationshipsAsConstructorParametersEntities.java @@ -31,7 +31,9 @@ public final class RelationshipsAsConstructorParametersEntities { @Node public static class NodeTypeA { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private final String name; @@ -50,9 +52,12 @@ public final class RelationshipsAsConstructorParametersEntities { @Node public static class NodeTypeB { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Relationship("BELONGS_TO") private final NodeTypeA nodeTypeA; + @Relationship("BELONGS_TO") + private final NodeTypeA nodeTypeA; private final String name; @@ -70,5 +75,6 @@ public final class RelationshipsAsConstructorParametersEntities { } } - private RelationshipsAsConstructorParametersEntities() {} + private RelationshipsAsConstructorParametersEntities() { + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SameIdProperty.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SameIdProperty.java index ccb33a9f6..1d48c1532 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SameIdProperty.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SameIdProperty.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.With; - import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.Relationship; @@ -34,60 +28,247 @@ import java.util.List; /** * @author Gerrit Meier */ +@SuppressWarnings("HiddenField") public class SameIdProperty { /** * @author Gerrit Meier */ @Node("Pod") - @Data - @With - @NoArgsConstructor - @AllArgsConstructor(access = AccessLevel.PRIVATE) public static class PodEntity { @Id private String code; + + private PodEntity(String code) { + this.code = code; + } + + public PodEntity() { + } + + public String getCode() { + return this.code; + } + + public void setCode(String code) { + this.code = code; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PodEntity)) { + return false; + } + final PodEntity other = (PodEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$code = this.getCode(); + final Object other$code = other.getCode(); + if (this$code == null ? other$code != null : !this$code.equals(other$code)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PodEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $code = this.getCode(); + result = result * PRIME + ($code == null ? 43 : $code.hashCode()); + return result; + } + + public String toString() { + return "SameIdProperty.PodEntity(code=" + this.getCode() + ")"; + } + + public PodEntity withCode(String code) { + return this.code == code ? this : new PodEntity(code); + } } /** * @author Gerrit Meier */ @Node("Pol") - @Data - @With - @NoArgsConstructor - @AllArgsConstructor(access = AccessLevel.PRIVATE) public static class PolEntity { @Id private String code; @Relationship(type = "ROUTES") private List routes = new ArrayList<>(); + + private PolEntity(String code, List routes) { + this.code = code; + this.routes = routes; + } + + public PolEntity() { + } + + public String getCode() { + return this.code; + } + + public List getRoutes() { + return this.routes; + } + + public void setCode(String code) { + this.code = code; + } + + public void setRoutes(List routes) { + this.routes = routes; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PolEntity)) { + return false; + } + final PolEntity other = (PolEntity) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$code = this.getCode(); + final Object other$code = other.getCode(); + if (this$code == null ? other$code != null : !this$code.equals(other$code)) { + return false; + } + final Object this$routes = this.getRoutes(); + final Object other$routes = other.getRoutes(); + if (this$routes == null ? other$routes != null : !this$routes.equals(other$routes)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PolEntity; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $code = this.getCode(); + result = result * PRIME + ($code == null ? 43 : $code.hashCode()); + final Object $routes = this.getRoutes(); + result = result * PRIME + ($routes == null ? 43 : $routes.hashCode()); + return result; + } + + public String toString() { + return "SameIdProperty.PolEntity(code=" + this.getCode() + ", routes=" + this.getRoutes() + ")"; + } + + public PolEntity withCode(String code) { + return this.code == code ? this : new PolEntity(code, this.routes); + } + + public PolEntity withRoutes(List routes) { + return this.routes == routes ? this : new PolEntity(this.code, routes); + } } /** * @author Gerrit Meier */ @Node("PolWithRP") - @Data - @With - @NoArgsConstructor - @AllArgsConstructor(access = AccessLevel.PRIVATE) public static class PolEntityWithRelationshipProperties { @Id private String code; @Relationship(type = "ROUTES") private List routes = new ArrayList<>(); + + private PolEntityWithRelationshipProperties(String code, List routes) { + this.code = code; + this.routes = routes; + } + + public PolEntityWithRelationshipProperties() { + } + + public String getCode() { + return this.code; + } + + public List getRoutes() { + return this.routes; + } + + public void setCode(String code) { + this.code = code; + } + + public void setRoutes(List routes) { + this.routes = routes; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PolEntityWithRelationshipProperties)) { + return false; + } + final PolEntityWithRelationshipProperties other = (PolEntityWithRelationshipProperties) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$code = this.getCode(); + final Object other$code = other.getCode(); + if (this$code == null ? other$code != null : !this$code.equals(other$code)) { + return false; + } + final Object this$routes = this.getRoutes(); + final Object other$routes = other.getRoutes(); + if (this$routes == null ? other$routes != null : !this$routes.equals(other$routes)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof PolEntityWithRelationshipProperties; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $code = this.getCode(); + result = result * PRIME + ($code == null ? 43 : $code.hashCode()); + final Object $routes = this.getRoutes(); + result = result * PRIME + ($routes == null ? 43 : $routes.hashCode()); + return result; + } + + public String toString() { + return "SameIdProperty.PolEntityWithRelationshipProperties(code=" + this.getCode() + ", routes=" + this.getRoutes() + ")"; + } + + public PolEntityWithRelationshipProperties withCode(String code) { + return this.code == code ? this : new PolEntityWithRelationshipProperties(code, this.routes); + } + + public PolEntityWithRelationshipProperties withRoutes(List routes) { + return this.routes == routes ? this : new PolEntityWithRelationshipProperties(this.code, routes); + } } /** * @author Gerrit Meier */ @RelationshipProperties - @Data - @With - @NoArgsConstructor - @AllArgsConstructor(access = AccessLevel.PRIVATE) public static class RouteProperties { @RelationshipId @@ -108,5 +289,239 @@ public class SameIdProperty { @TargetNode private PodEntity pod; + + private RouteProperties(Long id, Double truck, String truckCurrency, Double ft20, String ft20Currency, Double ft40, String ft40Currency, Double ft40HC, String ft40HCCurrency, PodEntity pod) { + this.id = id; + this.truck = truck; + this.truckCurrency = truckCurrency; + this.ft20 = ft20; + this.ft20Currency = ft20Currency; + this.ft40 = ft40; + this.ft40Currency = ft40Currency; + this.ft40HC = ft40HC; + this.ft40HCCurrency = ft40HCCurrency; + this.pod = pod; + } + + public RouteProperties() { + } + + public Long getId() { + return this.id; + } + + public Double getTruck() { + return this.truck; + } + + public String getTruckCurrency() { + return this.truckCurrency; + } + + public Double getFt20() { + return this.ft20; + } + + public String getFt20Currency() { + return this.ft20Currency; + } + + public Double getFt40() { + return this.ft40; + } + + public String getFt40Currency() { + return this.ft40Currency; + } + + public Double getFt40HC() { + return this.ft40HC; + } + + public String getFt40HCCurrency() { + return this.ft40HCCurrency; + } + + public PodEntity getPod() { + return this.pod; + } + + public void setId(Long id) { + this.id = id; + } + + public void setTruck(Double truck) { + this.truck = truck; + } + + public void setTruckCurrency(String truckCurrency) { + this.truckCurrency = truckCurrency; + } + + public void setFt20(Double ft20) { + this.ft20 = ft20; + } + + public void setFt20Currency(String ft20Currency) { + this.ft20Currency = ft20Currency; + } + + public void setFt40(Double ft40) { + this.ft40 = ft40; + } + + public void setFt40Currency(String ft40Currency) { + this.ft40Currency = ft40Currency; + } + + public void setFt40HC(Double ft40HC) { + this.ft40HC = ft40HC; + } + + public void setFt40HCCurrency(String ft40HCCurrency) { + this.ft40HCCurrency = ft40HCCurrency; + } + + public void setPod(PodEntity pod) { + this.pod = pod; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof RouteProperties)) { + return false; + } + final RouteProperties other = (RouteProperties) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$truck = this.getTruck(); + final Object other$truck = other.getTruck(); + if (this$truck == null ? other$truck != null : !this$truck.equals(other$truck)) { + return false; + } + final Object this$truckCurrency = this.getTruckCurrency(); + final Object other$truckCurrency = other.getTruckCurrency(); + if (this$truckCurrency == null ? other$truckCurrency != null : !this$truckCurrency.equals(other$truckCurrency)) { + return false; + } + final Object this$ft20 = this.getFt20(); + final Object other$ft20 = other.getFt20(); + if (this$ft20 == null ? other$ft20 != null : !this$ft20.equals(other$ft20)) { + return false; + } + final Object this$ft20Currency = this.getFt20Currency(); + final Object other$ft20Currency = other.getFt20Currency(); + if (this$ft20Currency == null ? other$ft20Currency != null : !this$ft20Currency.equals(other$ft20Currency)) { + return false; + } + final Object this$ft40 = this.getFt40(); + final Object other$ft40 = other.getFt40(); + if (this$ft40 == null ? other$ft40 != null : !this$ft40.equals(other$ft40)) { + return false; + } + final Object this$ft40Currency = this.getFt40Currency(); + final Object other$ft40Currency = other.getFt40Currency(); + if (this$ft40Currency == null ? other$ft40Currency != null : !this$ft40Currency.equals(other$ft40Currency)) { + return false; + } + final Object this$ft40HC = this.getFt40HC(); + final Object other$ft40HC = other.getFt40HC(); + if (this$ft40HC == null ? other$ft40HC != null : !this$ft40HC.equals(other$ft40HC)) { + return false; + } + final Object this$ft40HCCurrency = this.getFt40HCCurrency(); + final Object other$ft40HCCurrency = other.getFt40HCCurrency(); + if (this$ft40HCCurrency == null ? other$ft40HCCurrency != null : !this$ft40HCCurrency.equals(other$ft40HCCurrency)) { + return false; + } + final Object this$pod = this.getPod(); + final Object other$pod = other.getPod(); + if (this$pod == null ? other$pod != null : !this$pod.equals(other$pod)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof RouteProperties; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $truck = this.getTruck(); + result = result * PRIME + ($truck == null ? 43 : $truck.hashCode()); + final Object $truckCurrency = this.getTruckCurrency(); + result = result * PRIME + ($truckCurrency == null ? 43 : $truckCurrency.hashCode()); + final Object $ft20 = this.getFt20(); + result = result * PRIME + ($ft20 == null ? 43 : $ft20.hashCode()); + final Object $ft20Currency = this.getFt20Currency(); + result = result * PRIME + ($ft20Currency == null ? 43 : $ft20Currency.hashCode()); + final Object $ft40 = this.getFt40(); + result = result * PRIME + ($ft40 == null ? 43 : $ft40.hashCode()); + final Object $ft40Currency = this.getFt40Currency(); + result = result * PRIME + ($ft40Currency == null ? 43 : $ft40Currency.hashCode()); + final Object $ft40HC = this.getFt40HC(); + result = result * PRIME + ($ft40HC == null ? 43 : $ft40HC.hashCode()); + final Object $ft40HCCurrency = this.getFt40HCCurrency(); + result = result * PRIME + ($ft40HCCurrency == null ? 43 : $ft40HCCurrency.hashCode()); + final Object $pod = this.getPod(); + result = result * PRIME + ($pod == null ? 43 : $pod.hashCode()); + return result; + } + + public String toString() { + return "SameIdProperty.RouteProperties(id=" + this.getId() + ", truck=" + this.getTruck() + ", truckCurrency=" + this.getTruckCurrency() + ", ft20=" + this.getFt20() + ", ft20Currency=" + this.getFt20Currency() + ", ft40=" + this.getFt40() + ", ft40Currency=" + this.getFt40Currency() + ", ft40HC=" + this.getFt40HC() + ", ft40HCCurrency=" + this.getFt40HCCurrency() + ", pod=" + this.getPod() + ")"; + } + + public RouteProperties withId(Long id) { + return this.id == id ? this : new RouteProperties(id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withTruck(Double truck) { + return this.truck == truck ? this : new RouteProperties(this.id, truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withTruckCurrency(String truckCurrency) { + return this.truckCurrency == truckCurrency ? this : new RouteProperties(this.id, this.truck, truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt20(Double ft20) { + return this.ft20 == ft20 ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt20Currency(String ft20Currency) { + return this.ft20Currency == ft20Currency ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt40(Double ft40) { + return this.ft40 == ft40 ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt40Currency(String ft40Currency) { + return this.ft40Currency == ft40Currency ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, ft40Currency, this.ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt40HC(Double ft40HC) { + return this.ft40HC == ft40HC ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, ft40HC, this.ft40HCCurrency, this.pod); + } + + public RouteProperties withFt40HCCurrency(String ft40HCCurrency) { + return this.ft40HCCurrency == ft40HCCurrency ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, ft40HCCurrency, this.pod); + } + + public RouteProperties withPod(PodEntity pod) { + return this.pod == pod ? this : new RouteProperties(this.id, this.truck, this.truckCurrency, this.ft20, this.ft20Currency, this.ft40, this.ft40Currency, this.ft40HC, this.ft40HCCurrency, pod); + } } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimilarThing.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimilarThing.java index e86ceeee1..063f850fc 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimilarThing.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimilarThing.java @@ -28,16 +28,21 @@ import org.springframework.data.neo4j.core.schema.Relationship; */ @Node public class SimilarThing { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private String name; - @Relationship(type = "SimilarTo") private SimilarThing similar; + @Relationship(type = "SimilarTo") + private SimilarThing similar; - @Relationship(type = "SimilarTo", direction = Relationship.Direction.INCOMING) private SimilarThing similarOf; + @Relationship(type = "SimilarTo", direction = Relationship.Direction.INCOMING) + private SimilarThing similarOf; // included to ensure empty relationships do not cause deletion - @Relationship("EmptyRelationship") private List noSimilarThings; + @Relationship("EmptyRelationship") + private List noSimilarThings; public Long getId() { return id; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipA.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipA.java index f56ddc0e5..34b06d0c4 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipA.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipA.java @@ -28,7 +28,9 @@ import java.util.List; @Node public class SimpleEntityWithRelationshipA { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; @Relationship("TO_B") private List bs; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipB.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipB.java index 953514e1e..99aef7c83 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipB.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipB.java @@ -28,7 +28,9 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class SimpleEntityWithRelationshipB { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; @Relationship("TO_C") private List cs; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipC.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipC.java index 502cc3e37..c5cdccefd 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipC.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/SimpleEntityWithRelationshipC.java @@ -25,6 +25,8 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class SimpleEntityWithRelationshipC { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes.java index 7eba065d0..edf1f7605 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes.java @@ -15,11 +15,11 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.With; +import org.neo4j.driver.types.IsoDuration; +import org.neo4j.driver.types.Point; +import org.springframework.data.neo4j.core.schema.GeneratedValue; +import org.springframework.data.neo4j.core.schema.Id; +import org.springframework.data.neo4j.core.schema.Node; import java.time.Duration; import java.time.LocalDate; @@ -29,24 +29,18 @@ import java.time.OffsetTime; import java.time.Period; import java.time.ZonedDateTime; -import org.neo4j.driver.types.IsoDuration; -import org.neo4j.driver.types.Point; -import org.springframework.data.neo4j.core.schema.GeneratedValue; -import org.springframework.data.neo4j.core.schema.Id; -import org.springframework.data.neo4j.core.schema.Node; - /** * Contains properties of all cypher types. * * @author Michael J. Simons */ +@SuppressWarnings("HiddenField") @Node("CypherTypes") -@Data -@AllArgsConstructor(access = AccessLevel.PRIVATE) -@Builder public class ThingWithAllCypherTypes { - @Id @GeneratedValue @With public final Long id; + @Id + @GeneratedValue + public final Long id; private boolean aBoolean; @@ -75,4 +69,376 @@ public class ThingWithAllCypherTypes { private Period aZeroPeriod; private Duration aZeroDuration; + + private ThingWithAllCypherTypes(Long id, boolean aBoolean, long aLong, double aDouble, String aString, byte[] aByteArray, LocalDate aLocalDate, OffsetTime anOffsetTime, LocalTime aLocalTime, ZonedDateTime aZoneDateTime, LocalDateTime aLocalDateTime, IsoDuration anIsoDuration, Point aPoint, Period aZeroPeriod, Duration aZeroDuration) { + this.id = id; + this.aBoolean = aBoolean; + this.aLong = aLong; + this.aDouble = aDouble; + this.aString = aString; + this.aByteArray = aByteArray; + this.aLocalDate = aLocalDate; + this.anOffsetTime = anOffsetTime; + this.aLocalTime = aLocalTime; + this.aZoneDateTime = aZoneDateTime; + this.aLocalDateTime = aLocalDateTime; + this.anIsoDuration = anIsoDuration; + this.aPoint = aPoint; + this.aZeroPeriod = aZeroPeriod; + this.aZeroDuration = aZeroDuration; + } + + public static ThingWithAllCypherTypesBuilder builder() { + return new ThingWithAllCypherTypesBuilder(); + } + + public Long getId() { + return this.id; + } + + public boolean isABoolean() { + return this.aBoolean; + } + + public long getALong() { + return this.aLong; + } + + public double getADouble() { + return this.aDouble; + } + + public String getAString() { + return this.aString; + } + + public byte[] getAByteArray() { + return this.aByteArray; + } + + public LocalDate getALocalDate() { + return this.aLocalDate; + } + + public OffsetTime getAnOffsetTime() { + return this.anOffsetTime; + } + + public LocalTime getALocalTime() { + return this.aLocalTime; + } + + public ZonedDateTime getAZoneDateTime() { + return this.aZoneDateTime; + } + + public LocalDateTime getALocalDateTime() { + return this.aLocalDateTime; + } + + public IsoDuration getAnIsoDuration() { + return this.anIsoDuration; + } + + public Point getAPoint() { + return this.aPoint; + } + + public Period getAZeroPeriod() { + return this.aZeroPeriod; + } + + public Duration getAZeroDuration() { + return this.aZeroDuration; + } + + public void setABoolean(boolean aBoolean) { + this.aBoolean = aBoolean; + } + + public void setALong(long aLong) { + this.aLong = aLong; + } + + public void setADouble(double aDouble) { + this.aDouble = aDouble; + } + + public void setAString(String aString) { + this.aString = aString; + } + + public void setAByteArray(byte[] aByteArray) { + this.aByteArray = aByteArray; + } + + public void setALocalDate(LocalDate aLocalDate) { + this.aLocalDate = aLocalDate; + } + + public void setAnOffsetTime(OffsetTime anOffsetTime) { + this.anOffsetTime = anOffsetTime; + } + + public void setALocalTime(LocalTime aLocalTime) { + this.aLocalTime = aLocalTime; + } + + public void setAZoneDateTime(ZonedDateTime aZoneDateTime) { + this.aZoneDateTime = aZoneDateTime; + } + + public void setALocalDateTime(LocalDateTime aLocalDateTime) { + this.aLocalDateTime = aLocalDateTime; + } + + public void setAnIsoDuration(IsoDuration anIsoDuration) { + this.anIsoDuration = anIsoDuration; + } + + public void setAPoint(Point aPoint) { + this.aPoint = aPoint; + } + + public void setAZeroPeriod(Period aZeroPeriod) { + this.aZeroPeriod = aZeroPeriod; + } + + public void setAZeroDuration(Duration aZeroDuration) { + this.aZeroDuration = aZeroDuration; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ThingWithAllCypherTypes)) { + return false; + } + final ThingWithAllCypherTypes other = (ThingWithAllCypherTypes) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + if (this.isABoolean() != other.isABoolean()) { + return false; + } + if (this.getALong() != other.getALong()) { + return false; + } + if (Double.compare(this.getADouble(), other.getADouble()) != 0) { + return false; + } + final Object this$aString = this.getAString(); + final Object other$aString = other.getAString(); + if (this$aString == null ? other$aString != null : !this$aString.equals(other$aString)) { + return false; + } + if (!java.util.Arrays.equals(this.getAByteArray(), other.getAByteArray())) { + return false; + } + final Object this$aLocalDate = this.getALocalDate(); + final Object other$aLocalDate = other.getALocalDate(); + if (this$aLocalDate == null ? other$aLocalDate != null : !this$aLocalDate.equals(other$aLocalDate)) { + return false; + } + final Object this$anOffsetTime = this.getAnOffsetTime(); + final Object other$anOffsetTime = other.getAnOffsetTime(); + if (this$anOffsetTime == null ? other$anOffsetTime != null : !this$anOffsetTime.equals(other$anOffsetTime)) { + return false; + } + final Object this$aLocalTime = this.getALocalTime(); + final Object other$aLocalTime = other.getALocalTime(); + if (this$aLocalTime == null ? other$aLocalTime != null : !this$aLocalTime.equals(other$aLocalTime)) { + return false; + } + final Object this$aZoneDateTime = this.getAZoneDateTime(); + final Object other$aZoneDateTime = other.getAZoneDateTime(); + if (this$aZoneDateTime == null ? other$aZoneDateTime != null : !this$aZoneDateTime.equals(other$aZoneDateTime)) { + return false; + } + final Object this$aLocalDateTime = this.getALocalDateTime(); + final Object other$aLocalDateTime = other.getALocalDateTime(); + if (this$aLocalDateTime == null ? other$aLocalDateTime != null : !this$aLocalDateTime.equals(other$aLocalDateTime)) { + return false; + } + final Object this$anIsoDuration = this.getAnIsoDuration(); + final Object other$anIsoDuration = other.getAnIsoDuration(); + if (this$anIsoDuration == null ? other$anIsoDuration != null : !this$anIsoDuration.equals(other$anIsoDuration)) { + return false; + } + final Object this$aPoint = this.getAPoint(); + final Object other$aPoint = other.getAPoint(); + if (this$aPoint == null ? other$aPoint != null : !this$aPoint.equals(other$aPoint)) { + return false; + } + final Object this$aZeroPeriod = this.getAZeroPeriod(); + final Object other$aZeroPeriod = other.getAZeroPeriod(); + if (this$aZeroPeriod == null ? other$aZeroPeriod != null : !this$aZeroPeriod.equals(other$aZeroPeriod)) { + return false; + } + final Object this$aZeroDuration = this.getAZeroDuration(); + final Object other$aZeroDuration = other.getAZeroDuration(); + if (this$aZeroDuration == null ? other$aZeroDuration != null : !this$aZeroDuration.equals(other$aZeroDuration)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof ThingWithAllCypherTypes; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + result = result * PRIME + (this.isABoolean() ? 79 : 97); + final long $aLong = this.getALong(); + result = result * PRIME + (int) ($aLong >>> 32 ^ $aLong); + final long $aDouble = Double.doubleToLongBits(this.getADouble()); + result = result * PRIME + (int) ($aDouble >>> 32 ^ $aDouble); + final Object $aString = this.getAString(); + result = result * PRIME + ($aString == null ? 43 : $aString.hashCode()); + result = result * PRIME + java.util.Arrays.hashCode(this.getAByteArray()); + final Object $aLocalDate = this.getALocalDate(); + result = result * PRIME + ($aLocalDate == null ? 43 : $aLocalDate.hashCode()); + final Object $anOffsetTime = this.getAnOffsetTime(); + result = result * PRIME + ($anOffsetTime == null ? 43 : $anOffsetTime.hashCode()); + final Object $aLocalTime = this.getALocalTime(); + result = result * PRIME + ($aLocalTime == null ? 43 : $aLocalTime.hashCode()); + final Object $aZoneDateTime = this.getAZoneDateTime(); + result = result * PRIME + ($aZoneDateTime == null ? 43 : $aZoneDateTime.hashCode()); + final Object $aLocalDateTime = this.getALocalDateTime(); + result = result * PRIME + ($aLocalDateTime == null ? 43 : $aLocalDateTime.hashCode()); + final Object $anIsoDuration = this.getAnIsoDuration(); + result = result * PRIME + ($anIsoDuration == null ? 43 : $anIsoDuration.hashCode()); + final Object $aPoint = this.getAPoint(); + result = result * PRIME + ($aPoint == null ? 43 : $aPoint.hashCode()); + final Object $aZeroPeriod = this.getAZeroPeriod(); + result = result * PRIME + ($aZeroPeriod == null ? 43 : $aZeroPeriod.hashCode()); + final Object $aZeroDuration = this.getAZeroDuration(); + result = result * PRIME + ($aZeroDuration == null ? 43 : $aZeroDuration.hashCode()); + return result; + } + + public String toString() { + return "ThingWithAllCypherTypes(id=" + this.getId() + ", aBoolean=" + this.isABoolean() + ", aLong=" + this.getALong() + ", aDouble=" + this.getADouble() + ", aString=" + this.getAString() + ", aByteArray=" + java.util.Arrays.toString(this.getAByteArray()) + ", aLocalDate=" + this.getALocalDate() + ", anOffsetTime=" + this.getAnOffsetTime() + ", aLocalTime=" + this.getALocalTime() + ", aZoneDateTime=" + this.getAZoneDateTime() + ", aLocalDateTime=" + this.getALocalDateTime() + ", anIsoDuration=" + this.getAnIsoDuration() + ", aPoint=" + this.getAPoint() + ", aZeroPeriod=" + this.getAZeroPeriod() + ", aZeroDuration=" + this.getAZeroDuration() + ")"; + } + + public ThingWithAllCypherTypes withId(Long id) { + return this.id == id ? this : new ThingWithAllCypherTypes(id, this.aBoolean, this.aLong, this.aDouble, this.aString, this.aByteArray, this.aLocalDate, this.anOffsetTime, this.aLocalTime, this.aZoneDateTime, this.aLocalDateTime, this.anIsoDuration, this.aPoint, this.aZeroPeriod, this.aZeroDuration); + } + + /** + * the builder + */ + public static class ThingWithAllCypherTypesBuilder { + private Long id; + private boolean aBoolean; + private long aLong; + private double aDouble; + private String aString; + private byte[] aByteArray; + private LocalDate aLocalDate; + private OffsetTime anOffsetTime; + private LocalTime aLocalTime; + private ZonedDateTime aZoneDateTime; + private LocalDateTime aLocalDateTime; + private IsoDuration anIsoDuration; + private Point aPoint; + private Period aZeroPeriod; + private Duration aZeroDuration; + + ThingWithAllCypherTypesBuilder() { + } + + public ThingWithAllCypherTypesBuilder id(Long id) { + this.id = id; + return this; + } + + public ThingWithAllCypherTypesBuilder aBoolean(boolean aBoolean) { + this.aBoolean = aBoolean; + return this; + } + + public ThingWithAllCypherTypesBuilder aLong(long aLong) { + this.aLong = aLong; + return this; + } + + public ThingWithAllCypherTypesBuilder aDouble(double aDouble) { + this.aDouble = aDouble; + return this; + } + + public ThingWithAllCypherTypesBuilder aString(String aString) { + this.aString = aString; + return this; + } + + public ThingWithAllCypherTypesBuilder aByteArray(byte[] aByteArray) { + this.aByteArray = aByteArray; + return this; + } + + public ThingWithAllCypherTypesBuilder aLocalDate(LocalDate aLocalDate) { + this.aLocalDate = aLocalDate; + return this; + } + + public ThingWithAllCypherTypesBuilder anOffsetTime(OffsetTime anOffsetTime) { + this.anOffsetTime = anOffsetTime; + return this; + } + + public ThingWithAllCypherTypesBuilder aLocalTime(LocalTime aLocalTime) { + this.aLocalTime = aLocalTime; + return this; + } + + public ThingWithAllCypherTypesBuilder aZoneDateTime(ZonedDateTime aZoneDateTime) { + this.aZoneDateTime = aZoneDateTime; + return this; + } + + public ThingWithAllCypherTypesBuilder aLocalDateTime(LocalDateTime aLocalDateTime) { + this.aLocalDateTime = aLocalDateTime; + return this; + } + + public ThingWithAllCypherTypesBuilder anIsoDuration(IsoDuration anIsoDuration) { + this.anIsoDuration = anIsoDuration; + return this; + } + + public ThingWithAllCypherTypesBuilder aPoint(Point aPoint) { + this.aPoint = aPoint; + return this; + } + + public ThingWithAllCypherTypesBuilder aZeroPeriod(Period aZeroPeriod) { + this.aZeroPeriod = aZeroPeriod; + return this; + } + + public ThingWithAllCypherTypesBuilder aZeroDuration(Duration aZeroDuration) { + this.aZeroDuration = aZeroDuration; + return this; + } + + public ThingWithAllCypherTypes build() { + return new ThingWithAllCypherTypes(this.id, this.aBoolean, this.aLong, this.aDouble, this.aString, this.aByteArray, this.aLocalDate, this.anOffsetTime, this.aLocalTime, this.aZoneDateTime, this.aLocalDateTime, this.anIsoDuration, this.aPoint, this.aZeroPeriod, this.aZeroDuration); + } + + public String toString() { + return "ThingWithAllCypherTypes.ThingWithAllCypherTypesBuilder(id=" + this.id + ", aBoolean=" + this.aBoolean + ", aLong=" + this.aLong + ", aDouble=" + this.aDouble + ", aString=" + this.aString + ", aByteArray=" + java.util.Arrays.toString(this.aByteArray) + ", aLocalDate=" + this.aLocalDate + ", anOffsetTime=" + this.anOffsetTime + ", aLocalTime=" + this.aLocalTime + ", aZoneDateTime=" + this.aZoneDateTime + ", aLocalDateTime=" + this.aLocalDateTime + ", anIsoDuration=" + this.anIsoDuration + ", aPoint=" + this.aPoint + ", aZeroPeriod=" + this.aZeroPeriod + ", aZeroDuration=" + this.aZeroDuration + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes2.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes2.java index 51f3941dc..fecff9627 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes2.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllCypherTypes2.java @@ -15,9 +15,11 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; +import org.neo4j.driver.types.IsoDuration; +import org.neo4j.driver.types.Point; +import org.springframework.data.neo4j.core.schema.GeneratedValue; +import org.springframework.data.neo4j.core.schema.Id; +import org.springframework.data.neo4j.core.schema.Node; import java.time.Duration; import java.time.LocalDate; @@ -27,23 +29,18 @@ import java.time.OffsetTime; import java.time.Period; import java.time.ZonedDateTime; -import org.neo4j.driver.types.IsoDuration; -import org.neo4j.driver.types.Point; -import org.springframework.data.neo4j.core.schema.GeneratedValue; -import org.springframework.data.neo4j.core.schema.Id; -import org.springframework.data.neo4j.core.schema.Node; - /** * Similar to {@link ThingWithAllCypherTypes} but using field access. + * * @author Michael J. Simons */ +@SuppressWarnings("HiddenField") @Node -@Getter -@Setter -@RequiredArgsConstructor public class ThingWithAllCypherTypes2 { - @Id @GeneratedValue private final Long id; + @Id + @GeneratedValue + private final Long id; private boolean aBoolean; @@ -74,4 +71,132 @@ public class ThingWithAllCypherTypes2 { private Period aZeroPeriod; private Duration aZeroDuration; + + public ThingWithAllCypherTypes2(Long id) { + this.id = id; + } + + public Long getId() { + return this.id; + } + + public boolean isABoolean() { + return this.aBoolean; + } + + public long getALong() { + return this.aLong; + } + + public int getAnInt() { + return this.anInt; + } + + public double getADouble() { + return this.aDouble; + } + + public String getAString() { + return this.aString; + } + + public byte[] getAByteArray() { + return this.aByteArray; + } + + public LocalDate getALocalDate() { + return this.aLocalDate; + } + + public OffsetTime getAnOffsetTime() { + return this.anOffsetTime; + } + + public LocalTime getALocalTime() { + return this.aLocalTime; + } + + public ZonedDateTime getAZoneDateTime() { + return this.aZoneDateTime; + } + + public LocalDateTime getALocalDateTime() { + return this.aLocalDateTime; + } + + public IsoDuration getAnIsoDuration() { + return this.anIsoDuration; + } + + public Point getAPoint() { + return this.aPoint; + } + + public Period getAZeroPeriod() { + return this.aZeroPeriod; + } + + public Duration getAZeroDuration() { + return this.aZeroDuration; + } + + public void setABoolean(boolean aBoolean) { + this.aBoolean = aBoolean; + } + + public void setALong(long aLong) { + this.aLong = aLong; + } + + public void setAnInt(int anInt) { + this.anInt = anInt; + } + + public void setADouble(double aDouble) { + this.aDouble = aDouble; + } + + public void setAString(String aString) { + this.aString = aString; + } + + public void setAByteArray(byte[] aByteArray) { + this.aByteArray = aByteArray; + } + + public void setALocalDate(LocalDate aLocalDate) { + this.aLocalDate = aLocalDate; + } + + public void setAnOffsetTime(OffsetTime anOffsetTime) { + this.anOffsetTime = anOffsetTime; + } + + public void setALocalTime(LocalTime aLocalTime) { + this.aLocalTime = aLocalTime; + } + + public void setAZoneDateTime(ZonedDateTime aZoneDateTime) { + this.aZoneDateTime = aZoneDateTime; + } + + public void setALocalDateTime(LocalDateTime aLocalDateTime) { + this.aLocalDateTime = aLocalDateTime; + } + + public void setAnIsoDuration(IsoDuration anIsoDuration) { + this.anIsoDuration = anIsoDuration; + } + + public void setAPoint(Point aPoint) { + this.aPoint = aPoint; + } + + public void setAZeroPeriod(Period aZeroPeriod) { + this.aZeroPeriod = aZeroPeriod; + } + + public void setAZeroDuration(Duration aZeroDuration) { + this.aZeroDuration = aZeroDuration; + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllSpatialTypes.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllSpatialTypes.java index b645bb8fd..2ee5500ea 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllSpatialTypes.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAllSpatialTypes.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.common; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.With; - import org.springframework.data.geo.Point; import org.springframework.data.neo4j.core.schema.GeneratedValue; import org.springframework.data.neo4j.core.schema.Id; @@ -36,12 +30,11 @@ import org.springframework.data.neo4j.types.GeographicPoint3d; * @author Michael J. Simons */ @Node("SpatialTypes") -@Data -@AllArgsConstructor(access = AccessLevel.PRIVATE) -@Builder public class ThingWithAllSpatialTypes { - @Id @GeneratedValue @With public final Long id; + @Id + @GeneratedValue + public final Long id; private Point sdnPoint; @@ -52,4 +45,189 @@ public class ThingWithAllSpatialTypes { private CartesianPoint2d car2d; private CartesianPoint3d car3d; + + private ThingWithAllSpatialTypes(Long id, Point sdnPoint, GeographicPoint2d geo2d, GeographicPoint3d geo3d, CartesianPoint2d car2d, CartesianPoint3d car3d) { + this.id = id; + this.sdnPoint = sdnPoint; + this.geo2d = geo2d; + this.geo3d = geo3d; + this.car2d = car2d; + this.car3d = car3d; + } + + public static ThingWithAllSpatialTypesBuilder builder() { + return new ThingWithAllSpatialTypesBuilder(); + } + + public Long getId() { + return this.id; + } + + public Point getSdnPoint() { + return this.sdnPoint; + } + + public GeographicPoint2d getGeo2d() { + return this.geo2d; + } + + public GeographicPoint3d getGeo3d() { + return this.geo3d; + } + + public CartesianPoint2d getCar2d() { + return this.car2d; + } + + public CartesianPoint3d getCar3d() { + return this.car3d; + } + + public void setSdnPoint(Point sdnPoint) { + this.sdnPoint = sdnPoint; + } + + public void setGeo2d(GeographicPoint2d geo2d) { + this.geo2d = geo2d; + } + + public void setGeo3d(GeographicPoint3d geo3d) { + this.geo3d = geo3d; + } + + public void setCar2d(CartesianPoint2d car2d) { + this.car2d = car2d; + } + + public void setCar3d(CartesianPoint3d car3d) { + this.car3d = car3d; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ThingWithAllSpatialTypes)) { + return false; + } + final ThingWithAllSpatialTypes other = (ThingWithAllSpatialTypes) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$sdnPoint = this.getSdnPoint(); + final Object other$sdnPoint = other.getSdnPoint(); + if (this$sdnPoint == null ? other$sdnPoint != null : !this$sdnPoint.equals(other$sdnPoint)) { + return false; + } + final Object this$geo2d = this.getGeo2d(); + final Object other$geo2d = other.getGeo2d(); + if (this$geo2d == null ? other$geo2d != null : !this$geo2d.equals(other$geo2d)) { + return false; + } + final Object this$geo3d = this.getGeo3d(); + final Object other$geo3d = other.getGeo3d(); + if (this$geo3d == null ? other$geo3d != null : !this$geo3d.equals(other$geo3d)) { + return false; + } + final Object this$car2d = this.getCar2d(); + final Object other$car2d = other.getCar2d(); + if (this$car2d == null ? other$car2d != null : !this$car2d.equals(other$car2d)) { + return false; + } + final Object this$car3d = this.getCar3d(); + final Object other$car3d = other.getCar3d(); + if (this$car3d == null ? other$car3d != null : !this$car3d.equals(other$car3d)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof ThingWithAllSpatialTypes; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $sdnPoint = this.getSdnPoint(); + result = result * PRIME + ($sdnPoint == null ? 43 : $sdnPoint.hashCode()); + final Object $geo2d = this.getGeo2d(); + result = result * PRIME + ($geo2d == null ? 43 : $geo2d.hashCode()); + final Object $geo3d = this.getGeo3d(); + result = result * PRIME + ($geo3d == null ? 43 : $geo3d.hashCode()); + final Object $car2d = this.getCar2d(); + result = result * PRIME + ($car2d == null ? 43 : $car2d.hashCode()); + final Object $car3d = this.getCar3d(); + result = result * PRIME + ($car3d == null ? 43 : $car3d.hashCode()); + return result; + } + + public String toString() { + return "ThingWithAllSpatialTypes(id=" + this.getId() + ", sdnPoint=" + this.getSdnPoint() + ", geo2d=" + this.getGeo2d() + ", geo3d=" + this.getGeo3d() + ", car2d=" + this.getCar2d() + ", car3d=" + this.getCar3d() + ")"; + } + + public ThingWithAllSpatialTypes withId(Long newId) { + return this.id == newId ? this : new ThingWithAllSpatialTypes(newId, this.sdnPoint, this.geo2d, this.geo3d, this.car2d, this.car3d); + } + + /** + * the builder + */ + @SuppressWarnings("HiddenField") + public static class ThingWithAllSpatialTypesBuilder { + private Long id; + private Point sdnPoint; + private GeographicPoint2d geo2d; + private GeographicPoint3d geo3d; + private CartesianPoint2d car2d; + private CartesianPoint3d car3d; + + ThingWithAllSpatialTypesBuilder() { + } + + public ThingWithAllSpatialTypesBuilder id(Long id) { + this.id = id; + return this; + } + + public ThingWithAllSpatialTypesBuilder sdnPoint(Point sdnPoint) { + this.sdnPoint = sdnPoint; + return this; + } + + public ThingWithAllSpatialTypesBuilder geo2d(GeographicPoint2d geo2d) { + this.geo2d = geo2d; + return this; + } + + public ThingWithAllSpatialTypesBuilder geo3d(GeographicPoint3d geo3d) { + this.geo3d = geo3d; + return this; + } + + public ThingWithAllSpatialTypesBuilder car2d(CartesianPoint2d car2d) { + this.car2d = car2d; + return this; + } + + public ThingWithAllSpatialTypesBuilder car3d(CartesianPoint3d car3d) { + this.car3d = car3d; + return this; + } + + public ThingWithAllSpatialTypes build() { + return new ThingWithAllSpatialTypes(this.id, this.sdnPoint, this.geo2d, this.geo3d, this.car2d, this.car3d); + } + + public String toString() { + return "ThingWithAllSpatialTypes.ThingWithAllSpatialTypesBuilder(id=" + this.id + ", sdnPoint=" + this.sdnPoint + ", geo2d=" + this.geo2d + ", geo3d=" + this.geo3d + ", car2d=" + this.car2d + ", car3d=" + this.car3d + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAssignedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAssignedId.java index c95d165cc..3f869c402 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAssignedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithAssignedId.java @@ -32,9 +32,11 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node("Thing") public class ThingWithAssignedId extends AbstractNamedThing { - @Id private final String theId; + @Id + private final String theId; - @Relationship("Has") private List things; + @Relationship("Has") + private List things; @Transient private String randomValue; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithFixedGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithFixedGeneratedId.java index 549ff3278..04f71925b 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithFixedGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithFixedGeneratedId.java @@ -26,7 +26,9 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class ThingWithFixedGeneratedId extends AbstractNamedThing { - @Id @GeneratedValue(AlwaysTheSameIdGenerator.class) private String theId; + @Id + @GeneratedValue(AlwaysTheSameIdGenerator.class) + private String theId; @Relationship("KNOWS") private SimplePerson person; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithGeneratedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithGeneratedId.java index e192ded82..bb197be65 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithGeneratedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithGeneratedId.java @@ -25,7 +25,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class ThingWithGeneratedId extends AbstractNamedThing { - @Id @GeneratedValue(TestSequenceGenerator.class) private String theId; + @Id + @GeneratedValue(TestSequenceGenerator.class) + private String theId; public ThingWithGeneratedId(String name) { super.setName(name); diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithIdGeneratedByBean.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithIdGeneratedByBean.java index 78fb72be1..12e182774 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithIdGeneratedByBean.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithIdGeneratedByBean.java @@ -25,7 +25,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class ThingWithIdGeneratedByBean extends AbstractNamedThing { - @Id @GeneratedValue(generatorRef = "aFancyIdGenerator") private String theId; + @Id + @GeneratedValue(generatorRef = "aFancyIdGenerator") + private String theId; public ThingWithIdGeneratedByBean(String name) { this.setName(name); diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithSequence.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithSequence.java index e0dba9a14..509408609 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithSequence.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithSequence.java @@ -25,7 +25,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class ThingWithSequence { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; private Long sequenceNumber; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithUUIDID.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithUUIDID.java index 83fc95f2b..62831a970 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithUUIDID.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/ThingWithUUIDID.java @@ -28,7 +28,9 @@ import org.springframework.data.neo4j.core.schema.Node; @Node public class ThingWithUUIDID { - @Id @GeneratedValue private UUID id; + @Id + @GeneratedValue + private UUID id; private String name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThing.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThing.java index 84e6645df..2cd03b44a 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThing.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThing.java @@ -30,15 +30,19 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class VersionedThing { - @Id @GeneratedValue private Long id; + @Id + @GeneratedValue + private Long id; - @Version private Long myVersion; + @Version + private Long myVersion; private final String name; private String mutableProperty; - @Relationship("HAS") private List otherVersionedThings; + @Relationship("HAS") + private List otherVersionedThings; public VersionedThing(String name) { this.name = name; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThingWithAssignedId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThingWithAssignedId.java index 80f23f48b..5fd241872 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThingWithAssignedId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/common/VersionedThingWithAssignedId.java @@ -28,13 +28,16 @@ import org.springframework.data.neo4j.core.schema.Relationship; @Node public class VersionedThingWithAssignedId { - @Id private final Long id; + @Id + private final Long id; - @Version private Long myVersion; + @Version + private Long myVersion; private final String name; - @Relationship("HAS") private List otherVersionedThings; + @Relationship("HAS") + private List otherVersionedThings; public VersionedThingWithAssignedId(Long id, String name) { this.id = id; diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/Neo4jConversionsITBase.java b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/Neo4jConversionsITBase.java index e5ff72dad..5157c51ce 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/Neo4jConversionsITBase.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/Neo4jConversionsITBase.java @@ -15,7 +15,17 @@ */ package org.springframework.data.neo4j.integration.shared.conversion; -import lombok.Builder; +import org.junit.jupiter.api.BeforeAll; +import org.neo4j.driver.Session; +import org.neo4j.driver.Values; +import org.springframework.data.geo.Point; +import org.springframework.data.neo4j.integration.shared.conversion.ThingWithAllAdditionalTypes.SomeEnum; +import org.springframework.data.neo4j.test.BookmarkCapture; +import org.springframework.data.neo4j.test.Neo4jExtension; +import org.springframework.data.neo4j.types.CartesianPoint2d; +import org.springframework.data.neo4j.types.CartesianPoint3d; +import org.springframework.data.neo4j.types.GeographicPoint2d; +import org.springframework.data.neo4j.types.GeographicPoint3d; import java.math.BigDecimal; import java.math.BigInteger; @@ -44,18 +54,6 @@ import java.util.Map; import java.util.TimeZone; import java.util.UUID; -import org.junit.jupiter.api.BeforeAll; -import org.neo4j.driver.Session; -import org.neo4j.driver.Values; -import org.springframework.data.geo.Point; -import org.springframework.data.neo4j.integration.shared.conversion.ThingWithAllAdditionalTypes.SomeEnum; -import org.springframework.data.neo4j.test.BookmarkCapture; -import org.springframework.data.neo4j.test.Neo4jExtension; -import org.springframework.data.neo4j.types.CartesianPoint2d; -import org.springframework.data.neo4j.types.CartesianPoint3d; -import org.springframework.data.neo4j.types.GeographicPoint2d; -import org.springframework.data.neo4j.types.GeographicPoint3d; - /** * Provides some nodes spotting properties of all types we support. * @@ -131,12 +129,21 @@ public abstract class Neo4jConversionsITBase { ADDITIONAL_TYPES = Collections.unmodifiableMap(hlp); } - @Builder protected static class ParamHolder { String name; double latitude; double longitude; + ParamHolder(String name, double latitude, double longitude) { + this.name = name; + this.latitude = latitude; + this.longitude = longitude; + } + + public static ParamHolderBuilder builder() { + return new ParamHolderBuilder(); + } + Map toParameterMap() { Map parameters = new HashMap<>(); parameters.put("name", this.name); @@ -156,6 +163,39 @@ public abstract class Neo4jConversionsITBase { GeographicPoint3d asGeo3d(double height) { return new GeographicPoint3d(latitude, longitude, height); } + + @SuppressWarnings("HiddenField") + public static class ParamHolderBuilder { + private String name; + private double latitude; + private double longitude; + + ParamHolderBuilder() { + } + + public ParamHolderBuilder name(String name) { + this.name = name; + return this; + } + + public ParamHolderBuilder latitude(double latitude) { + this.latitude = latitude; + return this; + } + + public ParamHolderBuilder longitude(double longitude) { + this.longitude = longitude; + return this; + } + + public ParamHolder build() { + return new ParamHolder(this.name, this.latitude, this.longitude); + } + + public String toString() { + return "Neo4jConversionsITBase.ParamHolder.ParamHolderBuilder(name=" + this.name + ", latitude=" + this.latitude + ", longitude=" + this.longitude + ")"; + } + } } private static final ParamHolder NEO_HQ = ParamHolder.builder().latitude(55.612191).longitude(12.994823) diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/PersonWithCustomId.java b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/PersonWithCustomId.java index ab19f15e2..db2515cf1 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/PersonWithCustomId.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/PersonWithCustomId.java @@ -15,36 +15,116 @@ */ package org.springframework.data.neo4j.integration.shared.conversion; -import lombok.Value; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - import org.neo4j.driver.Values; import org.springframework.core.convert.TypeDescriptor; import org.springframework.core.convert.converter.GenericConverter; import org.springframework.data.neo4j.core.schema.Id; import org.springframework.data.neo4j.core.schema.Node; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + /** * @author Rosetta Roberts * @author Michael J. Simons */ -@Value @Node -public class PersonWithCustomId { +public final class PersonWithCustomId { + + public PersonWithCustomId(PersonId id, String name) { + this.id = id; + this.name = name; + } + + public PersonId getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PersonWithCustomId)) { + return false; + } + final PersonWithCustomId other = (PersonWithCustomId) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + final Object this$name = this.getName(); + final Object other$name = other.getName(); + if (this$name == null ? other$name != null : !this$name.equals(other$name)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + final Object $name = this.getName(); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); + return result; + } + + public String toString() { + return "PersonWithCustomId(id=" + this.getId() + ", name=" + this.getName() + ")"; + } /** * Custom ID type for a person object. */ - @Value - public static class PersonId { + public static final class PersonId { // Be aware that this is not the native (aka generated) Neo4j id. // Natively generated IDs are only possible directly on a long field. // This is an assigned id. private final Long id; + + public PersonId(Long id) { + this.id = id; + } + + public Long getId() { + return this.id; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof PersonId)) { + return false; + } + final PersonId other = (PersonId) o; + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + return true; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + return result; + } + + public String toString() { + return "PersonWithCustomId.PersonId(id=" + this.getId() + ")"; + } } /** diff --git a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/ThingWithAllAdditionalTypes.java b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/ThingWithAllAdditionalTypes.java index 5e1046b75..f76ad2a96 100644 --- a/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/ThingWithAllAdditionalTypes.java +++ b/src/test/java/org/springframework/data/neo4j/integration/shared/conversion/ThingWithAllAdditionalTypes.java @@ -15,12 +15,6 @@ */ package org.springframework.data.neo4j.integration.shared.conversion; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.With; - import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; @@ -45,17 +39,554 @@ import org.springframework.data.neo4j.core.schema.Node; * * @author Michael J. Simons */ +@SuppressWarnings("HiddenField") @Node("AdditionalTypes") -@Data -@AllArgsConstructor(access = AccessLevel.PRIVATE) -@Builder public class ThingWithAllAdditionalTypes { + private ThingWithAllAdditionalTypes(Long id, boolean[] booleanArray, byte aByte, char aChar, char[] charArray, Date aDate, BigDecimal aBigDecimal, BigInteger aBigInteger, double[] doubleArray, float aFloat, float[] floatArray, int anInt, int[] intArray, Locale aLocale, long[] longArray, short aShort, short[] shortArray, Period aPeriod, Duration aDuration, String[] stringArray, List listOfStrings, Set setOfStrings, Instant anInstant, UUID aUUID, URL aURL, URI aURI, SomeEnum anEnum, SomeEnum[] anArrayOfEnums, List listOfDoubles, List aCollectionOfEnums, TimeZone aTimeZone, ZoneId aZoneId, Period aZeroPeriod, Duration aZeroDuration) { + this.id = id; + this.booleanArray = booleanArray; + this.aByte = aByte; + this.aChar = aChar; + this.charArray = charArray; + this.aDate = aDate; + this.aBigDecimal = aBigDecimal; + this.aBigInteger = aBigInteger; + this.doubleArray = doubleArray; + this.aFloat = aFloat; + this.floatArray = floatArray; + this.anInt = anInt; + this.intArray = intArray; + this.aLocale = aLocale; + this.longArray = longArray; + this.aShort = aShort; + this.shortArray = shortArray; + this.aPeriod = aPeriod; + this.aDuration = aDuration; + this.stringArray = stringArray; + this.listOfStrings = listOfStrings; + this.setOfStrings = setOfStrings; + this.anInstant = anInstant; + this.aUUID = aUUID; + this.aURL = aURL; + this.aURI = aURI; + this.anEnum = anEnum; + this.anArrayOfEnums = anArrayOfEnums; + this.listOfDoubles = listOfDoubles; + this.aCollectionOfEnums = aCollectionOfEnums; + this.aTimeZone = aTimeZone; + this.aZoneId = aZoneId; + this.aZeroPeriod = aZeroPeriod; + this.aZeroDuration = aZeroDuration; + } + + public static ThingWithAllAdditionalTypesBuilder builder() { + return new ThingWithAllAdditionalTypesBuilder(); + } + + public Long getId() { + return this.id; + } + + public boolean[] getBooleanArray() { + return this.booleanArray; + } + + public byte getAByte() { + return this.aByte; + } + + public char getAChar() { + return this.aChar; + } + + public char[] getCharArray() { + return this.charArray; + } + + public Date getADate() { + return this.aDate; + } + + public BigDecimal getABigDecimal() { + return this.aBigDecimal; + } + + public BigInteger getABigInteger() { + return this.aBigInteger; + } + + public double[] getDoubleArray() { + return this.doubleArray; + } + + public float getAFloat() { + return this.aFloat; + } + + public float[] getFloatArray() { + return this.floatArray; + } + + public int getAnInt() { + return this.anInt; + } + + public int[] getIntArray() { + return this.intArray; + } + + public Locale getALocale() { + return this.aLocale; + } + + public long[] getLongArray() { + return this.longArray; + } + + public short getAShort() { + return this.aShort; + } + + public short[] getShortArray() { + return this.shortArray; + } + + public Period getAPeriod() { + return this.aPeriod; + } + + public Duration getADuration() { + return this.aDuration; + } + + public String[] getStringArray() { + return this.stringArray; + } + + public List getListOfStrings() { + return this.listOfStrings; + } + + public Set getSetOfStrings() { + return this.setOfStrings; + } + + public Instant getAnInstant() { + return this.anInstant; + } + + public UUID getAUUID() { + return this.aUUID; + } + + public URL getAURL() { + return this.aURL; + } + + public URI getAURI() { + return this.aURI; + } + + public SomeEnum getAnEnum() { + return this.anEnum; + } + + public SomeEnum[] getAnArrayOfEnums() { + return this.anArrayOfEnums; + } + + public List getListOfDoubles() { + return this.listOfDoubles; + } + + public List getACollectionOfEnums() { + return this.aCollectionOfEnums; + } + + public TimeZone getATimeZone() { + return this.aTimeZone; + } + + public ZoneId getAZoneId() { + return this.aZoneId; + } + + public Period getAZeroPeriod() { + return this.aZeroPeriod; + } + + public Duration getAZeroDuration() { + return this.aZeroDuration; + } + + public void setBooleanArray(boolean[] booleanArray) { + this.booleanArray = booleanArray; + } + + public void setAByte(byte aByte) { + this.aByte = aByte; + } + + public void setAChar(char aChar) { + this.aChar = aChar; + } + + public void setCharArray(char[] charArray) { + this.charArray = charArray; + } + + public void setADate(Date aDate) { + this.aDate = aDate; + } + + public void setABigDecimal(BigDecimal aBigDecimal) { + this.aBigDecimal = aBigDecimal; + } + + public void setABigInteger(BigInteger aBigInteger) { + this.aBigInteger = aBigInteger; + } + + public void setDoubleArray(double[] doubleArray) { + this.doubleArray = doubleArray; + } + + public void setAFloat(float aFloat) { + this.aFloat = aFloat; + } + + public void setFloatArray(float[] floatArray) { + this.floatArray = floatArray; + } + + public void setAnInt(int anInt) { + this.anInt = anInt; + } + + public void setIntArray(int[] intArray) { + this.intArray = intArray; + } + + public void setALocale(Locale aLocale) { + this.aLocale = aLocale; + } + + public void setLongArray(long[] longArray) { + this.longArray = longArray; + } + + public void setAShort(short aShort) { + this.aShort = aShort; + } + + public void setShortArray(short[] shortArray) { + this.shortArray = shortArray; + } + + public void setAPeriod(Period aPeriod) { + this.aPeriod = aPeriod; + } + + public void setADuration(Duration aDuration) { + this.aDuration = aDuration; + } + + public void setStringArray(String[] stringArray) { + this.stringArray = stringArray; + } + + public void setListOfStrings(List listOfStrings) { + this.listOfStrings = listOfStrings; + } + + public void setSetOfStrings(Set setOfStrings) { + this.setOfStrings = setOfStrings; + } + + public void setAnInstant(Instant anInstant) { + this.anInstant = anInstant; + } + + public void setAUUID(UUID aUUID) { + this.aUUID = aUUID; + } + + public void setAURL(URL aURL) { + this.aURL = aURL; + } + + public void setAURI(URI aURI) { + this.aURI = aURI; + } + + public void setAnEnum(SomeEnum anEnum) { + this.anEnum = anEnum; + } + + public void setAnArrayOfEnums(SomeEnum[] anArrayOfEnums) { + this.anArrayOfEnums = anArrayOfEnums; + } + + public void setListOfDoubles(List listOfDoubles) { + this.listOfDoubles = listOfDoubles; + } + + public void setACollectionOfEnums(List aCollectionOfEnums) { + this.aCollectionOfEnums = aCollectionOfEnums; + } + + public void setATimeZone(TimeZone aTimeZone) { + this.aTimeZone = aTimeZone; + } + + public void setAZoneId(ZoneId aZoneId) { + this.aZoneId = aZoneId; + } + + public void setAZeroPeriod(Period aZeroPeriod) { + this.aZeroPeriod = aZeroPeriod; + } + + public void setAZeroDuration(Duration aZeroDuration) { + this.aZeroDuration = aZeroDuration; + } + + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ThingWithAllAdditionalTypes)) { + return false; + } + final ThingWithAllAdditionalTypes other = (ThingWithAllAdditionalTypes) o; + if (!other.canEqual((Object) this)) { + return false; + } + final Object this$id = this.getId(); + final Object other$id = other.getId(); + if (this$id == null ? other$id != null : !this$id.equals(other$id)) { + return false; + } + if (!java.util.Arrays.equals(this.getBooleanArray(), other.getBooleanArray())) { + return false; + } + if (this.getAByte() != other.getAByte()) { + return false; + } + if (this.getAChar() != other.getAChar()) { + return false; + } + if (!java.util.Arrays.equals(this.getCharArray(), other.getCharArray())) { + return false; + } + final Object this$aDate = this.getADate(); + final Object other$aDate = other.getADate(); + if (this$aDate == null ? other$aDate != null : !this$aDate.equals(other$aDate)) { + return false; + } + final Object this$aBigDecimal = this.getABigDecimal(); + final Object other$aBigDecimal = other.getABigDecimal(); + if (this$aBigDecimal == null ? other$aBigDecimal != null : !this$aBigDecimal.equals(other$aBigDecimal)) { + return false; + } + final Object this$aBigInteger = this.getABigInteger(); + final Object other$aBigInteger = other.getABigInteger(); + if (this$aBigInteger == null ? other$aBigInteger != null : !this$aBigInteger.equals(other$aBigInteger)) { + return false; + } + if (!java.util.Arrays.equals(this.getDoubleArray(), other.getDoubleArray())) { + return false; + } + if (Float.compare(this.getAFloat(), other.getAFloat()) != 0) { + return false; + } + if (!java.util.Arrays.equals(this.getFloatArray(), other.getFloatArray())) { + return false; + } + if (this.getAnInt() != other.getAnInt()) { + return false; + } + if (!java.util.Arrays.equals(this.getIntArray(), other.getIntArray())) { + return false; + } + final Object this$aLocale = this.getALocale(); + final Object other$aLocale = other.getALocale(); + if (this$aLocale == null ? other$aLocale != null : !this$aLocale.equals(other$aLocale)) { + return false; + } + if (!java.util.Arrays.equals(this.getLongArray(), other.getLongArray())) { + return false; + } + if (this.getAShort() != other.getAShort()) { + return false; + } + if (!java.util.Arrays.equals(this.getShortArray(), other.getShortArray())) { + return false; + } + final Object this$aPeriod = this.getAPeriod(); + final Object other$aPeriod = other.getAPeriod(); + if (this$aPeriod == null ? other$aPeriod != null : !this$aPeriod.equals(other$aPeriod)) { + return false; + } + final Object this$aDuration = this.getADuration(); + final Object other$aDuration = other.getADuration(); + if (this$aDuration == null ? other$aDuration != null : !this$aDuration.equals(other$aDuration)) { + return false; + } + if (!java.util.Arrays.deepEquals(this.getStringArray(), other.getStringArray())) { + return false; + } + final Object this$listOfStrings = this.getListOfStrings(); + final Object other$listOfStrings = other.getListOfStrings(); + if (this$listOfStrings == null ? other$listOfStrings != null : !this$listOfStrings.equals(other$listOfStrings)) { + return false; + } + final Object this$setOfStrings = this.getSetOfStrings(); + final Object other$setOfStrings = other.getSetOfStrings(); + if (this$setOfStrings == null ? other$setOfStrings != null : !this$setOfStrings.equals(other$setOfStrings)) { + return false; + } + final Object this$anInstant = this.getAnInstant(); + final Object other$anInstant = other.getAnInstant(); + if (this$anInstant == null ? other$anInstant != null : !this$anInstant.equals(other$anInstant)) { + return false; + } + final Object this$aUUID = this.getAUUID(); + final Object other$aUUID = other.getAUUID(); + if (this$aUUID == null ? other$aUUID != null : !this$aUUID.equals(other$aUUID)) { + return false; + } + final Object this$aURL = this.getAURL(); + final Object other$aURL = other.getAURL(); + if (this$aURL == null ? other$aURL != null : !this$aURL.equals(other$aURL)) { + return false; + } + final Object this$aURI = this.getAURI(); + final Object other$aURI = other.getAURI(); + if (this$aURI == null ? other$aURI != null : !this$aURI.equals(other$aURI)) { + return false; + } + final Object this$anEnum = this.getAnEnum(); + final Object other$anEnum = other.getAnEnum(); + if (this$anEnum == null ? other$anEnum != null : !this$anEnum.equals(other$anEnum)) { + return false; + } + if (!java.util.Arrays.deepEquals(this.getAnArrayOfEnums(), other.getAnArrayOfEnums())) { + return false; + } + final Object this$listOfDoubles = this.getListOfDoubles(); + final Object other$listOfDoubles = other.getListOfDoubles(); + if (this$listOfDoubles == null ? other$listOfDoubles != null : !this$listOfDoubles.equals(other$listOfDoubles)) { + return false; + } + final Object this$aCollectionOfEnums = this.getACollectionOfEnums(); + final Object other$aCollectionOfEnums = other.getACollectionOfEnums(); + if (this$aCollectionOfEnums == null ? other$aCollectionOfEnums != null : !this$aCollectionOfEnums.equals(other$aCollectionOfEnums)) { + return false; + } + final Object this$aTimeZone = this.getATimeZone(); + final Object other$aTimeZone = other.getATimeZone(); + if (this$aTimeZone == null ? other$aTimeZone != null : !this$aTimeZone.equals(other$aTimeZone)) { + return false; + } + final Object this$aZoneId = this.getAZoneId(); + final Object other$aZoneId = other.getAZoneId(); + if (this$aZoneId == null ? other$aZoneId != null : !this$aZoneId.equals(other$aZoneId)) { + return false; + } + final Object this$aZeroPeriod = this.getAZeroPeriod(); + final Object other$aZeroPeriod = other.getAZeroPeriod(); + if (this$aZeroPeriod == null ? other$aZeroPeriod != null : !this$aZeroPeriod.equals(other$aZeroPeriod)) { + return false; + } + final Object this$aZeroDuration = this.getAZeroDuration(); + final Object other$aZeroDuration = other.getAZeroDuration(); + if (this$aZeroDuration == null ? other$aZeroDuration != null : !this$aZeroDuration.equals(other$aZeroDuration)) { + return false; + } + return true; + } + + protected boolean canEqual(final Object other) { + return other instanceof ThingWithAllAdditionalTypes; + } + + public int hashCode() { + final int PRIME = 59; + int result = 1; + final Object $id = this.getId(); + result = result * PRIME + ($id == null ? 43 : $id.hashCode()); + result = result * PRIME + java.util.Arrays.hashCode(this.getBooleanArray()); + result = result * PRIME + this.getAByte(); + result = result * PRIME + this.getAChar(); + result = result * PRIME + java.util.Arrays.hashCode(this.getCharArray()); + final Object $aDate = this.getADate(); + result = result * PRIME + ($aDate == null ? 43 : $aDate.hashCode()); + final Object $aBigDecimal = this.getABigDecimal(); + result = result * PRIME + ($aBigDecimal == null ? 43 : $aBigDecimal.hashCode()); + final Object $aBigInteger = this.getABigInteger(); + result = result * PRIME + ($aBigInteger == null ? 43 : $aBigInteger.hashCode()); + result = result * PRIME + java.util.Arrays.hashCode(this.getDoubleArray()); + result = result * PRIME + Float.floatToIntBits(this.getAFloat()); + result = result * PRIME + java.util.Arrays.hashCode(this.getFloatArray()); + result = result * PRIME + this.getAnInt(); + result = result * PRIME + java.util.Arrays.hashCode(this.getIntArray()); + final Object $aLocale = this.getALocale(); + result = result * PRIME + ($aLocale == null ? 43 : $aLocale.hashCode()); + result = result * PRIME + java.util.Arrays.hashCode(this.getLongArray()); + result = result * PRIME + this.getAShort(); + result = result * PRIME + java.util.Arrays.hashCode(this.getShortArray()); + final Object $aPeriod = this.getAPeriod(); + result = result * PRIME + ($aPeriod == null ? 43 : $aPeriod.hashCode()); + final Object $aDuration = this.getADuration(); + result = result * PRIME + ($aDuration == null ? 43 : $aDuration.hashCode()); + result = result * PRIME + java.util.Arrays.deepHashCode(this.getStringArray()); + final Object $listOfStrings = this.getListOfStrings(); + result = result * PRIME + ($listOfStrings == null ? 43 : $listOfStrings.hashCode()); + final Object $setOfStrings = this.getSetOfStrings(); + result = result * PRIME + ($setOfStrings == null ? 43 : $setOfStrings.hashCode()); + final Object $anInstant = this.getAnInstant(); + result = result * PRIME + ($anInstant == null ? 43 : $anInstant.hashCode()); + final Object $aUUID = this.getAUUID(); + result = result * PRIME + ($aUUID == null ? 43 : $aUUID.hashCode()); + final Object $aURL = this.getAURL(); + result = result * PRIME + ($aURL == null ? 43 : $aURL.hashCode()); + final Object $aURI = this.getAURI(); + result = result * PRIME + ($aURI == null ? 43 : $aURI.hashCode()); + final Object $anEnum = this.getAnEnum(); + result = result * PRIME + ($anEnum == null ? 43 : $anEnum.hashCode()); + result = result * PRIME + java.util.Arrays.deepHashCode(this.getAnArrayOfEnums()); + final Object $listOfDoubles = this.getListOfDoubles(); + result = result * PRIME + ($listOfDoubles == null ? 43 : $listOfDoubles.hashCode()); + final Object $aCollectionOfEnums = this.getACollectionOfEnums(); + result = result * PRIME + ($aCollectionOfEnums == null ? 43 : $aCollectionOfEnums.hashCode()); + final Object $aTimeZone = this.getATimeZone(); + result = result * PRIME + ($aTimeZone == null ? 43 : $aTimeZone.hashCode()); + final Object $aZoneId = this.getAZoneId(); + result = result * PRIME + ($aZoneId == null ? 43 : $aZoneId.hashCode()); + final Object $aZeroPeriod = this.getAZeroPeriod(); + result = result * PRIME + ($aZeroPeriod == null ? 43 : $aZeroPeriod.hashCode()); + final Object $aZeroDuration = this.getAZeroDuration(); + result = result * PRIME + ($aZeroDuration == null ? 43 : $aZeroDuration.hashCode()); + return result; + } + + public String toString() { + return "ThingWithAllAdditionalTypes(id=" + this.getId() + ", booleanArray=" + java.util.Arrays.toString(this.getBooleanArray()) + ", aByte=" + this.getAByte() + ", aChar=" + this.getAChar() + ", charArray=" + java.util.Arrays.toString(this.getCharArray()) + ", aDate=" + this.getADate() + ", aBigDecimal=" + this.getABigDecimal() + ", aBigInteger=" + this.getABigInteger() + ", doubleArray=" + java.util.Arrays.toString(this.getDoubleArray()) + ", aFloat=" + this.getAFloat() + ", floatArray=" + java.util.Arrays.toString(this.getFloatArray()) + ", anInt=" + this.getAnInt() + ", intArray=" + java.util.Arrays.toString(this.getIntArray()) + ", aLocale=" + this.getALocale() + ", longArray=" + java.util.Arrays.toString(this.getLongArray()) + ", aShort=" + this.getAShort() + ", shortArray=" + java.util.Arrays.toString(this.getShortArray()) + ", aPeriod=" + this.getAPeriod() + ", aDuration=" + this.getADuration() + ", stringArray=" + java.util.Arrays.deepToString(this.getStringArray()) + ", listOfStrings=" + this.getListOfStrings() + ", setOfStrings=" + this.getSetOfStrings() + ", anInstant=" + this.getAnInstant() + ", aUUID=" + this.getAUUID() + ", aURL=" + this.getAURL() + ", aURI=" + this.getAURI() + ", anEnum=" + this.getAnEnum() + ", anArrayOfEnums=" + java.util.Arrays.deepToString(this.getAnArrayOfEnums()) + ", listOfDoubles=" + this.getListOfDoubles() + ", aCollectionOfEnums=" + this.getACollectionOfEnums() + ", aTimeZone=" + this.getATimeZone() + ", aZoneId=" + this.getAZoneId() + ", aZeroPeriod=" + this.getAZeroPeriod() + ", aZeroDuration=" + this.getAZeroDuration() + ")"; + } + + public ThingWithAllAdditionalTypes withId(Long id) { + return this.id == id ? this : new ThingWithAllAdditionalTypes(id, this.booleanArray, this.aByte, this.aChar, this.charArray, this.aDate, this.aBigDecimal, this.aBigInteger, this.doubleArray, this.aFloat, this.floatArray, this.anInt, this.intArray, this.aLocale, this.longArray, this.aShort, this.shortArray, this.aPeriod, this.aDuration, this.stringArray, this.listOfStrings, this.setOfStrings, this.anInstant, this.aUUID, this.aURL, this.aURI, this.anEnum, this.anArrayOfEnums, this.listOfDoubles, this.aCollectionOfEnums, this.aTimeZone, this.aZoneId, this.aZeroPeriod, this.aZeroDuration); + } + enum SomeEnum { ValueA, ValueB, TheUsualMisfit, ValueC } - @Id @GeneratedValue @With public final Long id; + @Id + @GeneratedValue + public final Long id; private boolean[] booleanArray; @@ -122,4 +653,225 @@ public class ThingWithAllAdditionalTypes { private Period aZeroPeriod; private Duration aZeroDuration; + + /** + * the builder + */ + public static class ThingWithAllAdditionalTypesBuilder { + private Long id; + private boolean[] booleanArray; + private byte aByte; + private char aChar; + private char[] charArray; + private Date aDate; + private BigDecimal aBigDecimal; + private BigInteger aBigInteger; + private double[] doubleArray; + private float aFloat; + private float[] floatArray; + private int anInt; + private int[] intArray; + private Locale aLocale; + private long[] longArray; + private short aShort; + private short[] shortArray; + private Period aPeriod; + private Duration aDuration; + private String[] stringArray; + private List listOfStrings; + private Set setOfStrings; + private Instant anInstant; + private UUID aUUID; + private URL aURL; + private URI aURI; + private SomeEnum anEnum; + private SomeEnum[] anArrayOfEnums; + private List listOfDoubles; + private List aCollectionOfEnums; + private TimeZone aTimeZone; + private ZoneId aZoneId; + private Period aZeroPeriod; + private Duration aZeroDuration; + + ThingWithAllAdditionalTypesBuilder() { + } + + public ThingWithAllAdditionalTypesBuilder id(Long id) { + this.id = id; + return this; + } + + public ThingWithAllAdditionalTypesBuilder booleanArray(boolean[] booleanArray) { + this.booleanArray = booleanArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aByte(byte aByte) { + this.aByte = aByte; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aChar(char aChar) { + this.aChar = aChar; + return this; + } + + public ThingWithAllAdditionalTypesBuilder charArray(char[] charArray) { + this.charArray = charArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aDate(Date aDate) { + this.aDate = aDate; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aBigDecimal(BigDecimal aBigDecimal) { + this.aBigDecimal = aBigDecimal; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aBigInteger(BigInteger aBigInteger) { + this.aBigInteger = aBigInteger; + return this; + } + + public ThingWithAllAdditionalTypesBuilder doubleArray(double[] doubleArray) { + this.doubleArray = doubleArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aFloat(float aFloat) { + this.aFloat = aFloat; + return this; + } + + public ThingWithAllAdditionalTypesBuilder floatArray(float[] floatArray) { + this.floatArray = floatArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder anInt(int anInt) { + this.anInt = anInt; + return this; + } + + public ThingWithAllAdditionalTypesBuilder intArray(int[] intArray) { + this.intArray = intArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aLocale(Locale aLocale) { + this.aLocale = aLocale; + return this; + } + + public ThingWithAllAdditionalTypesBuilder longArray(long[] longArray) { + this.longArray = longArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aShort(short aShort) { + this.aShort = aShort; + return this; + } + + public ThingWithAllAdditionalTypesBuilder shortArray(short[] shortArray) { + this.shortArray = shortArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aPeriod(Period aPeriod) { + this.aPeriod = aPeriod; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aDuration(Duration aDuration) { + this.aDuration = aDuration; + return this; + } + + public ThingWithAllAdditionalTypesBuilder stringArray(String[] stringArray) { + this.stringArray = stringArray; + return this; + } + + public ThingWithAllAdditionalTypesBuilder listOfStrings(List listOfStrings) { + this.listOfStrings = listOfStrings; + return this; + } + + public ThingWithAllAdditionalTypesBuilder setOfStrings(Set setOfStrings) { + this.setOfStrings = setOfStrings; + return this; + } + + public ThingWithAllAdditionalTypesBuilder anInstant(Instant anInstant) { + this.anInstant = anInstant; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aUUID(UUID aUUID) { + this.aUUID = aUUID; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aURL(URL aURL) { + this.aURL = aURL; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aURI(URI aURI) { + this.aURI = aURI; + return this; + } + + public ThingWithAllAdditionalTypesBuilder anEnum(SomeEnum anEnum) { + this.anEnum = anEnum; + return this; + } + + public ThingWithAllAdditionalTypesBuilder anArrayOfEnums(SomeEnum[] anArrayOfEnums) { + this.anArrayOfEnums = anArrayOfEnums; + return this; + } + + public ThingWithAllAdditionalTypesBuilder listOfDoubles(List listOfDoubles) { + this.listOfDoubles = listOfDoubles; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aCollectionOfEnums(List aCollectionOfEnums) { + this.aCollectionOfEnums = aCollectionOfEnums; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aTimeZone(TimeZone aTimeZone) { + this.aTimeZone = aTimeZone; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aZoneId(ZoneId aZoneId) { + this.aZoneId = aZoneId; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aZeroPeriod(Period aZeroPeriod) { + this.aZeroPeriod = aZeroPeriod; + return this; + } + + public ThingWithAllAdditionalTypesBuilder aZeroDuration(Duration aZeroDuration) { + this.aZeroDuration = aZeroDuration; + return this; + } + + public ThingWithAllAdditionalTypes build() { + return new ThingWithAllAdditionalTypes(this.id, this.booleanArray, this.aByte, this.aChar, this.charArray, this.aDate, this.aBigDecimal, this.aBigInteger, this.doubleArray, this.aFloat, this.floatArray, this.anInt, this.intArray, this.aLocale, this.longArray, this.aShort, this.shortArray, this.aPeriod, this.aDuration, this.stringArray, this.listOfStrings, this.setOfStrings, this.anInstant, this.aUUID, this.aURL, this.aURI, this.anEnum, this.anArrayOfEnums, this.listOfDoubles, this.aCollectionOfEnums, this.aTimeZone, this.aZoneId, this.aZeroPeriod, this.aZeroDuration); + } + + public String toString() { + return "ThingWithAllAdditionalTypes.ThingWithAllAdditionalTypesBuilder(id=" + this.id + ", booleanArray=" + java.util.Arrays.toString(this.booleanArray) + ", aByte=" + this.aByte + ", aChar=" + this.aChar + ", charArray=" + java.util.Arrays.toString(this.charArray) + ", aDate=" + this.aDate + ", aBigDecimal=" + this.aBigDecimal + ", aBigInteger=" + this.aBigInteger + ", doubleArray=" + java.util.Arrays.toString(this.doubleArray) + ", aFloat=" + this.aFloat + ", floatArray=" + java.util.Arrays.toString(this.floatArray) + ", anInt=" + this.anInt + ", intArray=" + java.util.Arrays.toString(this.intArray) + ", aLocale=" + this.aLocale + ", longArray=" + java.util.Arrays.toString(this.longArray) + ", aShort=" + this.aShort + ", shortArray=" + java.util.Arrays.toString(this.shortArray) + ", aPeriod=" + this.aPeriod + ", aDuration=" + this.aDuration + ", stringArray=" + java.util.Arrays.deepToString(this.stringArray) + ", listOfStrings=" + this.listOfStrings + ", setOfStrings=" + this.setOfStrings + ", anInstant=" + this.anInstant + ", aUUID=" + this.aUUID + ", aURL=" + this.aURL + ", aURI=" + this.aURI + ", anEnum=" + this.anEnum + ", anArrayOfEnums=" + java.util.Arrays.deepToString(this.anArrayOfEnums) + ", listOfDoubles=" + this.listOfDoubles + ", aCollectionOfEnums=" + this.aCollectionOfEnums + ", aTimeZone=" + this.aTimeZone + ", aZoneId=" + this.aZoneId + ", aZeroPeriod=" + this.aZeroPeriod + ", aZeroDuration=" + this.aZeroDuration + ")"; + } + } } diff --git a/src/test/java/org/springframework/data/neo4j/repository/query/Neo4jNestedMapEntityWriterTest.java b/src/test/java/org/springframework/data/neo4j/repository/query/Neo4jNestedMapEntityWriterTest.java index 3ef5eebbe..f77732337 100644 --- a/src/test/java/org/springframework/data/neo4j/repository/query/Neo4jNestedMapEntityWriterTest.java +++ b/src/test/java/org/springframework/data/neo4j/repository/query/Neo4jNestedMapEntityWriterTest.java @@ -15,25 +15,6 @@ */ package org.springframework.data.neo4j.repository.query; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import lombok.AllArgsConstructor; -import lombok.RequiredArgsConstructor; -import lombok.With; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.function.Function; - import org.assertj.core.api.Condition; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; @@ -60,6 +41,21 @@ import org.springframework.data.neo4j.integration.issues.gh2323.Language; import org.springframework.data.neo4j.integration.issues.gh2323.Person; import org.springframework.util.ReflectionUtils; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.function.Function; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + /** * @author Michael J. Simons */ @@ -515,19 +511,24 @@ class Neo4jNestedMapEntityWriterTest { } @Node - @AllArgsConstructor static class FlatEntity { - @Id @GeneratedValue + @Id + @GeneratedValue private Long id; private double aDouble; private String aString; + + FlatEntity(Long id, double aDouble, String aString) { + this.id = id; + this.aDouble = aDouble; + this.aString = aString; + } } @Node - @AllArgsConstructor static class FlatEntityWithAdditionalTypes { @Id @@ -543,6 +544,15 @@ class Neo4jNestedMapEntityWriterTest { private SomeEnum someEnum; private List listOfDoubles; + + FlatEntityWithAdditionalTypes(String id, Long version, Locale aLocale, URI aURI, SomeEnum someEnum, List listOfDoubles) { + this.id = id; + this.version = version; + this.aLocale = aLocale; + this.aURI = aURI; + this.someEnum = someEnum; + this.listOfDoubles = listOfDoubles; + } } enum SomeEnum { A, B } @@ -556,18 +566,22 @@ class Neo4jNestedMapEntityWriterTest { } @Node - @AllArgsConstructor static class FlatEntityWithDynamicLabels { - @Id @GeneratedValue(generatorClass = SomeIdGeneratory.class) + @Id + @GeneratedValue(generatorClass = SomeIdGeneratory.class) private String id; @DynamicLabels private List dynamicLabels; + + FlatEntityWithDynamicLabels(String id, List dynamicLabels) { + this.id = id; + this.dynamicLabels = dynamicLabels; + } } @Node - @AllArgsConstructor static class GraphPropertyNamesShouldBeUsed { @Id @@ -576,10 +590,14 @@ class Neo4jNestedMapEntityWriterTest { @Property("a_field") private String aField; + + GraphPropertyNamesShouldBeUsed(String id, String aField) { + this.id = id; + this.aField = aField; + } } @Node - @RequiredArgsConstructor static class A { @Id @@ -589,28 +607,40 @@ class Neo4jNestedMapEntityWriterTest { @Relationship("HAS_MORE_B") private final List hasMoreBs; + + A(String id, B hasB, List hasMoreBs) { + this.id = id; + this.hasB = hasB; + this.hasMoreBs = hasMoreBs; + } } @Node - @RequiredArgsConstructor static class B { @Id private final String id; + + B(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A2 { @Id private final String id; private final B2 hasB; + + A2(String id, B2 hasB) { + this.id = id; + this.hasB = hasB; + } } @Node - @RequiredArgsConstructor static class B2 { @Id @@ -619,10 +649,13 @@ class Neo4jNestedMapEntityWriterTest { private A2 belongsToA2; private List knows; + + B2(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A3 { @Id @@ -633,10 +666,15 @@ class Neo4jNestedMapEntityWriterTest { @Relationship private final Map> hasMoreBs; + + A3(String id, Map hasB, Map> hasMoreBs) { + this.id = id; + this.hasB = hasB; + this.hasMoreBs = hasMoreBs; + } } @Node - @RequiredArgsConstructor static class A4 { @Id @@ -644,15 +682,16 @@ class Neo4jNestedMapEntityWriterTest { @Relationship("HAS_P1") private P1 p1; + + A4(String id) { + this.id = id; + } } @RelationshipProperties - @RequiredArgsConstructor - @AllArgsConstructor static class P1 { @RelationshipId - @With private Long id; private final String prop1; @@ -662,24 +701,44 @@ class Neo4jNestedMapEntityWriterTest { @TargetNode private final B3 b3; - @Override public String toString() { + P1(String prop1, String prop2, B3 b3) { + this.prop1 = prop1; + this.prop2 = prop2; + this.b3 = b3; + } + + P1(Long id, String prop1, String prop2, B3 b3) { + this.id = id; + this.prop1 = prop1; + this.prop2 = prop2; + this.b3 = b3; + } + + @Override + public String toString() { return "P1{" + - "prop1='" + prop1 + '\'' + - ", prop2='" + prop2 + '\'' + - '}'; + "prop1='" + prop1 + '\'' + + ", prop2='" + prop2 + '\'' + + '}'; + } + + P1 withId(Long newId) { + return this.id == newId ? this : new P1(newId, this.prop1, this.prop2, this.b3); } } @Node - @RequiredArgsConstructor static class B3 { @Id private final String id; + + B3(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A5 { @Id @@ -687,10 +746,13 @@ class Neo4jNestedMapEntityWriterTest { @Relationship("HAS_P1") private List p1; + + A5(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A6 { @Id @@ -698,10 +760,13 @@ class Neo4jNestedMapEntityWriterTest { @Relationship private Map p1; + + A6(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A7 { @Id @@ -709,10 +774,13 @@ class Neo4jNestedMapEntityWriterTest { @Relationship private Map> p1; + + A7(String id) { + this.id = id; + } } @Node - @RequiredArgsConstructor static class A8 { @Id @@ -727,5 +795,8 @@ class Neo4jNestedMapEntityWriterTest { @Relationship("HAS") private List b3; + A8(String id) { + this.id = id; + } } } diff --git a/src/test/java/org/springframework/data/neo4j/test/Neo4jExtension.java b/src/test/java/org/springframework/data/neo4j/test/Neo4jExtension.java index 05756eda7..e1ebfadad 100644 --- a/src/test/java/org/springframework/data/neo4j/test/Neo4jExtension.java +++ b/src/test/java/org/springframework/data/neo4j/test/Neo4jExtension.java @@ -15,21 +15,7 @@ */ package org.springframework.data.neo4j.test; -import static org.assertj.core.api.Assumptions.assumeThat; - -import lombok.extern.apachecommons.CommonsLog; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Optional; -import java.util.Set; - +import org.apache.commons.logging.Log; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -50,6 +36,19 @@ import org.springframework.lang.Nullable; import org.testcontainers.containers.Neo4jContainer; import org.testcontainers.utility.TestcontainersConfiguration; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Optional; +import java.util.Set; + +import static org.assertj.core.api.Assumptions.assumeThat; + /** * This extension is for internal use only. It is meant to speed up development and keep test containers for normal * build. When both {@code SDN_NEO4J_URL} and {@code SDN_NEO4J_PASSWORD} are set as environment variables, the extension @@ -59,7 +58,6 @@ import org.testcontainers.utility.TestcontainersConfiguration; * @author Michael J. Simons * @since 6.0 */ -@CommonsLog public class Neo4jExtension implements BeforeAllCallback, BeforeEachCallback { public final static String NEEDS_REACTIVE_SUPPORT = "reactive-test"; @@ -83,6 +81,7 @@ public class Neo4jExtension implements BeforeAllCallback, BeforeEachCallback { private static final String SYS_PROPERTY_NEO4J_ACCEPT_COMMERCIAL_EDITION = "SDN_NEO4J_ACCEPT_COMMERCIAL_EDITION"; private static final String SYS_PROPERTY_NEO4J_REPOSITORY = "SDN_NEO4J_REPOSITORY"; private static final String SYS_PROPERTY_NEO4J_VERSION = "SDN_NEO4J_VERSION"; + private static final Log log = org.apache.commons.logging.LogFactory.getLog(Neo4jExtension.class); private static Set COMMUNITY_EDITION_INDICATOR = Collections.singleton("community");