This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 4dbaa7219a2b128629dadbe69882ca71641501d4 Author: danhaywood <[email protected]> AuthorDate: Mon Apr 3 22:04:07 2023 +0100 CAUSEWAY-2485: wip on @DomainObjectLayout#bookmarking --- .../src/main/java/demoapp/dom/DemoModuleJpa.java | 4 ++ .../aliased/DomainObjectAliasedPage_lookup.java | 2 +- .../aliased/DomainObjectAliasedPage_objects.java | 2 +- .../DomainObjectAutoCompletePage_find.java | 2 +- .../DomainObjectAutoCompletePage_objects.java | 2 +- .../bounded/DomainObjectBoundingPage_objects.java | 2 +- .../bounded/jpa/DomainObjectBoundingPage_find.java | 2 +- .../editing/DomainObjectEditingPage_objects.java | 2 +- ...ObjectIntrospectionPage_annotationOptional.java | 2 +- ...ObjectIntrospectionPage_annotationRequired.java | 2 +- ...ObjectIntrospectionVm_encapsulationEnabled.java | 2 +- .../DomainObjectMixinMethodPage_objects.java | 2 +- .../DomainObjectMixinMethodPage_updateName.java | 4 +- .../nature/DomainObjectNaturePage_entities.java | 4 +- .../nature/DomainObjectNaturePage_viewModels.java | 4 +- .../bookmarking/DomainObjectLayoutBookmarking.java | 71 +++++++++++++++++++ ...ml => DomainObjectLayoutBookmarking.layout.xml} | 51 ++++++++++++-- ...ava => DomainObjectLayoutBookmarkingChild.java} | 39 +++++------ ... DomainObjectLayoutBookmarkingChild.layout.xml} | 45 ++++++++++-- ...mainObjectLayoutBookmarkingChildRepository.java | 28 ++++++++ .../DomainObjectLayoutBookmarkingPage.java | 3 +- .../DomainObjectLayoutBookmarkingPage.layout.xml | 11 ++- ...DomainObjectLayoutBookmarkingPage_objects.java} | 11 +-- .../DomainObjectLayoutBookmarkingRepository.java | 28 ++++++++ .../DomainObjectLayoutBookmarkingSeeding.java} | 31 +++------ ...DomainObjectLayoutBookmarking_addChildren.java} | 37 ++++++---- ...bjectLayoutBookmarkingChildJpa-description.adoc | 7 ++ .../jpa/DomainObjectLayoutBookmarkingChildJpa.java | 71 +++++++++++++++++++ ...mainObjectLayoutBookmarkingJpa-description.adoc | 7 ++ .../jpa/DomainObjectLayoutBookmarkingJpa.java | 81 ++++++++++++++++++++++ .../DomainObjectLayoutBookmarkingJpaEntities.java | 56 +++++++++++++++ 31 files changed, 518 insertions(+), 97 deletions(-) diff --git a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java index d0cd3cee84..f04b4d2cfe 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java @@ -31,6 +31,8 @@ import demoapp.dom.domain.objects.DomainObject.introspection.encapsulated.jpa.Do import demoapp.dom.domain.objects.DomainObject.mixinMethod.jpa.DomainObjectMixinMethodJpa; import demoapp.dom.domain.objects.DomainObject.nature.entity.jpa.DomainObjectNatureJpa; import demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent.jpa.DomainObjectXxxLifecycleEventJpa; +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.jpa.DomainObjectLayoutBookmarkingChildJpa; +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.jpa.DomainObjectLayoutBookmarkingJpa; import demoapp.dom.domain.objects.other.embedded.jpa.NumberConstantJpa; import demoapp.dom.domain.properties.Property.commandPublishing.jpa.PropertyCommandPublishingJpa; import demoapp.dom.domain.properties.Property.executionPublishing.jpa.PropertyExecutionPublishingJpa; @@ -106,6 +108,8 @@ import org.springframework.context.annotation.Profile; DomainObjectIntrospectionEncapsulatedJpa.class, DomainObjectMixinMethodJpa.class, DomainObjectXxxLifecycleEventJpa.class, + DomainObjectLayoutBookmarkingJpa.class, + DomainObjectLayoutBookmarkingChildJpa.class, CausewayBlobJpa.class, CausewayClobJpa.class, diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_lookup.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_lookup.java index c9cababc15..aec5e51e17 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_lookup.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_lookup.java @@ -20,7 +20,7 @@ import org.apache.causeway.applib.services.bookmark.BookmarkService; public class DomainObjectAliasedPage_lookup { @SuppressWarnings("unused") - private final DomainObjectAliasedPage mixee; + private final DomainObjectAliasedPage page; @MemberSupport public DomainObjectAliased act(final String bookmark) { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java index ca3fa353e8..a675faafe0 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java @@ -17,7 +17,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectAliasedPage_objects { @SuppressWarnings("unused") - private final DomainObjectAliasedPage mixee; + private final DomainObjectAliasedPage page; @MemberSupport public List<? extends DomainObjectAliased> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_find.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_find.java index c358757868..c45b5decc6 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_find.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_find.java @@ -12,7 +12,7 @@ import org.apache.causeway.applib.annotation.SemanticsOf; public class DomainObjectAutoCompletePage_find { @SuppressWarnings("unused") - private final DomainObjectAutoCompletePage mixee; + private final DomainObjectAutoCompletePage page; @MemberSupport public DomainObjectAutoComplete act(final DomainObjectAutoComplete domainObjectAutoComplete) { // <.> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_objects.java index 6ec731ab5c..811ebd8ef7 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/autoComplete/DomainObjectAutoCompletePage_objects.java @@ -17,7 +17,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectAutoCompletePage_objects { @SuppressWarnings("unused") - private final DomainObjectAutoCompletePage mixee; + private final DomainObjectAutoCompletePage page; @MemberSupport public List<? extends DomainObjectAutoComplete> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/DomainObjectBoundingPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/DomainObjectBoundingPage_objects.java index 0e5f51fb77..ce7ae874b2 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/DomainObjectBoundingPage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/DomainObjectBoundingPage_objects.java @@ -17,7 +17,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectBoundingPage_objects { @SuppressWarnings("unused") - private final DomainObjectBoundingPage mixee; + private final DomainObjectBoundingPage page; @MemberSupport public List<? extends DomainObjectBounding> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/jpa/DomainObjectBoundingPage_find.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/jpa/DomainObjectBoundingPage_find.java index 37db74a9a0..8c405ee70b 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/jpa/DomainObjectBoundingPage_find.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/bounded/jpa/DomainObjectBoundingPage_find.java @@ -15,7 +15,7 @@ import org.springframework.context.annotation.Profile; public class DomainObjectBoundingPage_find { @SuppressWarnings("unused") - private final DomainObjectBoundingPage mixee; + private final DomainObjectBoundingPage page; @MemberSupport public DomainObjectBoundingJpa act(final DomainObjectBoundingJpa domainObjectBounding) { // <.> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/editing/DomainObjectEditingPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/editing/DomainObjectEditingPage_objects.java index 626c2d79e3..49cbc332f8 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/editing/DomainObjectEditingPage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/editing/DomainObjectEditingPage_objects.java @@ -17,7 +17,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectEditingPage_objects { @SuppressWarnings("unused") - private final DomainObjectEditingPage mixee; + private final DomainObjectEditingPage page; @MemberSupport public List<? extends DomainObjectEditing> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java index d43d2902b7..34aef1ec5f 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java @@ -36,7 +36,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectIntrospectionPage_annotationOptional { @SuppressWarnings("unused") - private final DomainObjectIntrospectionPage mixee; + private final DomainObjectIntrospectionPage page; @MemberSupport public List<? extends DomainObjectIntrospectionAnnotOpt> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationRequired.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationRequired.java index d464d06a82..664496b417 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationRequired.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationRequired.java @@ -36,7 +36,7 @@ import org.apache.causeway.applib.annotation.MemberSupport; public class DomainObjectIntrospectionPage_annotationRequired { @SuppressWarnings("unused") - private final DomainObjectIntrospectionPage mixee; + private final DomainObjectIntrospectionPage page; @MemberSupport public List<? extends DomainObjectIntrospectionAnnotReqd> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionVm_encapsulationEnabled.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionVm_encapsulationEnabled.java index ebe0cb8795..852b8ecd92 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionVm_encapsulationEnabled.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/encapsulated/jpa/DomainObjectIntrospectionVm_encapsulationEnabled.java @@ -38,7 +38,7 @@ import org.springframework.context.annotation.Profile; public class DomainObjectIntrospectionVm_encapsulationEnabled { @SuppressWarnings("unused") - private final DomainObjectIntrospectionPage mixee; + private final DomainObjectIntrospectionPage page; @MemberSupport public List<DomainObjectIntrospectionEncapsulatedJpa> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_objects.java index d96e1e0558..d94d115e21 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_objects.java @@ -20,7 +20,7 @@ public class DomainObjectMixinMethodPage_objects { // ... //end::class[] @SuppressWarnings("unused") - private final DomainObjectMixinMethodPage mixee; + private final DomainObjectMixinMethodPage page; //tag::class[] public List<? extends DomainObjectMixinMethod> collection() { // <.> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_updateName.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_updateName.java index 4a7d63c9e5..3db6c50ee2 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_updateName.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/mixinMethod/DomainObjectMixinMethodPage_updateName.java @@ -20,7 +20,7 @@ import org.apache.causeway.applib.annotation.DomainObject; public class DomainObjectMixinMethodPage_updateName { // ... //end::class[] - private final DomainObjectMixinMethodPage mixee; + private final DomainObjectMixinMethodPage page; //tag::class[] public DomainObjectMixinMethodPage action( // <.> @@ -30,7 +30,7 @@ public class DomainObjectMixinMethodPage_updateName { // ... //end::class[] object.setName(newName); - return mixee; + return page; //tag::class[] } //end::class[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_entities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_entities.java index 86c754901e..e3350824cc 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_entities.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_entities.java @@ -9,15 +9,13 @@ import java.util.List; import javax.inject.Inject; import org.apache.causeway.applib.annotation.Collection; -import org.apache.causeway.applib.annotation.CollectionLayout; -import org.apache.causeway.applib.annotation.DomainObject; @Collection() @RequiredArgsConstructor public class DomainObjectNaturePage_entities { @SuppressWarnings("unused") - private final DomainObjectNaturePage mixee; + private final DomainObjectNaturePage page; public List<? extends DomainObjectNatureEntity> coll() { return objectRepository.all(); diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_viewModels.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_viewModels.java index e8734ea9e2..e57b6d08c8 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_viewModels.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/DomainObjectNaturePage_viewModels.java @@ -11,8 +11,6 @@ import java.util.stream.Collectors; import javax.inject.Inject; import org.apache.causeway.applib.annotation.Collection; -import org.apache.causeway.applib.annotation.CollectionLayout; -import org.apache.causeway.applib.annotation.DomainObject; //tag::class[] @Collection() @@ -21,7 +19,7 @@ public class DomainObjectNaturePage_viewModels { // ... //end::class[] @SuppressWarnings("unused") - private final DomainObjectNaturePage mixee; + private final DomainObjectNaturePage page; //tag::class[] public List<DomainObjectNatureViewModel> coll() { diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java new file mode 100644 index 0000000000..7e0c1fbb0b --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java @@ -0,0 +1,71 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; + +import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription; +import demoapp.dom._infra.values.ValueHolder; +import demoapp.dom.types.Samples; +import lombok.val; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.inject.Inject; + +import org.apache.causeway.applib.annotation.Action; +import org.apache.causeway.applib.annotation.BookmarkPolicy; +import org.apache.causeway.applib.annotation.DomainObjectLayout; +import org.apache.causeway.applib.annotation.SemanticsOf; + +@DomainObjectLayout( + bookmarking = BookmarkPolicy.AS_ROOT // <.> +) +public abstract class DomainObjectLayoutBookmarking + implements + HasAsciiDocDescription, + ValueHolder<String> { + + public String title() { + return value(); + } + + @Override + public String value() { + return getName(); + } + + public abstract String getName(); + public abstract void setName(String value); + + public abstract void addChild(String value); + + @Action + public DomainObjectLayoutBookmarking addChildren(int number) { + val strings = samples.stream().collect(Collectors.toList()); + for (int i = 0; i < number; i++) { + addChild(strings.get(i)); + } + return this; + } + + public abstract Set<? extends DomainObjectLayoutBookmarkingChild> getChildren(); + + @Inject Samples<String> samples; +} diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.layout.xml similarity index 60% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.layout.xml index b4f853de75..11b67b9496 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.layout.xml @@ -26,22 +26,59 @@ <bs3:row> <bs3:col span="6"> - <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + <bs3:tabGroup> + <bs3:tab name="General"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="General" id="general" > + <cpt:property id="name"/> + </cpt:fieldSet> + </bs3:col> + </bs3:row> + <bs3:row> + <bs3:col span="12"> + <cpt:collection id="children"> + <cpt:action id="addChildren"/> + </cpt:collection> + </bs3:col> + </bs3:row> + </bs3:tab> + <bs3:tab name="Metadata"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="Metadata" id="metadata" > + <cpt:property id="id"/> + <cpt:property id="logicalTypeName"/> + <cpt:property id="version"/> + </cpt:fieldSet> + </bs3:col> + </bs3:row> + </bs3:tab> + <bs3:tab name="Other"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + </bs3:col> + </bs3:row> + </bs3:tab> + </bs3:tabGroup> </bs3:col> <bs3:col span="6"> <cpt:fieldSet name="Description" id="description" > <cpt:action id="clearHints" position="PANEL" /> - <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/> <cpt:action id="rebuildMetamodel" position="PANEL"/> - <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadLayout" position="PANEL_DROPDOWN"/> <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/> - <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/> - <cpt:action id="downloadJdoMetadata" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/> + <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/> + <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/> + <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/> + <cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/> <cpt:action id="openRestApi" position="PANEL_DROPDOWN" /> <cpt:property id="description"/> </cpt:fieldSet> - </bs3:col> - </bs3:row> + </bs3:col> </bs3:row> <bs3:row> <bs3:col span="12" unreferencedCollections="true"/> </bs3:row> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java similarity index 54% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java index 91192e263e..ab6f12e8df 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java @@ -19,35 +19,28 @@ package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription; +import demoapp.dom._infra.values.ValueHolder; -import javax.inject.Named; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; +import org.apache.causeway.applib.annotation.BookmarkPolicy; +import org.apache.causeway.applib.annotation.DomainObjectLayout; -import org.apache.causeway.applib.annotation.*; - -//tag::class[] -@XmlRootElement(name = "root") -@XmlType -@XmlAccessorType(XmlAccessType.FIELD) -@Named("demo.DomainObjectLayoutBookmarkingVm") -@DomainObject( - nature=Nature.VIEW_MODEL) @DomainObjectLayout( - bookmarking = BookmarkPolicy.AS_ROOT // <.> - ) -public class DomainObjectLayoutBookmarkingPage implements HasAsciiDocDescription { + bookmarking = BookmarkPolicy.AS_CHILD // <.> +) +public abstract class DomainObjectLayoutBookmarkingChild + implements + HasAsciiDocDescription, + ValueHolder<String> { - @ObjectSupport public String title() { - return "DomainObjectLayout#bookmarking"; + public String title() { + return value(); } - @Action - public DomainObjectLayoutBookmarkingNestedVm nestedObject() { - return new DomainObjectLayoutBookmarkingNestedVm(this); + @Override + public String value() { + return getName(); } + public abstract String getName(); + public abstract void setName(String value); } -//end::class[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.layout.xml similarity index 62% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.layout.xml index b4f853de75..f924ce56d4 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.layout.xml @@ -26,22 +26,53 @@ <bs3:row> <bs3:col span="6"> - <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + <bs3:tabGroup> + <bs3:tab name="General"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="General" id="general" > + <cpt:property id="name"/> + <cpt:property id="parent"/> + </cpt:fieldSet> + </bs3:col> + </bs3:row> + </bs3:tab> + <bs3:tab name="Metadata"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="Metadata" id="metadata" > + <cpt:property id="id"/> + <cpt:property id="logicalTypeName"/> + <cpt:property id="version"/> + </cpt:fieldSet> + </bs3:col> + </bs3:row> + </bs3:tab> + <bs3:tab name="Other"> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + </bs3:col> + </bs3:row> + </bs3:tab> + </bs3:tabGroup> </bs3:col> <bs3:col span="6"> <cpt:fieldSet name="Description" id="description" > <cpt:action id="clearHints" position="PANEL" /> - <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/> <cpt:action id="rebuildMetamodel" position="PANEL"/> - <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadLayout" position="PANEL_DROPDOWN"/> <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/> - <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/> - <cpt:action id="downloadJdoMetadata" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/> + <cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/> + <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/> + <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/> + <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/> + <cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/> <cpt:action id="openRestApi" position="PANEL_DROPDOWN" /> <cpt:property id="description"/> </cpt:fieldSet> - </bs3:col> - </bs3:row> + </bs3:col> </bs3:row> <bs3:row> <bs3:col span="12" unreferencedCollections="true"/> </bs3:row> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChildRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChildRepository.java new file mode 100644 index 0000000000..163843c5b5 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChildRepository.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; + +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.DomainObjectLayoutBookmarkingChild; + +import java.util.List; + +public interface DomainObjectLayoutBookmarkingChildRepository { + + List<? extends DomainObjectLayoutBookmarkingChild> allInstances(); +} diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java index 91192e263e..8b9b517c95 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.java @@ -37,7 +37,7 @@ import org.apache.causeway.applib.annotation.*; nature=Nature.VIEW_MODEL) @DomainObjectLayout( bookmarking = BookmarkPolicy.AS_ROOT // <.> - ) +) public class DomainObjectLayoutBookmarkingPage implements HasAsciiDocDescription { @ObjectSupport public String title() { @@ -49,5 +49,6 @@ public class DomainObjectLayoutBookmarkingPage implements HasAsciiDocDescription return new DomainObjectLayoutBookmarkingNestedVm(this); } + } //end::class[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml index b4f853de75..a1b7f8c7a5 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage.layout.xml @@ -26,7 +26,16 @@ <bs3:row> <bs3:col span="6"> - <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + <bs3:row> + <bs3:col span="12"> + <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/> + </bs3:col> + </bs3:row> + <bs3:row> + <bs3:col span="12"> + <cpt:collection id="objects"/> + </bs3:col> + </bs3:row> </bs3:col> <bs3:col span="6"> <cpt:fieldSet name="Description" id="description" > diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage_objects.java similarity index 60% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage_objects.java index ca3fa353e8..023e8be3ca 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage_objects.java @@ -1,6 +1,7 @@ -package demoapp.dom.domain.objects.DomainObject.aliased; +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; import demoapp.dom._infra.values.ValueHolderRepository; +import demoapp.dom.domain.objects.DomainObject.aliased.DomainObjectAliased; import lombok.RequiredArgsConstructor; import java.util.List; @@ -14,16 +15,16 @@ import org.apache.causeway.applib.annotation.MemberSupport; @Collection() @CollectionLayout() @RequiredArgsConstructor -public class DomainObjectAliasedPage_objects { +public class DomainObjectLayoutBookmarkingPage_objects { @SuppressWarnings("unused") - private final DomainObjectAliasedPage mixee; + private final DomainObjectLayoutBookmarkingPage page; @MemberSupport - public List<? extends DomainObjectAliased> coll() { + public List<? extends DomainObjectLayoutBookmarking> coll() { return objectRepository.all(); } - @Inject ValueHolderRepository<String, ? extends DomainObjectAliased> objectRepository; + @Inject ValueHolderRepository<String, ? extends DomainObjectLayoutBookmarking> objectRepository; } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingRepository.java new file mode 100644 index 0000000000..d1bb1e94f2 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingRepository.java @@ -0,0 +1,28 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; + +import demoapp.dom.domain.objects.DomainObject.aliased.DomainObjectAliased; + +import java.util.List; + +public interface DomainObjectLayoutBookmarkingRepository { + + List<? extends DomainObjectLayoutBookmarking> allInstances(); +} diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java similarity index 52% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java index d43d2902b7..c8dcfcea3b 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java @@ -16,33 +16,24 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.objects.DomainObject.introspection; +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; +import demoapp.dom._infra.seed.SeedServiceAbstract; import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.objects.DomainObject.introspection.annotOpt.DomainObjectIntrospectionAnnotOpt; -import lombok.RequiredArgsConstructor; - -import java.util.List; +import demoapp.dom.types.Samples; import javax.inject.Inject; -import org.apache.causeway.applib.annotation.Collection; -import org.apache.causeway.applib.annotation.CollectionLayout; -import org.apache.causeway.applib.annotation.MemberSupport; - -@Collection() -@CollectionLayout() -@RequiredArgsConstructor -public class DomainObjectIntrospectionPage_annotationOptional { +import org.springframework.stereotype.Service; - @SuppressWarnings("unused") - private final DomainObjectIntrospectionPage mixee; +@Service +public class DomainObjectLayoutBookmarkingSeeding +extends SeedServiceAbstract { - @MemberSupport - public List<? extends DomainObjectIntrospectionAnnotOpt> coll() { - return entities.all(); + @Inject + public DomainObjectLayoutBookmarkingSeeding( + ValueHolderRepository<String, ? extends DomainObjectLayoutBookmarking> entities) { + super(entities); } - @Inject ValueHolderRepository<String, ? extends DomainObjectIntrospectionAnnotOpt> entities; - } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java similarity index 51% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java index d43d2902b7..ec4170aefa 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/introspection/DomainObjectIntrospectionPage_annotationOptional.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java @@ -16,33 +16,42 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.objects.DomainObject.introspection; +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking; -import demoapp.dom._infra.values.ValueHolderRepository; -import demoapp.dom.domain.objects.DomainObject.introspection.annotOpt.DomainObjectIntrospectionAnnotOpt; +import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription; +import demoapp.dom._infra.values.ValueHolder; +import demoapp.dom.types.Samples; import lombok.RequiredArgsConstructor; +import lombok.val; -import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; import javax.inject.Inject; -import org.apache.causeway.applib.annotation.Collection; -import org.apache.causeway.applib.annotation.CollectionLayout; +import org.apache.causeway.applib.annotation.Action; +import org.apache.causeway.applib.annotation.BookmarkPolicy; +import org.apache.causeway.applib.annotation.DomainObjectLayout; import org.apache.causeway.applib.annotation.MemberSupport; -@Collection() -@CollectionLayout() +@Action @RequiredArgsConstructor -public class DomainObjectIntrospectionPage_annotationOptional { +public class DomainObjectLayoutBookmarking_addChildren { - @SuppressWarnings("unused") - private final DomainObjectIntrospectionPage mixee; + private final DomainObjectLayoutBookmarking parent; @MemberSupport - public List<? extends DomainObjectIntrospectionAnnotOpt> coll() { - return entities.all(); + public DomainObjectLayoutBookmarking act(int number) { + val strings = samples.stream().collect(Collectors.toList()); + for (int i = 0; i < number; i++) { + parent.addChild(parent.getName() + " - " + strings.get(i)); + } + return parent; + } + @MemberSupport public int default0Act() { + return 3; } - @Inject ValueHolderRepository<String, ? extends DomainObjectIntrospectionAnnotOpt> entities; + @Inject Samples<String> samples; } diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc new file mode 100644 index 0000000000..ffbf0ae9a9 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc @@ -0,0 +1,7 @@ +: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 [...] + +[source,java,indent=0] +---- +include::DomainObjectLayoutBookmarkingJpa.java[tags=class] +---- +<.> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa.java new file mode 100644 index 0000000000..7ce5db9eeb --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa.java @@ -0,0 +1,71 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.jpa; + +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.DomainObjectLayoutBookmarkingChild; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.inject.Named; +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 org.springframework.context.annotation.Profile; + +@Profile("demo-jpa") +@Entity +@Table( + schema = "demo", + name = "DomainObjectLayoutBookmarkingChildJpa" +) +@EntityListeners(CausewayEntityListener.class) +@Named("demo.DomainObjectLayoutBookmarkingChildJpa") +@NoArgsConstructor +//tag::class[] +// ... +@DomainObject(nature = Nature.ENTITY) +public class DomainObjectLayoutBookmarkingChildJpa extends DomainObjectLayoutBookmarkingChild { + // ... +//end::class[] + + public DomainObjectLayoutBookmarkingChildJpa(DomainObjectLayoutBookmarkingJpa parent, String value) { + setParent(parent); + setName(value); + } + + @Id + @GeneratedValue + private Long id; + + @Property + @Getter @Setter + private String name; + + @Property + @ManyToOne(fetch = FetchType.LAZY) + @Getter @Setter + private DomainObjectLayoutBookmarkingJpa parent; + +//tag::class[] +} +//end::class[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc new file mode 100644 index 0000000000..ffbf0ae9a9 --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc @@ -0,0 +1,7 @@ +: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 [...] + +[source,java,indent=0] +---- +include::DomainObjectLayoutBookmarkingJpa.java[tags=class] +---- +<.> diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa.java new file mode 100644 index 0000000000..6fe0b4c6fd --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa.java @@ -0,0 +1,81 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.jpa; + +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.DomainObjectLayoutBookmarking; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.Set; +import java.util.TreeSet; + +import javax.inject.Named; +import javax.persistence.*; + +import org.apache.causeway.applib.annotation.Collection; +import org.apache.causeway.applib.annotation.DomainObject; +import org.apache.causeway.applib.annotation.Nature; +import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; +import org.springframework.context.annotation.Profile; + +@Profile("demo-jpa") +@Entity +@Table( + schema = "demo", + name = "DomainObjectLayoutBookmarkingJpa" +) +@EntityListeners(CausewayEntityListener.class) +@Named("demo.DomainObjectLayoutBookmarkingJpa") +@NoArgsConstructor +//tag::class[] +// ... +@DomainObject(nature = Nature.ENTITY) +public class DomainObjectLayoutBookmarkingJpa extends DomainObjectLayoutBookmarking { + // ... +//end::class[] + + public DomainObjectLayoutBookmarkingJpa(String value) { + setName(value); + } + + @Id + @GeneratedValue + private Long id; + + @Getter @Setter + private String name; + + @Collection + @OneToMany( + mappedBy = "parent", + cascade = CascadeType.ALL, + orphanRemoval = true + ) + @Getter @Setter + private Set<DomainObjectLayoutBookmarkingChildJpa> children = new TreeSet<>(); + + @Override + public void addChild(String value) { + getChildren().add(new DomainObjectLayoutBookmarkingChildJpa(this, value)); + } + +//tag::class[] +} +//end::class[] diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpaEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpaEntities.java new file mode 100644 index 0000000000..64eab563ab --- /dev/null +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpaEntities.java @@ -0,0 +1,56 @@ +/* + * 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. + */ +package demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.jpa; + +import demoapp.dom._infra.values.ValueHolderRepository; +import demoapp.dom.domain.objects.DomainObject.aliased.DomainObjectAliasedRepository; +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.DomainObjectLayoutBookmarking; +import demoapp.dom.domain.objects.DomainObjectLayout.bookmarking.DomainObjectLayoutBookmarkingRepository; + +import java.util.List; + +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; + +@Profile("demo-jpa") +@Service +public class DomainObjectLayoutBookmarkingJpaEntities +extends ValueHolderRepository<String, DomainObjectLayoutBookmarkingJpa> implements DomainObjectLayoutBookmarkingRepository { + + protected DomainObjectLayoutBookmarkingJpaEntities() { + super(DomainObjectLayoutBookmarkingJpa.class); + } + + @Override + protected DomainObjectLayoutBookmarkingJpa newDetachedEntity(String value) { + return new DomainObjectLayoutBookmarkingJpa(value); + } + + @Override + public List<? extends DomainObjectLayoutBookmarking> allInstances() { + return all(); + } + + public List<? extends DomainObjectLayoutBookmarking> allMatches(final String s) { + return all(); + } + public List<? extends DomainObjectLayoutBookmarking> allMatches() { + return all(); + } +}
