myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2325] trunk/lib: added content type/ workflow pr


From: noreply
Subject: [myexperiment-hackers] [2325] trunk/lib: added content type/ workflow processor sync process on startup
Date: Thu, 4 Feb 2010 09:27:39 -0500 (EST)

Revision
2325
Author
dgc
Date
2010-02-04 09:27:39 -0500 (Thu, 04 Feb 2010)

Log Message

added content type/workflow processor sync process on startup

Modified Paths

Diff

Modified: trunk/lib/workflow_processors/bio_extract.rb (2324 => 2325)


--- trunk/lib/workflow_processors/bio_extract.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/bio_extract.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -21,6 +21,10 @@
       "XML"
     end
 
+    def self.mime_type
+      "application/xml"
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_processors/interface.rb (2324 => 2325)


--- trunk/lib/workflow_processors/interface.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/interface.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -23,6 +23,9 @@
       ""
     end
     
+    def self.mime_type
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_processors/taverna2_beta.rb (2324 => 2325)


--- trunk/lib/workflow_processors/taverna2_beta.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/taverna2_beta.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -32,6 +32,10 @@
       "T2FLOW"
     end
     
+    def self.mime_type
+      "application/vnd.taverna.t2flow+xml"
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_processors/taverna_scufl.rb (2324 => 2325)


--- trunk/lib/workflow_processors/taverna_scufl.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/taverna_scufl.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -34,6 +34,10 @@
       "SCUFL"
     end
     
+    def self.mime_type
+      "application/vnd.taverna.scufl+xml"
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_processors/trident_opc.rb (2324 => 2325)


--- trunk/lib/workflow_processors/trident_opc.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/trident_opc.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -22,6 +22,10 @@
       "Package"
     end
     
+    def self.mime_type
+      "application/octet-stream"
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_processors/trident_xoml.rb (2324 => 2325)


--- trunk/lib/workflow_processors/trident_xoml.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_processors/trident_xoml.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -22,6 +22,10 @@
       "XOML"
     end
     
+    def self.mime_type
+      "application/xaml+xml"
+    end
+
     # All the file extensions supported by this workflow processor.
     # Must be all in lowercase.
     def self.file_extensions_supported

Modified: trunk/lib/workflow_types_handler.rb (2324 => 2325)


--- trunk/lib/workflow_types_handler.rb	2010-01-29 16:30:10 UTC (rev 2324)
+++ trunk/lib/workflow_types_handler.rb	2010-02-04 14:27:39 UTC (rev 2325)
@@ -84,6 +84,26 @@
     @@type_display_names_that_can_infer_metadata
   end
   
+  # Iterates through the workflow processors and creates/updates the ContentType records to match.
+  def self.sync_content_types
+
+    ContentType.transaction do
+      processor_classes.each do |processor_class|
+
+        title     = processor_class.display_name
+        mime_type = processor_class.mime_type
+
+        ct = ContentType.find_by_title(title)
+        ct = ContentType.create(:title => title, :mime_type => mime_type) if ct.nil?
+
+        if ct.mime_type != mime_type
+          ct.mime_type = mime_type
+          ct.save
+        end
+      end
+    end
+  end
+
 protected
 
   # List of all the processor classes available.
@@ -119,3 +139,7 @@
 
 # Refresh the list of workflow types in the system
 WorkflowTypesHandler.refresh_all_known_types!
+
+# Ensure that ContentType records exist and up to date for the workflow processors installed
+WorkflowTypesHandler.sync_content_types
+

reply via email to

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