-
Notifications
You must be signed in to change notification settings - Fork 16
/
doaj.py
152 lines (131 loc) · 5.17 KB
/
doaj.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# ~~DOAJ:Service~~
class DOAJ(object):
"""
Primary entry point to the services which back up the DOAJ Business Logic Layer.
This is, in effect, a factory for generating the services for the various areas
of the DOAJ.
To use it, request the service or services for the area that you are working with, and then
call functions on the resulting service object. For example:
applicationService = DOAJ.applicationService()
applicationService.application_2_journal(....)
"""
@classmethod
def applicationService(cls):
"""
Obtain an instance of the application service ~~->Application:Service~~
:return: ApplicationService
"""
# Note the use of delayed imports to minimise code pre-loading, and to allow services loaded
# via this factory to also use the factory to load other services.
from portality.bll.services import application
return application.ApplicationService()
@classmethod
def journalService(cls):
"""
Obtain an instance of the journal service ~~->Journal:Service~~
:return: JournalService
"""
# Note the use of delayed imports to minimise code pre-loading, and to allow services loaded
# via this factory to also use the factory to load other services.
from portality.bll.services import journal
return journal.JournalService()
@classmethod
def authorisationService(cls):
"""
Obtain an instance of the authorisation service ~~->AuthNZ:Service~~
:return: AuthorisationService
"""
# Note the use of delayed imports to minimise code pre-loading, and to allow services loaded
# via this factory to also use the factory to load other services.
from portality.bll.services import authorisation
return authorisation.AuthorisationService()
@classmethod
def queryService(cls):
"""
Obtain an instance of the query service ~~->Query:Service~~
:return: QueryService
"""
# Note the use of delayed imports to minimise code pre-loading, and to allow services loaded
# via this factory to also use the factory to load other services.
from portality.bll.services import query
return query.QueryService()
@classmethod
def articleService(cls):
"""
Obtain an instance of the article service ~~->Article:Service~~
:return: ArticleService
"""
# Note the use of delayed imports to minimise code pre-loading, and to allow services loaded
# via this factory to also use the factory to load other services.
from portality.bll.services import article
return article.ArticleService()
@classmethod
def siteService(cls):
"""
Obtain an instance of the site service ~~->Site:Service~~
:return: SiteService
"""
from portality.bll.services import site
return site.SiteService()
@classmethod
def eventsService(cls):
"""
Obtain an instance of the events service
:return: SiteService
"""
from portality.bll.services import events
return events.EventsService()
@classmethod
def notificationsService(cls):
"""
Obtain an instance of the notifications service ~~->Notifications:Service~~
:return: NotificationsService
"""
from portality.bll.services import notifications
return notifications.NotificationsService()
@classmethod
def todoService(cls):
"""
Obtain an instance of the todo service ~~->Todo:Service~~
:return: SiteService
"""
from portality.bll.services import todo
return todo.TodoService()
@classmethod
def backgroundTaskStatusService(cls):
"""
Obtain an instance of the background_task_status service
~~->BackgroundTask:Monitoring~~
:return: BackgroundTaskStatusService
"""
from portality.bll.services import background_task_status
return background_task_status.BackgroundTaskStatusService()
@classmethod
def concurrencyPreventionService(cls):
"""
Obtain an instance of the concurrency_prevention service
~~->Concurrency_Prevention:Service~~
:return: UpdateRequestConcurrencyPreventionService
"""
from portality.bll.services import concurrency_prevention
return concurrency_prevention.ConcurrencyPreventionService()
@classmethod
def tourService(cls):
"""
Obtain an instance of the tour service ~~->Tour:Service~~
:return: SiteService
"""
from portality.bll.services import tour
return tour.TourService()
@classmethod
def autochecksService(cls, autocheck_plugins=None):
from portality.bll.services import autochecks
return autochecks.AutocheckService(autocheck_plugins=autocheck_plugins)
@classmethod
def hueyJobService(cls):
"""
Obtain an instance of the huey_job service ~~->HueyJob:Service~~
:return: HueyJobService
"""
from portality.bll.services import huey_job
return huey_job.HueyJobService()