This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new dba64e531f CAUSEWAY-3697: reinstate old enum values - mark deprecated
dba64e531f is described below
commit dba64e531f67fe1e7ed8a7288b634059e54a7ef7
Author: Andi Huber <[email protected]>
AuthorDate: Thu Mar 14 06:58:30 2024 +0100
CAUSEWAY-3697: reinstate old enum values - mark deprecated
---
.../applib/annotation/NatureOfService.java | 44 +++++++++++++++-------
...viceMenuFacetFromDomainServiceFacetFactory.java | 2 +-
.../object/domainservice/DomainServiceFacet.java | 6 +--
.../bootstrap/MenuBarsServiceBootstrap.java | 5 +--
.../primary/ui/CommandReplayOnPrimaryService.java | 1 -
.../ui/CommandReplayOnSecondaryService.java | 1 -
.../model/actnsemantics/BlobDemoMenu.java | 1 -
.../model/bad/InvalidServiceWithAlias.java | 1 -
.../model/good/ProperServiceWithAlias.java | 1 -
.../model/good/ProperServiceWithMixin.java | 1 -
10 files changed, 36 insertions(+), 27 deletions(-)
diff --git
a/api/applib/src/main/java/org/apache/causeway/applib/annotation/NatureOfService.java
b/api/applib/src/main/java/org/apache/causeway/applib/annotation/NatureOfService.java
index db4717e7b8..10f70d0167 100644
---
a/api/applib/src/main/java/org/apache/causeway/applib/annotation/NatureOfService.java
+++
b/api/applib/src/main/java/org/apache/causeway/applib/annotation/NatureOfService.java
@@ -25,16 +25,16 @@ package org.apache.causeway.applib.annotation;
*/
public enum NatureOfService {
/**
- * The service's actions appear only in the menu bar human-usable Web UIs
(such as Wicket viewer).
+ * The service's actions appear only in the menu bar human-usable UIs
(such as Wicket viewer).
* They do <i>not</i> appear in any REST or GraphQL APIs.
*/
- WEB_UI,
+ WEB_UI, //TODO perhaps rename to UI_ONLY?
/**
* The service's actions should only be visible in the Web API exposed by
the Restful Objects viewer and the
* GraphQL viewer. They do <i>not</i> appear in any human-usable Web UIs
(such as Wicket viewer)
*/
- WEB_API,
+ WEB_API, //TODO perhaps rename to WEBAPI_ONLY?
/**
* The service's actions appear in the menu bar of Web UIs (such as Wicket
viewer), and also appear in the
@@ -44,35 +44,53 @@ public enum NatureOfService {
* Contributing actions to the 'viewer' implies, that these must also be
exposed to the REST API,
* simply because alternative viewers might be solely based on the
provided REST end-points.
*/
- BOTH,
+ BOTH, //TODO perhaps rename to ENABLED_EVERYWHERE?
+
+ /**
+ * @deprecated use {@link #BOTH} instead
+ * @see NatureOfService#BOTH
+ */
+ @Deprecated
+ VIEW,
+
+ /**
+ * @deprecated use {@link #WEB_API} instead
+ * @see NatureOfService#WEB_API
+ */
+ @Deprecated
+ REST
+
;
// -- BASIC PREDICATES
/**
- * Whether a service contributes its actions to both human-usable Web UIs
and the Web APIs.
+ * Whether a service contributes its actions to both human-usable UIs and
the Web APIs.
*
* @see NatureOfService#BOTH
*/
- public boolean isBoth() {
- return this == BOTH;
+ public boolean isEnabledEverywhere() {
+ return this == BOTH
+ || this == VIEW;
}
/**
- * Whether a service contributes its actions exclusively to human-usable
Web UIs.
+ * Whether a service contributes its actions to human-usable UIs.
* @see NatureOfService#WEB_UI
*/
- public boolean isWebUi() {
- return this == WEB_UI || this == BOTH;
+ public boolean isEnabledForUi() {
+ return isEnabledEverywhere()
+ || this == WEB_UI;
}
/**
* Whether a service contributes its actions to Web APIs (REST and GraphQL)
* @see NatureOfService#WEB_API
*/
- public boolean isWebApi() {
- return this == WEB_API || this == BOTH;
+ public boolean isEnabledForWebApi() {
+ return isEnabledEverywhere()
+ || this == WEB_API
+ || this == REST;
}
-
}
diff --git
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/actions/notinservicemenu/derived/NotInServiceMenuFacetFromDomainServiceFacetFactory.java
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/actions/notinservicemenu/derived/NotInServiceMenuFacetFromDomainServiceFacetFactory.java
index de017d8c01..487c5d6c1e 100644
---
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/actions/notinservicemenu/derived/NotInServiceMenuFacetFromDomainServiceFacetFactory.java
+++
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/actions/notinservicemenu/derived/NotInServiceMenuFacetFromDomainServiceFacetFactory.java
@@ -53,7 +53,7 @@ extends FacetFactoryAbstract {
spec.lookupNonFallbackFacet(DomainServiceFacet.class)
.ifPresent(domainServiceFacet->{
final NatureOfService natureOfService =
domainServiceFacet.getNatureOfService();
- if(natureOfService.isWebUi()) {
+ if(natureOfService.isEnabledForUi()) {
return;
}
final FacetedMethod facetHolder =
processMethodContext.getFacetHolder();
diff --git
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
index 9184f4f703..fafff2a6cb 100644
---
a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
+++
b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
@@ -51,9 +51,9 @@ public interface DomainServiceFacet extends Facet {
* @param facetHolderIfAny - null-able
* @return whether facetHolder represents a service that contributes
actions to the Web UI (may or may not also contribute to the Web APIs)
*/
- static boolean isContributingToWebUi(final @Nullable FacetHolder
facetHolderIfAny) {
+ static boolean isContributingToUi(final @Nullable FacetHolder
facetHolderIfAny) {
return getNatureOfService(facetHolderIfAny)
- .filter(NatureOfService::isWebUi)
+ .filter(NatureOfService::isEnabledForUi)
.isPresent();
}
@@ -63,7 +63,7 @@ public interface DomainServiceFacet extends Facet {
*/
static boolean isContributingToWebApi(final @Nullable FacetHolder
facetHolderIfAny) {
return getNatureOfService(facetHolderIfAny)
- .filter(NatureOfService::isWebApi)
+ .filter(NatureOfService::isEnabledForWebApi)
.isPresent();
}
diff --git
a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/menubars/bootstrap/MenuBarsServiceBootstrap.java
b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/menubars/bootstrap/MenuBarsServiceBootstrap.java
index be3d141650..9726bea67c 100644
---
a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/menubars/bootstrap/MenuBarsServiceBootstrap.java
+++
b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/menubars/bootstrap/MenuBarsServiceBootstrap.java
@@ -436,7 +436,7 @@ implements MenuBarsService {
final DomainServiceFacet domainServiceFacet =
serviceSpec.getFacet(DomainServiceFacet.class);
if (domainServiceFacet != null) {
final NatureOfService natureOfService =
domainServiceFacet.getNatureOfService();
- if (!natureOfService.isBoth()) {
+ if (!natureOfService.isEnabledForUi()) {
return Stream.empty();
}
}
@@ -483,8 +483,5 @@ implements MenuBarsService {
.collect(Collectors.joining(" "));
}
-
-
-
}
diff --git
a/incubator/extensions/core/commandreplay/primary/src/main/java/org/apache/causeway/extensions/commandreplay/primary/ui/CommandReplayOnPrimaryService.java
b/incubator/extensions/core/commandreplay/primary/src/main/java/org/apache/causeway/extensions/commandreplay/primary/ui/CommandReplayOnPrimaryService.java
index 140035ce0b..404fac5cec 100644
---
a/incubator/extensions/core/commandreplay/primary/src/main/java/org/apache/causeway/extensions/commandreplay/primary/ui/CommandReplayOnPrimaryService.java
+++
b/incubator/extensions/core/commandreplay/primary/src/main/java/org/apache/causeway/extensions/commandreplay/primary/ui/CommandReplayOnPrimaryService.java
@@ -32,7 +32,6 @@ import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.DomainService;
import org.apache.causeway.applib.annotation.DomainServiceLayout;
import org.apache.causeway.applib.annotation.MemberSupport;
-import org.apache.causeway.applib.annotation.NatureOfService;
import org.apache.causeway.applib.annotation.ParameterLayout;
import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.annotation.Publishing;
diff --git
a/incubator/extensions/core/commandreplay/secondary/src/main/java/org/apache/causeway/extensions/commandreplay/secondary/ui/CommandReplayOnSecondaryService.java
b/incubator/extensions/core/commandreplay/secondary/src/main/java/org/apache/causeway/extensions/commandreplay/secondary/ui/CommandReplayOnSecondaryService.java
index cc6291b0b2..b91ebd6176 100644
---
a/incubator/extensions/core/commandreplay/secondary/src/main/java/org/apache/causeway/extensions/commandreplay/secondary/ui/CommandReplayOnSecondaryService.java
+++
b/incubator/extensions/core/commandreplay/secondary/src/main/java/org/apache/causeway/extensions/commandreplay/secondary/ui/CommandReplayOnSecondaryService.java
@@ -29,7 +29,6 @@ import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.DomainService;
import org.apache.causeway.applib.annotation.DomainServiceLayout;
import org.apache.causeway.applib.annotation.MemberSupport;
-import org.apache.causeway.applib.annotation.NatureOfService;
import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.annotation.Publishing;
import org.apache.causeway.applib.annotation.SemanticsOf;
diff --git
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/actnsemantics/BlobDemoMenu.java
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/actnsemantics/BlobDemoMenu.java
index a1956c4e22..e88ac33d0a 100644
---
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/actnsemantics/BlobDemoMenu.java
+++
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/actnsemantics/BlobDemoMenu.java
@@ -25,7 +25,6 @@ import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.ActionLayout;
import org.apache.causeway.applib.annotation.DomainObjectLayout;
import org.apache.causeway.applib.annotation.DomainService;
-import org.apache.causeway.applib.annotation.NatureOfService;
import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.services.factory.FactoryService;
diff --git
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/bad/InvalidServiceWithAlias.java
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/bad/InvalidServiceWithAlias.java
index 5593e7b1d1..fac272345c 100644
---
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/bad/InvalidServiceWithAlias.java
+++
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/bad/InvalidServiceWithAlias.java
@@ -24,7 +24,6 @@ import org.joda.time.LocalDateTime;
import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.DomainService;
-import org.apache.causeway.applib.annotation.NatureOfService;
@Named("testdomain.InvalidServiceWithAlias")
@DomainService(
diff --git
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithAlias.java
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithAlias.java
index 20ac7cb4a3..a040dd0345 100644
---
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithAlias.java
+++
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithAlias.java
@@ -24,7 +24,6 @@ import org.joda.time.LocalDateTime;
import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.DomainService;
-import org.apache.causeway.applib.annotation.NatureOfService;
@Named("testdomain.ProperServiceWithAlias")
@DomainService(
diff --git
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithMixin.java
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithMixin.java
index 3f3a35032c..796dca7aaf 100644
---
a/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithMixin.java
+++
b/regressiontests/base/src/main/java/org/apache/causeway/testdomain/model/good/ProperServiceWithMixin.java
@@ -25,7 +25,6 @@ import org.joda.time.LocalDateTime;
import org.apache.causeway.applib.annotation.Action;
import org.apache.causeway.applib.annotation.DomainService;
import org.apache.causeway.applib.annotation.MemberSupport;
-import org.apache.causeway.applib.annotation.NatureOfService;
@Named("testdomain.ProperServiceWithMixin")
@DomainService()