myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3743] trunk: Added field to workflow API to show


From: noreply
Subject: [myexperiment-hackers] [3743] trunk: Added field to workflow API to show component families
Date: Fri, 4 Oct 2013 14:49:17 +0000 (UTC)

Revision
3743
Author
fbacall
Date
2013-10-04 14:49:17 +0000 (Fri, 04 Oct 2013)

Log Message

Added field to workflow API to show component families

Modified Paths

Diff

Modified: trunk/app/models/workflow.rb (3742 => 3743)


--- trunk/app/models/workflow.rb	2013-10-04 14:45:58 UTC (rev 3742)
+++ trunk/app/models/workflow.rb	2013-10-04 14:49:17 UTC (rev 3743)
@@ -31,6 +31,8 @@
   has_many :workflow_ports, :dependent => :destroy
   has_many :semantic_annotations, :as => :subject, :dependent => :destroy
   has_many :curation_events, :as => :object
+  has_many :pack_entries, :as => :contributable, :class_name => 'PackContributableEntry'
+  has_many :packs, :through => :pack_entries
 
   before_validation :check_unique_name
   before_validation :apply_extracted_metadata
@@ -433,4 +435,8 @@
     tags.any? { |t| t.name == 'component' }
   end
 
+  def component_families
+    self.packs.select { |p| p.component_family? }
+  end
+
 end

Modified: trunk/config/tables.xml


(Binary files differ)

Modified: trunk/lib/api/resources/workflows.rb (3742 => 3743)


--- trunk/lib/api/resources/workflows.rb	2013-10-04 14:45:58 UTC (rev 3742)
+++ trunk/lib/api/resources/workflows.rb	2013-10-04 14:49:17 UTC (rev 3743)
@@ -202,3 +202,19 @@
 
   { :xml => doc }
 end
+
+def component_families(ob, user, query)
+
+  families_node = LibXML::XML::Node.new('component-families')
+
+  ob.component_families.each do |family|
+    if Authorization.check('view', family, user)
+      family_node = LibXML::XML::Node.new('component-family')
+      family_node << rest_resource_uri(family)
+
+      families_node << family_node
+    end
+  end
+
+  families_node
+end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]