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 189 def has_reply? 190 @has_reply 191 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 198 def input_data 199 return "" if is_reply? 200 201 data_name = "interaction#{@id}InputData.json" 202 @run.read_interaction_data(data_name) 203 rescue AttributeNotFoundError 204 # It does not matter if the file doesn't exist. 205 "" 206 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 174 def is_notification? 175 @is_notification 176 end
Is this notification a reply to another notification?
# File lib/t2-server/interaction.rb 165 def is_reply? 166 @is_reply 167 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 213 def reply(status, data) 214 data_name = "interaction#{@id}OutputData.json" 215 216 notification = Atom::Entry.new do |entry| 217 entry.title = "A reply to #{@id}" 218 entry.id = "#{@id}reply" 219 entry.content = "" 220 entry[FEED_NS, "run-id"] << @run.id 221 entry[FEED_NS, "in-reply-to"] << @id 222 entry[FEED_NS, "result-status"] << status 223 end.to_xml 224 225 @run.write_interaction_data(data_name, data) 226 @run.write_notification(notification) 227 end
Private Instance Methods
# File lib/t2-server/interaction.rb 231 def get_link(links) 232 links.each do |l| 233 return URI.parse(l.to_s) if l.rel == "presentation" 234 end 235 end