My actor filter need access to the BDM

1
0
-1

Hello

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:

  1. LOGGER.debug("Find delegates for {}", direction);
  2. BusinessObjectDAOFactory daoFactory = new BusinessObjectDAOFactory();
  3. TiersDelegationSignatureDAO tdsDao = daoFactory.createDAO(null, TiersDelegationSignatureDAO.class);

How do I get a reference to the session?

Comments

Submitted by Lionel Palacin on Wed, 06/22/2016 - 00:57

Hi,

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?

Thanks

Submitted by g.lapierre on Wed, 06/22/2016 - 09:16

The use-case is simple: in my organization there are Directors. Some actions need validation from them. They are not always the manager of the case initiator.

My actor filter have two purposes:

  • find the right Director (depending on the initiator's membership to a given group)
  • find the delegations the Director might have given to other users

The delegations are handled as BDM objects and I have a specific process for Directors to manage them. Plus there is a special group of users who can manage those delegations (custom page - yet to be writen) as most of those Directors will not use the system (but their delegates will!). So this is where I need to be able to create a DAO to read BDM objects.

And this is of course project specific as those delegations are only valid for this process and I can have other processes with different delegations (or might be the same, Director's choice!).

Maybe my use of BDM is not the right thing to do? Maybe I should write those delegations in a separate database and use REST APIs to read/write them but I thought BDM would be easier. Any advice welcome!

Thanks

Submitted by g.lapierre on Thu, 06/23/2016 - 17:58

The BDM object will not be useful in my context but the DAO is indeed a very good idea!
Il will work on this one. As this is my very first actor filter I still lack insight on parameters but it will be a good exercice (I intended to add a boolean to enable/disable delegations)

1 answer

1
0
-1
This one is the BEST answer!

Hi,

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

Comments

Submitted by g.lapierre on Fri, 06/24/2016 - 10:56

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!

Notifications