My actor filter need access to the BDM
I am writing an actor filter that needs access to the BDM.
I am struggling with the BusinessObjectDAOFactory as createDAO method need an APISession parameter. My problem is that the APISession seems not to be accessible from the filter method.
Here is my code:
BusinessObjectDAOFactory daoFactory = new BusinessObjectDAOFactory();
TiersDelegationSignatureDAO tdsDao = daoFactory.createDAO(null, TiersDelegationSignatureDAO.class);
How do I get a reference to the session?
That's interesting use case.
Why do you need to create a DAO here? Are you trying to read a BDM object or to update/create an existing one?
I understand better now, thanks for the clarification.
As of now, I see two options to access a BDM object:
- You provide the BDM object as an input of your actor filter and then use this object in the implementation. When you define the Actor definition, you can specify any type for inputs, so you can use your BDM types - don't forget to use Script editor type for the widget field types.
- You provide the DAO accessor as an input of your actor filter. The DAOs are available in the Groovy script editor when providing the input of a Actor filter.
Hope it helps
It took me a while to find the right xsi:type (definition:) but finally managed to use the DAO as an input parameter but this does not solve my use-case problem as I get a java.lang.IllegalStateException No active transaction exception.
I believe I will have to use the DAO in the filter input parameter to send the real list of objects and iterate over it. Not a big issue here as there are not a lot of data but could prove problematic for other use cases.
Nevertheless I am fairly confident I will reach a working solution with the help of your answer. Thanks a lot!