This is an automated email from the ASF dual-hosted git repository. ahuber pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/isis.git
commit 6dd943862d1edaee8637ae769683b670bf763d2e Author: Andi Huber <[email protected]> AuthorDate: Thu Jun 30 11:22:48 2022 +0200 ISIS-3084: Remove direct Collections modification endpoints from RO --- .../WrapperFactory_020-examples-and-usage.adoc | 5 +- .../permission/dom/ApplicationPermissionMode.adoc | 4 +- .../applib/domainobjects/DomainObjectResource.adoc | 3 - .../dom/JavaObjectWithBasicProgramConventions.java | 4 +- .../permission/dom/ApplicationPermissionMode.java | 15 +-- .../applib/domainobjects/DomainObjectResource.java | 53 ++++----- .../resources/DomainObjectResourceServerside.java | 123 +++++++++++---------- 7 files changed, 100 insertions(+), 107 deletions(-) diff --git a/antora/components/refguide-index/modules/applib/pages/index/services/wrapper/hooks/WrapperFactory_020-examples-and-usage.adoc b/antora/components/refguide-index/modules/applib/pages/index/services/wrapper/hooks/WrapperFactory_020-examples-and-usage.adoc index 814c69f225..393c0ba16e 100644 --- a/antora/components/refguide-index/modules/applib/pages/index/services/wrapper/hooks/WrapperFactory_020-examples-and-usage.adoc +++ b/antora/components/refguide-index/modules/applib/pages/index/services/wrapper/hooks/WrapperFactory_020-examples-and-usage.adoc @@ -40,9 +40,12 @@ For domain objects (not mixins), the wrapper can be interacted with as follows: * a `get...()` method for properties or collections * a `set...()` method for properties -* an `addTo...()` or `removeFrom...()` method for collections * any action +NOTE: with ISIS-3084, `addTo...()` and `removeFrom...()` methods for collections were removed; + the notion (direct) collection modification was deprecated as any specific business logic + should by handled via actions instead; + Calling any of the above methods may result in a (subclass of) `InteractionException` if the object disallows it. For example, if a property is annotated with xref:refguide:applib:index/annotation/ActionLayout.adoc#hidden[@ActionLayout#hidden] then a `HiddenException` will be thrown. Similarly if an action has a xref:refguide:applib-methods:prefixes.adoc[validateXxx()] method and the supplied arguments are invalid then an `InvalidException` will be thrown. diff --git a/antora/components/refguide-index/modules/extensions/pages/index/secman/applib/permission/dom/ApplicationPermissionMode.adoc b/antora/components/refguide-index/modules/extensions/pages/index/secman/applib/permission/dom/ApplicationPermissionMode.adoc index 29a79b3479..07954b6c27 100644 --- a/antora/components/refguide-index/modules/extensions/pages/index/secman/applib/permission/dom/ApplicationPermissionMode.adoc +++ b/antora/components/refguide-index/modules/extensions/pages/index/secman/applib/permission/dom/ApplicationPermissionMode.adoc @@ -40,8 +40,8 @@ The xref:refguide:extensions:index/secman/applib/permission/dom/ApplicationPermi Whether can user/role can change (or is prevented from changing) the state of the system using the application feature (class member). -In other words, whether they can execute (if an action, modify/clear (if a property), addTo/removeFrom (if a collection). +In other words, whether they can execute (if an action, modify/clear (if a property), [addTo/removeFrom (if a collection) ... see note below]. The xref:refguide:extensions:index/secman/applib/permission/dom/ApplicationPermissionRule.adoc[ApplicationPermissionRule] of the xref:refguide:extensions:index/secman/applib/permission/dom/ApplicationPermission.adoc[ApplicationPermission] indicates whether access is being granted or denied. -Note that the Wicket viewer does not at the time of writing (Isis 1.6.0) support the notion of mutable collections. The RO viewer does, however. +Note: as of ISIS-3084 the notion of mutable collections was removed diff --git a/antora/components/refguide-index/modules/viewer/pages/index/restfulobjects/applib/domainobjects/DomainObjectResource.adoc b/antora/components/refguide-index/modules/viewer/pages/index/restfulobjects/applib/domainobjects/DomainObjectResource.adoc index 080a72d4b0..3167933115 100644 --- a/antora/components/refguide-index/modules/viewer/pages/index/restfulobjects/applib/domainobjects/DomainObjectResource.adoc +++ b/antora/components/refguide-index/modules/viewer/pages/index/restfulobjects/applib/domainobjects/DomainObjectResource.adoc @@ -19,9 +19,6 @@ interface DomainObjectResource { Response clearProperty(String domainType, String instanceId, String propertyId) Response postPropertyNotAllowed(String domainType, String instanceId, String propertyId) Response accessCollection(String domainType, String instanceId, String collectionId) - Response addToSet(String domainType, String instanceId, String collectionId, InputStream arguments) - Response addToList(String domainType, String instanceId, String collectionId, InputStream arguments) - Response removeFromCollection(String domainType, String instanceId, String collectionId) Response actionPrompt(String domainType, String instanceId, String actionId) Response deleteActionPromptNotAllowed(String domainType, String instanceId, String actionId) Response putActionPromptNotAllowed(String domainType, String instanceId, String actionId) diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/objects/dom/JavaObjectWithBasicProgramConventions.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/objects/dom/JavaObjectWithBasicProgramConventions.java index 53372f1e75..d8d80fd6f9 100644 --- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/objects/dom/JavaObjectWithBasicProgramConventions.java +++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/objects/dom/JavaObjectWithBasicProgramConventions.java @@ -207,7 +207,7 @@ public class JavaObjectWithBasicProgramConventions implements Interface1, Interf return "one, field two ,three, five"; } - // tests the hide method with same set of paramaters + // tests the hide method with same set of parameters public static boolean alwaysHideHiddenAction(final String param) { return true; } @@ -215,7 +215,7 @@ public class JavaObjectWithBasicProgramConventions implements Interface1, Interf public void hiddenAction(final String param) { } - // tests the hide method with no paramaters + // tests the hide method with no parameters public static boolean alwaysHideHiddenAction2() { return true; } diff --git a/extensions/security/secman/applib/src/main/java/org/apache/isis/extensions/secman/applib/permission/dom/ApplicationPermissionMode.java b/extensions/security/secman/applib/src/main/java/org/apache/isis/extensions/secman/applib/permission/dom/ApplicationPermissionMode.java index 80efdced81..00fb59548d 100644 --- a/extensions/security/secman/applib/src/main/java/org/apache/isis/extensions/secman/applib/permission/dom/ApplicationPermissionMode.java +++ b/extensions/security/secman/applib/src/main/java/org/apache/isis/extensions/secman/applib/permission/dom/ApplicationPermissionMode.java @@ -30,32 +30,23 @@ import org.apache.isis.commons.internal.base._Strings; public enum ApplicationPermissionMode { /** * Whether the user/role can view (or is prevented from viewing) the application feature (class member). - * * <p> * The {@link ApplicationPermissionRule rule} of the * {@link ApplicationPermission} indicates whether access is being * granted or denied. - * </p> */ VIEWING, /** * Whether can user/role can change (or is prevented from changing) the state of the system using the application feature (class member). - * * <p> - * In other words, whether they can execute (if an action, modify/clear (if a property), addTo/removeFrom - * (if a collection). - * </p> - * + * In other words, whether they can execute (if an action, modify/clear (if a property), [addTo/removeFrom + * (if a collection) ... see note below]. * <p> * The {@link ApplicationPermissionRule rule} of the * {@link ApplicationPermission} indicates whether access is being * granted or denied. - * </p> - * * <p> - * Note that the Wicket viewer does not at the time of writing (Isis 1.6.0) support the notion of - * mutable collections. The RO viewer does, however. - * </p> + * Note: as of ISIS-3084 the notion of mutable collections was removed */ CHANGING; diff --git a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java index b0057b9282..9b4bc93aba 100644 --- a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java +++ b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java @@ -164,32 +164,33 @@ public interface DomainObjectResource { }) public Response accessCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId); - @PUT - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response addToSet(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream arguments); - - @POST - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream arguments); - - @DELETE - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response removeFromCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId); +//XXX[ISIS-3084] - removal of (direct) collection modification - business logic should handle that via actions instead +// @PUT +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response addToSet(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream arguments); +// +// @POST +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId, final InputStream arguments); +// +// @DELETE +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response removeFromCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("collectionId") final String collectionId); // ////////////////////////////////////////////////////////// // domain object action diff --git a/viewers/restfulobjects/viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/DomainObjectResourceServerside.java b/viewers/restfulobjects/viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/DomainObjectResourceServerside.java index c337f0363a..2691ed3d26 100644 --- a/viewers/restfulobjects/viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/DomainObjectResourceServerside.java +++ b/viewers/restfulobjects/viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/DomainObjectResourceServerside.java @@ -545,67 +545,68 @@ implements DomainObjectResource { domainResourceHelper.collectionDetails(collectionId, ManagedMember.RepresentationMode.READ)); } - @Override - @PUT - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response addToSet( - @PathParam("domainType") final String domainType, - @PathParam("instanceId") final String instanceId, - @PathParam("collectionId") final String collectionId, - final InputStream body) { - - throw _EndpointLogging.error(log, "POST /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, - RestfulObjectsApplicationException - .createWithMessage( - HttpStatusCode.METHOD_NOT_ALLOWED, - "The framework no longer supports mutable collections.")); - } - - @Override - @POST - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response addToList( - @PathParam("domainType") final String domainType, - @PathParam("instanceId") final String instanceId, - @PathParam("collectionId") final String collectionId, - final InputStream body) { - - throw _EndpointLogging.error(log, "POST /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, - RestfulObjectsApplicationException - .createWithMessage( - HttpStatusCode.METHOD_NOT_ALLOWED, - "The framework no longer supports mutable collections.")); - } - - @Override - @DELETE - @Path("/{domainType}/{instanceId}/collections/{collectionId}") - @Consumes({ MediaType.WILDCARD }) - @Produces({ - MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, - MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR - }) - public Response removeFromCollection( - @PathParam("domainType") final String domainType, - @PathParam("instanceId") final String instanceId, - @PathParam("collectionId") final String collectionId) { - - throw _EndpointLogging.error(log, "DELETE /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, - RestfulObjectsApplicationException - .createWithMessage( - HttpStatusCode.METHOD_NOT_ALLOWED, - "The framework no longer supports mutable collections.")); - } + //XXX[ISIS-3084] - removal of (direct) collection modification - business logic should handle that via actions instead +// @Override +// @PUT +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response addToSet( +// @PathParam("domainType") final String domainType, +// @PathParam("instanceId") final String instanceId, +// @PathParam("collectionId") final String collectionId, +// final InputStream body) { +// +// throw _EndpointLogging.error(log, "POST /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, +// RestfulObjectsApplicationException +// .createWithMessage( +// HttpStatusCode.METHOD_NOT_ALLOWED, +// "The framework no longer supports mutable collections.")); +// } +// +// @Override +// @POST +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response addToList( +// @PathParam("domainType") final String domainType, +// @PathParam("instanceId") final String instanceId, +// @PathParam("collectionId") final String collectionId, +// final InputStream body) { +// +// throw _EndpointLogging.error(log, "POST /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, +// RestfulObjectsApplicationException +// .createWithMessage( +// HttpStatusCode.METHOD_NOT_ALLOWED, +// "The framework no longer supports mutable collections.")); +// } +// +// @Override +// @DELETE +// @Path("/{domainType}/{instanceId}/collections/{collectionId}") +// @Consumes({ MediaType.WILDCARD }) +// @Produces({ +// MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_JSON_ERROR, +// MediaType.APPLICATION_XML, RestfulMediaType.APPLICATION_XML_OBJECT_COLLECTION, RestfulMediaType.APPLICATION_XML_ERROR +// }) +// public Response removeFromCollection( +// @PathParam("domainType") final String domainType, +// @PathParam("instanceId") final String instanceId, +// @PathParam("collectionId") final String collectionId) { +// +// throw _EndpointLogging.error(log, "DELETE /objects/{}/{}/collections/{}", domainType, instanceId, collectionId, +// RestfulObjectsApplicationException +// .createWithMessage( +// HttpStatusCode.METHOD_NOT_ALLOWED, +// "The framework no longer supports mutable collections.")); +// } // ////////////////////////////////////////////////////////// // domain object action
