You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/05/27 09:54:07 UTC
[isis] branch master updated: ISIS-2513: Demo: add JPA support for
ActionCommandPublishing
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 2553570 ISIS-2513: Demo: add JPA support for ActionCommandPublishing
2553570 is described below
commit 2553570af486f3159d70acaac97d11bb2cf05318
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 27 11:53:50 2021 +0200
ISIS-2513: Demo: add JPA support for ActionCommandPublishing
---
.../src/main/java/demoapp/dom/DemoModuleJpa.java | 3 ++
.../dom/domain/actions/Action/ActionMenu.java | 10 ++--
.../ActionCommandPublishingEntity.java | 50 +++++++++++++++++++
...ml => ActionCommandPublishingEntity.layout.xml} | 0
...mmandPublishingEntity_mixinUpdateProperty.java} | 16 +++---
...Entity_mixinUpdatePropertyCommandDisabled.java} | 13 ++---
...gEntity_mixinUpdatePropertyMetaAnnotation.java} | 12 ++---
...xinUpdatePropertyMetaAnnotationOverridden.java} | 12 ++---
.../ActionCommandPublishingJdoSeedService.java | 57 ----------------------
...es.java => ActionCommandPublishingSeeding.java} | 27 +++-------
.../ActionCommandPublishingJdo-description.adoc | 10 ++--
.../{ => jdo}/ActionCommandPublishingJdo.java | 15 ++++--
.../ActionCommandPublishingJdoEntities.java | 31 +++++-------
.../ActionCommandPublishingJpa-description.adoc} | 18 +++----
.../ActionCommandPublishingJpa.java} | 55 +++++++++++++--------
.../ActionCommandPublishingJpaEntities.java} | 31 +++++-------
16 files changed, 173 insertions(+), 187 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
index 9f1b90e..3948c48 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Profile;
import org.apache.isis.extensions.commandlog.jpa.IsisModuleExtCommandLogJpa;
import org.apache.isis.persistence.jpa.eclipselink.IsisModuleJpaEclipselink;
+import demoapp.dom.domain.actions.Action.commandPublishing.jpa.ActionCommandPublishingJpa;
import demoapp.dom.services.core.wrapperFactory.jpa.WrapperFactoryJpa;
import demoapp.dom.services.extensions.secman.apptenancy.jpa.TenantedJpa;
import demoapp.dom.types.isis.blobs.jpa.IsisBlobJpa;
@@ -121,6 +122,8 @@ import demoapp.dom.types.primitive.shorts.jpa.PrimitiveShortJpa;
TenantedJpa.class,
WrapperFactoryJpa.class,
+ ActionCommandPublishingJpa.class,
+
})
public class DemoModuleJpa {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
index 2d68ebc..ebb3da2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/ActionMenu.java
@@ -30,10 +30,10 @@ import lombok.RequiredArgsConstructor;
import lombok.val;
import demoapp.dom._infra.samples.NameSamples;
+import demoapp.dom._infra.values.ValueHolderRepository;
import demoapp.dom.domain.actions.Action.associateWith.ActionAssociateWithVm;
import demoapp.dom.domain.actions.Action.associateWith.child.ActionAssociateWithChildVm;
-import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingJdo;
-import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingJdoEntities;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingEntity;
import demoapp.dom.domain.actions.Action.domainEvent.ActionDomainEventVm;
import demoapp.dom.domain.actions.Action.executionPublishing.ActionExecutionPublishingJdo;
import demoapp.dom.domain.actions.Action.executionPublishing.ActionExecutionPublishingJdoEntities;
@@ -47,7 +47,7 @@ import demoapp.dom.domain.actions.Action.typeOf.child.ActionTypeOfChildVm;
@RequiredArgsConstructor(onConstructor_ = {@Inject})
public class ActionMenu {
- final ActionCommandPublishingJdoEntities actionCommandJdoEntities;
+ final ValueHolderRepository<String, ? extends ActionCommandPublishingEntity> actionCommandEntities;
final ActionExecutionPublishingJdoEntities actionPublishingJdoEntities;
final NameSamples samples;
@@ -71,8 +71,8 @@ public class ActionMenu {
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-terminal", describedAs = "Action invocation intentions as XML")
- public ActionCommandPublishingJdo commandPublishing(){
- return actionCommandJdoEntities.first();
+ public ActionCommandPublishingEntity commandPublishing(){
+ return actionCommandEntities.first().orElse(null);
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity.java
new file mode 100644
index 0000000..823a28d
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demoapp.dom.domain.actions.Action.commandPublishing;
+
+import org.apache.isis.applib.annotation.DomainObject;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom.domain._commands.ExposePersistedCommands;
+
+@DomainObject(
+ logicalTypeName = "demo.ActionCommandPublishingEntity" // shared permissions with concrete sub class
+)
+public abstract class ActionCommandPublishingEntity
+implements
+ HasAsciiDocDescription,
+ ExposePersistedCommands,
+ ValueHolder<String> {
+
+ public abstract String getProperty();
+ public abstract void setProperty(String value);
+
+ @Override
+ public String value() {
+ return getProperty();
+ }
+ protected abstract void setPropertyCommandDisabled(String value);
+ protected abstract String getPropertyCommandDisabled();
+ protected abstract String getPropertyMetaAnnotated();
+ protected abstract void setPropertyMetaAnnotated(String value);
+ protected abstract String getPropertyMetaAnnotatedOverridden();
+ protected abstract void setPropertyMetaAnnotatedOverridden(String value);
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdateProperty.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdateProperty.java
similarity index 74%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdateProperty.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdateProperty.java
index 09b6ade..7550009 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdateProperty.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdateProperty.java
@@ -34,22 +34,22 @@ import org.apache.isis.applib.annotation.SemanticsOf;
, associateWith = "property"
, sequence = "2"
)
-public class ActionCommandPublishingJdo_mixinUpdateProperty {
+public class ActionCommandPublishingEntity_mixinUpdateProperty {
// ...
//end::class[]
- private final ActionCommandPublishingJdo actionCommandJdo;
+ private final ActionCommandPublishingEntity actionCommandEntity;
- public ActionCommandPublishingJdo_mixinUpdateProperty(ActionCommandPublishingJdo actionCommandJdo) {
- this.actionCommandJdo = actionCommandJdo;
+ public ActionCommandPublishingEntity_mixinUpdateProperty(ActionCommandPublishingEntity actionCommandEntity) {
+ this.actionCommandEntity = actionCommandEntity;
}
- public ActionCommandPublishingJdo act(final String value) {
- actionCommandJdo.setProperty(value);
- return actionCommandJdo;
+ public ActionCommandPublishingEntity act(final String value) {
+ actionCommandEntity.setProperty(value);
+ return actionCommandEntity;
}
public String default0Act() {
- return actionCommandJdo.getProperty();
+ return actionCommandEntity.getProperty();
}
//tag::class[]
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled.java
similarity index 80%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled.java
index d8a6906..1d84129 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled.java
@@ -25,6 +25,7 @@ import org.apache.isis.applib.annotation.SemanticsOf;
import lombok.RequiredArgsConstructor;
+
//tag::class[]
@Action(
commandPublishing = Publishing.DISABLED // <.>
@@ -37,18 +38,18 @@ import lombok.RequiredArgsConstructor;
, sequence = "2"
)
@RequiredArgsConstructor
-public class ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled {
+public class ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled {
// ...
//end::class[]
- private final ActionCommandPublishingJdo actionCommandJdo;
+ private final ActionCommandPublishingEntity actionCommandEntity;
- public ActionCommandPublishingJdo act(final String value) {
- actionCommandJdo.setPropertyCommandDisabled(value);
- return actionCommandJdo;
+ public ActionCommandPublishingEntity act(final String value) {
+ actionCommandEntity.setPropertyCommandDisabled(value);
+ return actionCommandEntity;
}
public String default0Act() {
- return actionCommandJdo.getPropertyCommandDisabled();
+ return actionCommandEntity.getPropertyCommandDisabled();
}
//tag::class[]
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation.java
similarity index 80%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation.java
index d624121..5616c64 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation.java
@@ -36,18 +36,18 @@ import lombok.RequiredArgsConstructor;
, sequence = "2"
)
@RequiredArgsConstructor
-public class ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation {
+public class ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation {
// ...
//end::class[]
- private final ActionCommandPublishingJdo actionCommandJdo;
+ private final ActionCommandPublishingEntity actionCommandEntity;
- public ActionCommandPublishingJdo act(final String value) {
- actionCommandJdo.setPropertyMetaAnnotated(value);
- return actionCommandJdo;
+ public ActionCommandPublishingEntity act(final String value) {
+ actionCommandEntity.setPropertyMetaAnnotated(value);
+ return actionCommandEntity;
}
public String default0Act() {
- return actionCommandJdo.getPropertyMetaAnnotated();
+ return actionCommandEntity.getPropertyMetaAnnotated();
}
//tag::class[]
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden.java
similarity index 80%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden.java
index d95f3e4..71c0d02 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden.java
@@ -40,18 +40,18 @@ import lombok.RequiredArgsConstructor;
, sequence = "2"
)
@RequiredArgsConstructor
-public class ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden {
+public class ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden {
// ...
//end::class[]
- private final ActionCommandPublishingJdo actionCommandJdo;
+ private final ActionCommandPublishingEntity actionCommandEntity;
- public ActionCommandPublishingJdo act(final String value) {
- actionCommandJdo.setPropertyMetaAnnotatedOverridden(value);
- return actionCommandJdo;
+ public ActionCommandPublishingEntity act(final String value) {
+ actionCommandEntity.setPropertyMetaAnnotatedOverridden(value);
+ return actionCommandEntity;
}
public String default0Act() {
- return actionCommandJdo.getPropertyMetaAnnotatedOverridden();
+ return actionCommandEntity.getPropertyMetaAnnotatedOverridden();
}
//tag::class[]
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoSeedService.java
deleted file mode 100644
index 385aaa1..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoSeedService.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.domain.actions.Action.commandPublishing;
-
-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 ActionCommandPublishingJdoSeedService extends SeedServiceAbstract {
-
- public ActionCommandPublishingJdoSeedService() {
- super(PropertyPublishingJdoEntityFixture::new);
- }
-
- static class PropertyPublishingJdoEntityFixture extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- samples.stream()
- .map(ActionCommandPublishingJdo::new)
- .forEach(domainObject -> {
- repositoryService.persist(domainObject);
- executionContext.addResult(this, domainObject);
- });
-
- }
-
- @Inject
- RepositoryService repositoryService;
-
- @Inject
- Samples<String> samples;
- }
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingSeeding.java
similarity index 59%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingSeeding.java
index b8d922d..494d51f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingSeeding.java
@@ -18,32 +18,21 @@
*/
package demoapp.dom.domain.actions.Action.commandPublishing;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
import javax.inject.Inject;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom._infra.values.ValueHolderRepository;
@Service
-public class ActionCommandPublishingJdoEntities {
-
- public Optional<ActionCommandPublishingJdo> find(final String value) {
- return repositoryService.firstMatch(ActionCommandPublishingJdo.class, x -> Objects.equals(x.getProperty(), value));
- }
-
- public List<ActionCommandPublishingJdo> all() {
- return repositoryService.allInstances(ActionCommandPublishingJdo.class);
- }
-
- public ActionCommandPublishingJdo first() {
- return all().stream().findFirst().get();
- }
+public class ActionCommandPublishingSeeding
+extends SeedServiceAbstract {
@Inject
- RepositoryService repositoryService;
+ public ActionCommandPublishingSeeding(ValueHolderRepository<String, ? extends ActionCommandPublishingEntity> entities) {
+ super(entities);
+ }
}
+
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo-description.adoc
similarity index 94%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo-description.adoc
index 6b14a12..fdb04e2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo-description.adoc
@@ -33,7 +33,7 @@ include::ActionCommandPublishingJdo.java[tags=annotation]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdateProperty.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdateProperty.java[tags=class]
----
<.> explicitly specifies that invoking the mixin action should be reified.
@@ -51,7 +51,7 @@ include::ActionCommandPublishingJdo.java[tags=annotation-2]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled.java[tags=class]
----
<.> explicitly specifies that invoking the mixin action should not be reified.
@@ -64,7 +64,7 @@ The `command` element can also be specified using a custom meta-annotation:
+
[source,java,indent=0]
----
-include::ActionCommandPublishingEnabledMetaAnnotation.java[tags=class]
+include::../ActionCommandPublishingEnabledMetaAnnotation.java[tags=class]
----
<.> annotated for an action
<.> annotation can be applied to an action method or to a mixin
@@ -81,7 +81,7 @@ include::ActionCommandPublishingJdo.java[tags=meta-annotation]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation.java[tags=class]
----
<.> semantic is inherited from the meta-annotation
@@ -103,7 +103,7 @@ include::ActionCommandPublishingJdo.java[tags=meta-annotation-overridden]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden.java[tags=class]
----
<.> semantic from meta-annotation ...
<.> \... is overridden by the `@Action` annotation
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo.java
similarity index 91%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo.java
index 50abf1a..469bd89 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdo.java
@@ -16,13 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.actions.Action.commandPublishing;
+package demoapp.dom.domain.actions.Action.commandPublishing.jdo;
import javax.jdo.annotations.DatastoreIdentity;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
+import org.springframework.context.annotation.Profile;
+
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.DomainObject;
@@ -33,21 +35,24 @@ import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._commands.ExposePersistedCommands;
import lombok.Getter;
import lombok.Setter;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingDisabledMetaAnnotation;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingEnabledMetaAnnotation;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingEntity;
+
+@Profile("demo-jdo")
//tag::class[]
@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(
nature=Nature.ENTITY
- , logicalTypeName = "demo.ActionCommandJdo"
+ , logicalTypeName = "demo.ActionCommandPublishingEntity"
, editing = Editing.DISABLED
)
public class ActionCommandPublishingJdo
- implements HasAsciiDocDescription, ExposePersistedCommands {
+ extends ActionCommandPublishingEntity {
// ...
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdoEntities.java
similarity index 54%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdoEntities.java
index b8d922d..f21cbd3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jdo/ActionCommandPublishingJdoEntities.java
@@ -16,34 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.actions.Action.commandPublishing;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.inject.Inject;
+package demoapp.dom.domain.actions.Action.commandPublishing.jdo;
+import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.values.ValueHolderRepository;
+@Profile("demo-jdo")
@Service
-public class ActionCommandPublishingJdoEntities {
+public class ActionCommandPublishingJdoEntities
+extends ValueHolderRepository<String, ActionCommandPublishingJdo> {
- public Optional<ActionCommandPublishingJdo> find(final String value) {
- return repositoryService.firstMatch(ActionCommandPublishingJdo.class, x -> Objects.equals(x.getProperty(), value));
+ protected ActionCommandPublishingJdoEntities() {
+ super(ActionCommandPublishingJdo.class);
}
- public List<ActionCommandPublishingJdo> all() {
- return repositoryService.allInstances(ActionCommandPublishingJdo.class);
+ @Override
+ protected ActionCommandPublishingJdo newDetachedEntity(String value) {
+ return new ActionCommandPublishingJdo(value);
}
- public ActionCommandPublishingJdo first() {
- return all().stream().findFirst().get();
- }
-
- @Inject
- RepositoryService repositoryService;
-
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa-description.adoc
similarity index 90%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa-description.adoc
index 6b14a12..88dc52a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa-description.adoc
@@ -25,7 +25,7 @@ The `command` element can be specified explicitly using an annotation through `@
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo.java[tags=annotation]
+include::ActionCommandPublishingJpa.java[tags=annotation]
----
<.> explicitly specifies that invoking the action should be reified .
@@ -33,7 +33,7 @@ include::ActionCommandPublishingJdo.java[tags=annotation]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdateProperty.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdateProperty.java[tags=class]
----
<.> explicitly specifies that invoking the mixin action should be reified.
@@ -43,7 +43,7 @@ The command reification can also be disabled:
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo.java[tags=annotation-2]
+include::ActionCommandPublishingJpa.java[tags=annotation-2]
----
<.> explicitly specifies that invoking the action should not be reified.
@@ -51,7 +51,7 @@ include::ActionCommandPublishingJdo.java[tags=annotation-2]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyCommandDisabled.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyCommandDisabled.java[tags=class]
----
<.> explicitly specifies that invoking the mixin action should not be reified.
@@ -64,7 +64,7 @@ The `command` element can also be specified using a custom meta-annotation:
+
[source,java,indent=0]
----
-include::ActionCommandPublishingEnabledMetaAnnotation.java[tags=class]
+include::../ActionCommandPublishingEnabledMetaAnnotation.java[tags=class]
----
<.> annotated for an action
<.> annotation can be applied to an action method or to a mixin
@@ -73,7 +73,7 @@ include::ActionCommandPublishingEnabledMetaAnnotation.java[tags=class]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo.java[tags=meta-annotation]
+include::ActionCommandPublishingJpa.java[tags=meta-annotation]
----
<.> semantic is inherited from the meta-annotation
@@ -81,7 +81,7 @@ include::ActionCommandPublishingJdo.java[tags=meta-annotation]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotation.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotation.java[tags=class]
----
<.> semantic is inherited from the meta-annotation
@@ -94,7 +94,7 @@ The meta-annotation can itself be overridden:
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo.java[tags=meta-annotation-overridden]
+include::ActionCommandPublishingJpa.java[tags=meta-annotation-overridden]
----
<.> semantic from meta-annotation ...
<.> \... is overridden by the `@Action` annotation
@@ -103,7 +103,7 @@ include::ActionCommandPublishingJdo.java[tags=meta-annotation-overridden]
+
[source,java,indent=0]
----
-include::ActionCommandPublishingJdo_mixinUpdatePropertyMetaAnnotationOverridden.java[tags=class]
+include::../ActionCommandPublishingEntity_mixinUpdatePropertyMetaAnnotationOverridden.java[tags=class]
----
<.> semantic from meta-annotation ...
<.> \... is overridden by the `@Action` annotation
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa.java
similarity index 78%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa.java
index 50abf1a..d80b8ee 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdo.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpa.java
@@ -16,42 +16,51 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.actions.Action.commandPublishing;
+package demoapp.dom.domain.actions.Action.commandPublishing.jpa;
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.PersistenceCapable;
+import javax.persistence.Entity;
+import javax.persistence.EntityListeners;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.springframework.context.annotation.Profile;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.DomainObject;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.persistence.jpa.applib.integration.JpaEntityInjectionPointResolver;
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._commands.ExposePersistedCommands;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingDisabledMetaAnnotation;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingEnabledMetaAnnotation;
+import demoapp.dom.domain.actions.Action.commandPublishing.ActionCommandPublishingEntity;
+
+@Profile("demo-jpa")
//tag::class[]
-@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
-@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
+@Entity
+@Table(
+ schema = "demo",
+ name = "ActionCommandPublishingJpa"
+)
+@EntityListeners(JpaEntityInjectionPointResolver.class)
@DomainObject(
- nature=Nature.ENTITY
- , logicalTypeName = "demo.ActionCommandJdo"
- , editing = Editing.DISABLED
+ logicalTypeName = "demo.ActionCommandPublishingEntity"
)
-public class ActionCommandPublishingJdo
- implements HasAsciiDocDescription, ExposePersistedCommands {
+@NoArgsConstructor
+public class ActionCommandPublishingJpa
+ extends ActionCommandPublishingEntity {
// ...
//end::class[]
- public ActionCommandPublishingJdo(String initialValue) {
+ public ActionCommandPublishingJpa(String initialValue) {
this.property = initialValue;
this.propertyCommandDisabled = initialValue;
this.propertyMetaAnnotated = initialValue;
@@ -62,6 +71,10 @@ public class ActionCommandPublishingJdo
return "Action#command";
}
+ @Id
+ @GeneratedValue
+ private Long id;
+
//tag::property[]
@Property()
@PropertyLayout(fieldSetId = "annotation", sequence = "1")
@@ -95,7 +108,7 @@ public class ActionCommandPublishingJdo
, associateWith = "property"
, sequence = "1"
)
- public ActionCommandPublishingJdo updatePropertyUsingAnnotation(final String value) {
+ public ActionCommandPublishingJpa updatePropertyUsingAnnotation(final String value) {
// ...
//end::annotation[]
setProperty(value);
@@ -118,7 +131,7 @@ public class ActionCommandPublishingJdo
, associateWith = "propertyCommandDisabled"
, sequence = "1"
)
- public ActionCommandPublishingJdo updatePropertyCommandDisabledUsingAnnotation(final String value) {
+ public ActionCommandPublishingJpa updatePropertyCommandDisabledUsingAnnotation(final String value) {
// ...
//end::annotation-2[]
setPropertyCommandDisabled(value);
@@ -141,7 +154,7 @@ public class ActionCommandPublishingJdo
, associateWith = "propertyMetaAnnotated"
, sequence = "1"
)
- public ActionCommandPublishingJdo updatePropertyUsingMetaAnnotation(final String value) {
+ public ActionCommandPublishingJpa updatePropertyUsingMetaAnnotation(final String value) {
// ...
//end::meta-annotation[]
setPropertyMetaAnnotated(value);
@@ -166,7 +179,7 @@ public class ActionCommandPublishingJdo
, associateWith = "propertyMetaAnnotatedOverridden"
, sequence = "1"
)
- public ActionCommandPublishingJdo updatePropertyUsingMetaAnnotationButOverridden(final String value) {
+ public ActionCommandPublishingJpa updatePropertyUsingMetaAnnotationButOverridden(final String value) {
// ...
//end::meta-annotation-overridden[]
setPropertyMetaAnnotatedOverridden(value);
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpaEntities.java
similarity index 54%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpaEntities.java
index b8d922d..614e53c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/ActionCommandPublishingJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/commandPublishing/jpa/ActionCommandPublishingJpaEntities.java
@@ -16,34 +16,25 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.actions.Action.commandPublishing;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.inject.Inject;
+package demoapp.dom.domain.actions.Action.commandPublishing.jpa;
+import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
-import org.apache.isis.applib.services.repository.RepositoryService;
+import demoapp.dom._infra.values.ValueHolderRepository;
+@Profile("demo-jpa")
@Service
-public class ActionCommandPublishingJdoEntities {
+public class ActionCommandPublishingJpaEntities
+extends ValueHolderRepository<String, ActionCommandPublishingJpa> {
- public Optional<ActionCommandPublishingJdo> find(final String value) {
- return repositoryService.firstMatch(ActionCommandPublishingJdo.class, x -> Objects.equals(x.getProperty(), value));
+ protected ActionCommandPublishingJpaEntities() {
+ super(ActionCommandPublishingJpa.class);
}
- public List<ActionCommandPublishingJdo> all() {
- return repositoryService.allInstances(ActionCommandPublishingJdo.class);
+ @Override
+ protected ActionCommandPublishingJpa newDetachedEntity(String value) {
+ return new ActionCommandPublishingJpa(value);
}
- public ActionCommandPublishingJdo first() {
- return all().stream().findFirst().get();
- }
-
- @Inject
- RepositoryService repositoryService;
-
}