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/20 06:53:27 UTC
[isis] branch master updated: ISIS-2620: Demo: prepare wrapper
types for JPA
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 c8854bd ISIS-2620: Demo: prepare wrapper types for JPA
c8854bd is described below
commit c8854bdef549e410968f40b5ceb4b5909a5c4b65
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 20 08:53:13 2021 +0200
ISIS-2620: Demo: prepare wrapper types for JPA
---
.../javalang/booleans/jdo/WrapperBooleanJdo.java | 11 +++--
.../booleans/jdo/WrapperBooleanJdoEntities.java | 24 ++++-----
.../booleans/jdo/WrapperBooleanJdoSeedService.java | 56 ---------------------
.../persistence/WrapperBooleanEntity.java} | 40 ++++++---------
.../persistence/WrapperBooleanEntity.layout.xml} | 0
.../persistence/WrapperBooleanSeeding.java} | 23 +++------
.../types/javalang/bytes/jdo/WrapperByteJdo.java | 11 +++--
.../javalang/bytes/jdo/WrapperByteJdoEntities.java | 24 ++++-----
.../bytes/jdo/WrapperByteJdoSeedService.java | 56 ---------------------
.../WrapperByteEntity.java} | 40 ++++++---------
.../persistence/WrapperByteEntity.layout.xml} | 0
.../WrapperByteSeeding.java} | 23 +++------
.../characters/jdo/WrapperCharacterJdo.java | 11 +++--
.../jdo/WrapperCharacterJdoEntities.java | 24 ++++-----
.../jdo/WrapperCharacterJdoSeedService.java | 56 ---------------------
.../persistence/WrapperCharacterEntity.java} | 40 ++++++---------
.../persistence/WrapperCharacterEntity.layout.xml} | 0
.../persistence/WrapperCharacterSeeding.java} | 23 +++------
.../javalang/doubles/jdo/WrapperDoubleJdo.java | 11 +++--
.../doubles/jdo/WrapperDoubleJdoEntities.java | 24 ++++-----
.../doubles/jdo/WrapperDoubleJdoSeedService.java | 57 ----------------------
.../persistence/WrapperDoubleEntity.java} | 40 ++++++---------
.../persistence/WrapperDoubleEntity.layout.xml} | 0
.../persistence/WrapperDoubleSeeding.java} | 23 +++------
.../types/javalang/floats/jdo/WrapperFloatJdo.java | 11 +++--
.../floats/jdo/WrapperFloatJdoEntities.java | 26 +++++-----
.../floats/jdo/WrapperFloatJdoSeedService.java | 56 ---------------------
.../persistence/WrapperFloatEntity.java} | 40 ++++++---------
.../persistence/WrapperFloatEntity.layout.xml} | 0
.../persistence/WrapperFloatSeeding.java} | 23 +++------
.../javalang/integers/jdo/WrapperIntegerJdo.java | 11 +++--
.../integers/jdo/WrapperIntegerJdoEntities.java | 24 ++++-----
.../integers/jdo/WrapperIntegerJdoSeedService.java | 56 ---------------------
.../persistence/WrapperIntegerEntity.java} | 40 ++++++---------
.../persistence/WrapperIntegerEntity.layout.xml} | 0
.../persistence/WrapperIntegerSeeding.java} | 23 +++------
.../types/javalang/longs/jdo/WrapperLongJdo.java | 11 +++--
.../javalang/longs/jdo/WrapperLongJdoEntities.java | 24 ++++-----
.../longs/jdo/WrapperLongJdoSeedService.java | 56 ---------------------
.../persistence/WrapperLongEntity.java} | 40 ++++++---------
.../persistence/WrapperLongEntity.layout.xml} | 0
.../persistence/WrapperLongSeeding.java} | 23 +++------
.../types/javalang/shorts/jdo/WrapperShortJdo.java | 11 +++--
.../shorts/jdo/WrapperShortJdoEntities.java | 24 ++++-----
.../shorts/jdo/WrapperShortJdoSeedService.java | 56 ---------------------
.../persistence/WrapperShortEntity.java} | 40 ++++++---------
.../persistence/WrapperShortEntity.layout.xml} | 0
.../persistence/WrapperShortSeeding.java} | 23 +++------
48 files changed, 321 insertions(+), 914 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.java
index 37ddbdd..86e307c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.booleans.holder.WrapperBooleanHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.booleans.persistence.WrapperBooleanEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperBooleanJdo"
+ objectType = "demo.WrapperBooleanEntity"
)
public class WrapperBooleanJdo // <.>
- implements HasAsciiDocDescription, WrapperBooleanHolder2 {
+ extends WrapperBooleanEntity {
//end::class[]
public WrapperBooleanJdo(Boolean initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoEntities.java
index c3b3308..d2e8484 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.booleans.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperBooleanJdoEntities {
+public class WrapperBooleanJdoEntities
+extends ValueHolderRepository<Boolean, WrapperBooleanJdo> {
- public Optional<WrapperBooleanJdo> find(final Boolean readOnlyProperty) {
- return repositoryService.firstMatch(WrapperBooleanJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperBooleanJdoEntities() {
+ super(WrapperBooleanJdo.class);
}
- public List<WrapperBooleanJdo> all() {
- return repositoryService.allInstances(WrapperBooleanJdo.class);
+ @Override
+ protected WrapperBooleanJdo newDetachedEntity(Boolean value) {
+ return new WrapperBooleanJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoSeedService.java
deleted file mode 100644
index fcbc800..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.booleans.jdo;
-
-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 WrapperBooleanJdoSeedService extends SeedServiceAbstract {
-
- public WrapperBooleanJdoSeedService() {
- super(WrapperBooleanJdoEntityFixture::new);
- }
-
- static class WrapperBooleanJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperBooleanJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Boolean> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
index e4edb32..14e4c71 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.booleans.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.booleans.holder.WrapperBooleanHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperBooleanEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperBooleanEntity
+implements
+ HasAsciiDocDescription,
+ WrapperBooleanHolder2,
+ ValueHolder<Boolean> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanSeeding.java
index e4edb32..df151bb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.booleans.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperBooleanSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperBooleanSeeding(ValueHolderRepository<Boolean, ? extends WrapperBooleanEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.java
index a447805..b7c1a6e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.bytes.holder.WrapperByteHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.bytes.persistence.WrapperByteEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperByteJdo"
+ objectType = "demo.WrapperByteEntity"
)
public class WrapperByteJdo // <.>
- implements HasAsciiDocDescription, WrapperByteHolder2 {
+ extends WrapperByteEntity {
//end::class[]
public WrapperByteJdo(Byte initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
index e4edb32..d70f302 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.bytes.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperByteJdoEntities {
+public class WrapperByteJdoEntities
+extends ValueHolderRepository<Byte, WrapperByteJdo> {
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperByteJdoEntities() {
+ super(WrapperByteJdo.class);
}
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
+ @Override
+ protected WrapperByteJdo newDetachedEntity(Byte value) {
+ return new WrapperByteJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoSeedService.java
deleted file mode 100644
index 66241cb..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.bytes.jdo;
-
-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 WrapperByteJdoSeedService extends SeedServiceAbstract {
-
- public WrapperByteJdoSeedService() {
- super(WrapperByteJdoEntityFixture::new);
- }
-
- static class WrapperByteJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperByteJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Byte> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
index e4edb32..6a811ba 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.bytes.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.bytes.holder.WrapperByteHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperByteEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperByteEntity
+implements
+ HasAsciiDocDescription,
+ WrapperByteHolder2,
+ ValueHolder<Byte> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteSeeding.java
index e4edb32..3483784 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.bytes.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperByteSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperByteSeeding(ValueHolderRepository<Byte, ? extends WrapperByteEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.java
index c372cb7..11f4a49 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.characters.holder.WrapperCharacterHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.characters.persistence.WrapperCharacterEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperCharacterJdo"
+ objectType = "demo.WrapperCharacterEntity"
)
public class WrapperCharacterJdo // <.>
- implements HasAsciiDocDescription, WrapperCharacterHolder2 {
+ extends WrapperCharacterEntity {
//end::class[]
public WrapperCharacterJdo(Character initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoEntities.java
index 674a27b..3a55e55 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.characters.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperCharacterJdoEntities {
+public class WrapperCharacterJdoEntities
+extends ValueHolderRepository<Character, WrapperCharacterJdo> {
- public Optional<WrapperCharacterJdo> find(final Character readOnlyProperty) {
- return repositoryService.firstMatch(WrapperCharacterJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected WrapperCharacterJdoEntities() {
+ super(WrapperCharacterJdo.class);
}
- public List<WrapperCharacterJdo> all() {
- return repositoryService.allInstances(WrapperCharacterJdo.class);
+ @Override
+ protected WrapperCharacterJdo newDetachedEntity(Character value) {
+ return new WrapperCharacterJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoSeedService.java
deleted file mode 100644
index 4d1763b..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.characters.jdo;
-
-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 WrapperCharacterJdoSeedService extends SeedServiceAbstract {
-
- public WrapperCharacterJdoSeedService() {
- super(WrapperCharacterJdoEntityFixture::new);
- }
-
- static class WrapperCharacterJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperCharacterJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Character> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
index e4edb32..fd0405e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.characters.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.characters.holder.WrapperCharacterHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperCharacterEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperCharacterEntity
+implements
+ HasAsciiDocDescription,
+ WrapperCharacterHolder2,
+ ValueHolder<Character> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterSeeding.java
index e4edb32..1ca6eb1 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.characters.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperCharacterSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperCharacterSeeding(ValueHolderRepository<Character, ? extends WrapperCharacterEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.java
index f04c71d..1a005d1 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.doubles.holder.WrapperDoubleHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.doubles.persistence.WrapperDoubleEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperDoubleJdo"
+ objectType = "demo.WrapperDoubleEntity"
)
public class WrapperDoubleJdo // <.>
- implements HasAsciiDocDescription, WrapperDoubleHolder2 {
+ extends WrapperDoubleEntity {
//end::class[]
public WrapperDoubleJdo(Double initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoEntities.java
index eaa9f73..6efc180 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.doubles.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperDoubleJdoEntities {
+public class WrapperDoubleJdoEntities
+extends ValueHolderRepository<Double, WrapperDoubleJdo> {
- public Optional<WrapperDoubleJdo> find(final Double readOnlyProperty) {
- return repositoryService.firstMatch(WrapperDoubleJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperDoubleJdoEntities() {
+ super(WrapperDoubleJdo.class);
}
- public List<WrapperDoubleJdo> all() {
- return repositoryService.allInstances(WrapperDoubleJdo.class);
+ @Override
+ protected WrapperDoubleJdo newDetachedEntity(Double value) {
+ return new WrapperDoubleJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoSeedService.java
deleted file mode 100644
index 8d21adc..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdoSeedService.java
+++ /dev/null
@@ -1,57 +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.types.javalang.doubles.jdo;
-
-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 WrapperDoubleJdoSeedService extends SeedServiceAbstract {
-
- public WrapperDoubleJdoSeedService() {
- super(WrapperDoubleJdoEntityFixture::new);
- }
-
- static class WrapperDoubleJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperDoubleJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
-
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Double> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
index e4edb32..49f3a6b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.doubles.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.doubles.holder.WrapperDoubleHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperDoubleEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperDoubleEntity
+implements
+ HasAsciiDocDescription,
+ WrapperDoubleHolder2,
+ ValueHolder<Double> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleSeeding.java
index e4edb32..4734d93 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.doubles.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperDoubleSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperDoubleSeeding(ValueHolderRepository<Double, ? extends WrapperDoubleEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.java
index b427472..4f9c3e5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.floats.holder.WrapperFloatHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.floats.persistence.WrapperFloatEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperFloatJdo"
+ objectType = "demo.WrapperFloatEntity"
)
public class WrapperFloatJdo // <.>
- implements HasAsciiDocDescription, WrapperFloatHolder2 {
+ extends WrapperFloatEntity {
//end::class[]
public WrapperFloatJdo(Float initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoEntities.java
index 4f3783d..5d09930 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.floats.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperFloatJdoEntities {
+public class WrapperFloatJdoEntities
+extends ValueHolderRepository<Float, WrapperFloatJdo> {
- public Optional<WrapperFloatJdo> find(final Float readOnlyProperty) {
- return repositoryService.firstMatch(WrapperFloatJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperFloatJdoEntities() {
+ super(WrapperFloatJdo.class);
}
- public List<WrapperFloatJdo> all() {
- return repositoryService.allInstances(WrapperFloatJdo.class);
+ @Override
+ protected WrapperFloatJdo newDetachedEntity(Float value) {
+ return new WrapperFloatJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoSeedService.java
deleted file mode 100644
index 49071ac..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/jdo/WrapperFloatJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.floats.jdo;
-
-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 WrapperFloatJdoSeedService extends SeedServiceAbstract {
-
- public WrapperFloatJdoSeedService() {
- super(WrapperFloatJdoEntityFixture::new);
- }
-
- static class WrapperFloatJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperFloatJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Float> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
index e4edb32..69c54fb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.floats.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.floats.holder.WrapperFloatHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperFloatEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperFloatEntity
+implements
+ HasAsciiDocDescription,
+ WrapperFloatHolder2,
+ ValueHolder<Float> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/jdo/WrapperDoubleJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatSeeding.java
index e4edb32..6d0f9d5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.floats.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperFloatSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperFloatSeeding(ValueHolderRepository<Float, ? extends WrapperFloatEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.java
index 7bf9824..31fb0c2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.integers.holder.WrapperIntegerHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.integers.persistence.WrapperIntegerEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperIntegerJdo"
+ objectType = "demo.WrapperIntegerEntity"
)
public class WrapperIntegerJdo // <.>
- implements HasAsciiDocDescription, WrapperIntegerHolder2 {
+ extends WrapperIntegerEntity {
//end::class[]
public WrapperIntegerJdo(Integer initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoEntities.java
index 94071ca..3c0468d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.integers.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperIntegerJdoEntities {
+public class WrapperIntegerJdoEntities
+extends ValueHolderRepository<Integer, WrapperIntegerJdo> {
- public Optional<WrapperIntegerJdo> find(final Integer readOnlyProperty) {
- return repositoryService.firstMatch(WrapperIntegerJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperIntegerJdoEntities() {
+ super(WrapperIntegerJdo.class);
}
- public List<WrapperIntegerJdo> all() {
- return repositoryService.allInstances(WrapperIntegerJdo.class);
+ @Override
+ protected WrapperIntegerJdo newDetachedEntity(Integer value) {
+ return new WrapperIntegerJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoSeedService.java
deleted file mode 100644
index 6395475..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/jdo/WrapperIntegerJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.integers.jdo;
-
-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 WrapperIntegerJdoSeedService extends SeedServiceAbstract {
-
- public WrapperIntegerJdoSeedService() {
- super(WrapperIntegerJdoEntityFixture::new);
- }
-
- static class WrapperIntegerJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperIntegerJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Integer> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
index e4edb32..a17bf18 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.integers.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.integers.holder.WrapperIntegerHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperIntegerEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperIntegerEntity
+implements
+ HasAsciiDocDescription,
+ WrapperIntegerHolder2,
+ ValueHolder<Integer> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/jdo/WrapperCharacterJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerSeeding.java
index e4edb32..d6de8e1 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.integers.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperIntegerSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperIntegerSeeding(ValueHolderRepository<Integer, ? extends WrapperIntegerEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.java
index f8a2f67..77e59e2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.longs.holder.WrapperLongHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.longs.persistence.WrapperLongEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperLongJdo"
+ objectType = "demo.WrapperLongEntity"
)
public class WrapperLongJdo // <.>
- implements HasAsciiDocDescription, WrapperLongHolder2 {
+ extends WrapperLongEntity {
//end::class[]
public WrapperLongJdo(Long initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoEntities.java
index 3aa0cc5..f961052 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.longs.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperLongJdoEntities {
+public class WrapperLongJdoEntities
+extends ValueHolderRepository<Long, WrapperLongJdo> {
- public Optional<WrapperLongJdo> find(final Long readOnlyProperty) {
- return repositoryService.firstMatch(WrapperLongJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperLongJdoEntities() {
+ super(WrapperLongJdo.class);
}
- public List<WrapperLongJdo> all() {
- return repositoryService.allInstances(WrapperLongJdo.class);
+ @Override
+ protected WrapperLongJdo newDetachedEntity(Long value) {
+ return new WrapperLongJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoSeedService.java
deleted file mode 100644
index f894626..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.longs.jdo;
-
-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 WrapperLongJdoSeedService extends SeedServiceAbstract {
-
- public WrapperLongJdoSeedService() {
- super(WrapperLongJdoEntityFixture::new);
- }
-
- static class WrapperLongJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperLongJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Long> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
index e4edb32..aa2c164 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.longs.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.longs.holder.WrapperLongHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperLongEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperLongEntity
+implements
+ HasAsciiDocDescription,
+ WrapperLongHolder2,
+ ValueHolder<Long> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongSeeding.java
index e4edb32..dd2a4a6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.longs.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperLongSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperLongSeeding(ValueHolderRepository<Long, ? extends WrapperLongEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.java
index 0227c21..978cb04 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdo.java
@@ -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.DomainObject;
import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.Optionality;
@@ -31,19 +33,20 @@ import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Title;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.types.javalang.shorts.holder.WrapperShortHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.javalang.shorts.persistence.WrapperShortEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.WrapperShortJdo"
+ objectType = "demo.WrapperShortEntity"
)
public class WrapperShortJdo // <.>
- implements HasAsciiDocDescription, WrapperShortHolder2 {
+ extends WrapperShortEntity {
//end::class[]
public WrapperShortJdo(Short initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoEntities.java
index 4601ec9..0c671d4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.javalang.shorts.jdo;
-import java.util.List;
-import java.util.Optional;
-
-import javax.inject.Inject;
-
+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 WrapperShortJdoEntities {
+public class WrapperShortJdoEntities
+extends ValueHolderRepository<Short, WrapperShortJdo> {
- public Optional<WrapperShortJdo> find(final Short readOnlyProperty) {
- return repositoryService.firstMatch(WrapperShortJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
+ protected WrapperShortJdoEntities() {
+ super(WrapperShortJdo.class);
}
- public List<WrapperShortJdo> all() {
- return repositoryService.allInstances(WrapperShortJdo.class);
+ @Override
+ protected WrapperShortJdo newDetachedEntity(Short value) {
+ return new WrapperShortJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoSeedService.java
deleted file mode 100644
index a84668b..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/jdo/WrapperShortJdoSeedService.java
+++ /dev/null
@@ -1,56 +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.types.javalang.shorts.jdo;
-
-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 WrapperShortJdoSeedService extends SeedServiceAbstract {
-
- public WrapperShortJdoSeedService() {
- super(WrapperShortJdoEntityFixture::new);
- }
-
- static class WrapperShortJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(WrapperShortJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<Short> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
index e4edb32..d1802a9 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
@@ -16,29 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-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;
-
-@Service
-public class WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
-
- @Inject
- RepositoryService repositoryService;
+package demoapp.dom.types.javalang.shorts.persistence;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.types.javalang.shorts.holder.WrapperShortHolder2;
+
+@DomainObject(
+ objectType = "demo.WrapperShortEntity" // shared permissions with concrete sub class
+)
+public abstract class WrapperShortEntity
+implements
+ HasAsciiDocDescription,
+ WrapperShortHolder2,
+ ValueHolder<Short> {
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/jdo/WrapperBooleanJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortSeeding.java
similarity index 62%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortSeeding.java
index e4edb32..60fedfb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/jdo/WrapperByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortSeeding.java
@@ -16,29 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.bytes.jdo;
-
-import java.util.List;
-import java.util.Optional;
+package demoapp.dom.types.javalang.shorts.persistence;
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 WrapperByteJdoEntities {
-
- public Optional<WrapperByteJdo> find(final Byte readOnlyProperty) {
- return repositoryService.firstMatch(WrapperByteJdo.class, x -> x.getReadOnlyProperty().equals(readOnlyProperty));
- }
-
- public List<WrapperByteJdo> all() {
- return repositoryService.allInstances(WrapperByteJdo.class);
- }
+public class WrapperShortSeeding extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
-
+ public WrapperShortSeeding(ValueHolderRepository<Short, ? extends WrapperShortEntity> entities) {
+ super(entities);
+ }
}