You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by al...@apache.org on 2015/08/24 13:41:44 UTC
[18/50] [abbrv] incubator-taverna-databundle-viewer git commit: Add
workflow method in decorator for open parsed t2flow workflow
Add workflow method in decorator for open parsed t2flow workflow
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/commit/5aea3b95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/tree/5aea3b95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/diff/5aea3b95
Branch: refs/heads/master
Commit: 5aea3b95152a3294e107f131c65ab47c5b703775
Parents: ad1de77
Author: Denis Karyakin <sa...@gmail.com>
Authored: Mon Aug 17 01:54:43 2015 +0300
Committer: Denis Karyakin <sa...@gmail.com>
Committed: Mon Aug 17 01:54:43 2015 +0300
----------------------------------------------------------------------
app/decorators/data_bundle_decorator.rb | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/5aea3b95/app/decorators/data_bundle_decorator.rb
----------------------------------------------------------------------
diff --git a/app/decorators/data_bundle_decorator.rb b/app/decorators/data_bundle_decorator.rb
index 90359d3..635ce71 100644
--- a/app/decorators/data_bundle_decorator.rb
+++ b/app/decorators/data_bundle_decorator.rb
@@ -40,4 +40,15 @@ class DataBundleDecorator < Draper::Decorator
@manifest
end
+
+ def workflow
+ if @workflow.nil?
+ manifest = Nokogiri::XML(File.open("#{object.file.root}/#{object.file.store_dir}/#{DataBundle::EXTRACTED_PATH}/#{DataBundle::EXTRACTED_WORKFLOW_PATH}/META-INF/manifest.xml"))
+ t2flow_name = manifest.xpath('//manifest:file-entry[@manifest:media-type="application/vnd.taverna.t2flow+xml"][@manifest:size]').first['manifest:full-path']
+ file = File.open("#{object.file.root}/#{object.file.store_dir}/#{DataBundle::EXTRACTED_PATH}/#{DataBundle::EXTRACTED_WORKFLOW_PATH}/#{t2flow_name}")
+ @workflow = T2Flow::Parser.new.parse(file)
+ end
+
+ @workflow
+ end
end