Very good Oscar, going to give it try. And thanks for point out this direction, Eder On Feb 15, 2017 5:44 PM, "Óscar Bou - GOVERTIS" <[email protected]> wrote:
> > Sure. > > Dan pointed in the previous email to the Estatio web app he and Jeroen are > developing, as it's fully Apache licensed. > > Use it for best practices using Apache Isis. > > There you will find an "app" Maven module different from the "domain" > Maven module, used for defining Services that use actions and generate View > Models from Domain Entities defined in the "domain" module. > You should not find any Domain Entity on the "app" Maven module, as its > responsibility it's to define a "facade"? for the web UI or the REST API. > > All business logic, Domain Entities, etc. should be on the "domain" Maven > module. > > Services in the "app" module should only be attached to the UI (like to > define menus) or implement actions that are directly invoked from the UI > (or REST API) that probably a te simply some chained invocations of Actions > defined in Services, Repositories or Domain Entities from the "domain" > Maven module. > > There's another example on the Todo web app [1], where you can also see > how the "todo-app" Maven module uses Domain Entities and other business > logic that resides in the "todo-domain" Maven module. > > HTH, > > Oscar > > > [1] https://github.com/isisaddons/isis-app-todoapp/blob/master/README.md > > [2] https://github.com/isisaddons/isis-app-todoapp/tree/master/ > app/src/main/java/todoapp/app > > > > Disculpa que sea breve. > Enviado desde mi móvil > > El 15 feb 2017, a las 21:13, L Eder <[email protected]> escribió: > > > > Dan: > > Could not delete it. There are plenty of ramifications, scattered > > among many modules. > > IntelliJ says there are over 1k of them. > > > > However based on what you said about the DOMAIN nature, i explored > > more, and confirmed there is no problem for it indeed works. I > > perceived ExportToWordMenu as being the one impeding the suppression. > > It was contributing with one menu item there in QuickObjectMenu. > > I then looked at its nature value, and was undefined (maybe using the > > default value). Then i defined it to DOMAIN and the issue was nicely > > fixed. > > > > Oscar: > > Thanks and sorry i am a newbie here. Could you elaborate a bit more, > > sort of sample code? > > > > > > 2017-02-15 14:42 GMT-04:00, Dan Haywood <[email protected]>: > >> Yes, this is actually how Estatio is currently structured [1]. We're > not > >> certain if we're going to stick with it, but the original thinking was > >> similar to what you say. > >> > >> Cheers > >> > >> [1] > >> https://github.com/estatio/estatio/tree/master/ > estatioapp/app/src/main/java/org/estatio/app/menus > >> > >> > >> On Wed, 15 Feb 2017 at 18:20 Óscar Bou - GOVERTIS <[email protected]> > >> wrote: > >> > >>> > >>> You could define the "menu service", and other coordination services > >>> invoking domain actions that could be guided by the use cases / UI, in > an > >>> "app" module, different from the "domain" one. > >>> > >>> My 2cts ... > >>> > >>> > >>> > >>>> El 15 feb 2017, a las 17:17, Dan Haywood < > [email protected]> > >>> escribió: > >>>> > >>>> The pattern we suggest is two domain services, one being a repository > >>>> for > >>>> an entity - ie QuickObjectRepository - and the other a menu - ie > >>>> QuickObjectMenu. Not every entity will need a menu, and indeed it > >>>> might > >>>> make sense to have menus that provide access to multiple entities, eg > a > >>>> "Reference Data" or "Admin" menu. In other words, the *Menu services > >>>> are > >>>> really just to organize the UI, while the *Repository services do the > >>> real > >>>> work. > >>>> > >>>> In this case, if you don't need a menu then just delete > >>>> QuickObjectsMenu. > >>>> It doesn't have any behaviour other than delegating to > >>>> QuickObjectRepository. > >>>> > >>>> You are correct that setting the nature=DOMAIN should suppress it from > >>> the > >>>> UI also; if that isn't the case, then please create a test example > >>>> application demonstrating the problem and push it to github. > >>>> > >>>> HTH > >>>> Dan > >>>> > >>>>> On Wed, 15 Feb 2017 at 14:54 L Eder <[email protected]> wrote: > >>>>> > >>>>> The code. Actually it is the one at quickstart sample: > >>>>> > >>>>> QuickObjectRepository: > >>>>> " > >>>>> @DomainService( > >>>>> nature = NatureOfService.DOMAIN, > >>>>> repositoryFor = QuickObject.class > >>>>> ) > >>>>> public class QuickObjectRepository { > >>>>> > >>>>> //region > listAll (programmatic) > >>>>> > >>>>> @Programmatic > >>>>> public List<QuickObject> listAll() { > >>>>> return container.allInstances(QuickObject.class); > >>>>> } > >>>>> //endregion > >>>>> > >>>>> //region > findByName (programmatic) > >>>>> > >>>>> @Programmatic > >>>>> public QuickObject findByName( > >>>>> final String name > >>>>> ) { > >>>>> return container.uniqueMatch( > >>>>> new QueryDefault<>( > >>>>> QuickObject.class, > >>>>> "findByName", > >>>>> "name", name)); > >>>>> } > >>>>> //endregion > >>>>> > >>>>> //region > findByNameContains (programmatic) > >>>>> > >>>>> @Programmatic > >>>>> public List<QuickObject> findByNameContains( > >>>>> final String name > >>>>> ) { > >>>>> return container.allMatches( > >>>>> new QueryDefault<>( > >>>>> QuickObject.class, > >>>>> "findByNameContains", > >>>>> "name", name)); > >>>>> } > >>>>> //endregion > >>>>> > >>>>> //region > create (programmatic) > >>>>> > >>>>> @Programmatic > >>>>> public QuickObject create(final String name) { > >>>>> final QuickObject obj = > >>>>> container.newTransientInstance(QuickObject.class); > >>>>> obj.setName(name); > >>>>> container.persistIfNotAlready(obj); > >>>>> return obj; > >>>>> } > >>>>> > >>>>> //endregion > >>>>> > >>>>> //region > findOrCreate (programmatic) > >>>>> > >>>>> @Programmatic > >>>>> public QuickObject findOrCreate( > >>>>> final String name > >>>>> ) { > >>>>> QuickObject quickObject = findByName(name); > >>>>> if(quickObject == null) { > >>>>> quickObject = create(name); > >>>>> } > >>>>> return quickObject; > >>>>> } > >>>>> //endregion > >>>>> > >>>>> > >>>>> //region > injected services > >>>>> > >>>>> @javax.inject.Inject > >>>>> DomainObjectContainer container; > >>>>> > >>>>> //endregion > >>>>> } > >>>>> " > >>>>> > >>>>> QuickObjectMenu: > >>>>> " > >>>>> @DomainService( > >>>>> nature = NatureOfService.VIEW_MENU_ONLY > >>>>> // nature = NatureOfService.DOMAIN > >>>>> ) > >>>>> @DomainServiceLayout( > >>>>> menuOrder = "700", > >>>>> named = "Quick Objects" > >>>>> ) > >>>>> public class QuickObjectMenu { > >>>>> > >>>>> //region > listAll (action) > >>>>> @Action( > >>>>> semantics = SemanticsOf.SAFE > >>>>> ) > >>>>> @ActionLayout( > >>>>> bookmarking = BookmarkPolicy.AS_ROOT > >>>>> ) > >>>>> @MemberOrder(sequence = "1") > >>>>> public List<QuickObject> listAll() { > >>>>> return quickObjectRepository.listAll(); > >>>>> } > >>>>> //endregion > >>>>> > >>>>> //region > findByName (action) > >>>>> @Action( > >>>>> semantics = SemanticsOf.SAFE > >>>>> ) > >>>>> @ActionLayout( > >>>>> bookmarking = BookmarkPolicy.AS_ROOT > >>>>> ) > >>>>> @MemberOrder(sequence = "2") > >>>>> public List<QuickObject> findByName( > >>>>> @ParameterLayout(named="Name") > >>>>> final String name > >>>>> ) { > >>>>> return quickObjectRepository.findByNameContains(name); > >>>>> } > >>>>> //endregion > >>>>> > >>>>> //region > create (action) > >>>>> public static class CreateDomainEvent extends > >>>>> ActionDomainEvent<QuickObjectMenu> { } > >>>>> > >>>>> @Action( > >>>>> domainEvent = CreateDomainEvent.class > >>>>> ) > >>>>> @MemberOrder(sequence = "3") > >>>>> public QuickObject create( > >>>>> @ParameterLayout(named="Name") > >>>>> final String name) { > >>>>> return quickObjectRepository.create(name); > >>>>> } > >>>>> > >>>>> //endregion > >>>>> > >>>>> //region > injected services > >>>>> > >>>>> @javax.inject.Inject > >>>>> QuickObjectRepository quickObjectRepository; > >>>>> > >>>>> //endregion > >>>>> } > >>>>> " > >>>>> > >>>>> > >>>>> > >>>>> 2017-02-15 10:35 GMT-04:00, Dan Haywood > >>>>> <[email protected]>: > >>>>>> Should be easy ... can you post the code of the domain service that > >>>>>> is > >>>>>> appearing as a menu that you want to suppress ? > >>>>>> > >>>>>> > >>>>>>> On Wed, 15 Feb 2017 at 14:23 L Eder <[email protected]> wrote: > >>>>>>> > >>>>>>> Hi Dan: > >>>>>>> > >>>>>>> I browsed the documentation for a way to hide a menu object but > >>>>>>> properties and actions. The closest thing found was > >>>>>>> @NotInServiceMenu. > >>>>>>> I tried some combinations, even using the NatureOfService enum, but > >>>>>>> no > >>>>>>> success so far. > >>>>>>> > >>>>>>> Idea is to omit, eg, prevent QuickObjects entity from being > rendered > >>>>>>> in the menu bar. > >>>>>>> > >>>>>>> Thanks for you suggestion, Eder > >>>>>>> > >>>>>> > >>>>> > >>> > >>> > >> >
