You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/05/24 07:29:46 UTC

[isis] branch master updated: ISIS-2513: Demo: prepare JPA support for WrapperFactory

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 2260b33  ISIS-2513: Demo: prepare JPA support for WrapperFactory
2260b33 is described below

commit 2260b336518658902e91ee38fe6ad501ebb42a33
Author: andi-huber <ah...@apache.org>
AuthorDate: Mon May 24 09:28:58 2021 +0200

    ISIS-2513: Demo: prepare JPA support for WrapperFactory
---
 .../dom/_infra/values/ValueHolderRepository.java   |  7 ++-
 .../demoapp/dom/services/core/ServicesMenu.java    | 14 +++---
 ....adoc => WrapperFactoryEntity-description.adoc} |  0
 ...yJdoEntities.java => WrapperFactoryEntity.java} | 52 ++++++++++-----------
 ....layout.xml => WrapperFactoryEntity.layout.xml} |  0
 ...perFactoryEntity_mixinUpdatePropertyAsync.java} | 14 +++---
 ...perFactoryEntity_updatePropertyAsyncMixin.java} | 14 +++---
 .../WrapperFactoryJdoSeedService.java              | 54 ----------------------
 ...JdoEntities.java => WrapperFactorySeeding.java} | 29 ++++--------
 .../{ => jdo}/WrapperFactoryJdo.java               | 28 ++++++-----
 .../{ => jdo}/WrapperFactoryJdoEntities.java       | 33 +++++--------
 11 files changed, 85 insertions(+), 160 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
index d946f48..4e0cc54 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
@@ -27,12 +27,11 @@ import javax.inject.Inject;
 
 import org.apache.isis.applib.services.repository.RepositoryService;
 
+import demoapp.dom.types.Samples;
 import lombok.AccessLevel;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
 
