1
|
package eu.dnetlib.api.functionality;
|
2
|
|
3
|
import java.net.URL;
|
4
|
import java.util.Date;
|
5
|
import java.util.SortedSet;
|
6
|
|
7
|
import eu.dnetlib.api.DriverService;
|
8
|
import eu.dnetlib.domain.functionality.NotificationEvent;
|
9
|
import eu.dnetlib.domain.functionality.NotificationQuery;
|
10
|
import eu.dnetlib.domain.functionality.NotificationResult;
|
11
|
import eu.dnetlib.domain.functionality.NotificationSchedule;
|
12
|
import eu.dnetlib.domain.functionality.NotificationSubscription;
|
13
|
import eu.dnetlib.domain.functionality.ObjectPage;
|
14
|
import eu.dnetlib.domain.functionality.ResultPage;
|
15
|
|
16
|
/**
|
17
|
* This interface declares the available methods of notification service. Alert service is used to manage queries, schedules, events, results and subscriptions.
|
18
|
* @author thanos@di.uoa.gr
|
19
|
* @see eu.dnetlib.domain.functionality.NotificationQuery
|
20
|
* @see eu.dentlib.domain.functionality.NotificationSchedule
|
21
|
* @see eu.dnetlib.domain.functionality.NotificationEvent
|
22
|
* @see eu.dnetlib.domain.functionality.NotificationResult
|
23
|
* @see eu.dnetlib.domain.functionality.NotificationSubscription
|
24
|
* @see NotificationServiceException
|
25
|
*
|
26
|
*/
|
27
|
public interface NotificationService extends DriverService {
|
28
|
/**
|
29
|
* Retrieve all the supported languages in which queries can be expressed.
|
30
|
* @return a set containing all the supported languages in which queries can be expressed
|
31
|
*/
|
32
|
public SortedSet<String> getSupportedQueryLanguages();
|
33
|
|
34
|
/**
|
35
|
* Retrieve a page of queries.
|
36
|
* @param pageNumber the number of the page to retrieve
|
37
|
* @param pageSize the size of the page to retrieve
|
38
|
* @return an object page containing queries
|
39
|
* @throws NotificationServiceException if any errors occur
|
40
|
*/
|
41
|
public ObjectPage<NotificationQuery> getQueries(final int pageNumber, final int pageSize) throws NotificationServiceException;
|
42
|
|
43
|
/**
|
44
|
* Add a query.
|
45
|
* @param query the query to add
|
46
|
* @throws NotificationServiceException if any errors occur
|
47
|
*/
|
48
|
public void addQuery(final NotificationQuery query) throws NotificationServiceException;
|
49
|
|
50
|
/**
|
51
|
* Remove a query.
|
52
|
* @param queryId the unique identifier of the query to remove
|
53
|
* @throws NotificationServiceException if any errors occur
|
54
|
*/
|
55
|
public void removeQuery(final String queryId) throws NotificationServiceException;
|
56
|
|
57
|
/**
|
58
|
* Execute a query and return the generated result.
|
59
|
* @param queryId the unique identifier of the query to execute
|
60
|
* @param resultId the unique result identifier to use
|
61
|
* @param fromDate the from date to use
|
62
|
* @param toDate the to date to use
|
63
|
* @param limit the limit to use
|
64
|
* @param offset the offset to use
|
65
|
* @return a result page containing the generated result
|
66
|
* @throws NotificationServiceException if any errors occur
|
67
|
*/
|
68
|
public ResultPage executeQuery(final String queryId, final String resultId, final Date fromDate, final Date toDate, final int limit, final int offset) throws NotificationServiceException;
|
69
|
|
70
|
/**
|
71
|
* Retrieve a page of schedules.
|
72
|
* @param pageNumber the number of the page to retrieve
|
73
|
* @param pageSize the size of the page to retrieve
|
74
|
* @return an object page containing schedules
|
75
|
* @throws NotificationServiceException if any errors occur
|
76
|
*/
|
77
|
public ObjectPage<NotificationSchedule> getSchedules(final int pageNumber, final int pageSize) throws NotificationServiceException;
|
78
|
|
79
|
/**
|
80
|
* Add a schedule.
|
81
|
* @param schedule the schedule to add
|
82
|
* @throws NotificationServiceException if any errors occur
|
83
|
*/
|
84
|
public void addSchedule(final NotificationSchedule schedule) throws NotificationServiceException;
|
85
|
|
86
|
/**
|
87
|
* Enable a schedule.
|
88
|
* @param queryId the unique identifier of the query whose schedule to enable
|
89
|
* @throws NotificationServiceException if any errors occur
|
90
|
*/
|
91
|
public void enableSchedule(final String queryId) throws NotificationServiceException;
|
92
|
|
93
|
/**
|
94
|
* Disable a schedule.
|
95
|
* @param queryId the unique identifier of the query whose schedule to disable
|
96
|
* @throws NotificationServiceException if any errors occur
|
97
|
*/
|
98
|
public void disableSchedule(final String queryId) throws NotificationServiceException;
|
99
|
|
100
|
/**
|
101
|
* Remove a schedule.
|
102
|
* @param queryId the unique identifier of the query of the schedule to remove
|
103
|
* @throws NotificationServiceException if any errors occur
|
104
|
*/
|
105
|
public void removeSchedule(final String queryId) throws NotificationServiceException;
|
106
|
|
107
|
/**
|
108
|
* Retrieve a page of events.
|
109
|
* @param pageNumber the number of the page to retrieve
|
110
|
* @param pageSize the size of the page to retrieve
|
111
|
* @return an object page containing events
|
112
|
* @throws NotificationServiceException if any errors occur
|
113
|
*/
|
114
|
public ObjectPage<NotificationEvent> getEvents(final int pageNumber, final int pageSize) throws NotificationServiceException;
|
115
|
|
116
|
/**
|
117
|
* Retrieve a page of results.
|
118
|
* @param pageNumber the number of the page to retrieve
|
119
|
* @param pageSize the size of the page to retrieve
|
120
|
* @return an object page containing results
|
121
|
* @throws NotificationServiceException if any errors occur
|
122
|
*/
|
123
|
public ObjectPage<NotificationResult> getResults(final int pageNumber, final int pageSize) throws NotificationServiceException;
|
124
|
|
125
|
/**
|
126
|
* Retrieve a result of an event of a query.
|
127
|
* @param queryId the unique identifier of the query of the event of the result to retrieve
|
128
|
* @param date the date corresponding to the event of the result to retrieve
|
129
|
* @param resultId the unique identifier of the result to retrieve
|
130
|
* @return the specified result of the specified event of the specified query or null if no such result exists
|
131
|
* @throws NotificationServiceException if any errors occur
|
132
|
*/
|
133
|
public NotificationResult getResult(final String queryId, final Date date, final String resultId) throws NotificationServiceException;
|
134
|
|
135
|
/**
|
136
|
* Retrieve a result of the previous event of an event of a query.
|
137
|
* @param queryId the unique identifier of the query of the event of the result to retrieve
|
138
|
* @param date the date corresponding to the next event of the event whose result to retrieve
|
139
|
* @param resultId the unique identifier of the result to retrieve
|
140
|
* @return the specified result of the previous event of the specified event of the specified query or null if no such result exists
|
141
|
* @throws NotificationServiceException if any errors occur
|
142
|
*/
|
143
|
public NotificationResult getPreviousResult(final String queryId, final Date date, final String resultId) throws NotificationServiceException;
|
144
|
|
145
|
/**
|
146
|
* Retrieve a page of subscriptions.
|
147
|
* @param pageNumber the number of the page to retrieve
|
148
|
* @param pageSize the size of the page to retrieve
|
149
|
* @return an object page containign subscriptions
|
150
|
* @throws NotificationServiceException if any errors occur
|
151
|
*/
|
152
|
public ObjectPage<NotificationSubscription> getSubscriptions(final int pageNumber, final int pageSize) throws NotificationServiceException;
|
153
|
|
154
|
/**
|
155
|
* Add a subscription.
|
156
|
* @param subscription the subscription to add
|
157
|
* @throws NotificationServiceException if any errors occur
|
158
|
*/
|
159
|
public void addSubscription(final NotificationSubscription subscription) throws NotificationServiceException;
|
160
|
|
161
|
/**
|
162
|
* Enable a subscription.
|
163
|
* @param queryId the unique identifier of the query of the schedule of the subscription to enable
|
164
|
* @param alertService the URL of the alert service of the subscription to enable
|
165
|
* @throws NotificationServiceException if any errors occur
|
166
|
*/
|
167
|
public void enableSubscription(final String queryId, final URL alertService) throws NotificationServiceException;
|
168
|
|
169
|
/**
|
170
|
* Disable a subscription.
|
171
|
* @param queryId the unique identifier of the query of the schedule of the subscription to disable
|
172
|
* @param alertService the URL of the alert service of the subscription to disable
|
173
|
* @throws NotificationServiceException if any errors occur
|
174
|
*/
|
175
|
public void disableSubscription(final String queryId, final URL alertService) throws NotificationServiceException;
|
176
|
|
177
|
/**
|
178
|
* Remove a subscription.
|
179
|
* @param queryId the unique identifier of the query of the schedule of the subscription to remove
|
180
|
* @param alertService the URL of the alert service of the subscription to remove
|
181
|
* @throws NotificationServiceException if any errors occur
|
182
|
*/
|
183
|
public void removeSubscription(final String queryId, final URL alertService) throws NotificationServiceException;
|
184
|
}
|