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 09:52:43 UTC
[isis] branch master updated: ISIS-2620: Demo: prepare primitive
value entities
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 14a6f12 ISIS-2620: Demo: prepare primitive value entities
14a6f12 is described below
commit 14a6f1259f72347979c04bf5900be3ada142a5a7
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 20 11:52:28 2021 +0200
ISIS-2620: Demo: prepare primitive value entities
---
.../demoapp/dom/_infra/values/ValueHolder.java | 2 +-
.../dom/_infra/values/ValueHolderRepository.java | 2 +-
.../booleans/persistence/WrapperBooleanEntity.java | 5 ++
.../bytes/persistence/WrapperByteEntity.java | 5 ++
.../persistence/WrapperCharacterEntity.java | 5 ++
.../doubles/persistence/WrapperDoubleEntity.java | 5 ++
.../floats/persistence/WrapperFloatEntity.java | 5 ++
.../integers/persistence/WrapperIntegerEntity.java | 5 ++
.../longs/persistence/WrapperLongEntity.java | 5 ++
.../shorts/persistence/WrapperShortEntity.java | 5 ++
.../strings/persistence/JavaLangStringEntity.java | 5 ++
.../booleans/jdo/PrimitiveBooleanJdo.java | 11 +++--
.../booleans/jdo/PrimitiveBooleanJdoEntities.java | 24 ++++-----
.../jdo/PrimitiveBooleanJdoSeedService.java | 57 ----------------------
.../persistence/PrimitiveBooleanEntity.java} | 17 ++++---
.../persistence/PrimitiveBooleanEntity.layout.xml} | 0
.../persistence/PrimitiveBooleanSeeding.java} | 17 +++++--
.../primitive/bytes/jdo/PrimitiveByteJdo.java | 11 +++--
.../bytes/jdo/PrimitiveByteJdoEntities.java | 26 +++++-----
.../bytes/jdo/PrimitiveByteJdoSeedService.java | 56 ---------------------
.../bytes/persistence/PrimitiveByteEntity.java} | 17 ++++---
.../PrimitiveByteEntity.layout.xml} | 0
.../bytes/persistence/PrimitiveByteSeeding.java} | 17 +++++--
.../primitive/chars/jdo/PrimitiveCharJdo.java | 11 +++--
.../chars/jdo/PrimitiveCharJdoEntities.java | 26 +++++-----
.../chars/jdo/PrimitiveCharJdoSeedService.java | 56 ---------------------
.../chars/persistence/PrimitiveCharEntity.java} | 17 ++++---
.../persistence/PrimitiveCharEntity.layout.xml} | 0
.../chars/persistence/PrimitiveCharSeeding.java} | 17 +++++--
.../primitive/doubles/jdo/PrimitiveDoubleJdo.java | 11 +++--
.../doubles/jdo/PrimitiveDoubleJdoEntities.java | 26 +++++-----
.../doubles/jdo/PrimitiveDoubleJdoSeedService.java | 56 ---------------------
.../persistence/PrimitiveDoubleEntity.java} | 15 ++++--
.../persistence/PrimitiveDoubleEntity.layout.xml} | 0
.../persistence/PrimitiveDoubleSeeding.java} | 17 +++++--
.../primitive/floats/jdo/PrimitiveFloatJdo.java | 11 +++--
.../floats/jdo/PrimitiveFloatJdoEntities.java | 26 +++++-----
.../floats/jdo/PrimitiveFloatJdoSeedService.java | 56 ---------------------
.../floats/persistence/PrimitiveFloatEntity.java} | 17 ++++---
.../persistence/PrimitiveFloatEntity.layout.xml} | 0
.../floats/persistence/PrimitiveFloatSeeding.java} | 17 +++++--
.../types/primitive/ints/jdo/PrimitiveIntJdo.java | 11 +++--
.../ints/jdo/PrimitiveIntJdoEntities.java | 26 +++++-----
.../ints/jdo/PrimitiveIntJdoSeedService.java | 57 ----------------------
.../ints/persistence/PrimitiveIntEntity.java} | 17 ++++---
.../PrimitiveIntEntity.layout.xml} | 0
.../ints/persistence/PrimitiveIntSeeding.java} | 17 +++++--
.../primitive/longs/jdo/PrimitiveLongJdo.java | 11 +++--
.../longs/jdo/PrimitiveLongJdoEntities.java | 26 +++++-----
.../longs/jdo/PrimitiveLongJdoSeedService.java | 57 ----------------------
.../longs/persistence/PrimitiveLongEntity.java} | 17 ++++---
.../persistence/PrimitiveLongEntity.layout.xml} | 0
.../longs/persistence/PrimitiveLongSeeding.java} | 17 +++++--
.../primitive/shorts/jdo/PrimitiveShortJdo.java | 11 +++--
.../shorts/jdo/PrimitiveShortJdoEntities.java | 26 +++++-----
.../shorts/jdo/PrimitiveShortJdoSeedService.java | 56 ---------------------
.../shorts/persistence/PrimitiveShortEntity.java} | 17 ++++---
.../persistence/PrimitiveShortEntity.layout.xml} | 0
.../shorts/persistence/PrimitiveShortSeeding.java} | 17 +++++--
59 files changed, 389 insertions(+), 675 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
index a4a7c0a..4436bd6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
@@ -20,6 +20,6 @@ package demoapp.dom._infra.values;
public interface ValueHolder<T> {
- T getReadOnlyProperty();
+ T value();
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
index 5aeab8c..d946f48 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolderRepository.java
@@ -46,7 +46,7 @@ public abstract class ValueHolderRepository<T, E extends ValueHolder<T>> {
return repositoryService
.firstMatch(
entityType,
- x -> Objects.equals(x.getReadOnlyProperty(), readOnlyProperty));
+ x -> Objects.equals(x.value(), readOnlyProperty));
}
public List<E> all() {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
index 14e4c71..69cb81f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/booleans/persistence/WrapperBooleanEntity.java
@@ -33,4 +33,9 @@ implements
WrapperBooleanHolder2,
ValueHolder<Boolean> {
+ @Override
+ public Boolean value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
index 6a811ba..ee97e9d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/bytes/persistence/WrapperByteEntity.java
@@ -33,4 +33,9 @@ implements
WrapperByteHolder2,
ValueHolder<Byte> {
+ @Override
+ public Byte value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
index fd0405e..bf3b585 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
@@ -33,4 +33,9 @@ implements
WrapperCharacterHolder2,
ValueHolder<Character> {
+ @Override
+ public Character value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
index 49f3a6b..877ab85 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
@@ -33,4 +33,9 @@ implements
WrapperDoubleHolder2,
ValueHolder<Double> {
+ @Override
+ public Double value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
index 69c54fb..8abbc50 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
@@ -33,4 +33,9 @@ implements
WrapperFloatHolder2,
ValueHolder<Float> {
+ @Override
+ public Float value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
index a17bf18..32cf267 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/integers/persistence/WrapperIntegerEntity.java
@@ -33,4 +33,9 @@ implements
WrapperIntegerHolder2,
ValueHolder<Integer> {
+ @Override
+ public Integer value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
index aa2c164..43884ab 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/persistence/WrapperLongEntity.java
@@ -33,4 +33,9 @@ implements
WrapperLongHolder2,
ValueHolder<Long> {
+ @Override
+ public Long value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
index d1802a9..4576616 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/shorts/persistence/WrapperShortEntity.java
@@ -33,4 +33,9 @@ implements
WrapperShortHolder2,
ValueHolder<Short> {
+ @Override
+ public Short value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
index eda96b7..ef7a238 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
@@ -33,4 +33,9 @@ implements
JavaLangStringHolder2,
ValueHolder<String> {
+ @Override
+ public String value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.java
index c0d1e96..90011da 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.booleans.holder.PrimitiveBooleanHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.booleans.persistence.PrimitiveBooleanEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveBooleanJdo"
+ objectType = "demo.PrimitiveBooleanEntity"
)
public class PrimitiveBooleanJdo // <.>
- implements HasAsciiDocDescription, PrimitiveBooleanHolder2 {
+ extends PrimitiveBooleanEntity {
//end::class[]
public PrimitiveBooleanJdo(boolean initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoEntities.java
index 5ae44ba..d72089a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveBooleanJdoEntities {
+public class PrimitiveBooleanJdoEntities
+extends ValueHolderRepository<Boolean, PrimitiveBooleanJdo> {
- public Optional<PrimitiveBooleanJdo> find(final boolean readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveBooleanJdo.class, x -> x.isReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveBooleanJdoEntities() {
+ super(PrimitiveBooleanJdo.class);
}
- public List<PrimitiveBooleanJdo> all() {
- return repositoryService.allInstances(PrimitiveBooleanJdo.class);
+ @Override
+ protected PrimitiveBooleanJdo newDetachedEntity(Boolean value) {
+ return new PrimitiveBooleanJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoSeedService.java
deleted file mode 100644
index ce26447..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdoSeedService.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.primitive.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 PrimitiveBooleanJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveBooleanJdoSeedService() {
- super(PrimitiveBooleanJdoEntityFixture::new);
- }
-
- static class PrimitiveBooleanJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveBooleanJdo::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/characters/persistence/WrapperCharacterEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanEntity.java
similarity index 73%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanEntity.java
index fd0405e..7389172 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/characters/persistence/WrapperCharacterEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.characters.persistence;
+package demoapp.dom.types.primitive.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.characters.holder.WrapperCharacterHolder2;
+import demoapp.dom.types.primitive.booleans.holder.PrimitiveBooleanHolder2;
@DomainObject(
- objectType = "demo.WrapperCharacterEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveBooleanEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperCharacterEntity
+public abstract class PrimitiveBooleanEntity
implements
HasAsciiDocDescription,
- WrapperCharacterHolder2,
- ValueHolder<Character> {
+ PrimitiveBooleanHolder2,
+ ValueHolder<Boolean> {
+
+ @Override
+ public Boolean value() {
+ return isReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanSeeding.java
similarity index 63%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanSeeding.java
index a4a7c0a..f80d24a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/persistence/PrimitiveBooleanSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.booleans.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveBooleanSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveBooleanSeeding(ValueHolderRepository<Boolean, ? extends PrimitiveBooleanEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.java
index 7d4c9d3..a68c6bc 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.bytes.holder.PrimitiveByteHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.bytes.persistence.PrimitiveByteEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveByteJdo"
+ objectType = "demo.PrimitiveByteEntity"
)
public class PrimitiveByteJdo // <.>
- implements HasAsciiDocDescription, PrimitiveByteHolder2 {
+ extends PrimitiveByteEntity {
//end::class[]
public PrimitiveByteJdo(byte initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoEntities.java
index b530073..81abf4f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveByteJdoEntities {
+public class PrimitiveByteJdoEntities
+extends ValueHolderRepository<Byte, PrimitiveByteJdo> {
- public Optional<PrimitiveByteJdo> find(final byte readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveByteJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveByteJdoEntities() {
+ super(PrimitiveByteJdo.class);
}
- public List<PrimitiveByteJdo> all() {
- return repositoryService.allInstances(PrimitiveByteJdo.class);
+ @Override
+ protected PrimitiveByteJdo newDetachedEntity(Byte value) {
+ return new PrimitiveByteJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoSeedService.java
deleted file mode 100644
index 6ecf03f..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdoSeedService.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.primitive.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 PrimitiveByteJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveByteJdoSeedService() {
- super(PrimitiveByteJdoEntityFixture::new);
- }
-
- static class PrimitiveByteJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveByteJdo::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/doubles/persistence/WrapperDoubleEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteEntity.java
index 49f3a6b..1eea4d7 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.doubles.persistence;
+package demoapp.dom.types.primitive.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.doubles.holder.WrapperDoubleHolder2;
+import demoapp.dom.types.primitive.bytes.holder.PrimitiveByteHolder2;
@DomainObject(
- objectType = "demo.WrapperDoubleEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveByteEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperDoubleEntity
+public abstract class PrimitiveByteEntity
implements
HasAsciiDocDescription,
- WrapperDoubleHolder2,
- ValueHolder<Double> {
+ PrimitiveByteHolder2,
+ ValueHolder<Byte> {
+
+ @Override
+ public Byte value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/jdo/PrimitiveByteJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteSeeding.java
index a4a7c0a..90c8610 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/bytes/persistence/PrimitiveByteSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.bytes.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveByteSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveByteSeeding(ValueHolderRepository<Byte, ? extends PrimitiveByteEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.java
index 146e175..bba5764 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.chars.holder.PrimitiveCharHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.chars.persistence.PrimitiveCharEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveCharJdo"
+ objectType = "demo.PrimitiveCharEntity"
)
public class PrimitiveCharJdo // <.>
- implements HasAsciiDocDescription, PrimitiveCharHolder2 {
+ extends PrimitiveCharEntity {
//end::class[]
public PrimitiveCharJdo(char initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java
index dd5bac5..225c8cd 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.chars.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 PrimitiveCharJdoEntities {
+public class PrimitiveCharJdoEntities
+extends ValueHolderRepository<Character, PrimitiveCharJdo> {
- public Optional<PrimitiveCharJdo> find(final char readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveCharJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveCharJdoEntities() {
+ super(PrimitiveCharJdo.class);
}
- public List<PrimitiveCharJdo> all() {
- return repositoryService.allInstances(PrimitiveCharJdo.class);
+ @Override
+ protected PrimitiveCharJdo newDetachedEntity(Character value) {
+ return new PrimitiveCharJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoSeedService.java
deleted file mode 100644
index 16beed1..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoSeedService.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.primitive.chars.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 PrimitiveCharJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveCharJdoSeedService() {
- super(PrimitiveCharJdoEntityFixture::new);
- }
-
- static class PrimitiveCharJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveCharJdo::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/doubles/persistence/WrapperDoubleEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharEntity.java
index 49f3a6b..3859d43 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.doubles.persistence;
+package demoapp.dom.types.primitive.chars.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;
+import demoapp.dom.types.primitive.chars.holder.PrimitiveCharHolder2;
@DomainObject(
- objectType = "demo.WrapperDoubleEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveCharEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperDoubleEntity
+public abstract class PrimitiveCharEntity
implements
HasAsciiDocDescription,
- WrapperDoubleHolder2,
- ValueHolder<Double> {
+ PrimitiveCharHolder2,
+ ValueHolder<Character> {
+
+ @Override
+ public Character value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/booleans/jdo/PrimitiveBooleanJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharSeeding.java
index a4a7c0a..d2c23f4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/persistence/PrimitiveCharSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.chars.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveCharSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveCharSeeding(ValueHolderRepository<Character, ? extends PrimitiveCharEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.java
index 62b50f9..c76b431 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.doubles.holder.PrimitiveDoubleHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.doubles.persistence.PrimitiveDoubleEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveDoubleJdo"
+ objectType = "demo.PrimitiveDoubleEntity"
)
public class PrimitiveDoubleJdo // <.>
- implements HasAsciiDocDescription, PrimitiveDoubleHolder2 {
+ extends PrimitiveDoubleEntity {
//end::class[]
public PrimitiveDoubleJdo(double initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoEntities.java
index 8a284ff..b0e520d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveDoubleJdoEntities {
+public class PrimitiveDoubleJdoEntities
+extends ValueHolderRepository<Double, PrimitiveDoubleJdo> {
- public Optional<PrimitiveDoubleJdo> find(final double readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveDoubleJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveDoubleJdoEntities() {
+ super(PrimitiveDoubleJdo.class);
}
- public List<PrimitiveDoubleJdo> all() {
- return repositoryService.allInstances(PrimitiveDoubleJdo.class);
+ @Override
+ protected PrimitiveDoubleJdo newDetachedEntity(Double value) {
+ return new PrimitiveDoubleJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoSeedService.java
deleted file mode 100644
index e905910..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdoSeedService.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.primitive.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 PrimitiveDoubleJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveDoubleJdoSeedService() {
- super(PrimitiveDoubleJdoEntityFixture::new);
- }
-
- static class PrimitiveDoubleJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveDoubleJdo::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/doubles/persistence/WrapperDoubleEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleEntity.java
similarity index 73%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleEntity.java
index 49f3a6b..12b8346 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.doubles.persistence;
+package demoapp.dom.types.primitive.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;
+import demoapp.dom.types.primitive.doubles.holder.PrimitiveDoubleHolder2;
@DomainObject(
- objectType = "demo.WrapperDoubleEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveDoubleEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperDoubleEntity
+public abstract class PrimitiveDoubleEntity
implements
HasAsciiDocDescription,
- WrapperDoubleHolder2,
+ PrimitiveDoubleHolder2,
ValueHolder<Double> {
+ @Override
+ public Double value() {
+ return getReadOnlyProperty();
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleSeeding.java
similarity index 63%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleSeeding.java
index a4a7c0a..b8e2d24 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/persistence/PrimitiveDoubleSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.doubles.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveDoubleSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveDoubleSeeding(ValueHolderRepository<Double, ? extends PrimitiveDoubleEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.java
index 7f19af3..54f323e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.floats.holder.PrimitiveFloatHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.floats.persistence.PrimitiveFloatEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveFloatJdo"
+ objectType = "demo.PrimitiveFloatEntity"
)
public class PrimitiveFloatJdo // <.>
- implements HasAsciiDocDescription, PrimitiveFloatHolder2 {
+ extends PrimitiveFloatEntity {
//end::class[]
public PrimitiveFloatJdo(float initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoEntities.java
index 54bc921..c820d1a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveFloatJdoEntities {
+public class PrimitiveFloatJdoEntities
+extends ValueHolderRepository<Float, PrimitiveFloatJdo> {
- public Optional<PrimitiveFloatJdo> find(final float readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveFloatJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveFloatJdoEntities() {
+ super(PrimitiveFloatJdo.class);
}
- public List<PrimitiveFloatJdo> all() {
- return repositoryService.allInstances(PrimitiveFloatJdo.class);
+ @Override
+ protected PrimitiveFloatJdo newDetachedEntity(Float value) {
+ return new PrimitiveFloatJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoSeedService.java
deleted file mode 100644
index 6c40365..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdoSeedService.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.primitive.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 PrimitiveFloatJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveFloatJdoSeedService() {
- super(PrimitiveFloatJdoEntityFixture::new);
- }
-
- static class PrimitiveFloatJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveFloatJdo::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/strings/persistence/JavaLangStringEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatEntity.java
index eda96b7..4bc6a56 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.strings.persistence;
+package demoapp.dom.types.primitive.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.strings.holder.JavaLangStringHolder2;
+import demoapp.dom.types.primitive.floats.holder.PrimitiveFloatHolder2;
@DomainObject(
- objectType = "demo.JavaLangStringEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveFloatEntity" // shared permissions with concrete sub class
)
-public abstract class JavaLangStringEntity
+public abstract class PrimitiveFloatEntity
implements
HasAsciiDocDescription,
- JavaLangStringHolder2,
- ValueHolder<String> {
+ PrimitiveFloatHolder2,
+ ValueHolder<Float> {
+
+ @Override
+ public Float value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatSeeding.java
index a4a7c0a..bd959e3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/persistence/PrimitiveFloatSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.floats.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveFloatSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveFloatSeeding(ValueHolderRepository<Float, ? extends PrimitiveFloatEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.java
index 7706cc5..ca4e6e8 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.ints.holder.PrimitiveIntHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.ints.persistence.PrimitiveIntEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveIntJdo"
+ objectType = "demo.PrimitiveIntEntity"
)
public class PrimitiveIntJdo // <.>
- implements HasAsciiDocDescription, PrimitiveIntHolder2 {
+ extends PrimitiveIntEntity {
//end::class[]
public PrimitiveIntJdo(int initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoEntities.java
index 60c0620..83bdc68 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.ints.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 PrimitiveIntJdoEntities {
+public class PrimitiveIntJdoEntities
+extends ValueHolderRepository<Integer, PrimitiveIntJdo> {
- public Optional<PrimitiveIntJdo> find(final int readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveIntJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveIntJdoEntities() {
+ super(PrimitiveIntJdo.class);
}
- public List<PrimitiveIntJdo> all() {
- return repositoryService.allInstances(PrimitiveIntJdo.class);
+ @Override
+ protected PrimitiveIntJdo newDetachedEntity(Integer value) {
+ return new PrimitiveIntJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoSeedService.java
deleted file mode 100644
index 708bb26..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdoSeedService.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.primitive.ints.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 PrimitiveIntJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveIntJdoSeedService() {
- super(PrimitiveIntJdoEntityFixture::new);
- }
-
- static class PrimitiveIntJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveIntJdo::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/floats/persistence/WrapperFloatEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntEntity.java
index 69c54fb..115304a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/floats/persistence/WrapperFloatEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.floats.persistence;
+package demoapp.dom.types.primitive.ints.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;
+import demoapp.dom.types.primitive.ints.holder.PrimitiveIntHolder2;
@DomainObject(
- objectType = "demo.WrapperFloatEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveIntEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperFloatEntity
+public abstract class PrimitiveIntEntity
implements
HasAsciiDocDescription,
- WrapperFloatHolder2,
- ValueHolder<Float> {
+ PrimitiveIntHolder2,
+ ValueHolder<Integer> {
+
+ @Override
+ public Integer value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/jdo/PrimitiveIntJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntSeeding.java
index a4a7c0a..7a5ddea 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/ints/persistence/PrimitiveIntSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.ints.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveIntSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveIntSeeding(ValueHolderRepository<Integer, ? extends PrimitiveIntEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.java
index ead4556..921d5ee 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.longs.holder.PrimitiveLongHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.longs.persistence.PrimitiveLongEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveLongJdo"
+ objectType = "demo.PrimitiveLongEntity"
)
public class PrimitiveLongJdo // <.>
- implements HasAsciiDocDescription, PrimitiveLongHolder2 {
+ extends PrimitiveLongEntity {
//end::class[]
public PrimitiveLongJdo(long initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoEntities.java
index ec9a377..31780fd 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveLongJdoEntities {
+public class PrimitiveLongJdoEntities
+extends ValueHolderRepository<Long, PrimitiveLongJdo> {
- public Optional<PrimitiveLongJdo> find(final long readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveLongJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveLongJdoEntities() {
+ super(PrimitiveLongJdo.class);
}
- public List<PrimitiveLongJdo> all() {
- return repositoryService.allInstances(PrimitiveLongJdo.class);
+ @Override
+ protected PrimitiveLongJdo newDetachedEntity(Long value) {
+ return new PrimitiveLongJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoSeedService.java
deleted file mode 100644
index cdeba55..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/jdo/PrimitiveLongJdoSeedService.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.primitive.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 PrimitiveLongJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveLongJdoSeedService() {
- super(PrimitiveLongJdoEntityFixture::new);
- }
-
- static class PrimitiveLongJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveLongJdo::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/doubles/persistence/WrapperDoubleEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongEntity.java
index 49f3a6b..56a18c5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/doubles/persistence/WrapperDoubleEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.doubles.persistence;
+package demoapp.dom.types.primitive.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.doubles.holder.WrapperDoubleHolder2;
+import demoapp.dom.types.primitive.longs.holder.PrimitiveLongHolder2;
@DomainObject(
- objectType = "demo.WrapperDoubleEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveLongEntity" // shared permissions with concrete sub class
)
-public abstract class WrapperDoubleEntity
+public abstract class PrimitiveLongEntity
implements
HasAsciiDocDescription,
- WrapperDoubleHolder2,
- ValueHolder<Double> {
+ PrimitiveLongHolder2,
+ ValueHolder<Long> {
+
+ @Override
+ public Long value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/floats/jdo/PrimitiveFloatJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongSeeding.java
index a4a7c0a..29ba173 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/longs/persistence/PrimitiveLongSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.longs.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveLongSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveLongSeeding(ValueHolderRepository<Long, ? extends PrimitiveLongEntity> entities) {
+ super(entities);
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.java
index b91962a..312ce9e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdo.java
@@ -23,25 +23,28 @@ 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.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.primitive.shorts.holder.PrimitiveShortHolder2;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.types.primitive.shorts.persistence.PrimitiveShortEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
- objectType = "demo.PrimitiveShortJdo"
+ objectType = "demo.PrimitiveShortEntity"
)
public class PrimitiveShortJdo // <.>
- implements HasAsciiDocDescription, PrimitiveShortHolder2 {
+ extends PrimitiveShortEntity {
//end::class[]
public PrimitiveShortJdo(short initialValue) {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoEntities.java
index d9e58ff..3f282b3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoEntities.java
@@ -18,27 +18,23 @@
*/
package demoapp.dom.types.primitive.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 PrimitiveShortJdoEntities {
+public class PrimitiveShortJdoEntities
+extends ValueHolderRepository<Short, PrimitiveShortJdo> {
- public Optional<PrimitiveShortJdo> find(final short readOnlyProperty) {
- return repositoryService.firstMatch(PrimitiveShortJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ protected PrimitiveShortJdoEntities() {
+ super(PrimitiveShortJdo.class);
}
- public List<PrimitiveShortJdo> all() {
- return repositoryService.allInstances(PrimitiveShortJdo.class);
+ @Override
+ protected PrimitiveShortJdo newDetachedEntity(Short value) {
+ return new PrimitiveShortJdo(value);
}
- @Inject
- RepositoryService repositoryService;
-
-}
+}
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoSeedService.java
deleted file mode 100644
index 7efd9d0..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/jdo/PrimitiveShortJdoSeedService.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.primitive.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 PrimitiveShortJdoSeedService extends SeedServiceAbstract {
-
- public PrimitiveShortJdoSeedService() {
- super(PrimitiveShortJdoEntityFixture::new);
- }
-
- static class PrimitiveShortJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(PrimitiveShortJdo::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/strings/persistence/JavaLangStringEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortEntity.java
similarity index 74%
copy from examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortEntity.java
index eda96b7..dc341b8 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/persistence/JavaLangStringEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortEntity.java
@@ -16,21 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.types.javalang.strings.persistence;
+package demoapp.dom.types.primitive.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.strings.holder.JavaLangStringHolder2;
+import demoapp.dom.types.primitive.shorts.holder.PrimitiveShortHolder2;
@DomainObject(
- objectType = "demo.JavaLangStringEntity" // shared permissions with concrete sub class
+ objectType = "demo.PrimitiveShortEntity" // shared permissions with concrete sub class
)
-public abstract class JavaLangStringEntity
+public abstract class PrimitiveShortEntity
implements
HasAsciiDocDescription,
- JavaLangStringHolder2,
- ValueHolder<String> {
+ PrimitiveShortHolder2,
+ ValueHolder<Short> {
+
+ @Override
+ public Short value() {
+ return getReadOnlyProperty();
+ }
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/types/primitive/doubles/jdo/PrimitiveDoubleJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortSeeding.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortSeeding.java
index a4a7c0a..4034ca6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/values/ValueHolder.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/shorts/persistence/PrimitiveShortSeeding.java
@@ -16,10 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom._infra.values;
+package demoapp.dom.types.primitive.shorts.persistence;
-public interface ValueHolder<T> {
+import javax.inject.Inject;
- T getReadOnlyProperty();
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Service
+public class PrimitiveShortSeeding extends SeedServiceAbstract {
+
+ @Inject
+ public PrimitiveShortSeeding(ValueHolderRepository<Short, ? extends PrimitiveShortEntity> entities) {
+ super(entities);
+ }
}