-import demoapp.dom.types.Samples;
-
 @RequiredArgsConstructor(access = AccessLevel.PROTECTED)
 public abstract class ValueHolderRepository<T, E extends ValueHolder<T>> {
 
@@ -55,6 +54,10 @@ public abstract class ValueHolderRepository<T, E extends ValueHolder<T>> {
 
     protected abstract E newDetachedEntity(T value);
 
+    public Optional<E> first() {
+        return all().stream().findFirst();
+    }
+
     // -- SEEDING SUPPORT
 
     @Inject protected Samples<T> samples;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/ServicesMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/ServicesMenu.java
index f201385..e51bf86 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/ServicesMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/ServicesMenu.java
@@ -27,20 +27,18 @@ import org.apache.isis.applib.annotation.NatureOfService;
 import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.services.factory.FactoryService;
 
-import lombok.RequiredArgsConstructor;
-import lombok.val;
-import lombok.extern.log4j.Log4j2;
-
 import demoapp.dom.services.core.errorreportingservice.ErrorReportingServiceDemoVm;
 import demoapp.dom.services.core.eventbusservice.EventBusServiceDemoVm;
 import demoapp.dom.services.core.messageservice.MessageServiceDemoVm;
-import demoapp.dom.services.core.wrapperFactory.WrapperFactoryJdo;
-import demoapp.dom.services.core.wrapperFactory.WrapperFactoryJdoEntities;
+import demoapp.dom.services.core.wrapperFactory.jdo.WrapperFactoryJdo;
+import demoapp.dom.services.core.wrapperFactory.jdo.WrapperFactoryJdoEntities;
 import demoapp.dom.services.core.xmlSnapshotService.XmlSnapshotParentVm;
 import demoapp.dom.services.core.xmlSnapshotService.peer.XmlSnapshotPeerVm;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
 
 @DomainService(nature=NatureOfService.VIEW, objectType = "demo.ServicesMenu")
-@Log4j2
+//@Log4j2
 @RequiredArgsConstructor(onConstructor_ = {@Inject})
 public class ServicesMenu {
 
@@ -69,7 +67,7 @@ public class ServicesMenu {
     @Action(semantics = SemanticsOf.SAFE)
     @ActionLayout(cssClassFa="fa-gift", describedAs = "Formal object interactions + async")
     public WrapperFactoryJdo wrapperFactory(){
-        return wrapperFactoryJdoEntities.first();
+        return wrapperFactoryJdoEntities.first().orElse(null);
     }
 
     @Action(semantics = SemanticsOf.SAFE)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity-description.adoc
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo-description.adoc
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity-description.adoc
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity.java
similarity index 52%
copy from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity.java
index f213ba9..1884a51 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity.java
@@ -18,34 +18,30 @@
  */
 package demoapp.dom.services.core.wrapperFactory;
 
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
-import org.springframework.stereotype.Service;
-
-import org.apache.isis.applib.services.repository.RepositoryService;
-
-import lombok.RequiredArgsConstructor;
-
-@Service
-@RequiredArgsConstructor(onConstructor_ = {@Inject})
-public class WrapperFactoryJdoEntities {
-
-    final RepositoryService repositoryService;
-
-    public Optional<WrapperFactoryJdo> find(final String value) {
-        return repositoryService.firstMatch(WrapperFactoryJdo.class, x -> Objects.equals(x.getPropertyAsync(), value));
-    }
-
-    public List<WrapperFactoryJdo> all() {
-        return repositoryService.allInstances(WrapperFactoryJdo.class);
-    }
-
-    public WrapperFactoryJdo first() {
-        return all().stream().findFirst().get();
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.domain._commands.ExposePersistedCommands;
+
+@DomainObject(
+        objectType = "demo.WrapperFactoryEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperFactoryEntity
+implements
+    HasAsciiDocDescription,
+    ExposePersistedCommands,
+    ValueHolder<String> {
+
+    public abstract String getPropertyAsync();
+    public abstract void setPropertyAsync(String value);
+
+    public abstract String getPropertyAsyncMixin();
+    public abstract void setPropertyAsyncMixin(String value);
+
+    @Override
+    public String value() {
+        return getPropertyAsync();
     }
 
 }
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_mixinUpdatePropertyAsync.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_mixinUpdatePropertyAsync.java
similarity index 85%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_mixinUpdatePropertyAsync.java
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_mixinUpdatePropertyAsync.java
index 46a32a8..61656d2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_mixinUpdatePropertyAsync.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_mixinUpdatePropertyAsync.java
@@ -32,31 +32,31 @@ import lombok.val;
 //tag::class[]
 @Action(
     semantics = SemanticsOf.IDEMPOTENT
-    , associateWith = "propertyAsync"
 )
 @ActionLayout(
     named = "Mixin Update Property"
+    , associateWith = "propertyAsync"
     , sequence = "2"
 )
 @RequiredArgsConstructor
-public class WrapperFactoryJdo_mixinUpdatePropertyAsync {
+public class WrapperFactoryEntity_mixinUpdatePropertyAsync {
 
     @Inject WrapperFactory wrapperFactory;
 
     // ...
 //end::class[]
 
-    private final WrapperFactoryJdo wrapperFactoryJdo;
+    private final WrapperFactoryEntity wrapperFactoryEntity;
 
 //tag::class[]
-    public WrapperFactoryJdo act(final String value) {
+    public WrapperFactoryEntity act(final String value) {
         val control = AsyncControl.returningVoid().withSkipRules();
-        val wrapped = this.wrapperFactory.asyncWrap(this.wrapperFactoryJdo, control);
+        val wrapped = this.wrapperFactory.asyncWrap(this.wrapperFactoryEntity, control);
         wrapped.setPropertyAsync(value);
-        return this.wrapperFactoryJdo;
+        return this.wrapperFactoryEntity;
     }
     public String default0Act() {
-        return wrapperFactoryJdo.getPropertyAsync();
+        return wrapperFactoryEntity.getPropertyAsync();
     }
 }
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_updatePropertyAsyncMixin.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_updatePropertyAsyncMixin.java
similarity index 81%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_updatePropertyAsyncMixin.java
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_updatePropertyAsyncMixin.java
index b7ab332..d35a36d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo_updatePropertyAsyncMixin.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryEntity_updatePropertyAsyncMixin.java
@@ -27,27 +27,27 @@ import lombok.RequiredArgsConstructor;
 //tag::class[]
 @Action(
     semantics = SemanticsOf.IDEMPOTENT
-    , associateWith = "propertyAsyncMixin"
 )
 @ActionLayout(
     named = "Update Property Async"
     , describedAs = "Mixin that Updates 'property async mixin' directly"
+    , associateWith = "propertyAsyncMixin"
     , sequence = "2"
 )
 @RequiredArgsConstructor
-public class WrapperFactoryJdo_updatePropertyAsyncMixin {
+public class WrapperFactoryEntity_updatePropertyAsyncMixin {
     // ...
 //end::class[]
 
-    private final WrapperFactoryJdo wrapperFactoryJdo;
+    private final WrapperFactoryEntity wrapperFactoryEntity;
 
 //tag::class[]
-    public WrapperFactoryJdo act(final String value) {
-        wrapperFactoryJdo.setPropertyAsyncMixin(value);
-        return wrapperFactoryJdo;
+    public WrapperFactoryEntity act(final String value) {
+        wrapperFactoryEntity.setPropertyAsyncMixin(value);
+        return wrapperFactoryEntity;
     }
     public String default0Act() {
-        return wrapperFactoryJdo.getPropertyAsyncMixin();
+        return wrapperFactoryEntity.getPropertyAsyncMixin();
     }
 }
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoSeedService.java
deleted file mode 100644
index 71dff07..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoSeedService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  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.services.core.wrapperFactory;
-
-import javax.inject.Inject;
-
-import org.springframework.stereotype.Service;
-
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
-
-import demoapp.dom._infra.seed.SeedServiceAbstract;
-import demoapp.dom.types.Samples;
-
-@Service
-public class WrapperFactoryJdoSeedService extends SeedServiceAbstract {
-
-    public WrapperFactoryJdoSeedService() {
-        super(PropertyPublishingJdoEntityFixture::new);
-    }
-
-    static class PropertyPublishingJdoEntityFixture extends FixtureScript {
-
-        @Override
-        protected void execute(ExecutionContext executionContext) {
-            samples.stream()
-                    .map(WrapperFactoryJdo::new)
-                    .forEach(domainObject -> {
-                        repositoryService.persist(domainObject);
-                        executionContext.addResult(this, domainObject);
-                    });
-
-        }
-
-        @Inject RepositoryService repositoryService;
-        @Inject Samples<String> samples;
-    }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactorySeeding.java
similarity index 57%
copy from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactorySeeding.java
index f213ba9..41bcb71 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactorySeeding.java
@@ -18,34 +18,21 @@
  */
 package demoapp.dom.services.core.wrapperFactory;
 
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
 import javax.inject.Inject;
 
 import org.springframework.stereotype.Service;
 
-import org.apache.isis.applib.services.repository.RepositoryService;
-
-import lombok.RequiredArgsConstructor;
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
 
 @Service
-@RequiredArgsConstructor(onConstructor_ = {@Inject})
-public class WrapperFactoryJdoEntities {
-
-    final RepositoryService repositoryService;
-
-    public Optional<WrapperFactoryJdo> find(final String value) {
-        return repositoryService.firstMatch(WrapperFactoryJdo.class, x -> Objects.equals(x.getPropertyAsync(), value));
-    }
-
-    public List<WrapperFactoryJdo> all() {
-        return repositoryService.allInstances(WrapperFactoryJdo.class);
-    }
+public class WrapperFactorySeeding
+extends SeedServiceAbstract {
 
-    public WrapperFactoryJdo first() {
-        return all().stream().findFirst().get();
+    @Inject
+    public WrapperFactorySeeding(ValueHolderRepository<String, ? extends WrapperFactoryEntity> entities) {
+        super(entities);
     }
 
 }
+
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdo.java
similarity index 84%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo.java
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdo.java
index c962827..461d645 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdo.java
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package demoapp.dom.services.core.wrapperFactory;
+package demoapp.dom.services.core.wrapperFactory.jdo;
 
 import javax.inject.Inject;
 import javax.jdo.annotations.DatastoreIdentity;
@@ -24,6 +24,8 @@ import javax.jdo.annotations.IdGeneratorStrategy;
 import javax.jdo.annotations.IdentityType;
 import javax.jdo.annotations.PersistenceCapable;
 
+import org.springframework.context.annotation.Profile;
+
 import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.ActionLayout;
 import org.apache.isis.applib.annotation.DomainObject;
@@ -36,12 +38,13 @@ import org.apache.isis.applib.services.factory.FactoryService;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 import org.apache.isis.applib.services.wrapper.control.AsyncControl;
 
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._commands.ExposePersistedCommands;
+import demoapp.dom.services.core.wrapperFactory.WrapperFactoryEntity;
+import demoapp.dom.services.core.wrapperFactory.WrapperFactoryEntity_updatePropertyAsyncMixin;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.val;
 
+@Profile("demo-jdo")
 //tag::class[]
 @PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
 @DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@@ -51,10 +54,10 @@ import lombok.val;
         , editing = Editing.DISABLED
 )
 public class WrapperFactoryJdo
-        implements HasAsciiDocDescription, ExposePersistedCommands {
+        extends WrapperFactoryEntity {
 
-    @Inject WrapperFactory wrapperFactory;
-    @Inject FactoryService factoryService;
+    @Inject transient WrapperFactory wrapperFactory;
+    @Inject transient FactoryService factoryService;
 
     // ...
 //end::class[]
@@ -83,10 +86,10 @@ public class WrapperFactoryJdo
 //tag::async[]
     @Action(
         semantics = SemanticsOf.IDEMPOTENT
-        , associateWith = "propertyAsync"
     )
     @ActionLayout(
         describedAs = "@Action()"
+        , associateWith = "propertyAsync"
         , sequence = "1"
     )
     public WrapperFactoryJdo updatePropertyAsync(final String value) {
@@ -100,23 +103,26 @@ public class WrapperFactoryJdo
     }
 //end::async[]
 
+//end::class[]
+    @SuppressWarnings("unused")
+//tag::class[]
 //tag::async[]
     @Action(
         semantics = SemanticsOf.IDEMPOTENT
-        , associateWith = "propertyAsyncMixin"
     )
     @ActionLayout(
         describedAs = "Calls the 'updatePropertyAsync' (mixin) action asynchronously"
+        , associateWith = "propertyAsyncMixin"
         , sequence = "1"
     )
     public WrapperFactoryJdo updatePropertyUsingAsyncWrapMixin(final String value) {
         val control = AsyncControl.returning(WrapperFactoryJdo.class).withSkipRules();
-        val mixin = this.wrapperFactory.asyncWrapMixin(WrapperFactoryJdo_updatePropertyAsyncMixin.class, this, control);
-        WrapperFactoryJdo act = mixin.act(value);
+        val mixin = this.wrapperFactory.asyncWrapMixin(WrapperFactoryEntity_updatePropertyAsyncMixin.class, this, control);
+        WrapperFactoryJdo act = (WrapperFactoryJdo) mixin.act(value);
         return this;
     }
     public String default0UpdatePropertyUsingAsyncWrapMixin() {
-        return new WrapperFactoryJdo_updatePropertyAsyncMixin(this).default0Act();
+        return new WrapperFactoryEntity_updatePropertyAsyncMixin(this).default0Act();
     }
 //end::async[]
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdoEntities.java
similarity index 53%
rename from examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
rename to examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdoEntities.java
index f213ba9..36dd30c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/WrapperFactoryJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/core/wrapperFactory/jdo/WrapperFactoryJdoEntities.java
@@ -16,36 +16,25 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package demoapp.dom.services.core.wrapperFactory;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.inject.Inject;
+package demoapp.dom.services.core.wrapperFactory.jdo;
 
+import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Service;
 
-import org.apache.isis.applib.services.repository.RepositoryService;
-
-import lombok.RequiredArgsConstructor;
+import demoapp.dom._infra.values.ValueHolderRepository;
 
+@Profile("demo-jdo")
 @Service
-@RequiredArgsConstructor(onConstructor_ = {@Inject})
-public class WrapperFactoryJdoEntities {
-
-    final RepositoryService repositoryService;
-
-    public Optional<WrapperFactoryJdo> find(final String value) {
-        return repositoryService.firstMatch(WrapperFactoryJdo.class, x -> Objects.equals(x.getPropertyAsync(), value));
-    }
+public class WrapperFactoryJdoEntities
+extends ValueHolderRepository<String, WrapperFactoryJdo> {
 
-    public List<WrapperFactoryJdo> all() {
-        return repositoryService.allInstances(WrapperFactoryJdo.class);
+    protected WrapperFactoryJdoEntities() {
+        super(WrapperFactoryJdo.class);
     }
 
-    public WrapperFactoryJdo first() {
-        return all().stream().findFirst().get();
+    @Override
+    protected WrapperFactoryJdo newDetachedEntity(String value) {
+        return new WrapperFactoryJdo(value);
     }
 
 }