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/27 12:57:03 UTC
[isis] branch master updated: ISIS-2513: Demo: add JPA support for
JaxbRef
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 27532d4 ISIS-2513: Demo: add JPA support for JaxbRef
27532d4 is described below
commit 27532d4119dc7d4d26eb14f9739bc56a005307df
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 27 14:56:49 2021 +0200
ISIS-2513: Demo: add JPA support for JaxbRef
---
.../src/main/java/demoapp/dom/DemoModuleJpa.java | 3 ++
.../{ChildJdoEntities.java => JaxbRefEntity.java} | 30 +++++------
.../{ChildJdoEntities.java => JaxbRefSeeding.java} | 21 +++-----
.../jaxbrefentity/StatefulVmJaxbRefsEntity.java | 32 ++++++------
.../{ChildJdo.java => jdo/JaxbRefJdo.java} | 13 +++--
.../JaxbRefJdoEntities.java} | 26 ++++------
.../{ChildJdo.java => jpa/JaxbRefJpa.java} | 33 ++++++++----
.../JaxbRefJpaEntities.java} | 26 ++++------
.../jaxbrefentity/seed/ChildJdoSeedService.java | 58 ----------------------
9 files changed, 93 insertions(+), 149 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 12879fe..8385d43 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
@@ -28,6 +28,7 @@ import org.apache.isis.persistence.jpa.eclipselink.IsisModuleJpaEclipselink;
import demoapp.dom.domain.actions.Action.commandPublishing.jpa.ActionCommandPublishingJpa;
import demoapp.dom.domain.actions.Action.executionPublishing.jpa.ActionExecutionPublishingJpa;
+import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.jpa.JaxbRefJpa;
import demoapp.dom.domain.properties.Property.commandPublishing.jpa.PropertyCommandPublishingJpa;
import demoapp.dom.domain.properties.Property.executionPublishing.jpa.PropertyExecutionPublishingJpa;
import demoapp.dom.domain.properties.Property.projecting.jpa.PropertyProjectingChildJpa;
@@ -132,6 +133,8 @@ import demoapp.dom.types.primitive.shorts.jpa.PrimitiveShortJpa;
PropertyExecutionPublishingJpa.class,
PropertyProjectingChildJpa.class,
+ JaxbRefJpa.class,
+
})
public class DemoModuleJpa {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefEntity.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefEntity.java
index 6519fab..f9dc660 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefEntity.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
-import java.util.List;
-import java.util.Optional;
+import org.apache.isis.applib.annotation.DomainObject;
-import javax.inject.Inject;
+import demoapp.dom._infra.values.ValueHolder;
-import org.springframework.stereotype.Service;
+@DomainObject(
+ logicalTypeName = "demo.JaxbRefEntity" // shared permissions with concrete sub class
+)
+public abstract class JaxbRefEntity
+implements
+ ValueHolder<String> {
-import org.apache.isis.applib.services.repository.RepositoryService;
-
-@Service
-public class ChildJdoEntities {
-
- public Optional<ChildJdo> find(final String name) {
- return repositoryService.firstMatch(ChildJdo.class, x -> x.getName().equals(name));
- }
-
- public List<ChildJdo> all() {
- return repositoryService.allInstances(ChildJdo.class);
+ @Override
+ public String value() {
+ return getName();
}
- @Inject
- RepositoryService repositoryService;
+ protected abstract String getName();
+ protected abstract void setName(String value);
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefSeeding.java
similarity index 69%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefSeeding.java
index 6519fab..5632f6a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/JaxbRefSeeding.java
@@ -18,27 +18,20 @@
*/
package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
-import java.util.List;
-import java.util.Optional;
-
import javax.inject.Inject;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
@Service
-public class ChildJdoEntities {
-
- public Optional<ChildJdo> find(final String name) {
- return repositoryService.firstMatch(ChildJdo.class, x -> x.getName().equals(name));
- }
-
- public List<ChildJdo> all() {
- return repositoryService.allInstances(ChildJdo.class);
- }
+public class JaxbRefSeeding
+extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
+ public JaxbRefSeeding(ValueHolderRepository<String, ? extends JaxbRefEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/StatefulVmJaxbRefsEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/StatefulVmJaxbRefsEntity.java
index 1395b27..b9b4997 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/StatefulVmJaxbRefsEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/StatefulVmJaxbRefsEntity.java
@@ -41,11 +41,13 @@ import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.SemanticsOf;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import lombok.Getter;
import lombok.Setter;
import lombok.val;
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
//tag::class[]
@XmlRootElement(name = "root")
@XmlType(
@@ -59,7 +61,7 @@ import lombok.val;
public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
@XmlTransient @Inject
- private ChildJdoEntities childJdoEntities;
+ private ValueHolderRepository<String, ? extends JaxbRefEntity> childEntities;
public String title() {
return String.format("%s; %s children", getMessage(), getChildren().size());
@@ -73,16 +75,16 @@ public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
@Getter @Setter
@Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL)
@XmlElement(required = false)
- private ChildJdo favoriteChild = null;
+ private JaxbRefEntity favoriteChild = null;
@Action(semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(associateWith = "favoriteChild", sequence = "1")
- public StatefulVmJaxbRefsEntity changeFavoriteChild(ChildJdo newFavorite) {
+ public StatefulVmJaxbRefsEntity changeFavoriteChild(JaxbRefEntity newFavorite) {
favoriteChild = newFavorite;
return this;
}
- public List<ChildJdo> choices0ChangeFavoriteChild() {
- List<ChildJdo> children = new ArrayList<>(getChildren());
+ public List<JaxbRefEntity> choices0ChangeFavoriteChild() {
+ List<JaxbRefEntity> children = new ArrayList<>(getChildren());
children.remove(getFavoriteChild());
return children;
}
@@ -98,8 +100,8 @@ public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
//XXX[ISIS-2384] potentially fails with NPE
@Action(choicesFrom = "children")
- public StatefulVmJaxbRefsEntity suffixSelected(List<ChildJdo> children) {
- for(ChildJdo child : children) {
+ public StatefulVmJaxbRefsEntity suffixSelected(List<JaxbRefEntity> children) {
+ for(JaxbRefEntity child : children) {
child.setName(child.getName() + ", Jr");
}
return this;
@@ -109,16 +111,16 @@ public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@ActionLayout(associateWith = "children", sequence = "2")
public StatefulVmJaxbRefsEntity addAll() {
- Objects.requireNonNull(childJdoEntities,
+ Objects.requireNonNull(childEntities,
"ViewModel must have its injections points resolved, before any actions can be invoked.");
- val all = childJdoEntities.all();
+ val all = childEntities.all();
getChildren().clear();
getChildren().addAll(all);
return this;
}
//XXX[ISIS-2383] in support of an editable property ...
- public List<ChildJdo> choicesFavoriteChild() {
+ public List<JaxbRefEntity> choicesFavoriteChild() {
return choices0ChangeFavoriteChild(); // reuse logic from above
}
public String disableFavoriteChild() {
@@ -130,11 +132,11 @@ public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
@Collection
@XmlElementWrapper(name = "children")
@XmlElement(name = "child")
- private List<ChildJdo> children = new ArrayList<>();
+ private List<JaxbRefEntity> children = new ArrayList<>();
@Action(choicesFrom = "children", semantics = SemanticsOf.NON_IDEMPOTENT)
@ActionLayout(sequence = "1")
- public StatefulVmJaxbRefsEntity addChild(final ChildJdo child) {
+ public StatefulVmJaxbRefsEntity addChild(final JaxbRefEntity child) {
children.add(child);
if(children.size() == 1) {
setFavoriteChild(child);
@@ -144,11 +146,11 @@ public class StatefulVmJaxbRefsEntity implements HasAsciiDocDescription {
@Action(choicesFrom = "children", semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(sequence = "2")
- public StatefulVmJaxbRefsEntity removeChild(final ChildJdo child) {
+ public StatefulVmJaxbRefsEntity removeChild(final JaxbRefEntity child) {
children.remove(child);
return this;
}
- public List<ChildJdo> choices0RemoveChild() { return getChildren(); }
+ public List<JaxbRefEntity> choices0RemoveChild() { return getChildren(); }
public String disableRemoveChild() {
return choices0RemoveChild().isEmpty()? "No children to remove" : null;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdo.java
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdo.java
index 2248839..92509d6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdo.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
+package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.jdo;
import javax.jdo.annotations.DatastoreIdentity;
import javax.jdo.annotations.IdGeneratorStrategy;
@@ -34,15 +34,20 @@ import org.apache.isis.applib.jaxb.PersistentEntityAdapter;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.JaxbRefEntity;
+
@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo" )
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
-@DomainObject(bounding = Bounding.BOUNDED)
+@DomainObject(
+ bounding = Bounding.BOUNDED
+ , logicalTypeName = "demo.JaxbRefEntity")
@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
-public class ChildJdo {
+public class JaxbRefJdo
+ extends JaxbRefEntity {
- public ChildJdo(String name) {
+ public JaxbRefJdo(String name) {
this.name = name;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdoEntities.java
similarity index 66%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdoEntities.java
index 6519fab..707da6c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jdo/JaxbRefJdoEntities.java
@@ -16,29 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
-
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
+package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.jdo;
+import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.values.ValueHolderRepository;
+@Profile("demo-jdo")
@Service
-public class ChildJdoEntities {
+public class JaxbRefJdoEntities
+extends ValueHolderRepository<String, JaxbRefJdo> {
- public Optional<ChildJdo> find(final String name) {
- return repositoryService.firstMatch(ChildJdo.class, x -> x.getName().equals(name));
+ protected JaxbRefJdoEntities() {
+ super(JaxbRefJdo.class);
}
- public List<ChildJdo> all() {
- return repositoryService.allInstances(ChildJdo.class);
+ @Override
+ protected JaxbRefJdo newDetachedEntity(String value) {
+ return new JaxbRefJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpa.java
similarity index 67%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpa.java
index 2248839..87794c9 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpa.java
@@ -16,12 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
+package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.jpa;
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.PersistenceCapable;
+import javax.persistence.Entity;
+import javax.persistence.EntityListeners;
+import javax.persistence.Table;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.springframework.context.annotation.Profile;
@@ -30,19 +29,31 @@ import org.apache.isis.applib.annotation.Bounding;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.jaxb.PersistentEntityAdapter;
+import org.apache.isis.persistence.jpa.applib.integration.JpaEntityInjectionPointResolver;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
-@Profile("demo-jdo")
+import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.JaxbRefEntity;
+
+@Profile("demo-jpa")
//tag::class[]
-@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo" )
-@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
-@DomainObject(bounding = Bounding.BOUNDED)
+@Entity
+@Table(
+ schema = "demo",
+ name = "JaxbRefJpa"
+)
+@EntityListeners(JpaEntityInjectionPointResolver.class)
+@DomainObject(
+ bounding = Bounding.BOUNDED
+ , logicalTypeName = "demo.JaxbRefEntity")
@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
-public class ChildJdo {
+@NoArgsConstructor
+public class JaxbRefJpa
+ extends JaxbRefEntity {
- public ChildJdo(String name) {
+ public JaxbRefJpa(String name) {
this.name = name;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpaEntities.java
similarity index 66%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpaEntities.java
index 6519fab..b6f4a18 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/ChildJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/jpa/JaxbRefJpaEntities.java
@@ -16,29 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity;
-
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
+package demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.jpa;
+import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.values.ValueHolderRepository;
+@Profile("demo-jpa")
@Service
-public class ChildJdoEntities {
+public class JaxbRefJpaEntities
+extends ValueHolderRepository<String, JaxbRefJpa> {
- public Optional<ChildJdo> find(final String name) {
- return repositoryService.firstMatch(ChildJdo.class, x -> x.getName().equals(name));
+ protected JaxbRefJpaEntities() {
+ super(JaxbRefJpa.class);
}
- public List<ChildJdo> all() {
- return repositoryService.allInstances(ChildJdo.class);
+ @Override
+ protected JaxbRefJpa newDetachedEntity(String value) {
+ return new JaxbRefJpa(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/seed/ChildJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/seed/ChildJdoSeedService.java
deleted file mode 100644
index 94006ae..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/nature/viewmodels/jaxbrefentity/seed/ChildJdoSeedService.java
+++ /dev/null
@@ -1,58 +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.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.seed;
-
-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.samples.NameSamples;
-import demoapp.dom._infra.seed.SeedServiceAbstract;
-import demoapp.dom.domain.objects.DomainObject.nature.viewmodels.jaxbrefentity.ChildJdo;
-
-@Service
-public class ChildJdoSeedService extends SeedServiceAbstract {
-
- public ChildJdoSeedService() {
- super(ChildJdoEntityFixture::new);
- }
-
- static class ChildJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- nameSamples.stream()
- .map(ChildJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- NameSamples nameSamples;
-
- }
-}