You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2019/01/06 11:44:00 UTC

[jira] [Updated] (ISIS-1732) Document "hidden" as a supported method for services.

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

Dan Haywood updated ISIS-1732:
------------------------------
    Fix Version/s:     (was: 2.2.0)
                   1.18.0

> Document "hidden" as a supported method for services.
> -----------------------------------------------------
>
>                 Key: ISIS-1732
>                 URL: https://issues.apache.org/jira/browse/ISIS-1732
>             Project: Isis
>          Issue Type: Improvement
>    Affects Versions: 1.15.0
>            Reporter: Dan Haywood
>            Priority: Minor
>             Fix For: 1.18.0
>
>
> eg, in kitchensink, we have:
> {code}
> public abstract class RepositoryAbstract<T extends Entity> {
>     private final Class<T> cls;
>     public RepositoryAbstract(Class<T> cls, Visibility visibility) {
>         this.cls = cls;
>         this.visibility = visibility;
>     }
>     //region > visibility
>     private final Visibility visibility;
>     protected enum Visibility {
>         VISIBLE,
>         NOT_VISIBLE
>     }
>     public boolean hidden() {
>         return this.visibility == Visibility.NOT_VISIBLE;
>     }
>     //endregion
>  ....
> {code}
> and then:
> {code}
> @DomainService(
>         repositoryFor = ChildObject.class
> )
> public class ChildObjects extends RepositoryAbstract<ChildObject> {
>     public ChildObjects() {
>         super(ChildObject.class, Visibility.NOT_VISIBLE);
>     }
>     public ChildObject create(
>             final String name,
>             final ParentObject parentObject) {
>         return repositoryService.persist(ChildObject.create(name, parentObject));
>     }
>     public List<ChildObject> listAll() {
>         return repositoryService.allInstances(ChildObject.class);
>     }
> }
> {code}
> if use super(...VISIBLE) then this service appears in the menu.  so, "hidden()" is a way of globally hiding an object (or a domain service, at least).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)