incubator-isis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Howard <howard.a...@gmail.com>
Subject Two bugs I'm working on
Date Mon, 09 Jul 2012 06:02:03 GMT
Hi Dan,

I forked the Isis repo on github and I'm working on the two "hiding"
issues I had mentioned earlier [1].

The @NotInServicesMenu check won't work as I described. When I get
into the NotInServicesMenuFacetAnnotation.hides() method
ic.getTarget() is the PojoAdapter for the Repository, not for the
object who is receiving the contributed action. Example:

interface ProjectRepository {
  Project newProject();

  @NotInServicesMenu
  List<Project> projectFor(Contact contact);
}

When building the representation of the service this code works:

public class NotInServicesMenuFacetAnnotation ... {

  @Override
  public String hides(final VisibilityContext<? extends VisibilityEvent> ic) {
    if (ic.getTarget().getSpecification().isService()) {
      return "@NotInServiceMenu annotation present";
    }
    return null;
  }
}

The target is the repository which is a service so the action is hidden. Good.

But when building the representation for the Contact object there is a twist.

DomainObjectReprRenderer calls action.isVisible(session,
objectAdapter) for each action (including contributed.) objectAdapter
is the PojoAdapter for the Contact.

action.isVisible turns around and calls super.isVisible(session,
realTarget(objectAdapter)). It is this realTarget() call that changes
from operating on the Contact to the Repository. If it was left out
then I think the hides method above would correctly allow the action
to be visible on the Contact.

Can you give me an idea of why we need to get the real target in this
case? And why the service is the real target for a contributed action.

The fix for keeping @Hidden objects out of list representations (like
the list of services) was just as simple as I thought. So I'm ready to
commit that change (3 lines.) Are there any steps I should take before
committing, pushing to github and submitting a pull request? Build the
whole project? Write a test case? Anything special I should include in
the commit comment?

Thanks.
--
Adam

[1] http://mail-archives.apache.org/mod_mbox/incubator-isis-dev/201207.mbox/%3CCALJOYLEzOEnYHqx8JUK_ygoKN1-ET2Q%3DXnPrfy%3DGOiRdKJ%3DuqA%40mail.gmail.com%3E

Mime
View raw message