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 2017/09/21 10:17:00 UTC

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

Dan Haywood created ISIS-1732:
---------------------------------

             Summary: 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: 2.0.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
(v6.4.14#64029)