Coverage for portality / bll / doaj.py: 97%

73 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-05 00:09 +0100

1# ~~DOAJ:Service~~ 

2class DOAJ(object): 

3 """ 

4 Primary entry point to the services which back up the DOAJ Business Logic Layer. 

5 This is, in effect, a factory for generating the services for the various areas 

6 of the DOAJ. 

7 

8 To use it, request the service or services for the area that you are working with, and then 

9 call functions on the resulting service object. For example: 

10 

11 applicationService = DOAJ.applicationService() 

12 applicationService.application_2_journal(....) 

13 """ 

14 

15 @classmethod 

16 def applicationService(cls): 

17 """ 

18 Obtain an instance of the application service ~~->Application:Service~~ 

19 

20 :return: ApplicationService 

21 """ 

22 # Note the use of delayed imports to minimise code pre-loading, and to allow services loaded 

23 # via this factory to also use the factory to load other services. 

24 from portality.bll.services import application 

25 return application.ApplicationService() 

26 

27 @classmethod 

28 def exportService(cls): 

29 """ 

30 Obtain an instance of the export service ~~->Export:Service~~ 

31 

32 :return: ExportService 

33 """ 

34 from portality.bll.services import export 

35 return export.ExportService() 

36 

37 @classmethod 

38 def journalService(cls): 

39 """ 

40 Obtain an instance of the journal service ~~->Journal:Service~~ 

41 

42 :return: JournalService 

43 """ 

44 # Note the use of delayed imports to minimise code pre-loading, and to allow services loaded 

45 # via this factory to also use the factory to load other services. 

46 from portality.bll.services import journal 

47 return journal.JournalService() 

48 

49 @classmethod 

50 def authorisationService(cls): 

51 """ 

52 Obtain an instance of the authorisation service ~~->AuthNZ:Service~~ 

53 

54 :return: AuthorisationService 

55 """ 

56 # Note the use of delayed imports to minimise code pre-loading, and to allow services loaded 

57 # via this factory to also use the factory to load other services. 

58 from portality.bll.services import authorisation 

59 return authorisation.AuthorisationService() 

60 

61 @classmethod 

62 def queryService(cls): 

63 """ 

64 Obtain an instance of the query service ~~->Query:Service~~ 

65 

66 :return: QueryService 

67 """ 

68 # Note the use of delayed imports to minimise code pre-loading, and to allow services loaded 

69 # via this factory to also use the factory to load other services. 

70 from portality.bll.services import query 

71 return query.QueryService() 

72 

73 @classmethod 

74 def articleService(cls): 

75 """ 

76 Obtain an instance of the article service ~~->Article:Service~~ 

77 

78 :return: ArticleService 

79 """ 

80 # Note the use of delayed imports to minimise code pre-loading, and to allow services loaded 

81 # via this factory to also use the factory to load other services. 

82 from portality.bll.services import article 

83 return article.ArticleService() 

84 

85 @classmethod 

86 def siteService(cls): 

87 """ 

88 Obtain an instance of the site service ~~->Site:Service~~ 

89 :return: SiteService 

90 """ 

91 from portality.bll.services import site 

92 return site.SiteService() 

93 

94 @classmethod 

95 def eventsService(cls): 

96 """ 

97 Obtain an instance of the events service 

98 :return: SiteService 

99 """ 

100 from portality.bll.services import events 

101 return events.EventsService() 

102 

103 @classmethod 

104 def notificationsService(cls): 

105 """ 

106 Obtain an instance of the notifications service ~~->Notifications:Service~~ 

107 :return: NotificationsService 

108 """ 

109 from portality.bll.services import notifications 

110 return notifications.NotificationsService() 

111 

112 @classmethod 

113 def todoService(cls): 

114 """ 

115 Obtain an instance of the todo service ~~->Todo:Service~~ 

116 :return: SiteService 

117 """ 

118 from portality.bll.services import todo 

119 return todo.TodoService() 

120 

121 @classmethod 

122 def backgroundTaskStatusService(cls): 

123 """ 

124 Obtain an instance of the background_task_status service 

125 ~~->BackgroundTask:Monitoring~~ 

126 :return: BackgroundTaskStatusService 

127 """ 

128 from portality.bll.services import background_task_status 

129 return background_task_status.BackgroundTaskStatusService() 

130 

131 @classmethod 

132 def concurrencyPreventionService(cls): 

133 """ 

134 Obtain an instance of the concurrency_prevention service 

135 ~~->Concurrency_Prevention:Service~~ 

136 :return: UpdateRequestConcurrencyPreventionService 

137 """ 

138 from portality.bll.services import concurrency_prevention 

139 return concurrency_prevention.ConcurrencyPreventionService() 

140 

141 @classmethod 

142 def tourService(cls): 

143 """ 

144 Obtain an instance of the tour service ~~->Tour:Service~~ 

145 :return: SiteService 

146 """ 

147 from portality.bll.services import tour 

148 return tour.TourService() 

149 

150 @classmethod 

151 def autochecksService(cls, autocheck_plugins=None): 

152 from portality.bll.services import autochecks 

153 return autochecks.AutocheckService(autocheck_plugins=autocheck_plugins) 

154 

155 @classmethod 

156 def shortUrlService(cls): 

157 from portality.bll.services import shorturl 

158 return shorturl.ShortUrlService() 

159 

160 @classmethod 

161 def hueyJobService(cls): 

162 """ 

163 Obtain an instance of the huey_job service ~~->HueyJob:Service~~ 

164 :return: HueyJobService 

165 """ 

166 from portality.bll.services import huey_job 

167 return huey_job.HueyJobService() 

168 

169 @classmethod 

170 def publicDataDumpService(cls, *args, **kwargs): 

171 from portality.bll.services import public_data_dump 

172 return public_data_dump.PublicDataDumpService(*args, **kwargs) 

173 

174 @classmethod 

175 def adminAlertsService(cls): 

176 """ 

177 Obtain an instance of the admin alerts service ~~->AdminAlerts:Service~~ 

178 :return: AdminAlertsService 

179 """ 

180 from portality.bll.services import admin_alerts 

181 return admin_alerts.AdminAlertsService()