use of org.plos.ned_client.model.Alert in project wombat by PLOS.
the class AlertService method createAlertForSubject.
/**
* Create a new JSON alert object for the subject in that journal.
*
* @param journalKey The journal key.
* @param subjectName The subject to create alert for.
* @return JSON alert object.
*/
private Alert createAlertForSubject(String journalKey, String subjectName) {
AlertQuery query = new AlertQuery();
query.setFilterJournals(ImmutableList.of(journalKey));
query.setFilterSubjectsDisjunction(ImmutableList.of(subjectName));
Alert alert = new Alert();
alert.setSource(ALERT_SOURCE);
alert.setFrequency(ALERT_FREQUENCY);
alert.setName(ALERT_NAME);
alert.setQuery(gson.toJson(query));
return alert;
}
use of org.plos.ned_client.model.Alert in project wombat by PLOS.
the class AlertService method addSearchAlert.
public void addSearchAlert(String authId, String name, String query, String frequency) throws IOException {
String userId = userApi.getUserIdFromAuthId(authId);
Alert alert = createAlertForSearch(name, query, frequency);
userApi.postObject(ApiAddress.builder("individuals").addToken(userId).addToken("alerts").build(), alert);
}
Aggregations