-
Notifications
You must be signed in to change notification settings - Fork 0
/
FillerFactory.py
30 lines (26 loc) · 1.19 KB
/
FillerFactory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import importlib
from EMInfraImporter import EMInfraImporter
from PostGISConnector import PostGISConnector
from ResourceEnum import ResourceEnum
FILLER_FACTORY_DICT = {
ResourceEnum.agents: 'AgentFiller',
ResourceEnum.assets: 'AssetFiller',
ResourceEnum.identiteiten: 'IdentiteitFiller',
ResourceEnum.assettypes: 'AssetTypeFiller',
ResourceEnum.relatietypes: 'RelatieTypeFiller',
ResourceEnum.bestekken: 'BestekFiller',
ResourceEnum.toezichtgroepen: 'ToezichtgroepFiller',
ResourceEnum.beheerders: 'BeheerderFiller',
ResourceEnum.assetrelaties: 'AssetRelatieFiller',
ResourceEnum.betrokkenerelaties: 'BetrokkeneRelatieFiller',
ResourceEnum.controlefiches: 'ControleficheFiller',
}
class FillerFactory:
@staticmethod
def create_filler(eminfra_importer: EMInfraImporter, resource: ResourceEnum, postgis_connector: PostGISConnector,
fill_manager):
name = FILLER_FACTORY_DICT[resource]
module = importlib.import_module(name)
class_ = getattr(module, name)
return class_(eminfra_importer=eminfra_importer, postgis_connector=postgis_connector,
resource=resource, fill_manager=fill_manager)