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 <[email protected]>
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 <[email protected]>:
>
> > Perhaps you can specify your question with some (pseudo) code?
> >
> > On 15 June 2016 at 16:41, Fabio Purcino <[email protected]> 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
>

Reply via email to