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

37 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-07-22 15:59 +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 @classmethod 

15 def applicationService(cls): 

16 """ 

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

18 

19 :return: ApplicationService 

20 """ 

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

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

23 from portality.bll.services import application 

24 return application.ApplicationService() 

25 

26 @classmethod 

27 def journalService(cls): 

28 """ 

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

30 

31 :return: JournalService 

32 """ 

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

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

35 from portality.bll.services import journal 

36 return journal.JournalService() 

37 

38 @classmethod 

39 def authorisationService(cls): 

40 """ 

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

42 

43 :return: AuthorisationService 

44 """ 

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

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

47 from portality.bll.services import authorisation 

48 return authorisation.AuthorisationService() 

49 

50 @classmethod 

51 def queryService(cls): 

52 """ 

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

54 

55 :return: QueryService 

56 """ 

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

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

59 from portality.bll.services import query 

60 return query.QueryService() 

61 

62 @classmethod 

63 def articleService(cls): 

64 """ 

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

66 

67 :return: ArticleService 

68 """ 

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

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

71 from portality.bll.services import article 

72 return article.ArticleService() 

73 

74 @classmethod 

75 def siteService(cls): 

76 """ 

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

78 :return: SiteService 

79 """ 

80 from portality.bll.services import site 

81 return site.SiteService() 

82 

83 @classmethod 

84 def eventsService(cls): 

85 """ 

86 Obtain an instance of the events service 

87 :return: SiteService 

88 """ 

89 from portality.bll.services import events 

90 return events.EventsService() 

91 

92 @classmethod 

93 def notificationsService(cls): 

94 """ 

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

96 :return: NotificationsService 

97 """ 

98 from portality.bll.services import notifications 

99 return notifications.NotificationsService() 

100 

101 @classmethod 

102 def todoService(cls): 

103 """ 

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

105 :return: SiteService 

106 """ 

107 from portality.bll.services import todo 

108 return todo.TodoService()