class T2Server::Interaction::Notification
This class represents a Taverna notification.
Attributes
The identifier of this notification.
If this notification is a reply then this is the identifier of the notification that it is a reply to.
The serial number of a notification. This identifies a notification within a workflow.
The URI of the notification page to show.
Public Instance Methods
Does this notification have a reply? This only makes sense for notifications that are not replies or pure notifications.
# File lib/t2-server/interaction.rb, line 189 def has_reply? @has_reply end
Get the input data associated with this notification. Returns an empty string if this notification is a reply.
# File lib/t2-server/interaction.rb, line 198 def input_data return "" if is_reply? data_name = "interaction#{@id}InputData.json" @run.read_interaction_data(data_name) rescue AttributeNotFoundError # It does not matter if the file doesn't exist. "" end
Is this notification a pure notification only? There is no user response to a pure notification, it is for information only.
# File lib/t2-server/interaction.rb, line 174 def is_notification? @is_notification end
Is this notification a reply to another notification?
# File lib/t2-server/interaction.rb, line 165 def is_reply? @is_reply end
Given a status and some data this method uploads the data and publishes an interaction reply on the run’s notification feed.
# File lib/t2-server/interaction.rb, line 213 def reply(status, data) data_name = "interaction#{@id}OutputData.json" notification = Atom::Entry.new do |entry| entry.title = "A reply to #{@id}" entry.id = "#{@id}reply" entry.content = "" entry[FEED_NS, "run-id"] << @run.id entry[FEED_NS, "in-reply-to"] << @id entry[FEED_NS, "result-status"] << status end.to_xml @run.write_interaction_data(data_name, data) @run.write_notification(notification) end