[ 
https://issues.apache.org/jira/browse/CAUSEWAY-3752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andi Huber updated CAUSEWAY-3752:
---------------------------------
    Summary: Programming Model to describe which Classes are surfaced by the 
different Viewers  (was: Provide SPI to describe which classes are surfaced by 
the different viewers.)

> Programming Model to describe which Classes are surfaced by the different 
> Viewers
> ---------------------------------------------------------------------------------
>
>                 Key: CAUSEWAY-3752
>                 URL: https://issues.apache.org/jira/browse/CAUSEWAY-3752
>             Project: Causeway
>          Issue Type: New Feature
>          Components: Core, Viewer GraphQL, Viewer RO, Viewer Wicket
>    Affects Versions: 2.0.0
>            Reporter: Daniel Keir Haywood
>            Assignee: Andi Huber
>            Priority: Major
>             Fix For: 4.0.0
>
>
> Before releasing 2.0.0/3.0.0, we decided to make 
> `@DomainService(nature=VIEW|REST_ONLY)` a no-op , for a couple of reasons:
>  * we now have a GraphQL viewer, and the enum didn't seem general enough
>  * the REST API has its own rather adhoc mechanism for what to expose: 
> public, prototyping or private
>  ** but this only affects the Swagger file, not the actual API that's 
> actually available
>  * the GraphQL viewer has an issue that it takes a loooong time to expose the 
> entire API; and probably we wouldn't want to do that.
>  In removing `@DomainService(nature=...)`, we told ourselves that users could 
> just use security; but that doesn't address the above issues.
>  
> We propose a new programing model to honor _Viewer_ specific _Domain Object_ 
> visibility:
> {color:#0f0f0f}Instead of referencing viewer IDs directly, users declare 
> intent using {color}*abstract profiles*{color:#0f0f0f} (e.g., 
> {color}{{{}web-ui{}}}{color:#0f0f0f}, {color}{{{}api-v2{}}}{color:#0f0f0f}, 
> {color}{{{}mobile{}}}{color:#0f0f0f}, {color}{{{}admin{}}}{color:#0f0f0f}). 
> The framework maps these profiles to actual viewer IDs via 
> configuration.{color}
> Configuration:
> {noformat}
> # Map viewer IDs to the profiles they support
> causeway.viewer-profiles.wicket=web-ui
> causeway.viewer-profiles.restful=api,restful-only
> causeway.viewer-profiles.qraphql=api,graphql-only
> # Global fallback
> causeway.viewer-profiles.default=web-ui
> # Namespace specific overrides
> causeway.viewer-profiles.default.com.myapp.orders=web-ui
> causeway.viewer-profiles.default.com.myapp.payments=api
> causeway.viewer-profiles.default.com.myapp.reports=web-ui,api
> {noformat}
> Defaults can then be overridden on a per class basis:
> {code:java}
> @DomainServiceLayout(showFor = {"web-ui", "restful-only"}) 
> class SomeDomainService {
> }
> @DomainObjectLayout(showFor = {"web-ui", "restful-only"}) 
> class SomeDomainObject {
> }
> {code}
> (If unspecified, defaults from config apply.)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to