You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2026/10/02 08:46:05 UTC
(causeway) 02/02: CAUSEWAY-4070: ports configurable pessimistic JPA locking to main
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-4070-v4
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit b2a9e8a95567b308b1c30a6b169885855ff375cd
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Oct 2 09:45:55 2026 +0100
CAUSEWAY-4070: ports configurable pessimistic JPA locking to main
---
.../pages/index/annotation/DomainObject.adoc | 15 ++
.../annotation/hooks/DomainObject_030-locking.adoc | 103 ++++++++
.../causeway/applib/annotation/DomainObject.java | 14 ++
.../apache/causeway/applib/annotation/Locking.java | 36 ++-
.../core/config/CausewayConfiguration.java | 8 +
.../facets/DomainObjectConfigOptions.java | 5 +
.../config/CausewayConfiguration_locking_Test.java | 52 ++++
core/metamodel/src/main/java/module-info.java | 1 +
.../DomainObjectAnnotationFacetFactory.java | 8 +
.../LockingFacetForDomainObjectAnnotation.java | 50 ++++
...acetForDomainObjectAnnotationAsConfigured.java} | 26 +-
.../locking/LockingFacetFromConfiguration.java} | 27 +-
.../facets/object/locking/LockingFacet.java} | 26 +-
.../object/locking/LockingFacetAbstract.java} | 32 +--
...bjectAnnotationFacetFactoryRegressionTest.java} | 25 +-
.../DomainObjectLockingFacetFactoryTest.java | 99 ++++++++
...hPdfJsViewer_IntegTest.dump_facets.approved.xml | 10 +
..._MixinDomain_IntegTest.dump_facets.approved.xml | 10 +
...hPdfjsViewer_IntegTest.dump_facets.approved.xml | 5 +
...r_PropDomain_IntegTest.dump_facets.approved.xml | 5 +
.../changes/port-domain-object-locking/design.md | 7 +-
.../changes/port-domain-object-locking/tasks.md | 58 +++--
.../jpa/integration/entity/JpaEntityFacet.java | 9 +-
.../entity/JpaEntityFacetLockingTest.java | 129 ++++++++++
.../jpa/entities/JpaCallbackOrchestration.java | 65 +++++
.../MetaModelRegressionTest.verify.approved.xml | 275 +++++++++++++++++++++
.../persistence/jpa/JpaPessimisticLockingTest.java | 266 ++++++++++++++++++++
.../ObjectActionArgHelperReferenceTest.java | 117 +++++++++
28 files changed, 1341 insertions(+), 142 deletions(-)
diff --git a/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc b/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
index 827cfc8c092..277a5350f9d 100644
--- a/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
+++ b/antora/components/refguide-index/modules/applib/pages/index/annotation/DomainObject.adoc
@@ -19,6 +19,7 @@ If - for the currently logged on user - none of the domain object's members are
String editingDisabledReason() default ""; // <.>
Publishing entityChangePublishing() default Publishing.NOT_SPECIFIED; // <.>
Introspection introspection() default Introspection.NOT_SPECIFIED; // <.>
+ Locking locking() default Locking.DEFAULT; // <.>
String mixinMethod() default "$$"; // <.>
Nature nature() default Nature.NOT_SPECIFIED; // <.>
Class<? extends ObjectCreatedEvent<?>> createdLifecycleEvent() default ObjectCreatedEvent.Default.class; // <.>
@@ -78,6 +79,11 @@ Whether entity changes (persistent property updates) should be published to _org
--
Controls on a per class basis, how meta-model class introspection should process members, supporting methods and callback methods.
--
+<.> xref:#locking[locking]
++
+--
+Locking policy for Causeway JPA bookmark loads, including REST entity reference parameters.
+--
<.> xref:#mixinMethod[mixinMethod]
+
--
@@ -213,6 +219,13 @@ Whether entity changes (persistent property updates) should be published to _org
Controls on a per class basis, how meta-model class introspection should process members, supporting methods and callback methods.
+[#locking]
+=== locking
+
+Selects the locking policy for Causeway JPA bookmark loads.
+Defaults to `Locking.DEFAULT`, allowing inherited or meta-annotation policies before falling back to configuration.
+See <<locking-policy,Locking Policy>> for configuration, transaction requirements and callback usage.
+
[#mixinMethod]
=== mixinMethod
@@ -391,4 +404,6 @@ include::hooks/DomainObject_028-autoCompleteRepository.adoc[]
include::hooks/DomainObject_029-mixinMethod.adoc[]
+include::hooks/DomainObject_030-locking.adoc[]
+
include::hooks/DomainObject_040-see-also.adoc[]
diff --git a/antora/components/refguide-index/modules/applib/pages/index/annotation/hooks/DomainObject_030-locking.adoc b/antora/components/refguide-index/modules/applib/pages/index/annotation/hooks/DomainObject_030-locking.adoc
new file mode 100644
index 00000000000..e1675e1d9a1
--- /dev/null
+++ b/antora/components/refguide-index/modules/applib/pages/index/annotation/hooks/DomainObject_030-locking.adoc
@@ -0,0 +1,103 @@
+[#locking-policy]
+=== Locking Policy
+
+:Notice: 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 ag [...]
+:page-partial:
+
+Causeway can acquire a pessimistic database write lock when loading a JPA entity by bookmark.
+This includes entity references supplied as RESTful Objects action parameters.
+It is useful for serializing parallel callbacks that update the progress of a shared orchestration.
+
+==== Annotation and Configuration
+
+[source,java]
+----
+@Entity
+@DomainObject(locking = Locking.PESSIMISTIC)
+public class PaymentBatchOrchestration {
+ // retain the existing @Version mapping
+}
+----
+
+The annotation attribute defaults to `Locking.DEFAULT`.
+Its values have the following meanings:
+
+[cols="1,3",options="header"]
+|===
+|Value |Meaning
+|`OPTIMISTIC` |Preserve ordinary entity loading and existing ORM version checks. This does not introduce a version mapping or request an explicit JPA optimistic lock.
+|`PESSIMISTIC` |Acquire a JPA `PESSIMISTIC_WRITE` lock when loading by bookmark, held until the transaction commits or rolls back.
+|`AS_CONFIGURED` |Explicitly select the configured policy, overriding a policy inherited from other annotation sources.
+|`DEFAULT` |Allow merged annotation resolution to find a policy in superclass or meta-annotations; otherwise use configuration.
+|===
+
+The configuration property accepts `OPTIMISTIC` or `PESSIMISTIC` and defaults to `OPTIMISTIC`:
+
+[source,properties]
+----
+causeway.applib.annotation.domain-object.locking=OPTIMISTIC
+----
+
+An explicit optimistic or pessimistic annotation policy overrides configuration.
+Entities without an applicable `@DomainObject` annotation also use configuration.
+A global pessimistic configuration affects all JPA bookmark loads, including reads, so per-entity opt-in is usually appropriate for orchestration callbacks.
+
+==== REST Callback Parameters
+
+For an action accepting an orchestration reference:
+
+[source,java]
+----
+@Action(semantics = SemanticsOf.IDEMPOTENT)
+public Orchestration<?, ?> onSuccess(
+ final Orchestration<?, ?> orchestration,
+ final String payload) {
+ orchestration.onSuccess(payload);
+ return orchestration;
+}
+----
+
+The RESTful Objects argument body uses a reference link:
+
+[source,json]
+----
+{
+ "orchestration": {
+ "value": {
+ "href": "https://host/restful/objects/payments.PaymentBatchOrchestration/123"
+ }
+ },
+ "payload": { "value": "..." }
+}
+----
+
+Causeway resolves this link to a bookmark and loads the concrete entity before parameter validation and action invocation.
+The concrete entity's policy applies even when the declared parameter is a base type.
+The request transaction retains the lock throughout callback execution and commit.
+A competing callback for the same orchestration waits for the lock or fails according to the database/provider timeout behavior.
+Callbacks for independent orchestration rows do not share an application-wide lock.
+
+==== Scope and Transaction Requirements
+
+This policy applies to Causeway JPA bookmark loads, including bookmark service lookup and REST action reference parameters.
+It does not automatically apply to named queries, all-instances queries, Spring Data repositories, QueryDSL, lazy relationship loads or JDO.
+All callback writers whose decisions must serialize need to acquire the same orchestration lock before reading its progress.
+
+Pessimistic loading requires an active transaction; loading without one fails rather than silently returning an unlocked entity.
+Causeway does not start a separate transaction around the load or retry failed callbacks automatically.
+Locks end at commit or rollback and do not cover the time between separate HTTP requests or the external worker's processing interval.
+
+State refresh behavior depends on the JPA provider.
+With EclipseLink 5.0.2, the first pessimistic `find()` refreshes an entity previously managed without a pessimistic lock, including replacing unflushed local changes and updating stale state.
+Once that entity is pessimistically locked in the current transaction, subsequent locking finds return it without refreshing again, retaining the callback's changes.
+Causeway adds no explicit refresh calls around the locking `find()`.
+Resolve the callback reference and acquire its lock before application code reads or modifies orchestration state.
+Any lock or version-check failures raised by the provider remain failures.
+
+Lock and version failures propagate from the JPA adapter.
+When they occur during REST argument resolution, the existing argument-validation error path reports the failure and prevents action invocation.
+No successful callback response is produced for a failed argument load.
+
+Retain existing version mappings and keep callback transactions short.
+Database timeout and deadlock handling remain provider/deployment concerns.
+Serialization does not deduplicate callback delivery: the application's idempotent callback must still avoid applying the same line completion or publishing its final completion event repeatedly.
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java b/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
index 8d6ef24be99..0e930adb1db 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/annotation/DomainObject.java
@@ -159,6 +159,20 @@ Publishing entityChangePublishing()
Introspection introspection()
default Introspection.NOT_SPECIFIED;
+ /**
+ * Locking policy for Causeway JPA bookmark loads, including REST action
+ * reference parameters. Pessimistic loading requires an active transaction
+ * and holds a write lock until commit or rollback.
+ * <p>
+ * Does not apply to queries, repository loads, lazy relationships or JDO.
+ * Optimistic loading preserves existing ORM version behavior.
+ * </p>
+ * @apiNote Acquire the lock before modifying the entity: the provider may
+ * refresh previously unlocked managed state on first acquisition.
+ * @since 4.0
+ */
+ Locking locking() default Locking.DEFAULT;
+
/**
* Applicable only if {@link #nature()} is {@link Nature#MIXIN}, indicates
* the name of the method within the mixin class to be inferred as the
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/api/applib/src/main/java/org/apache/causeway/applib/annotation/Locking.java
similarity index 57%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to api/applib/src/main/java/org/apache/causeway/applib/annotation/Locking.java
index 9653015c813..30c3fffd2b2 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/annotation/Locking.java
@@ -16,27 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
-
-import org.apache.causeway.core.config.CausewayConfiguration;
-
-import org.jspecify.annotations.NonNull;
-
-public final class DomainObjectConfigOptions {
-
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
-
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
- }
-
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
- }
+package org.apache.causeway.applib.annotation;
+/**
+ * Policy for loading JPA entities by bookmark, including REST action parameters.
+ * @since 4.0 {@index}
+ */
+public enum Locking {
+ /** Preserve ordinary loading and existing ORM version checks. */
+ OPTIMISTIC,
+ /** Acquire a database write lock until the current transaction completes. */
+ PESSIMISTIC,
+ /** Explicitly use causeway.applib.annotation.domain-object.locking. */
+ AS_CONFIGURED,
+ /** Search other annotation sources, then fall back to configuration. */
+ DEFAULT
}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
index 66f56d99951..bcb4e86b507 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
@@ -437,6 +437,14 @@ public interface ConfigPropsForPropertyOrParameterLayout {
}
public record DomainObject(
+ /**
+ * Default locking policy for Causeway JPA bookmark loads.
+ * Pessimistic loads require an active transaction and acquire a write lock.
+ * Overridden by {@link DomainObject#locking()}.
+ */
+ @DefaultValue("OPTIMISTIC")
+ DomainObjectConfigOptions.LockingPolicy locking,
+
/**
* The default for whether <i>domain entities</i> should be audited or not (meaning that any changes are
* sent through to {@link EntityChangesSubscriber}s and
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
index 9653015c813..e63b72d36ee 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
@@ -29,6 +29,11 @@ public enum EntityChangePublishingPolicy {
NONE;
}
+ public enum LockingPolicy {
+ OPTIMISTIC,
+ PESSIMISTIC;
+ }
+
public enum EditingObjectsConfiguration {
TRUE,
FALSE;
diff --git a/core/config/src/test/java/org/apache/causeway/core/config/CausewayConfiguration_locking_Test.java b/core/config/src/test/java/org/apache/causeway/core/config/CausewayConfiguration_locking_Test.java
new file mode 100644
index 00000000000..3f79c1a9deb
--- /dev/null
+++ b/core/config/src/test/java/org/apache/causeway/core/config/CausewayConfiguration_locking_Test.java
@@ -0,0 +1,52 @@
+/*
+ * 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 org.apache.causeway.core.config;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.util.TestPropertyValues;
+import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+
+class CausewayConfiguration_locking_Test {
+ private final ConfigurationFactory configurations = new ConfigurationFactory();
+
+ @Test
+ void defaultsToOptimistic() {
+ configurations.test(TestPropertyValues.empty(), config ->
+ assertThat(config.applib().annotation().domainObject().locking()).isEqualTo(LockingPolicy.OPTIMISTIC));
+ }
+
+ @Test
+ void bindsPessimistic() {
+ configurations.test(TestPropertyValues.of("causeway.applib.annotation.domain-object.locking=pessimistic"), config ->
+ assertThat(config.applib().annotation().domainObject().locking()).isEqualTo(LockingPolicy.PESSIMISTIC));
+ }
+
+ @Test
+ void rejectsUnresolvedValues() {
+ for (var value : new String[] { "DEFAULT", "AS_CONFIGURED" }) {
+ new ApplicationContextRunner().withUserConfiguration(CausewayModuleCoreConfig.class)
+ .withPropertyValues("causeway.applib.annotation.domain-object.locking=" + value)
+ .run(context -> assertThat(context).hasFailed());
+ }
+ }
+}
diff --git a/core/metamodel/src/main/java/module-info.java b/core/metamodel/src/main/java/module-info.java
index a5d00a19d97..5c2922c1c1e 100644
--- a/core/metamodel/src/main/java/module-info.java
+++ b/core/metamodel/src/main/java/module-info.java
@@ -42,6 +42,7 @@
exports org.apache.causeway.core.metamodel.facets.members.layout.group;
exports org.apache.causeway.core.metamodel.facets.members.publish.command;
exports org.apache.causeway.core.metamodel.facets.members.publish.execution;
+ exports org.apache.causeway.core.metamodel.facets.object.locking;
exports org.apache.causeway.core.metamodel.facets.object.bookmarkpolicy;
exports org.apache.causeway.core.metamodel.facets.object.callbacks;
exports org.apache.causeway.core.metamodel.facets.object.domainobject;
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
index 1777b64c5be..6bee813ff3e 100644
--- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
@@ -69,6 +69,7 @@
import org.apache.causeway.core.metamodel.facets.object.domainobject.editing.ImmutableFacetForDomainObjectAnnotation;
import org.apache.causeway.core.metamodel.facets.object.domainobject.entitychangepublishing.EntityChangePublishingFacetForDomainObjectAnnotation;
import org.apache.causeway.core.metamodel.facets.object.domainobject.introspection.IntrospectionPolicyFacetForDomainObjectAnnotation;
+import org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotation;
import org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl;
import org.apache.causeway.core.metamodel.facets.object.viewmodel.ViewModelFacetForDomainObjectAnnotation;
import org.apache.causeway.core.metamodel.object.MmEventUtils;
@@ -178,6 +179,7 @@ public void process(final ProcessClassContext processClassContext) {
var domainObjectIfAny = processClassContext.synthesizeOnType(DomainObject.class);
+ processLocking(domainObjectIfAny, processClassContext);
processEntityChangePublishing(domainObjectIfAny, processClassContext);
processAutoComplete(domainObjectIfAny, processClassContext);
processBounded(domainObjectIfAny, processClassContext);
@@ -187,6 +189,12 @@ public void process(final ProcessClassContext processClassContext) {
processDomainEvents(domainObjectIfAny, processClassContext);
}
+ void processLocking(final Optional<DomainObject> domainObjectIfAny,
+ final ProcessClassContext processClassContext) {
+ LockingFacetForDomainObjectAnnotation.create(
+ domainObjectIfAny.map(DomainObject::locking), getConfiguration(), processClassContext.facetHolder());
+ }
+
void processEntityChangePublishing(
final Optional<DomainObject> domainObjectIfAny,
final ProcessClassContext processClassContext) {
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotation.java
new file mode 100644
index 00000000000..9db80ecb5e7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotation.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 org.apache.causeway.core.metamodel.facets.object.domainobject.locking;
+
+import java.util.Optional;
+
+import org.apache.causeway.applib.annotation.Locking;
+import org.apache.causeway.core.config.CausewayConfiguration;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacetAbstract;
+
+public class LockingFacetForDomainObjectAnnotation extends LockingFacetAbstract {
+
+ public static LockingFacet create(final Optional<Locking> locking,
+ final CausewayConfiguration configuration, final FacetHolder holder) {
+ switch (locking.orElse(Locking.DEFAULT)) {
+ case OPTIMISTIC:
+ return new LockingFacetForDomainObjectAnnotation(holder, LockingPolicy.OPTIMISTIC);
+ case PESSIMISTIC:
+ return new LockingFacetForDomainObjectAnnotation(holder, LockingPolicy.PESSIMISTIC);
+ default:
+ final LockingPolicy policy = configuration.applib().annotation().domainObject().locking();
+ return locking.isPresent()
+ ? new LockingFacetForDomainObjectAnnotationAsConfigured(holder, policy)
+ : new LockingFacetFromConfiguration(holder, policy);
+ }
+ }
+
+ protected LockingFacetForDomainObjectAnnotation(final FacetHolder holder, final LockingPolicy policy) {
+ super(holder, policy);
+ }
+}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotationAsConfigured.java
similarity index 57%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotationAsConfigured.java
index 9653015c813..f294f0f01b9 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetForDomainObjectAnnotationAsConfigured.java
@@ -16,27 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
+package org.apache.causeway.core.metamodel.facets.object.domainobject.locking;
-import org.apache.causeway.core.config.CausewayConfiguration;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
-import org.jspecify.annotations.NonNull;
-
-public final class DomainObjectConfigOptions {
-
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
-
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
+public class LockingFacetForDomainObjectAnnotationAsConfigured extends LockingFacetForDomainObjectAnnotation {
+ public LockingFacetForDomainObjectAnnotationAsConfigured(final FacetHolder holder, final LockingPolicy policy) {
+ super(holder, policy);
}
-
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
- }
-
}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetFromConfiguration.java
similarity index 57%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetFromConfiguration.java
index 9653015c813..e6b02f08493 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainobject/locking/LockingFacetFromConfiguration.java
@@ -16,27 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
+package org.apache.causeway.core.metamodel.facets.object.domainobject.locking;
-import org.apache.causeway.core.config.CausewayConfiguration;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacetAbstract;
-import org.jspecify.annotations.NonNull;
-
-public final class DomainObjectConfigOptions {
-
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
-
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
+public class LockingFacetFromConfiguration extends LockingFacetAbstract {
+ public LockingFacetFromConfiguration(final FacetHolder holder, final LockingPolicy policy) {
+ super(holder, policy);
}
-
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
- }
-
}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacet.java
similarity index 57%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacet.java
index 9653015c813..1478b398989 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacet.java
@@ -16,27 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
+package org.apache.causeway.core.metamodel.facets.object.locking;
-import org.apache.causeway.core.config.CausewayConfiguration;
-
-import org.jspecify.annotations.NonNull;
-
-public final class DomainObjectConfigOptions {
-
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
-
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
- }
-
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
- }
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.Facet;
+public interface LockingFacet extends Facet {
+ LockingPolicy getPolicy();
}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacetAbstract.java
similarity index 50%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacetAbstract.java
index 9653015c813..73dba72cf74 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/locking/LockingFacetAbstract.java
@@ -16,27 +16,29 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
+package org.apache.causeway.core.metamodel.facets.object.locking;
-import org.apache.causeway.core.config.CausewayConfiguration;
+import java.util.function.BiConsumer;
-import org.jspecify.annotations.NonNull;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.FacetAbstract;
+import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
-public final class DomainObjectConfigOptions {
+import lombok.Getter;
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
+public abstract class LockingFacetAbstract extends FacetAbstract implements LockingFacet {
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
- }
+ @Getter
+ private final LockingPolicy policy;
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
+ protected LockingFacetAbstract(final FacetHolder holder, final LockingPolicy policy) {
+ super(LockingFacet.class, holder);
+ this.policy = policy;
}
+ @Override
+ public void visitAttributes(final BiConsumer<String, Object> visitor) {
+ LockingFacet.super.visitAttributes(visitor);
+ visitor.accept("policy", policy);
+ }
}
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java b/core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactoryRegressionTest.java
similarity index 57%
copy from core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
copy to core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactoryRegressionTest.java
index 9653015c813..ac6b1be8aa4 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/metamodel/facets/DomainObjectConfigOptions.java
+++ b/core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactoryRegressionTest.java
@@ -16,27 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.causeway.core.config.metamodel.facets;
-
-import org.apache.causeway.core.config.CausewayConfiguration;
-
-import org.jspecify.annotations.NonNull;
-
-public final class DomainObjectConfigOptions {
-
- public enum EntityChangePublishingPolicy {
- ALL,
- NONE;
- }
-
- public enum EditingObjectsConfiguration {
- TRUE,
- FALSE;
- }
-
- public static EntityChangePublishingPolicy entityChangePublishingPolicy(
- final @NonNull CausewayConfiguration configuration) {
- return configuration.applib().annotation().domainObject().entityChangePublishing();
- }
+package org.apache.causeway.core.metamodel.facets.object.domainobject;
+/** Makes the existing abstract suite executable alongside locking policy regressions. */
+class DomainObjectAnnotationFacetFactoryRegressionTest extends DomainObjectAnnotationFacetFactoryTest {
}
diff --git a/core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectLockingFacetFactoryTest.java b/core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectLockingFacetFactoryTest.java
new file mode 100644
index 00000000000..2d087af41cc
--- /dev/null
+++ b/core/mmtest/src/test/java/org/apache/causeway/core/metamodel/facets/object/domainobject/DomainObjectLockingFacetFactoryTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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 org.apache.causeway.core.metamodel.facets.object.domainobject;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.util.TestPropertyValues;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Locking;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facets.FacetFactoryTestAbstract;
+import org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotation;
+import org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured;
+import org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetFromConfiguration;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet;
+
+class DomainObjectLockingFacetFactoryTest extends FacetFactoryTestAbstract {
+
+ static class Unannotated { }
+ @DomainObject static class Default { }
+ @DomainObject(locking = Locking.PESSIMISTIC) static class Pessimistic { }
+ @DomainObject(locking = Locking.OPTIMISTIC) static class Optimistic { }
+ @DomainObject static class Inherited extends Pessimistic { }
+ @DomainObject(locking = Locking.AS_CONFIGURED) static class Configured extends Pessimistic { }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @DomainObject(locking = Locking.PESSIMISTIC)
+ @interface Locked { }
+ @Locked @DomainObject static class MetaAnnotated { }
+
+ @Test
+ void defaultsToOptimistic() {
+ check(Default.class, LockingPolicy.OPTIMISTIC, LockingFacetForDomainObjectAnnotationAsConfigured.class);
+ check(Unannotated.class, LockingPolicy.OPTIMISTIC, LockingFacetFromConfiguration.class);
+ }
+
+ @Test
+ void explicitPoliciesOverrideConfiguration() {
+ check(Pessimistic.class, LockingPolicy.PESSIMISTIC, LockingFacetForDomainObjectAnnotation.class);
+ configure(LockingPolicy.PESSIMISTIC);
+ check(Optimistic.class, LockingPolicy.OPTIMISTIC, LockingFacetForDomainObjectAnnotation.class);
+ }
+
+ @Test
+ void defaultAndUnannotatedUseConfiguration() {
+ configure(LockingPolicy.PESSIMISTIC);
+ check(Default.class, LockingPolicy.PESSIMISTIC, LockingFacetForDomainObjectAnnotationAsConfigured.class);
+ check(Unannotated.class, LockingPolicy.PESSIMISTIC, LockingFacetFromConfiguration.class);
+ }
+
+ @Test
+ void defaultAllowsInheritedAndMetaAnnotationPolicies() {
+ check(Inherited.class, LockingPolicy.PESSIMISTIC, LockingFacetForDomainObjectAnnotation.class);
+ check(MetaAnnotated.class, LockingPolicy.PESSIMISTIC, LockingFacetForDomainObjectAnnotation.class);
+ }
+
+ @Test
+ void asConfiguredOverridesInheritance() {
+ check(Configured.class, LockingPolicy.OPTIMISTIC, LockingFacetForDomainObjectAnnotationAsConfigured.class);
+ }
+
+ private void configure(final LockingPolicy policy) {
+ setup(builder -> builder.testPropertyValues(TestPropertyValues.of(
+ "causeway.applib.annotation.domain-object.locking=" + policy.name())));
+ }
+
+ private void check(final Class<?> type, final LockingPolicy policy, final Class<?> implementation) {
+ final DomainObjectAnnotationFacetFactory factory = new DomainObjectAnnotationFacetFactory(getMetaModelContext());
+ objectScenario(type, (context, holder) -> {
+ factory.processLocking(context.synthesizeOnType(DomainObject.class), context);
+ final LockingFacet facet = holder.lookupFacet(LockingFacet.class).orElseThrow();
+ assertEquals(policy, facet.getPolicy());
+ assertInstanceOf(implementation, facet);
+ assertNoMethodsRemoved();
+ });
+ }
+}
diff --git a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomainWithPdfJsViewer_IntegTest.dump_facets.approved.xml b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomainWithPdfJsViewer_IntegTest.dump_facets.approved.xml
index 64a54ce85ce..a346706fc04 100644
--- a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomainWithPdfJsViewer_IntegTest.dump_facets.approved.xml
+++ b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomainWithPdfJsViewer_IntegTest.dump_facets.approved.xml
@@ -70,6 +70,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -1578,6 +1583,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_PROPERTY"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
diff --git a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomain_IntegTest.dump_facets.approved.xml b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomain_IntegTest.dump_facets.approved.xml
index 4f76e7eb372..6a9db71b23a 100644
--- a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomain_IntegTest.dump_facets.approved.xml
+++ b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_MixinDomain_IntegTest.dump_facets.approved.xml
@@ -70,6 +70,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -1571,6 +1576,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_PROPERTY"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
diff --git a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomainWithPdfjsViewer_IntegTest.dump_facets.approved.xml b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomainWithPdfjsViewer_IntegTest.dump_facets.approved.xml
index 720680c19f9..9c6a3d03cb7 100644
--- a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomainWithPdfjsViewer_IntegTest.dump_facets.approved.xml
+++ b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomainWithPdfjsViewer_IntegTest.dump_facets.approved.xml
@@ -70,6 +70,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
diff --git a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomain_IntegTest.dump_facets.approved.xml b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomain_IntegTest.dump_facets.approved.xml
index f043b5abbf0..befc449a021 100644
--- a/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomain_IntegTest.dump_facets.approved.xml
+++ b/extensions/vw/pdfjs/metamodel/src/test/java/org/apache/causeway/extensions/pdfjs/metamodel/PdfjsViewer_PropDomain_IntegTest.dump_facets.approved.xml
@@ -70,6 +70,11 @@
<mml:attr name="precedence" value="DEFAULT"/>
<mml:attr name="reason" value="Disabled via @DomainObject annotation, reason not given."/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
diff --git a/openspec/changes/port-domain-object-locking/design.md b/openspec/changes/port-domain-object-locking/design.md
index 31bfcac9ce3..85ba84b2337 100644
--- a/openspec/changes/port-domain-object-locking/design.md
+++ b/openspec/changes/port-domain-object-locking/design.md
@@ -64,7 +64,8 @@ Document the feature in Antora's DomainObject annotation reference and associate
Implement on a dedicated branch based on main in the main worktree, committing proposal artifacts before applying. Existing applications need no changes. Applications requiring serialized callback access opt in with `@DomainObject(locking = Locking.PESSIMISTIC)` and retain version mappings. Reverting to optimistic policy restores ordinary bookmark loading. No data migration is required.
-## Open Questions
+## Verification Findings
-- Confirm first-acquisition refresh, stale-version handling, and repeated locked loads on main's EclipseLink 5.0.2 during implementation.
-- Confirm the exact approval snapshot set affected by main's installed facets; the maintenance correction commit identifies candidate modules rather than replacement files.
+EclipseLink 5.0.2 passes the ported first-acquisition refresh, stale-state refresh, and repeated locked-load regressions with the existing H2 regression database and shared cache enabled. The maintenance cached-state contract therefore remains applicable to main.
+
+Main's affected approval set is the same five files identified by the maintenance correction commit, with 55 locking facets in the domainmodel snapshot and six across the four PDF.js snapshots. Regeneration changed only those facet blocks. Focused validation commands and results are recorded in tasks.md.
diff --git a/openspec/changes/port-domain-object-locking/tasks.md b/openspec/changes/port-domain-object-locking/tasks.md
index 3d1014ececc..f7ade9ca3ec 100644
--- a/openspec/changes/port-domain-object-locking/tasks.md
+++ b/openspec/changes/port-domain-object-locking/tasks.md
@@ -1,32 +1,54 @@
## 1. Prepare the main-side port
-- [ ] 1.1 Create a dedicated implementation branch from main in this worktree and commit the proposal artifacts before applying, using the branch/Jira prefix.
-- [ ] 1.2 Review maintenance implementation `746fd6393ce`, approval corrections `04029032473`, and archived contract `47f055e3cbd`; map selected files to main's current modules without merging maintenance history or copying its archive.
+- [x] 1.1 Create a dedicated implementation branch from main in this worktree and commit the proposal artifacts before applying, using the branch/Jira prefix.
+- [x] 1.2 Review maintenance implementation `746fd6393ce`, approval corrections `04029032473`, and archived contract `47f055e3cbd`; map selected files to main's current modules without merging maintenance history or copying its archive.
## 2. Port annotation, configuration, and facet resolution
-- [ ] 2.1 Add applib `Locking` and `DomainObject.locking()` with the maintenance values and DEFAULT semantics, using main's API documentation version.
-- [ ] 2.2 Add the restricted configuration enum and immutable DomainObject record component defaulting to OPTIMISTIC; test property binding, absent defaults, and rejection of sentinel values, and verify generated configuration metadata.
-- [ ] 2.3 Port persistence-neutral locking facets and factory installation using main's automatic registration, precedence, attribute visitor, and module export conventions.
-- [ ] 2.4 Port policy tests to `core/mmtest`, covering explicit policies, no annotation, configuration, superclass/meta-annotation resolution, and AS_CONFIGURED overriding inherited policy; run the existing DomainObject factory tests.
+- [x] 2.1 Add applib `Locking` and `DomainObject.locking()` with the maintenance values and DEFAULT semantics, using main's API documentation version.
+- [x] 2.2 Add the restricted configuration enum and immutable DomainObject record component defaulting to OPTIMISTIC; test property binding, absent defaults, and rejection of sentinel values, and verify generated configuration metadata.
+- [x] 2.3 Port persistence-neutral locking facets and factory installation using main's automatic registration, precedence, attribute visitor, and module export conventions.
+- [x] 2.4 Port policy tests to `core/mmtest`, covering explicit policies, no annotation, configuration, superclass/meta-annotation resolution, and AS_CONFIGURED overriding inherited policy; run the existing DomainObject factory tests.
## 3. Port observed JPA bookmark loading and REST coverage
-- [ ] 3.1 Adapt `JpaEntityFacet.fetchByBookmark()` to request Jakarta PESSIMISTIC_WRITE for pessimistic policy inside the existing observation wrapper, retaining ordinary optimistic find and empty-result behavior.
-- [ ] 3.2 Adapt adapter tests to main's services/observation support; verify find overloads, missing entities, observed execution, and preservation of provider lock/version failures.
-- [ ] 3.3 Port REST reference-parameter tests to main, verifying serialized href/bookmark resolution to the concrete entity and preventing validation/action execution after argument-load failure.
+- [x] 3.1 Adapt `JpaEntityFacet.fetchByBookmark()` to request Jakarta PESSIMISTIC_WRITE for pessimistic policy inside the existing observation wrapper, retaining ordinary optimistic find and empty-result behavior.
+- [x] 3.2 Adapt adapter tests to main's services/observation support; verify find overloads, missing entities, observed execution, and preservation of provider lock/version failures.
+- [x] 3.3 Port REST reference-parameter tests to main, verifying serialized href/bookmark resolution to the concrete entity and preventing validation/action execution after argument-load failure.
## 4. Verify concurrency and EclipseLink state behavior
-- [ ] 4.1 Port the versioned callback orchestration fixture into `regressiontests/base-jpa` and adapt interaction/bootstrap APIs in the persistence-jpa tests.
-- [ ] 4.2 Verify same-row callback blocking with independent transactions, bounded waits, shared cache enabled, visibility of committed progress, and the fixture's single final completion event.
-- [ ] 4.3 Verify rollback releases the lock without exposing rolled-back progress and different orchestration rows remain independent.
-- [ ] 4.4 Verify EclipseLink 5.0.2 first-lock refresh of previously unlocked managed state, stale-version refresh behavior, and preservation of changes on repeated already-locked loads; reconcile any provider differences in the design/specification before completing this task.
-- [ ] 4.5 Verify pessimistic loads fail without a transaction while ordinary optimistic loads retain existing behavior; run existing JPA bootstrap/query regressions alongside the new tests.
+- [x] 4.1 Port the versioned callback orchestration fixture into `regressiontests/base-jpa` and adapt interaction/bootstrap APIs in the persistence-jpa tests.
+- [x] 4.2 Verify same-row callback blocking with independent transactions, bounded waits, shared cache enabled, visibility of committed progress, and the fixture's single final completion event.
+- [x] 4.3 Verify rollback releases the lock without exposing rolled-back progress and different orchestration rows remain independent.
+- [x] 4.4 Verify EclipseLink 5.0.2 first-lock refresh of previously unlocked managed state, stale-version refresh behavior, and preservation of changes on repeated already-locked loads; reconcile any provider differences in the design/specification before completing this task.
+- [x] 4.5 Verify pessimistic loads fail without a transaction while ordinary optimistic loads retain existing behavior; run existing JPA bootstrap/query regressions alongside the new tests.
## 5. Integrate documentation and approvals
-- [ ] 5.1 Update Antora annotation/configuration guidance with resolution rules, a REST orchestration reference example, transaction lifetime, provider cache behavior, scope exclusions, and application idempotence responsibility.
-- [ ] 5.2 Regenerate and review main's affected metamodel and extension approval snapshots using the maintenance approval correction as a footprint reference; run the affected approval tests.
-- [ ] 5.3 Run the focused configuration, metamodel, adapter, REST, and JPA regression checks using main's current toolchain; record commands, results, and any remaining limitations in this change.
-- [ ] 5.4 Validate the completed OpenSpec change and review the final diff for unintended maintenance build settings, dependencies, or unrelated snapshot changes.
+- [x] 5.1 Update Antora annotation/configuration guidance with resolution rules, a REST orchestration reference example, transaction lifetime, provider cache behavior, scope exclusions, and application idempotence responsibility.
+- [x] 5.2 Regenerate and review main's affected metamodel and extension approval snapshots using the maintenance approval correction as a footprint reference; run the affected approval tests.
+- [x] 5.3 Run the focused configuration, metamodel, adapter, REST, and JPA regression checks using main's current toolchain; record commands, results, and any remaining limitations in this change.
+- [x] 5.4 Validate the completed OpenSpec change and review the final diff for unintended maintenance build settings, dependencies, or unrelated snapshot changes.
+
+## Verification results
+
+- Proposal committed before implementation as `6d89fce763a` on `CAUSEWAY-4070-v4` in the main worktree.
+- Focused reactor build: **BUILD SUCCESS**, 73 tests, 0 failures, 0 errors, 2 existing JpaQueryTest skips (71 passed). Includes 33 existing DomainObject factory tests, made executable via a concrete subclass of main's abstract suite.
+- EclipseLink **5.0.2** passes all eight concurrency/cache/transaction regressions: same-row blocking, commit visibility and single fixture completion event, rollback release, independent rows, first-lock refresh of local/stale managed state, repeated-lock preservation, pessimistic transaction requirement, and ordinary optimistic compatibility.
+- Adapter tests verify both find overloads execute inside the bookmark observation and provider exceptions remain intact. REST tests resolve the concrete serialized bookmark and exercise the existing parameter-veto failure path; they are parser tests, not a complete HTTP concurrency test.
+- Generated configuration metadata exposes `causeway.applib.annotation.domain-object.locking` with restricted LockingPolicy and default OPTIMISTIC.
+- Five approval files regenerated on main. Removing the new locking facet blocks yields exactly the previous content: 55 domainmodel facets and six facets across four PDF.js snapshots.
+- No dependency or build configuration changes. Provider concurrency tests use the existing H2 regression database; production-database lock timeout/deadlock behavior remains deployment-specific.
+
+Command (from the main worktree, Maven 3.9.13, Java 25.0.4, compile release 17):
+
+```sh
+JAVA_HOME=/Users/danhaywood/.sdkman/candidates/java/25.0.4-tem mvn -o \
+ -Drevision=4.0.0-SNAPSHOT -Dmodule-regressiontests \
+ -pl core/mmtest,viewers/restfulobjects/viewer,regressiontests/persistence-jpa,regressiontests/domainmodel,extensions/vw/pdfjs/metamodel -am \
+ '-Dtest=CausewayConfiguration_locking_Test,DomainObjectLockingFacetFactoryTest,DomainObjectAnnotationFacetFactoryRegressionTest,JpaEntityFacetLockingTest,ObjectActionArgHelperReferenceTest,JpaPessimisticLockingTest,JpaQueryTest,JpaBootstrappingTest,MetaModelRegressionTest,PdfjsViewer*IntegTest' \
+ -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.source.skip=true test
+```
+
+The initial builds fetched missing main dependencies online; the final verification succeeded offline. Log: `/tmp/causeway-4070-v4-verification.log`.
diff --git a/persistence/jpa/integration/src/main/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacet.java b/persistence/jpa/integration/src/main/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacet.java
index f527da93fbe..953495748f1 100644
--- a/persistence/jpa/integration/src/main/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacet.java
+++ b/persistence/jpa/integration/src/main/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacet.java
@@ -32,12 +32,14 @@
import org.apache.causeway.commons.internal.assertions._Assert;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import org.apache.causeway.core.config.beans.CausewayBeanMetaData.PersistenceStack;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
import org.apache.causeway.core.config.observation.CausewayObservationIntegration;
import org.apache.causeway.core.config.observation.CausewayObservationIntegration.ObservationProvider;
import org.apache.causeway.core.metamodel.facetapi.FacetAbstract;
import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
import org.apache.causeway.core.metamodel.facets.object.entity.EntityFacet;
import org.apache.causeway.core.metamodel.facets.object.entity.EntityOrmMetadata;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet;
import org.apache.causeway.core.metamodel.object.ManagedObject;
import org.apache.causeway.core.metamodel.services.idstringifier.IdStringifierLookupService;
import org.apache.causeway.persistence.jpa.applib.integration.HasVersion;
@@ -48,6 +50,7 @@
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
+import jakarta.persistence.LockModeType;
import jakarta.persistence.PersistenceUnitUtil;
import jakarta.persistence.TypedQuery;
import lombok.Getter;
@@ -122,7 +125,11 @@ public Optional<Object> fetchByBookmark(final @NonNull Bookmark bookmark) {
return observationProvider.get("Fetch by Bookmark (%s)".formatted(bookmark))
.observe(()->{
var primaryKey = primaryKeyType.destring(bookmark.identifier());
- return Optional.ofNullable(getEntityManager().find(entityClass, primaryKey));
+ var policy = facetHolder().lookupFacet(LockingFacet.class)
+ .map(LockingFacet::getPolicy).orElse(LockingPolicy.OPTIMISTIC);
+ return Optional.ofNullable(policy == LockingPolicy.PESSIMISTIC
+ ? getEntityManager().find(entityClass, primaryKey, LockModeType.PESSIMISTIC_WRITE)
+ : getEntityManager().find(entityClass, primaryKey));
});
}
diff --git a/persistence/jpa/integration/src/test/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacetLockingTest.java b/persistence/jpa/integration/src/test/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacetLockingTest.java
new file mode 100644
index 00000000000..969bda78d3d
--- /dev/null
+++ b/persistence/jpa/integration/src/test/java/org/apache/causeway/persistence/jpa/integration/entity/JpaEntityFacetLockingTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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 org.apache.causeway.persistence.jpa.integration.entity;
+
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.LockModeType;
+import jakarta.persistence.PessimisticLockException;
+import jakarta.persistence.OptimisticLockException;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.test.util.ReflectionTestUtils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.*;
+
+import org.apache.causeway.applib.services.bookmark.Bookmark;
+import org.apache.causeway.applib.services.bookmark.IdStringifier;
+import org.apache.causeway.core.config.metamodel.facets.DomainObjectConfigOptions.LockingPolicy;
+import org.apache.causeway.core.metamodel.facetapi.FacetHolder;
+import org.apache.causeway.core.config.observation.CausewayObservationIntegration;
+import io.micrometer.observation.ObservationRegistry;
+import io.micrometer.observation.ObservationHandler;
+import io.micrometer.observation.Observation;
+import org.apache.causeway.core.metamodel.facets.object.entity.EntityFacet.PrimaryKeyType;
+import org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet;
+
+class JpaEntityFacetLockingTest {
+ private final EntityManager em = mock(EntityManager.class);
+ private final FacetHolder holder = mock(FacetHolder.class);
+ private final LockingFacet policy = mock(LockingFacet.class);
+ private JpaEntityFacet facet;
+ private final ObservationRegistry registry = ObservationRegistry.create();
+ private boolean observing;
+ private final Bookmark bookmark = Bookmark.forLogicalTypeNameAndIdentifier("test.Entity", "42");
+
+ @BeforeEach
+ void setUp() {
+ registry.observationConfig().observationHandler(new ObservationHandler<Observation.Context>() {
+ @Override public boolean supportsContext(Observation.Context context) { return true; }
+ @Override public void onStart(Observation.Context context) { observing = true; }
+ @Override public void onStop(Observation.Context context) { observing = false; }
+ });
+ facet = mock(JpaEntityFacet.class, CALLS_REAL_METHODS);
+ ReflectionTestUtils.setField(facet, "observationProvider",
+ new CausewayObservationIntegration(registry).provider(JpaEntityFacet.class));
+ doReturn(em).when(facet).getEntityManager();
+ doReturn(holder).when(facet).facetHolder();
+ @SuppressWarnings("unchecked")
+ final IdStringifier<Long> stringifier = mock(IdStringifier.class);
+ when(stringifier.destring(Object.class, "42")).thenReturn(42L);
+ ReflectionTestUtils.setField(facet, "entityClass", Object.class);
+ ReflectionTestUtils.setField(facet, "primaryKeyType", new PrimaryKeyType<>(Object.class, stringifier, Long.class));
+ when(holder.lookupFacet(LockingFacet.class)).thenReturn(java.util.Optional.of(policy));
+ }
+
+ @Test
+ void pessimisticLoadConvertsKeyAndLocks() {
+ when(policy.getPolicy()).thenReturn(LockingPolicy.PESSIMISTIC);
+ final Object entity = new Object();
+ when(em.find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE)).thenAnswer(invocation -> {
+ assertTrue(observing, "locking find must remain observed");
+ return entity;
+ });
+ assertSame(entity, facet.fetchByBookmark(bookmark).orElseThrow());
+ verify(em).find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE);
+ verifyNoMoreInteractions(em);
+ }
+
+ @Test
+ void optimisticLoadPreservesOrdinaryFind() {
+ when(policy.getPolicy()).thenReturn(LockingPolicy.OPTIMISTIC);
+ final Object entity = new Object();
+ when(em.find(Object.class, 42L)).thenAnswer(invocation -> {
+ assertTrue(observing, "ordinary find must remain observed");
+ return entity;
+ });
+ assertEquals(entity, facet.fetchByBookmark(bookmark).orElseThrow());
+ verify(em).find(Object.class, 42L);
+ verifyNoMoreInteractions(em);
+ }
+
+ @Test
+ void missingEntityReturnsEmpty() {
+ when(policy.getPolicy()).thenReturn(LockingPolicy.PESSIMISTIC);
+ assertTrue(facet.fetchByBookmark(bookmark).isEmpty());
+ }
+
+ @Test
+ void preservesProviderFailure() {
+ when(policy.getPolicy()).thenReturn(LockingPolicy.PESSIMISTIC);
+ final PessimisticLockException failure = new PessimisticLockException("locked");
+ when(em.find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE)).thenThrow(failure);
+ assertSame(failure, assertThrows(PessimisticLockException.class, () -> facet.fetchByBookmark(bookmark)));
+ assertTrue(!observing, "observation must stop on provider failure");
+ verify(em).find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE);
+ verifyNoMoreInteractions(em);
+ }
+ @Test
+ void preservesProviderVersionFailure() {
+ when(policy.getPolicy()).thenReturn(LockingPolicy.PESSIMISTIC);
+ final OptimisticLockException failure = new OptimisticLockException("stale version");
+ when(em.find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE)).thenThrow(failure);
+ assertSame(failure, assertThrows(OptimisticLockException.class, () -> facet.fetchByBookmark(bookmark)));
+ assertTrue(!observing, "observation must stop on provider failure");
+ verify(em).find(Object.class, 42L, LockModeType.PESSIMISTIC_WRITE);
+ verifyNoMoreInteractions(em);
+ }
+
+}
diff --git a/regressiontests/base-jpa/src/main/java/org/apache/causeway/testdomain/jpa/entities/JpaCallbackOrchestration.java b/regressiontests/base-jpa/src/main/java/org/apache/causeway/testdomain/jpa/entities/JpaCallbackOrchestration.java
new file mode 100644
index 00000000000..46bcadb4e6e
--- /dev/null
+++ b/regressiontests/base-jpa/src/main/java/org/apache/causeway/testdomain/jpa/entities/JpaCallbackOrchestration.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.causeway.testdomain.jpa.entities;
+
+import jakarta.inject.Named;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Version;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Locking;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Publishing;
+import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.annotation.Title;
+
+import org.apache.causeway.persistence.jpa.applib.integration.HasVersion;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/** Minimal batch callback fixture; completionEvents models an outbox publication. */
+@Entity
+@Named("testdomain.jpa.CallbackOrchestration")
+@DomainObject(locking = Locking.PESSIMISTIC, entityChangePublishing = Publishing.DISABLED)
+@NoArgsConstructor
+public class JpaCallbackOrchestration implements HasVersion<Long> {
+ @Id @Property @Title @Getter
+ private String id;
+ @Version @Property @Getter
+ private Long version;
+ @Property @Getter
+ private int completedLines;
+ @Property @Getter
+ private int completionEvents;
+
+ public JpaCallbackOrchestration(final String id) {
+ this.id = id;
+ }
+
+ @Action(semantics = SemanticsOf.IDEMPOTENT)
+ public void onSuccess(final int line) {
+ completedLines |= 1 << line;
+ if (completedLines == 3 && completionEvents == 0) {
+ completionEvents++;
+ }
+ }
+}
diff --git a/regressiontests/domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/MetaModelRegressionTest.verify.approved.xml b/regressiontests/domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/MetaModelRegressionTest.verify.approved.xml
index c4279acf4dc..904a662fbed 100644
--- a/regressiontests/domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/MetaModelRegressionTest.verify.approved.xml
+++ b/regressiontests/domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/MetaModelRegressionTest.verify.approved.xml
@@ -53,6 +53,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -256,6 +261,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -1601,6 +1611,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -3023,6 +3038,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetFromConfiguration">
+ <mml:attr name="facet" value="LockingFacetFromConfiguration"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -4242,6 +4262,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -5630,6 +5655,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -5845,6 +5875,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -7232,6 +7267,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -7453,6 +7493,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -8855,6 +8900,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -10800,6 +10850,11 @@
<mml:attr name="origin" value="LayoutMethod"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -12278,6 +12333,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -13693,6 +13753,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -15108,6 +15173,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -16457,6 +16527,11 @@
<mml:attr name="origin" value="LayoutMethod"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -18123,6 +18198,11 @@
<mml:attr name="methods" value="public default org.apache.causeway.applib.annotation.ObjectSupport$IconResource org.apache.causeway.testdomain.model.good.ProperMemberInheritanceInterface.icon(org.apache.causeway.applib.annotation.ObjectSupport$IconSize)"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -19902,6 +19982,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -21201,6 +21286,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -22504,6 +22594,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -23802,6 +23897,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -27926,6 +28026,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -29592,6 +29697,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -31262,6 +31372,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -32915,6 +33030,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -33240,6 +33360,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -33554,6 +33679,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -33882,6 +34012,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -34210,6 +34345,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -34397,6 +34537,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -34717,6 +34862,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_COLLECTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -34939,6 +35089,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_COLLECTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -35161,6 +35316,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_COLLECTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -35362,6 +35522,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_PROPERTY"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -35593,6 +35758,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_PROPERTY"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -35824,6 +35994,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_PROPERTY"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -36032,6 +36207,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -38250,6 +38430,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -38428,6 +38613,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -38606,6 +38796,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -38784,6 +38979,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -38962,6 +39162,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -39140,6 +39345,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -39318,6 +39528,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -39496,6 +39711,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -39669,6 +39889,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -39922,6 +40147,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -40325,6 +40555,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -41825,6 +42060,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -43123,6 +43363,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -44515,6 +44760,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -46240,6 +46490,11 @@
<mml:attr name="introspection" value="ANNOTATION_REQUIRED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -47887,6 +48142,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -49517,6 +49777,11 @@
<mml:attr name="interactionAdvisors" value="HidingOrShowing"/>
<mml:attr name="precedence" value="HIGH"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.mixin.MixinFacetImpl">
<mml:attr name="contributing" value="AS_ACTION"/>
<mml:attr name="facet" value="MixinFacetImpl"/>
@@ -49721,6 +49986,11 @@
<mml:attr name="introspection" value="ANNOTATION_OPTIONAL"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
@@ -51227,6 +51497,11 @@
<mml:attr name="introspection" value="ENCAPSULATION_ENABLED"/>
<mml:attr name="precedence" value="DEFAULT"/>
</mml:facet>
+ <mml:facet id="org.apache.causeway.core.metamodel.facets.object.locking.LockingFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.domainobject.locking.LockingFacetForDomainObjectAnnotationAsConfigured">
+ <mml:attr name="facet" value="LockingFacetForDomainObjectAnnotationAsConfigured"/>
+ <mml:attr name="policy" value="OPTIMISTIC"/>
+ <mml:attr name="precedence" value="DEFAULT"/>
+ </mml:facet>
<mml:facet id="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.ObjectValidPropertiesFacet" fqcn="org.apache.causeway.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImpl">
<mml:attr name="facet" value="ObjectValidPropertiesFacetImpl"/>
<mml:attr name="interactionAdvisors" value="Validating"/>
diff --git a/regressiontests/persistence-jpa/src/test/java/org/apache/causeway/testdomain/persistence/jpa/JpaPessimisticLockingTest.java b/regressiontests/persistence-jpa/src/test/java/org/apache/causeway/testdomain/persistence/jpa/JpaPessimisticLockingTest.java
new file mode 100644
index 00000000000..043d6adf7eb
--- /dev/null
+++ b/regressiontests/persistence-jpa/src/test/java/org/apache/causeway/testdomain/persistence/jpa/JpaPessimisticLockingTest.java
@@ -0,0 +1,266 @@
+/*
+ * 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 org.apache.causeway.testdomain.persistence.jpa;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Supplier;
+
+import jakarta.inject.Inject;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.TransactionRequiredException;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.apache.causeway.applib.services.bookmark.Bookmark;
+import org.apache.causeway.applib.services.bookmark.BookmarkService;
+import org.apache.causeway.applib.services.iactn.InteractionService;
+import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
+import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
+import org.apache.causeway.persistence.jpa.applib.services.JpaSupportService;
+import org.apache.causeway.testdomain.jpa.conf.Configuration_usingJpa;
+import org.apache.causeway.testdomain.jpa.entities.JpaCallbackOrchestration;
+import org.apache.causeway.testdomain.jpa.entities.JpaEntityNonGeneratedStringId;
+
+@SpringBootTest(classes = Configuration_usingJpa.class, properties = {
+ "spring.datasource.url=jdbc:h2:mem:JpaPessimisticLockingTest;LOCK_TIMEOUT=10000",
+ "eclipselink.cache.shared.default=true"
+})
+class JpaPessimisticLockingTest {
+ @Inject private InteractionService interactions;
+ @Inject private JpaSupportService jpa;
+ @Inject private ObjectManager objects;
+ @Inject private BookmarkService bookmarks;
+ @Inject private SpecificationLoader specifications;
+ @Inject private EntityManagerFactory emf;
+
+ private ExecutorService worker;
+ private String id;
+ private String otherId;
+ private Bookmark batchBookmark;
+ private Bookmark otherBookmark;
+
+ @BeforeEach
+ void setUp() {
+ worker = Executors.newSingleThreadExecutor();
+ id = UUID.randomUUID().toString();
+ otherId = UUID.randomUUID().toString();
+ tx(() -> {
+ final var em = jpa.getEntityManagerElseFail(JpaCallbackOrchestration.class);
+ final var batch = new JpaCallbackOrchestration(id);
+ final var other = new JpaCallbackOrchestration(otherId);
+ em.persist(batch);
+ em.persist(other);
+ em.flush();
+ batchBookmark = bookmarks.bookmarkFor(batch).orElseThrow();
+ otherBookmark = bookmarks.bookmarkFor(other).orElseThrow();
+ return null;
+ });
+ assertTrue(emf.getCache().contains(JpaCallbackOrchestration.class, id), "exercise shared-cache hits");
+ }
+
+ @AfterEach
+ void tearDown() throws Exception {
+ worker.shutdownNow();
+ assertTrue(worker.awaitTermination(15, TimeUnit.SECONDS));
+ tx(() -> {
+ final var em = jpa.getEntityManagerElseFail(JpaCallbackOrchestration.class);
+ em.remove(em.find(JpaCallbackOrchestration.class, id));
+ em.remove(em.find(JpaCallbackOrchestration.class, otherId));
+ return null;
+ });
+ }
+
+ @Test
+ void callbacksSerializeAndPublishCompletionOnce() throws Exception {
+ final CountDownLatch attempting = new CountDownLatch(1);
+ final Future<?> second = tx(() -> {
+ final var first = load(id);
+ first.onSuccess(0);
+ final Future<?> future = worker.submit(() -> tx(() -> {
+ attempting.countDown();
+ final var next = load(id);
+ assertEquals(1, next.getCompletedLines(), "waiter must see the committed first callback");
+ next.onSuccess(1);
+ return null;
+ }));
+ assertBlocked(attempting, future);
+ return future;
+ });
+ second.get(15, TimeUnit.SECONDS);
+ tx(() -> {
+ final var batch = load(id);
+ assertEquals(3, batch.getCompletedLines());
+ assertEquals(1, batch.getCompletionEvents());
+ batch.onSuccess(1); // repeated callback remains idempotent
+ assertEquals(1, batch.getCompletionEvents());
+ return null;
+ });
+ }
+
+ @Test
+ void rollbackReleasesLockWithoutPublishingChanges() throws Exception {
+ final CountDownLatch attempting = new CountDownLatch(1);
+ final java.util.concurrent.atomic.AtomicReference<Future<?>> second = new java.util.concurrent.atomic.AtomicReference<>();
+ assertThrows(Rollback.class, () -> tx(() -> {
+ load(id).onSuccess(0);
+ final Future<?> future = worker.submit(() -> tx(() -> {
+ attempting.countDown();
+ final var batch = load(id);
+ assertEquals(0, batch.getCompletedLines());
+ batch.onSuccess(1);
+ return null;
+ }));
+ second.set(future);
+ assertBlocked(attempting, future);
+ throw new Rollback();
+ }));
+ second.get().get(15, TimeUnit.SECONDS);
+ tx(() -> {
+ assertEquals(2, load(id).getCompletedLines());
+ assertEquals(0, load(id).getCompletionEvents());
+ return null;
+ });
+ }
+
+ @Test
+ void differentOrchestrationsDoNotShareALock() {
+ tx(() -> {
+ load(id);
+ final Future<?> second = worker.submit(() -> tx(() -> {
+ load(otherId).onSuccess(0);
+ return null;
+ }));
+ try {
+ second.get(5, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ throw new AssertionError("different orchestration should proceed", e);
+ }
+ return null;
+ });
+ }
+
+ @Test
+ void firstLockCanRefreshPreviouslyUnlockedLocalChanges() {
+ tx(() -> {
+ final var existing = jpa.getEntityManagerElseFail(JpaCallbackOrchestration.class)
+ .find(JpaCallbackOrchestration.class, id);
+ existing.onSuccess(0);
+ assertSame(existing, load(id));
+ assertEquals(0, existing.getCompletedLines(), "EclipseLink refreshes on first lock acquisition");
+ return null;
+ });
+ }
+
+ @Test
+ void repeatedLockedLoadsPreserveCallbackChanges() {
+ tx(() -> {
+ final var existing = load(id);
+ existing.onSuccess(0);
+ assertSame(existing, load(id));
+ assertEquals(1, existing.getCompletedLines());
+ return null;
+ });
+ }
+
+ @Test
+ void firstLockRefreshesPreviouslyManagedStaleState() {
+ tx(() -> {
+ final var original = jpa.getEntityManagerElseFail(JpaCallbackOrchestration.class)
+ .find(JpaCallbackOrchestration.class, id);
+ final Long previousVersion = original.getVersion();
+ final Future<?> update = worker.submit(() -> tx(() -> {
+ load(id).onSuccess(0);
+ return null;
+ }));
+ try {
+ update.get(5, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ assertSame(original, load(id));
+ assertEquals(1, original.getCompletedLines());
+ assertTrue(original.getVersion() > previousVersion);
+ return null;
+ });
+ }
+
+ @Test
+ void pessimisticLoadRequiresTransaction() {
+ final var facet = specifications.loadSpecification(JpaCallbackOrchestration.class).entityFacetElseFail();
+ assertThrows(TransactionRequiredException.class, () -> facet.fetchByBookmark(bookmark(id)));
+ }
+
+ @Test
+ void defaultOptimisticLoadStillWorksWithoutTransaction() {
+ final Bookmark bookmark = tx(() -> {
+ final var entity = new JpaEntityNonGeneratedStringId(id);
+ final var em = jpa.getEntityManagerElseFail(JpaEntityNonGeneratedStringId.class);
+ em.persist(entity);
+ em.flush();
+ return bookmarks.bookmarkFor(entity).orElseThrow();
+ });
+ try {
+ final var facet = specifications.loadSpecification(JpaEntityNonGeneratedStringId.class).entityFacetElseFail();
+ assertTrue(facet.fetchByBookmark(bookmark).isPresent());
+ } finally {
+ tx(() -> {
+ final var em = jpa.getEntityManagerElseFail(JpaEntityNonGeneratedStringId.class);
+ em.remove(em.find(JpaEntityNonGeneratedStringId.class, id));
+ return null;
+ });
+ }
+ }
+
+ private JpaCallbackOrchestration load(final String identifier) {
+ return (JpaCallbackOrchestration) objects.loadObject(bookmark(identifier)).orElseThrow().getPojo();
+ }
+
+ private Bookmark bookmark(final String identifier) {
+ return identifier.equals(id) ? batchBookmark : otherBookmark;
+ }
+
+ private <T> T tx(final Supplier<T> body) {
+ return interactions.callAnonymous(body::get);
+ }
+
+ private void assertBlocked(final CountDownLatch attempting, final Future<?> future) {
+ try {
+ assertTrue(attempting.await(5, TimeUnit.SECONDS), "second callback must enter its transaction");
+ assertThrows(TimeoutException.class, () -> future.get(300, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new AssertionError(e);
+ }
+ }
+
+ private static class Rollback extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+ }
+}
diff --git a/viewers/restfulobjects/viewer/src/test/java/org/apache/causeway/viewer/restfulobjects/viewer/resources/ObjectActionArgHelperReferenceTest.java b/viewers/restfulobjects/viewer/src/test/java/org/apache/causeway/viewer/restfulobjects/viewer/resources/ObjectActionArgHelperReferenceTest.java
new file mode 100644
index 00000000000..03495078195
--- /dev/null
+++ b/viewers/restfulobjects/viewer/src/test/java/org/apache/causeway/viewer/restfulobjects/viewer/resources/ObjectActionArgHelperReferenceTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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 org.apache.causeway.viewer.restfulobjects.viewer.resources;
+
+import java.util.Optional;
+import java.util.List;
+
+import org.springframework.http.MediaType;
+
+import org.apache.causeway.applib.annotation.Where;
+import org.apache.causeway.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.causeway.viewer.restfulobjects.rendering.domainobjects.ObjectAdapterLinkTo;
+import org.apache.causeway.viewer.restfulobjects.rendering.service.RepresentationService;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.causeway.applib.services.bookmark.Bookmark;
+import org.apache.causeway.commons.collections.Can;
+import org.apache.causeway.core.metamodel.context.MetaModelContext;
+import org.apache.causeway.core.metamodel.object.ManagedObject;
+import org.apache.causeway.core.metamodel.facets.object.entity.EntityFacet;
+import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
+import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
+import org.apache.causeway.core.metamodel.spec.feature.ObjectAction;
+import org.apache.causeway.core.metamodel.spec.feature.ObjectActionParameter;
+import org.apache.causeway.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.causeway.viewer.restfulobjects.rendering.IResourceContext;
+import org.apache.causeway.viewer.restfulobjects.rendering.service.valuerender.JsonValueEncoderService;
+
+/** Covers the reference-parameter path, including its existing load-failure handling. */
+class ObjectActionArgHelperReferenceTest {
+ private final MetaModelContext mmc = mock(MetaModelContext.class, RETURNS_DEEP_STUBS);
+ private final IResourceContext context = new IResourceContext() {
+ @Override public MetaModelContext getMetaModelContext() { return mmc; }
+ @Override public String restfulUrlFor(String url) { throw new UnsupportedOperationException(); }
+ @Override public String applicationUrlFor(String url) { throw new UnsupportedOperationException(); }
+ @Override public List<MediaType> acceptableMediaTypes() { throw new UnsupportedOperationException(); }
+ @Override public InteractionInitiatedBy interactionInitiatedBy() { throw new UnsupportedOperationException(); }
+ @Override public Where where() { throw new UnsupportedOperationException(); }
+ @Override public ObjectAdapterLinkTo objectAdapterLinkTo() { throw new UnsupportedOperationException(); }
+ @Override public List<List<String>> followLinks() { throw new UnsupportedOperationException(); }
+ @Override public boolean isValidateOnly() { throw new UnsupportedOperationException(); }
+ @Override public boolean canEagerlyRender(ManagedObject object) { throw new UnsupportedOperationException(); }
+ @Override public RepresentationService.Intent intent() { throw new UnsupportedOperationException(); }
+ };
+ private final ObjectManager objects = mock(ObjectManager.class);
+ private final ObjectAction action = mock(ObjectAction.class);
+ private final ObjectActionParameter parameter = mock(ObjectActionParameter.class);
+ private final ObjectSpecification baseSpec = mock(ObjectSpecification.class);
+ private final Bookmark bookmark = Bookmark.forLogicalTypeNameAndIdentifier("test.PaymentBatchOrchestration", "42");
+
+ private JsonRepresentation arguments() {
+ when(mmc.getObjectManager()).thenReturn(objects);
+ when(mmc.getServiceRegistry().lookupServiceElseFail(JsonValueEncoderService.class))
+ .thenReturn(mock(JsonValueEncoderService.class));
+ when(action.getParameters()).thenReturn(Can.ofSingleton(parameter));
+ when(action.getParameterById("orchestration")).thenReturn(parameter);
+ when(parameter.getId()).thenReturn("orchestration");
+ when(parameter.getElementType()).thenReturn(baseSpec);
+ final JsonRepresentation reference = JsonRepresentation.newMap();
+ reference.mapPutString("href", "http://localhost/restful/objects/test.PaymentBatchOrchestration/42");
+ final JsonRepresentation argument = JsonRepresentation.newMap();
+ argument.mapPutJsonRepresentation("value", reference);
+ final JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPutJsonRepresentation("orchestration", argument);
+ return args;
+ }
+
+ @Test
+ void loadsConcreteBookmarkForBaseTypeParameterBeforeInvocation() {
+ final ObjectSpecification concreteSpec = mock(ObjectSpecification.class, RETURNS_DEEP_STUBS);
+ final EntityFacet entityFacet = mock(EntityFacet.class);
+ final Object pojo = new Object();
+ when(concreteSpec.isEntity()).thenReturn(true);
+ when(concreteSpec.getSpecificationLoader().specForType(Object.class)).thenReturn(Optional.of(concreteSpec));
+ when(concreteSpec.entityFacet()).thenReturn(Optional.of(entityFacet));
+ when(concreteSpec.entityFacetElseFail()).thenReturn(entityFacet);
+ when(entityFacet.isInjectionPointsResolved(pojo)).thenReturn(true);
+ when(entityFacet.validateBookmark(bookmark)).thenReturn(bookmark);
+ final ManagedObject concrete = ManagedObject.entity(concreteSpec, pojo, Optional.of(bookmark));
+ when(objects.loadObject(bookmark)).thenReturn(Optional.of(concrete));
+ final var parsed = ObjectActionArgHelper.parseArguments(context, action, arguments()).getElseFail(0);
+ assertTrue(parsed.isSuccess(), () -> parsed.getFailure().map(Object::toString).orElse(""));
+ assertSame(concrete, parsed.getSuccessElseFail());
+ verify(objects).loadObject(bookmark);
+ // Parsing only resolves references; callback invocation follows in _DomainResourceHelper.
+ verifyNoMoreInteractions(objects);
+ }
+
+ @Test
+ void loadFailureBecomesParameterVeto() {
+ when(objects.loadObject(bookmark)).thenThrow(new IllegalStateException("provider lock failure"));
+ final var parsed = ObjectActionArgHelper.parseArguments(context, action, arguments()).getElseFail(0);
+ assertTrue(parsed.isFailure());
+ assertTrue(parsed.getSuccess().isEmpty());
+ verify(objects).loadObject(bookmark);
+ }
+}