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, line 189
def has_reply?
  @has_reply
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, 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_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, line 174
def is_notification?
  @is_notification
end
is_reply? → true or false click to toggle source

Is this notification a reply to another notification?

# File lib/t2-server/interaction.rb, line 165
def is_reply?
  @is_reply
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, 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