Hello, just got back to this one, used option 1, it worked just fine. Thank you!
-----Original Message----- From: Dan Haywood [mailto:[email protected]] Sent: Wednesday, November 4, 2015 4:12 PM To: users Subject: Re: Add tenancy programtically Four ways of doing this: 1. direct: in the action that creates the Business object, eg createBusiness(...), have it call an injected ApplicationTenancyRepository to create a corresponding ApplicationTenancy 2. using a subscriber: define a custom subclass of ActionDomainEvent, eg CreateBusinessDomainEvent, and have a subscriber listen for that. In the EXECUTING or EXECUTED phase, create the ApplicationTenancy, again using an injected ApplicationTenancy 3. use IsisJdoSupport to register a direct JDO lifecycle event listener for the JDO persisting event: public void preStore(InstanceLifecycleEvent event) . Note this is called for both INSERTs and UPDATEs 4. if using 1.10.0-SNAPSHOT, then have a subscriber listen to ObjectPersistingEvent or ObjectPersistedEvent, and create the corresponding ApplicationTenancy there. HTH Dan On 4 November 2015 at 21:55, Cesar Lugo <[email protected]> wrote: > > > Hello. > > > > When using the security module add-on, I want a new tenancy to be > created automatically when a user inserts a new entity domain object, > called Business,, which has tenancy support, and then assign that > newly created tenancy to that Business object before persisting it. I > would like to know if there is a method I can call that creates a new > tenancy, and then assign the created tenancy to the newly created object > (Business). > > > > Cesar. > > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
