use of org.apache.rya.periodic.notification.notification.CommandNotification.Command in project incubator-rya by apache.
the class CommandNotificationTypeAdapter method deserialize.
@Override
public CommandNotification deserialize(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
JsonObject json = arg0.getAsJsonObject();
Command command = Command.valueOf(json.get("command").getAsString());
String type = json.get("type").getAsString();
Notification notification = null;
if (type.equals(PeriodicNotification.class.getSimpleName())) {
notification = (new PeriodicNotificationTypeAdapter()).deserialize(json.get("notification"), PeriodicNotification.class, arg2);
} else if (type.equals(BasicNotification.class.getSimpleName())) {
notification = (new BasicNotificationTypeAdapter()).deserialize(json.get("notification"), BasicNotification.class, arg2);
} else {
throw new JsonParseException("Cannot deserialize Json");
}
return new CommandNotification(command, notification);
}
use of org.apache.rya.periodic.notification.notification.CommandNotification.Command in project incubator-rya by apache.
the class PeriodicNotificationCoordinatorExecutor method processNotification.
private void processNotification(CommandNotification notification) {
Command command = notification.getCommand();
Notification periodic = notification.getNotification();
switch(command) {
case ADD:
addNotification(periodic);
break;
case DELETE:
deleteNotification(periodic);
break;
}
}
Aggregations