This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-2485 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit b6f7fc6d52e5136b28f7896b0538ea05d01c69d4 Author: danhaywood <[email protected]> AuthorDate: Tue May 23 07:36:32 2023 +0100 CAUSEWAY-2485: adds some missing jdo entities --- examples/demo/.run/DemoAppWicketJdo.run.xml | 1 + .../PropertyCommandPublishingEntityRepository.java | 2 +- ...tyCommandPublishingEntityImpl-description.adoc} | 2 +- .../PropertyCommandPublishingEntityImpl.java | 30 ++++++--------- ...pertyCommandPublishingEntityImplRepository.java | 19 +--------- .../jpa/PropertyCommandPublishingEntityImpl.java | 4 +- ...pertyCommandPublishingEntityImplRepository.java | 15 -------- .../jdo/PropertyEditingEntityImpl-description.adoc | 33 +++++++++++++++++ .../{jpa => jdo}/PropertyEditingEntityImpl.java | 30 ++++++--------- .../jdo/PropertyEditingEntityImplRepository.java} | 22 +++++++++-- .../editing/jpa/PropertyEditingEntityImpl.java | 4 +- ...ropertyExecutionPublishingEntityRepository.java | 2 +- ...yExecutionPublishingEntityImpl-description.adoc | 2 +- .../PropertyExecutionPublishingEntityImpl.java | 30 ++++++--------- ...rtyExecutionPublishingEntityImplRepository.java | 19 +--------- ...yExecutionPublishingEntityImpl-description.adoc | 2 +- .../jpa/PropertyExecutionPublishingEntityImpl.java | 6 +-- ...rtyExecutionPublishingEntityImplRepository.java | 15 -------- .../PropertySnapshotEntityImpl-description.adoc} | 3 +- .../{jpa => jdo}/PropertySnapshotEntityImpl.java | 43 ++++++++++------------ .../jdo/PropertySnapshotEntityImplRepository.java} | 22 +++++++++-- .../snapshot/jpa/PropertySnapshotEntityImpl.java | 4 +- examples/demo/enhance.sh | 22 +++++++++++ 23 files changed, 163 insertions(+), 169 deletions(-) diff --git a/examples/demo/.run/DemoAppWicketJdo.run.xml b/examples/demo/.run/DemoAppWicketJdo.run.xml index 512a010222..586a468c32 100644 --- a/examples/demo/.run/DemoAppWicketJdo.run.xml +++ b/examples/demo/.run/DemoAppWicketJdo.run.xml @@ -2,6 +2,7 @@ <configuration default="false" name="DemoAppWicketJdo" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> <option name="ACTIVE_PROFILES" /> <module name="demo-wicket-jdo" /> + <option name="SHORTEN_COMMAND_LINE" value="ARGS_FILE" /> <option name="SPRING_BOOT_MAIN_CLASS" value="demoapp.webapp.wicket.jdo.DemoAppWicketJdo" /> <method v="2"> <option name="Make" enabled="true" /> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/PropertyCommandPublishingEntityRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/PropertyCommandPublishingEntityRepository.java index 12088b7423..2b562382c3 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/PropertyCommandPublishingEntityRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/PropertyCommandPublishingEntityRepository.java @@ -22,5 +22,5 @@ import java.util.List; public interface PropertyCommandPublishingEntityRepository { - List<? extends PropertyCommandPublishingEntity> allInstances(); + List<? extends PropertyCommandPublishingEntity> all(); } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl-description.adoc similarity index 92% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl-description.adoc index b6444cac80..aab3ce6028 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl-description.adoc @@ -1,4 +1,4 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] -include::../PropertyExecutionPublishing-description.adoc[] +include::../PropertyCommandPublishingEntity-description.adoc[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl.java similarity index 75% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl.java index 8dcecc7a61..04d221d342 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImpl.java @@ -16,36 +16,32 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.commandPublishing.jpa; +package demoapp.dom.domain.properties.Property.commandPublishing.jdo; import javax.inject.Named; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.jdo.annotations.DatastoreIdentity; +import javax.jdo.annotations.IdGeneratorStrategy; +import javax.jdo.annotations.IdentityType; +import javax.jdo.annotations.PersistenceCapable; import org.springframework.context.annotation.Profile; import org.apache.causeway.applib.annotation.DomainObject; import org.apache.causeway.applib.annotation.Nature; -import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandPublishingEntity; -@Profile("demo-jpa") -@Entity -@Table( +@Profile("demo-jdo") +@PersistenceCapable( + identityType = IdentityType.DATASTORE, schema = "demo", - name = "PropertyCommandPublishingJpa" + table = "PropertyCommandPublishingEntity" ) -@EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyCommandPublishingJpa") -@NoArgsConstructor +@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id") +@Named("demo.PropertyCommandPublishingEntity") //tag::class[] // ... @DomainObject(nature = Nature.ENTITY) @@ -57,10 +53,6 @@ public class PropertyCommandPublishingEntityImpl extends PropertyCommandPublishi setName(value); } - @Id - @GeneratedValue - private Long id; - @Getter @Setter private String name; diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImplRepository.java similarity index 77% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImplRepository.java index 5b2119e144..3d710bd0dd 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jdo/PropertyCommandPublishingEntityImplRepository.java @@ -16,18 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.commandPublishing.jpa; - -import java.util.List; +package demoapp.dom.domain.properties.Property.commandPublishing.jdo; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandPublishingEntity; import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandPublishingEntityRepository; -@Profile("demo-jpa") +@Profile("demo-jdo") @Service public class PropertyCommandPublishingEntityImplRepository extends ValueHolderRepository<String, PropertyCommandPublishingEntityImpl> implements PropertyCommandPublishingEntityRepository { @@ -40,16 +37,4 @@ extends ValueHolderRepository<String, PropertyCommandPublishingEntityImpl> imple protected PropertyCommandPublishingEntityImpl newDetachedEntity(String value) { return new PropertyCommandPublishingEntityImpl(value); } - - @Override - public List<? extends PropertyCommandPublishingEntity> allInstances() { - return all(); - } - - public List<? extends PropertyCommandPublishingEntity> allMatches(final String s) { - return all(); - } - public List<? extends PropertyCommandPublishingEntity> allMatches() { - return all(); - } } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java index 8dcecc7a61..d8080146c7 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImpl.java @@ -41,10 +41,10 @@ import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandP @Entity @Table( schema = "demo", - name = "PropertyCommandPublishingJpa" + name = "PropertyCommandPublishingEntity" ) @EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyCommandPublishingJpa") +@Named("demo.PropertyCommandPublishingEntity") @NoArgsConstructor //tag::class[] // ... diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java index 5b2119e144..df02b7d712 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/commandPublishing/jpa/PropertyCommandPublishingEntityImplRepository.java @@ -18,13 +18,10 @@ */ package demoapp.dom.domain.properties.Property.commandPublishing.jpa; -import java.util.List; - import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandPublishingEntity; import demoapp.dom.domain.properties.Property.commandPublishing.PropertyCommandPublishingEntityRepository; @Profile("demo-jpa") @@ -40,16 +37,4 @@ extends ValueHolderRepository<String, PropertyCommandPublishingEntityImpl> imple protected PropertyCommandPublishingEntityImpl newDetachedEntity(String value) { return new PropertyCommandPublishingEntityImpl(value); } - - @Override - public List<? extends PropertyCommandPublishingEntity> allInstances() { - return all(); - } - - public List<? extends PropertyCommandPublishingEntity> allMatches(final String s) { - return all(); - } - public List<? extends PropertyCommandPublishingEntity> allMatches() { - return all(); - } } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl-description.adoc new file mode 100644 index 0000000000..ac4c338778 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl-description.adoc @@ -0,0 +1,33 @@ +:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] + +In this demo app, property editing is disabled by default. + +However: + +* for the `name` property, editing has been explicitly enabled: ++ +[source,java,indent=0] +.PropertyEditingEntityImpl.java +---- +include::PropertyEditingEntityImpl.java[tags=name] +---- +<.> editing is enabled after all + +* The `originalName` property remains as not editable. ++ +It uses `@Property#editingDisabledReason` to explain why: ++ +[source,java,indent=0] +.PropertyEditingEntityImpl.java +---- +include::PropertyEditingEntityImpl.java[tags=original-name] +---- +<.> this reason is rendered in the UI as a tooltip + +* Meanwhile the `initialCharacter` property is also not editable (this time, because it is derived) but has no additional annotations: ++ +[source,java,indent=0] +.PropertyEditingEntityImpl.java +---- +include::PropertyEditingEntityImpl.java[tags=initial-character] +---- diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl.java similarity index 79% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl.java index 06fe271e0f..11d45be87a 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImpl.java @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.editing.jpa; +package demoapp.dom.domain.properties.Property.editing.jdo; import javax.inject.Named; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.jdo.annotations.DatastoreIdentity; +import javax.jdo.annotations.IdGeneratorStrategy; +import javax.jdo.annotations.IdentityType; +import javax.jdo.annotations.PersistenceCapable; import org.springframework.context.annotation.Profile; @@ -31,23 +30,20 @@ import org.apache.causeway.applib.annotation.DomainObject; import org.apache.causeway.applib.annotation.Editing; import org.apache.causeway.applib.annotation.Nature; import org.apache.causeway.applib.annotation.Property; -import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import demoapp.dom.domain.properties.Property.editing.PropertyEditingEntity; -@Profile("demo-jpa") -@Entity -@Table( +@Profile("demo-jdo") +@PersistenceCapable( + identityType = IdentityType.DATASTORE, schema = "demo", - name = "PropertyEditingJpa" + table = "PropertyEditingEntity" ) -@EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyEditing") -@NoArgsConstructor +@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id") +@Named("demo.PropertyEditingEntity") //tag::class[] // ... @DomainObject(nature = Nature.ENTITY) @@ -60,10 +56,6 @@ public class PropertyEditingEntityImpl setName(value); setOriginalName(value); } - - @Id - @GeneratedValue - private Long id; //tag::class[] //tag::name[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImplRepository.java similarity index 57% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImplRepository.java index 9542b54023..a6b83e96ff 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jdo/PropertyEditingEntityImplRepository.java @@ -16,11 +16,25 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.executionPublishing; +package demoapp.dom.domain.properties.Property.editing.jdo; -import java.util.List; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; -public interface PropertyExecutionPublishingEntityRepository { +import demoapp.dom._infra.values.ValueHolderRepository; + +@Profile("demo-jdo") +@Service +public class PropertyEditingEntityImplRepository +extends ValueHolderRepository<String, PropertyEditingEntityImpl> { + + protected PropertyEditingEntityImplRepository() { + super(PropertyEditingEntityImpl.class); + } + + @Override + protected PropertyEditingEntityImpl newDetachedEntity(String value) { + return new PropertyEditingEntityImpl(value); + } - List<? extends PropertyExecutionPublishingEntity> allInstances(); } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java index 06fe271e0f..3f131e4ba7 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/editing/jpa/PropertyEditingEntityImpl.java @@ -43,10 +43,10 @@ import demoapp.dom.domain.properties.Property.editing.PropertyEditingEntity; @Entity @Table( schema = "demo", - name = "PropertyEditingJpa" + name = "PropertyEditingEntity" ) @EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyEditing") +@Named("demo.PropertyEditingEntity") @NoArgsConstructor //tag::class[] // ... diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java index 9542b54023..6569a5a19c 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java @@ -22,5 +22,5 @@ import java.util.List; public interface PropertyExecutionPublishingEntityRepository { - List<? extends PropertyExecutionPublishingEntity> allInstances(); + List<? extends PropertyExecutionPublishingEntity> all(); } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl-description.adoc similarity index 92% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl-description.adoc index b6444cac80..44f2155acb 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl-description.adoc @@ -1,4 +1,4 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] -include::../PropertyExecutionPublishing-description.adoc[] +include::../PropertyExecutionPublishingEntity-description.adoc[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl.java similarity index 75% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl.java index 6cce52c512..2f38877ced 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImpl.java @@ -16,36 +16,32 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.executionPublishing.jpa; +package demoapp.dom.domain.properties.Property.executionPublishing.jdo; import javax.inject.Named; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.jdo.annotations.DatastoreIdentity; +import javax.jdo.annotations.IdGeneratorStrategy; +import javax.jdo.annotations.IdentityType; +import javax.jdo.annotations.PersistenceCapable; import org.springframework.context.annotation.Profile; import org.apache.causeway.applib.annotation.DomainObject; import org.apache.causeway.applib.annotation.Nature; -import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntity; -@Profile("demo-jpa") -@Entity -@Table( +@Profile("demo-jdo") +@PersistenceCapable( + identityType = IdentityType.DATASTORE, schema = "demo", - name = "PropertyExecutionPublishingJpa" + table = "PropertyExecutionPublishingEntity" ) -@EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyExecutionPublishingJpa") -@NoArgsConstructor +@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id") +@Named("demo.PropertyExecutionPublishingEntity") //tag::class[] // ... @DomainObject(nature = Nature.ENTITY) @@ -57,10 +53,6 @@ public class PropertyExecutionPublishingEntityImpl extends PropertyExecutionPubl setName(value); } - @Id - @GeneratedValue - private Long id; - @Getter @Setter private String name; diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImplRepository.java similarity index 77% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImplRepository.java index a184c36c75..986910d8df 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jdo/PropertyExecutionPublishingEntityImplRepository.java @@ -16,18 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.executionPublishing.jpa; - -import java.util.List; +package demoapp.dom.domain.properties.Property.executionPublishing.jdo; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntity; import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntityRepository; -@Profile("demo-jpa") +@Profile("demo-jdo") @Service public class PropertyExecutionPublishingEntityImplRepository extends ValueHolderRepository<String, PropertyExecutionPublishingEntityImpl> implements PropertyExecutionPublishingEntityRepository { @@ -40,16 +37,4 @@ extends ValueHolderRepository<String, PropertyExecutionPublishingEntityImpl> imp protected PropertyExecutionPublishingEntityImpl newDetachedEntity(String value) { return new PropertyExecutionPublishingEntityImpl(value); } - - @Override - public List<? extends PropertyExecutionPublishingEntity> allInstances() { - return all(); - } - - public List<? extends PropertyExecutionPublishingEntity> allMatches(final String s) { - return all(); - } - public List<? extends PropertyExecutionPublishingEntity> allMatches() { - return all(); - } } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc index b6444cac80..44f2155acb 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc @@ -1,4 +1,4 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] -include::../PropertyExecutionPublishing-description.adoc[] +include::../PropertyExecutionPublishingEntity-description.adoc[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java index 6cce52c512..6e0fdf87f1 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl.java @@ -37,14 +37,14 @@ import lombok.Setter; import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntity; -@Profile("demo-jpa") +@Profile("demo-jdo") @Entity @Table( schema = "demo", - name = "PropertyExecutionPublishingJpa" + name = "PropertyExecutionPublishingEntity" ) @EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertyExecutionPublishingJpa") +@Named("demo.PropertyExecutionPublishingEntity") @NoArgsConstructor //tag::class[] // ... diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java index a184c36c75..b11e22984d 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImplRepository.java @@ -18,13 +18,10 @@ */ package demoapp.dom.domain.properties.Property.executionPublishing.jpa; -import java.util.List; - import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntity; import demoapp.dom.domain.properties.Property.executionPublishing.PropertyExecutionPublishingEntityRepository; @Profile("demo-jpa") @@ -40,16 +37,4 @@ extends ValueHolderRepository<String, PropertyExecutionPublishingEntityImpl> imp protected PropertyExecutionPublishingEntityImpl newDetachedEntity(String value) { return new PropertyExecutionPublishingEntityImpl(value); } - - @Override - public List<? extends PropertyExecutionPublishingEntity> allInstances() { - return all(); - } - - public List<? extends PropertyExecutionPublishingEntity> allMatches(final String s) { - return all(); - } - public List<? extends PropertyExecutionPublishingEntity> allMatches() { - return all(); - } } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl-description.adoc similarity index 92% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl-description.adoc index b6444cac80..10459a53c1 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/jpa/PropertyExecutionPublishingEntityImpl-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl-description.adoc @@ -1,4 +1,3 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] - -include::../PropertyExecutionPublishing-description.adoc[] +include::../PropertySnapshotEntity-description.adoc[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl.java similarity index 77% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl.java index 2484b45f7d..955cd00bf6 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImpl.java @@ -16,37 +16,36 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.snapshot.jpa; +package demoapp.dom.domain.properties.Property.snapshot.jdo; -import javax.inject.Named; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; +import demoapp.dom.domain.properties.Property.snapshot.PropertySnapshotEntity; -import org.springframework.context.annotation.Profile; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.inject.Named; +import javax.jdo.annotations.DatastoreIdentity; +import javax.jdo.annotations.IdGeneratorStrategy; +import javax.jdo.annotations.IdentityType; +import javax.jdo.annotations.PersistenceCapable; +import javax.persistence.*; import org.apache.causeway.applib.annotation.DomainObject; import org.apache.causeway.applib.annotation.Nature; import org.apache.causeway.applib.annotation.Property; import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import demoapp.dom.domain.properties.Property.snapshot.PropertySnapshotEntity; +import org.springframework.context.annotation.Profile; -@Profile("demo-jpa") -@Entity -@Table( +@Profile("demo-jdo") +@PersistenceCapable( + identityType = IdentityType.DATASTORE, schema = "demo", - name = "PropertySnapshotJpa" + table = "PropertySnapshotEntity" ) -@EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertySnapshot") -@NoArgsConstructor +@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id") +@Named("demo.PropertySnapshotEntity") //tag::class[] // ... @DomainObject(nature = Nature.ENTITY) @@ -58,10 +57,6 @@ public class PropertySnapshotEntityImpl public PropertySnapshotEntityImpl(String value) { setName(value); } - - @Id - @GeneratedValue - private Long id; //tag::class[] //tag::name[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImplRepository.java similarity index 56% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImplRepository.java index 9542b54023..a4142b3ad6 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/executionPublishing/PropertyExecutionPublishingEntityRepository.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jdo/PropertySnapshotEntityImplRepository.java @@ -16,11 +16,25 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.properties.Property.executionPublishing; +package demoapp.dom.domain.properties.Property.snapshot.jdo; -import java.util.List; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; -public interface PropertyExecutionPublishingEntityRepository { +import demoapp.dom._infra.values.ValueHolderRepository; + +@Profile("demo-jdo") +@Service +public class PropertySnapshotEntityImplRepository +extends ValueHolderRepository<String, PropertySnapshotEntityImpl> { + + protected PropertySnapshotEntityImplRepository() { + super(PropertySnapshotEntityImpl.class); + } + + @Override + protected PropertySnapshotEntityImpl newDetachedEntity(String value) { + return new PropertySnapshotEntityImpl(value); + } - List<? extends PropertyExecutionPublishingEntity> allInstances(); } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java index 2484b45f7d..52d36ee3f7 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/Property/snapshot/jpa/PropertySnapshotEntityImpl.java @@ -42,10 +42,10 @@ import demoapp.dom.domain.properties.Property.snapshot.PropertySnapshotEntity; @Entity @Table( schema = "demo", - name = "PropertySnapshotJpa" + name = "PropertySnapshotEntity" ) @EntityListeners(CausewayEntityListener.class) -@Named("demo.PropertySnapshot") +@Named("demo.PropertySnapshotEntity") @NoArgsConstructor //tag::class[] // ... diff --git a/examples/demo/enhance.sh b/examples/demo/enhance.sh new file mode 100644 index 0000000000..fa01e0581a --- /dev/null +++ b/examples/demo/enhance.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +mvn compile datanucleus:enhance@process-classes -Dmodule-examples-demo-wicket
