Diff
Modified: branches/packs/app/controllers/packs_controller.rb (3638 => 3639)
--- branches/packs/app/controllers/packs_controller.rb 2013-08-28 12:24:48 UTC (rev 3638)
+++ branches/packs/app/controllers/packs_controller.rb 2013-08-28 13:25:34 UTC (rev 3639)
@@ -412,7 +412,7 @@
when PackContributableEntry
resource_uri = entry.resource.uri
when PackRemoteEntry
- resource_uri = entry.uri
+ resource_uri = entry.resource.uri
end
post_process_created_resource(@pack, entry, resource_uri, params)
Modified: branches/packs/app/controllers/resources_controller.rb (3638 => 3639)
--- branches/packs/app/controllers/resources_controller.rb 2013-08-28 12:24:48 UTC (rev 3638)
+++ branches/packs/app/controllers/resources_controller.rb 2013-08-28 13:25:34 UTC (rev 3639)
@@ -63,7 +63,11 @@
# FIXME: This needs to support 406
if resource.is_proxy
- redirect_to resource.proxy_for.uri.to_s, :status => 303
+ if resource.proxy_for
+ redirect_to resource.proxy_for.uri.to_s, :status => 303
+ else
+ redirect_to resource.proxy_for_path, :status => 303
+ end
else
send_data(resource.content_blob.data, :type => resource.content_type)
end
Modified: branches/packs/app/models/pack_remote_entry.rb (3638 => 3639)
--- branches/packs/app/models/pack_remote_entry.rb 2013-08-28 12:24:48 UTC (rev 3638)
+++ branches/packs/app/models/pack_remote_entry.rb 2013-08-28 13:25:34 UTC (rev 3639)
@@ -18,6 +18,10 @@
after_save :touch_pack
after_destroy :touch_pack
+ after_save :synchronize_research_object
+
+ belongs_to :resource, :dependent => :destroy
+
def check_unique
if PackRemoteEntry.find(:first, :conditions => ["pack_id = ? AND version = ? AND uri = ?", self.pack_id, self.version, self.uri])
errors.add_to_base("This external link already exists in the pack")
@@ -34,4 +38,23 @@
def available?
true
end
+
+ def synchronize_research_object
+
+ ro = pack.research_object
+
+ user_path = "/users/#{user_id}"
+
+ if ro && resource_id.nil?
+
+ resource = ro.create_proxy(
+ :proxy_for_path => uri,
+ :proxy_in_path => ".",
+ :user_uri => user_path)
+
+ update_attribute(:resource_id, resource.id)
+
+ ro.update_manifest!
+ end
+ end
end
Modified: branches/packs/config/default_settings.yml (3638 => 3639)
--- branches/packs/config/default_settings.yml 2013-08-28 12:24:48 UTC (rev 3638)
+++ branches/packs/config/default_settings.yml 2013-08-28 13:25:34 UTC (rev 3639)
@@ -1452,10 +1452,6 @@
- label: "Example outputs"
uri: "http://purl.org/wf4ever/roterms#ExampleOutputs"
- - label: "Workflow run"
- uri: "http://purl.org/wf4ever/roterms#WorkflowRunBundle"
- folder: "datasets/results"
-
- label: "Example Workflow Run"
uri: "http://purl.org/wf4ever/roterms#ExampleRun"