class T2Server::Interaction::Notification

This class represents a Taverna notification.

Attributes

id[R]

The identifier of this notification.

reply_to[R]

If this notification is a reply then this is the identifier of the notification that it is a reply to.

serial[R]

The serial number of a notification. This identifies a notification within a workflow.

uri[R]

The URI of the notification page to show.

Public Instance Methods

has_reply? → true or false click to toggle source

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
input_data → data click to toggle source

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_notification? → true or false click to toggle source

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_reply? → true or false click to toggle source

Is this notification a reply to another notification?

    # File lib/t2-server/interaction.rb
165 def is_reply?
166   @is_reply
167 end
reply(status, data) click to toggle source

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