Hi Dan,

It's exactly what I'm trying to do. I want to make an Action with an
Autocomplete Parameter listing All Services and Actions.  After user select
some action this action will fire the action as if I clicked.

I'm thinking about the growing complexity keeping navigation fluidly and
easy.

Thanks,
Fabio






2016-06-16 8:57 GMT-03:00 Dan Haywood <d...@haywood-associates.co.uk>:

> Hi Fabio,
>
> What Stephen has said is all true, of course, but I'm just wondering if
> what you want is some sort of intercept in order to influence the action
> prompt that's rendered?
>
> If so, then the answer to that is "no", I'm afraid.
>
> That said, I'm not certain if I fully understand the objective.  My *guess*
> is that you want to be able to have the user invoke some sort of menu item,
> but then programmatically decide which action to delegate on to, almost
> like a redirect?
>
> For example, something like:
>
>
> public class SomeMenu {
>     public void doSomethingOrOther() {
>         if(shouldDoSomething()) {
>            // render the prompt for "doSomething" and invoke
>          } else
>            // render the prompt for "doOther" and invoke
>          }
>     }
>
>     public Object doSomething(int x) {
>        // would render an action prompt requesting an int param, and return
> a single object
>     }
>
>     public List doSomething(boolean y) {
>        // would render an action prompt requesting an boolean param, and
> return a list
>     }
>
> }
>
> Do I at least understand the question?
>
> Thx
> Dan
>
>
>
>
>
>
>
> On 15 June 2016 at 23:33, Stephen Cameron <steve.cameron...@gmail.com>
> wrote:
>
> > At the code level its just OO programming, so whatever your action
> 'method'
> > returns is what Isis will display to the user, as long as it knows of
> that
> > class in its metamodel (from which it builds the view) so the Doenca
> class
> > needs to be annotated with @DomainObject.
> >
> > then:
> >
> > @DomainService(nature = NatureOfService.DOMAIN) // not a user viewed
> > service
> >
> > public class Doencas {
> >
> > public Doenca create(){
> > ...
> > }
> >
> > }
> >
> > and:
> >
> > @DomainService(nature = NatureOfService.VIEW_MENU_ONLY)
> >
> > @DomainServiceLayout(
> >
> > named = "Transações",
> >
> >         menuBar = DomainServiceLayout.MenuBar.PRIMARY,
> >
> >         menuOrder = "1"
> >
> > )
> >
> > public class Transacoes {
> >
> >     @Action(semantics = SemanticsOf.SAFE)
> >
> >     @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT, named="Buscar
> > Transação") // Why bookmark an action thats in the menu?
> >
> >     @MemberOrder(sequence = "1.1")
> >
> >     public Doenca buscarTransacao(
> >
> >         final @ParameterLayout(named="Transação") String tr) {
> >
> >
> >
> >     //Code here
> >
> >           return   doencaRepo.create();
> >
> >     }
> >
> > @javax.inject.Inject
> > Doencas doencaRepo;
> >
> > }
> >
> > On Thu, Jun 16, 2016 at 3:13 AM, Fabio Purcino <fa...@viacodigo.com.br>
> > wrote:
> >
> > > Hi Jeroen,
> > >
> > > Thanks for your reply. Following are some code snippets:
> > >
> > > First of all I have this Domain Service with an action buscarTransacao
> > that
> > > shows an parameter screen. It works fine.
> > >
> > > My goal is call a method like this:
> > >
> > > manager.InvokeAction("Doenca","create") ;
> > >
> > > And the action be called showing a parameter screen. I tried to do this
> > by
> > > injecting Doencas into Transacoes and calling it directly but It
> bypasses
> > > parameter screen.
> > >
> > > Could you help me solving this issue?
> > >
> > >
> > >
> > >
> > >
> >
> ***********************************************************************************
> > >
> > > @DomainService(nature = NatureOfService.VIEW_MENU_ONLY)
> > >
> > > @DomainServiceLayout(
> > >
> > > named = "Transações",
> > >
> > >         menuBar = DomainServiceLayout.MenuBar.PRIMARY,
> > >
> > >         menuOrder = "1"
> > >
> > > )
> > >
> > > public class Transacoes {
> > >
> > >     @Action(semantics = SemanticsOf.SAFE)
> > >
> > >     @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT, named="Buscar
> > > Transação")
> > >
> > >     @MemberOrder(sequence = "1.1")
> > >
> > >     public void buscarTransacao(
> > >
> > >         final @ParameterLayout(named="Transação") String tr) {
> > >
> > >
> > >
> > >     //Code here
> > >
> > >               manager.InvokeAction("Doenca","create") ;
> > >
> > >     }
> > >
> > > }
> > >
> > >
> > >
> >
> ***********************************************************************************
> > >
> > >
> > > I have another Domain Service I intend to be called only
> > programmatically.
> > > It works fine too.
> > >
> > >
> > >
> > >
> >
> ***********************************************************************************
> > >
> > > @DomainService(nature = NatureOfService.VIEW_MENU_ONLY,repositoryFor =
> > > Doenca.class)
> > >
> > > @DomainServiceLayout(
> > >
> > > named = "Dados Mestres",
> > >
> > >         menuBar = DomainServiceLayout.MenuBar.PRIMARY,
> > >
> > >         menuOrder = "10.3"
> > >
> > > )
> > >
> > > public class Doencas {
> > >
> > >     public TranslatableString title() {
> > >
> > >         return TranslatableString.tr("Doenças");
> > >
> > >     }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >     @Action(semantics = SemanticsOf.SAFE)
> > >
> > >     @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT,
> named="Doenças")
> > >
> > >     @MemberOrder(sequence = "1")
> > >
> > >     public List<Doenca> listAll() {
> > >
> > >         return repositoryService.allInstances(Doenca.class);
> > >
> > >     }
> > >
> > >
> > >
> > >
> > >
> > >     @Action(semantics = SemanticsOf.SAFE)
> > >
> > >     @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> > >
> > >     @MemberOrder(sequence = "2")
> > >
> > >     public Doenca create(
> > >
> > >     final @ParameterLayout(named="CID") String cid,
> > >
> > >         final @ParameterLayout(named="Descrição") String descricao) {
> > >
> > >         final Doenca obj = repositoryService.instantiate(Doenca.class);
> > >
> > >         obj.setCid(cid);
> > >
> > >         obj.setDescricao(descricao);
> > >
> > >         repositoryService.persist(obj);
> > >
> > >         return obj;
> > >
> > >     }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >     @javax.inject.Inject
> > >
> > >     RepositoryService repositoryService;
> > >
> > > }
> > >
> > >
> > >
> >
> ***********************************************************************************
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > 2016-06-15 13:14 GMT-03:00 Jeroen van der Wal <jer...@stromboli.it>:
> > >
> > > > Perhaps you can specify your question with some (pseudo) code?
> > > >
> > > > On 15 June 2016 at 16:41, Fabio Purcino <fa...@viacodigo.com.br>
> > wrote:
> > > >
> > > > > Hi all,
> > > > >
> > > > > Is it possible to invoke an action programmatically from another
> > > action?
> > > > >
> > > > > The called action has parameters and I'd like to show the same
> screen
> > > as
> > > > I
> > > > > click on the service menu.
> > > > >
> > > > > Thanks and best Regards,
> > > > >
> > > > > --
> > > > > ------------------------------------------------------------
> > > > > Fábio Purcino Aragão
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > ------------------------------------------------------------
> > > Fábio Purcino Aragão
> > >
> >
>



-- 
------------------------------------------------------------
Fábio Purcino Aragão

Reply via email to