Base Interface for factories
Created by: martinRenou
In order to be able to factorize some code in the GUI I would like to have a base interface for the bundles, this interface would just express that the class needs to implement a create_model
method.
This would allow in the GUI to have a AddEntityModalDialog
class which has a list of available bundles, and create associated models without knowing if those models are MCOs, KPICs or DataSources.
For now I have one modal class per type of entity, and it is a lot of duplicated code. A workaround is to use the Either
trait and, in the AddEntityModalDialog
, define the list of bundles as follows:
available_bundles = Either(
List(Instance(IMCOBundle)),
List(Instance(IDataSourceBundle)),
List(Instance(IKPICalculatorBundle)),
)
But if we have a base bundle interface we could have:
available_bundles = List(Instance(IBundle))