myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3553] trunk: removed some of the nested methods


From: noreply
Subject: [myexperiment-hackers] [3553] trunk: removed some of the nested methods definitions
Date: Tue, 21 May 2013 13:07:41 +0000 (UTC)

Revision
3553
Author
dgc
Date
2013-05-21 13:07:41 +0000 (Tue, 21 May 2013)

Log Message

removed some of the nested methods definitions

Modified Paths

Diff

Modified: trunk/app/controllers/application_controller.rb (3552 => 3553)


--- trunk/app/controllers/application_controller.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/app/controllers/application_controller.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -184,110 +184,110 @@
     list = s.split(',')
   end
 
-  def update_policy(contributable, params, user)
+  def update_policy_aux(contributable, params)
 
-    def aux(contributable, params)
+    # this method will return an error message is something goes wrong (empty string in case of success)
+    error_msg = ""
 
-      # this method will return an error message is something goes wrong (empty string in case of success)
-      error_msg = ""
+    # BEGIN validation and initialisation
 
-      # BEGIN validation and initialisation
-
-      # If a group policy was selected, use that, and delete the old custom one (if there was one).
-      if params[:policy_type] == "group"
-        if contributable.contribution.policy && !contributable.contribution.policy.group_policy?
-          contributable.contribution.policy.destroy
-        end
-        contributable.contribution.policy_id = params[:group_policy]
-        contributable.contribution.save
-        return
+    # If a group policy was selected, use that, and delete the old custom one (if there was one).
+    if params[:policy_type] == "group"
+      if contributable.contribution.policy && !contributable.contribution.policy.group_policy?
+        contributable.contribution.policy.destroy
       end
+      contributable.contribution.policy_id = params[:group_policy]
+      contributable.contribution.save
+      return
+    end
 
-      # This variable will hold current settings of the policy in case something
-      # goes wrong and a revert would be needed at some point
-      last_saved_policy = nil
-      
-      return if params[:sharing].nil? or params[:sharing][:class_id].blank?
+    # This variable will hold current settings of the policy in case something
+    # goes wrong and a revert would be needed at some point
+    last_saved_policy = nil
+    
+    return if params[:sharing].nil? or params[:sharing][:class_id].blank?
 
-      sharing_class  = params[:sharing][:class_id]
-      updating_class = (params[:updating] and !params[:updating][:class_id].blank?) ? params[:updating][:class_id] : "6"
+    sharing_class  = params[:sharing][:class_id]
+    updating_class = (params[:updating] and !params[:updating][:class_id].blank?) ? params[:updating][:class_id] : "6"
 
-      # Check allowed sharing_class values
-      return unless [ "0", "1", "2", "3", "4", "7" ].include? sharing_class
-      
-      # Check allowed updating_class values
-      return unless [ "0", "1", "5", "6" ].include? updating_class
-      
-      view_protected     = 0
-      view_public        = 0
-      download_protected = 0
-      download_public    = 0
-      edit_protected     = 0
-      edit_public        = 0
-      
-      # BEGIN initialisation and validation
+    # Check allowed sharing_class values
+    return unless [ "0", "1", "2", "3", "4", "7" ].include? sharing_class
+    
+    # Check allowed updating_class values
+    return unless [ "0", "1", "5", "6" ].include? updating_class
+    
+    view_protected     = 0
+    view_public        = 0
+    download_protected = 0
+    download_public    = 0
+    edit_protected     = 0
+    edit_public        = 0
+    
+    # BEGIN initialisation and validation
 
-      if contributable.contribution.policy.nil? || contributable.contribution.policy.group_policy?
-        last_saved_policy = Policy._default(current_user, nil) # second parameter ensures that this policy is not applied anywhere
+    if contributable.contribution.policy.nil? || contributable.contribution.policy.group_policy?
+      last_saved_policy = Policy._default(current_user, nil) # second parameter ensures that this policy is not applied anywhere
 
-        policy = Policy.new(:name => 'auto',
-            :contributor_type => 'User', :contributor_id => current_user.id,
-            :share_mode         => sharing_class,
-            :update_mode        => updating_class)
-        contributable.contribution.policy = policy  # by doing this the new policy object is saved implicitly too
-        contributable.contribution.save
-      else
-         policy = contributable.contribution.policy
-         last_saved_policy = policy.clone # clone required, not 'dup' (which still works through reference, so the values in both get changed anyway - which is not what's needed here)
-         
-         policy.share_mode = sharing_class
-         policy.update_mode = updating_class
-         policy.save
-      end
+      policy = Policy.new(:name => 'auto',
+          :contributor_type => 'User', :contributor_id => current_user.id,
+          :share_mode         => sharing_class,
+          :update_mode        => updating_class)
+      contributable.contribution.policy = policy  # by doing this the new policy object is saved implicitly too
+      contributable.contribution.save
+    else
+       policy = contributable.contribution.policy
+       last_saved_policy = policy.clone # clone required, not 'dup' (which still works through reference, so the values in both get changed anyway - which is not what's needed here)
+       
+       policy.share_mode = sharing_class
+       policy.update_mode = updating_class
+       policy.save
+    end
 
 
-      # Process 'update' permissions for "Some of my Friends"
+    # Process 'update' permissions for "Some of my Friends"
 
-      if updating_class == "5"
-        if params[:updating_somefriends]
-          # Delete old User permissions
-          policy.delete_all_user_permissions
-          
-          # Now create new User permissions, if required
-          params[:updating_somefriends].each do |f|
-            Permission.new(:policy => policy,
-                :contributor => (User.find f[1].to_i),
-                :view => 1, :download => 1, :edit => 1).save
-          end
-        else # none of the 'some of my friends' were selected, error
-          # revert changes made to policy (however any permissions updated will preserve the state)
-          policy.copy_values_from( last_saved_policy )
-          policy.save
-          error_msg += "You have selected to set 'update' permissions for 'Some of your Friends', but didn't select any from the list.</br>Previous (if any) or default sharing permissions have been set."
-          return error_msg
+    if updating_class == "5"
+      if params[:updating_somefriends]
+        # Delete old User permissions
+        policy.delete_all_user_permissions
+        
+        # Now create new User permissions, if required
+        params[:updating_somefriends].each do |f|
+          Permission.new(:policy => policy,
+              :contributor => (User.find f[1].to_i),
+              :view => 1, :download => 1, :edit => 1).save
         end
-      else
-        # Delete all User permissions - as this isn't mode 5 (i.e. the mode has changed),
-        # where some explicit permissions to friends are set
-        policy.delete_all_user_permissions
+      else # none of the 'some of my friends' were selected, error
+        # revert changes made to policy (however any permissions updated will preserve the state)
+        policy.copy_values_from( last_saved_policy )
+        policy.save
+        error_msg += "You have selected to set 'update' permissions for 'Some of your Friends', but didn't select any from the list.</br>Previous (if any) or default sharing permissions have been set."
+        return error_msg
       end
-      
+    else
+      # Delete all User permissions - as this isn't mode 5 (i.e. the mode has changed),
+      # where some explicit permissions to friends are set
+      policy.delete_all_user_permissions
+    end
+    
 
-      # Process explicit Group permissions now
-      process_permissions(policy, params)
+    # Process explicit Group permissions now
+    process_permissions(policy, params)
 
-      logger.debug("------ Workflow create summary ------------------------------------")
-      logger.debug("current_user   = #{current_user.id}")
-      logger.debug("updating_class = #{updating_class}")
-      logger.debug("sharing_class  = #{sharing_class}")
-      logger.debug("policy         = #{policy}")
-      logger.debug("group_sharing  = #{params[:group_sharing]}")
-      logger.debug("-------------------------------------------------------------------")
+    logger.debug("------ Workflow create summary ------------------------------------")
+    logger.debug("current_user   = #{current_user.id}")
+    logger.debug("updating_class = #{updating_class}")
+    logger.debug("sharing_class  = #{sharing_class}")
+    logger.debug("policy         = #{policy}")
+    logger.debug("group_sharing  = #{params[:group_sharing]}")
+    logger.debug("-------------------------------------------------------------------")
 
-      # returns some message in case of errors (or empty string in case of success)
-      return error_msg
-    end
+    # returns some message in case of errors (or empty string in case of success)
+    return error_msg
+  end
 
+  def update_policy(contributable, params, user)
+
     # Remember which groups have view access to the contributable before
     # changes are made.
 
@@ -295,7 +295,7 @@
 
     old_groups = contributable.contribution.policy.permissions.find(:all, :conditions => conditions).map { |p| p.contributor }
 
-    result = aux(contributable, params)
+    result = update_policy_aux(contributable, params)
 
     # Work out which groups have view access after the changes were made and
     # generate activities for them.

Modified: trunk/app/models/workflow.rb (3552 => 3553)


--- trunk/app/models/workflow.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/app/models/workflow.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -260,28 +260,28 @@
   
   # End acts_as_runnable overridden methods
 
-  def filename(version=nil)
+  def filename_aux(record)
 
-    def aux(record)
+    extension = ""
 
-      extension = ""
+    if record.processor_class && record.processor_class.default_file_extension
+      extension = ".#{record.processor_class.default_file_extension}"
+    end
 
-      if record.processor_class && record.processor_class.default_file_extension
-        extension = ".#{record.processor_class.default_file_extension}"
-      end
+    if record.file_ext
+      extension = ".#{record.file_ext}"
+    end
 
-      if record.file_ext
-        extension = ".#{record.file_ext}"
-      end
+    extension
+  end
 
-      extension
-    end
+  def filename(version=nil)
 
     if version.blank?
-      "#{unique_name}#{aux(self)}"
+      "#{unique_name}#{filename_aux(self)}"
     else
       workflow_version = self.find_version(version)
-      "#{workflow_version.unique_name}#{aux(workflow_version)}"
+      "#{workflow_version.unique_name}#{filename_aux(workflow_version)}"
     end
   end
   

Modified: trunk/lib/rest.rb (3552 => 3553)


--- trunk/lib/rest.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/lib/rest.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -456,37 +456,37 @@
   rest_get_request(ob, user, query)
 end
 
-def find_paginated_auth(args, num, page, filters, user, &blk)
+def find_paginated_auth_aux(args, num, page, filters, user)
 
-  def aux(args, num, page, filters, user)
+  results = yield(args, num, page)
 
-    results = yield(args, num, page)
+  return nil if results.nil?
 
-    return nil if results.nil?
+  failures = 0
 
-    failures = 0
+  results.select do |result|
 
-    results.select do |result|
+    selected = Authorization.check('view', result, user)
 
-      selected = Authorization.check('view', result, user)
+    if selected
+      filters.each do |attribute, bits|
 
-      if selected
-        filters.each do |attribute, bits|
+        lhs = eval("result.#{bits[:accessor]}")
+        rhs = bits[:value]
 
-          lhs = eval("result.#{bits[:accessor]}")
-          rhs = bits[:value]
+        lhs = lhs.downcase if lhs.class == String
+        rhs = rhs.downcase if rhs.class == String
 
-          lhs = lhs.downcase if lhs.class == String
-          rhs = rhs.downcase if rhs.class == String
-
-          selected = false unless lhs == rhs
-        end
+        selected = false unless lhs == rhs
       end
+    end
 
-      selected
-    end
+    selected
   end
+end
 
+def find_paginated_auth(args, num, page, filters, user, &blk)
+
   # 'upto' is the number of results needed to fulfil the request
 
   upto = num * page
@@ -498,13 +498,13 @@
   # up to possibly fulfil the request
 
   if (page > 1)
-    results = aux(args, upto, 1, filters, user, &blk)
+    results = find_paginated_auth_aux(args, upto, 1, filters, user, &blk)
     current_page = page + 1
   end
 
   while (results.length < upto)
 
-    results_page = aux(args, num, current_page, filters, user, &blk)
+    results_page = find_paginated_auth_aux(args, num, current_page, filters, user, &blk)
 
     if results_page.nil?
       break

Modified: trunk/lib/workflow_processors/rapid_miner.rb (3552 => 3553)


--- trunk/lib/workflow_processors/rapid_miner.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/lib/workflow_processors/rapid_miner.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -315,23 +315,23 @@
         components << output_els
       end
 
-      def all_operators
-        
-        def aux(process, result)
-          process.operators.each do |operator|
+      def all_operators_aux(process, result)
+        process.operators.each do |operator|
 
-            result << operator
+          result << operator
 
-            operator.processes.each do |sub_process|
-              aux(sub_process, result)
-            end
+          operator.processes.each do |sub_process|
+            all_operators_aux(sub_process, result)
           end
-
-          result
         end
 
-        aux(process, [])
+        result
       end
+
+      def all_operators
+        
+        all_operators_aux(process, [])
+      end
     end
   end
 end

Modified: trunk/lib/workflow_processors/taverna2.rb (3552 => 3553)


--- trunk/lib/workflow_processors/taverna2.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/lib/workflow_processors/taverna2.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -234,159 +234,158 @@
       return get_scufl_metadata(@t2flow_model)
     end
     
-    def get_components
+    def build(name, text = nil, &blk)
+      node = XML::Node.new(name)
+      node << text if text
+      yield(node) if blk
+      node
+    end
 
-      def aux(base_model, model, tag)
-
-        def build(name, text = nil, &blk)
-          node = XML::Node.new(name)
-          node << text if text
-          yield(node) if blk
-          node
+    def build_semantic_annotation_element(object)
+      build('semantic_annotation') do |semantic_annotation_element|
+        if object.semantic_annotation
+          semantic_annotation_element << build('type', object.semantic_annotation.type)
+          semantic_annotation_element << build('content', object.semantic_annotation.content)
         end
+      end
+    end
 
-        def build_semantic_annotation_element(object)
-          build('semantic_annotation') do |semantic_annotation_element|
-            if object.semantic_annotation
-              semantic_annotation_element << build('type', object.semantic_annotation.type)
-              semantic_annotation_element << build('content', object.semantic_annotation.content)
-            end
-          end
-        end
+    def get_components_aux(base_model, model, tag)
 
-        build(tag) do |components|
+      build(tag) do |components|
 
-          components << build('dataflows') do |dataflows_element|
+        components << build('dataflows') do |dataflows_element|
 
-            model.dataflows.each do |dataflow|
+          model.dataflows.each do |dataflow|
 
-              dataflows_element << build('dataflow') do |dataflow_element|
+            dataflows_element << build('dataflow') do |dataflow_element|
 
-                dataflow_element['id']   = dataflow.dataflow_id
-                dataflow_element['role'] = dataflow.role
+              dataflow_element['id']   = dataflow.dataflow_id
+              dataflow_element['role'] = dataflow.role
 
-                dataflow_element << build('sources') do |sources_element|
+              dataflow_element << build('sources') do |sources_element|
 
-                  dataflow.sources.each do |source|
+                dataflow.sources.each do |source|
 
-                    sources_element << build('source') do |source_element|
+                  sources_element << build('source') do |source_element|
 
-                      source_element << build('name', source.name) if source.name
+                    source_element << build('name', source.name) if source.name
 
-                      source_element << build('descriptions') do |source_descriptions_element|
+                    source_element << build('descriptions') do |source_descriptions_element|
 
-                        if source.descriptions
-                          source.descriptions.each do |source_description|
+                      if source.descriptions
+                        source.descriptions.each do |source_description|
 
-                            source_descriptions_element << build('description', source_description)
-                          end
+                          source_descriptions_element << build('description', source_description)
                         end
                       end
+                    end
 
-                      source_element << build('examples') do |source_examples_element|
+                    source_element << build('examples') do |source_examples_element|
 
-                        if source.example_values
-                          source.example_values.each do |source_example_value|
-                           
-                            source_examples_element << build('example', source_example_value)
-                          end
+                      if source.example_values
+                        source.example_values.each do |source_example_value|
+                         
+                          source_examples_element << build('example', source_example_value)
                         end
                       end
-
-                      source_element << build_semantic_annotation_element(source) if source.semantic_annotation
                     end
+
+                    source_element << build_semantic_annotation_element(source) if source.semantic_annotation
                   end
                 end
+              end
 
-                dataflow_element << build('sinks') do |sinks_element|
+              dataflow_element << build('sinks') do |sinks_element|
 
-                  dataflow.sinks.each do |sink|
+                dataflow.sinks.each do |sink|
 
-                    sinks_element << build('sink') do |sink_element|
+                  sinks_element << build('sink') do |sink_element|
 
-                      sink_element << build('name', sink.name) if sink.name
+                    sink_element << build('name', sink.name) if sink.name
 
-                      sink_element << build('descriptions') do |sink_descriptions_element|
+                    sink_element << build('descriptions') do |sink_descriptions_element|
 
-                        if sink.descriptions
-                          sink.descriptions.each do |sink_description|
-                            sink_descriptions_element << build('description', sink_description)
-                          end
+                      if sink.descriptions
+                        sink.descriptions.each do |sink_description|
+                          sink_descriptions_element << build('description', sink_description)
                         end
                       end
+                    end
 
-                      sink_element << build('examples') do |sink_examples_element|
+                    sink_element << build('examples') do |sink_examples_element|
 
-                        if sink.example_values
-                          sink.example_values.each do |sink_example_value|
-                           
-                            sink_examples_element << build('example', sink_example_value)
-                          end
+                      if sink.example_values
+                        sink.example_values.each do |sink_example_value|
+                         
+                          sink_examples_element << build('example', sink_example_value)
                         end
                       end
-                      sink_element << build_semantic_annotation_element(sink) if sink.semantic_annotation
                     end
+                    sink_element << build_semantic_annotation_element(sink) if sink.semantic_annotation
                   end
                 end
+              end
 
-                dataflow_element << build('processors') do |processors_element|
+              dataflow_element << build('processors') do |processors_element|
 
-                  dataflow.processors.each do |processor|
+                dataflow.processors.each do |processor|
 
-                    processors_element << build('processor') do |processor_element|
+                  processors_element << build('processor') do |processor_element|
 
-                      processor_element << build('name',                   processor.name)                   if processor.name
-                      processor_element << build('description',            processor.description)            if processor.description
-                      processor_element << build('type',                   processor.type)                   if processor.type
-                      processor_element << build('dataflow-id',            processor.dataflow_id)            if processor.dataflow_id
+                    processor_element << build('name',                   processor.name)                   if processor.name
+                    processor_element << build('description',            processor.description)            if processor.description
+                    processor_element << build('type',                   processor.type)                   if processor.type
+                    processor_element << build('dataflow-id',            processor.dataflow_id)            if processor.dataflow_id
 
-                      processor_element << build('script',                 processor.script)                 if processor.script
-                      processor_element << build('wsdl',                   processor.wsdl)                   if processor.wsdl
-                      processor_element << build('wsdl-operation',         processor.wsdl_operation)         if processor.wsdl_operation
-                      processor_element << build('endpoint',               processor.endpoint)               if processor.endpoint
-                      processor_element << build('biomoby-authority-name', processor.biomoby_authority_name) if processor.biomoby_authority_name
-                      processor_element << build('biomoby-service-name',   processor.biomoby_service_name)   if processor.biomoby_service_name
-                      processor_element << build('biomoby-category',       processor.biomoby_category)       if processor.biomoby_category
-                      processor_element << build('value',                  processor.value)                  if processor.value
-                      processor_element << build_semantic_annotation_element(processor)                      if processor.semantic_annotation
+                    processor_element << build('script',                 processor.script)                 if processor.script
+                    processor_element << build('wsdl',                   processor.wsdl)                   if processor.wsdl
+                    processor_element << build('wsdl-operation',         processor.wsdl_operation)         if processor.wsdl_operation
+                    processor_element << build('endpoint',               processor.endpoint)               if processor.endpoint
+                    processor_element << build('biomoby-authority-name', processor.biomoby_authority_name) if processor.biomoby_authority_name
+                    processor_element << build('biomoby-service-name',   processor.biomoby_service_name)   if processor.biomoby_service_name
+                    processor_element << build('biomoby-category',       processor.biomoby_category)       if processor.biomoby_category
+                    processor_element << build('value',                  processor.value)                  if processor.value
+                    processor_element << build_semantic_annotation_element(processor)                      if processor.semantic_annotation
 
-                      if processor.dataflow_id
-                        nested_dataflow = base_model.dataflow(processor.dataflow_id)
-                      end
+                    if processor.dataflow_id
+                      nested_dataflow = base_model.dataflow(processor.dataflow_id)
                     end
                   end
                 end
+              end
 
-                dataflow_element << build('datalinks') do |links_element|
+              dataflow_element << build('datalinks') do |links_element|
 
-                  dataflow.datalinks.each do |datalink|
+                dataflow.datalinks.each do |datalink|
 
-                    sink_bits   = datalink.sink.split(':')
-                    source_bits = datalink.source.split(':')
+                  sink_bits   = datalink.sink.split(':')
+                  source_bits = datalink.source.split(':')
 
-                    links_element << build('datalink') do |datalink_element|
+                  links_element << build('datalink') do |datalink_element|
 
-                      datalink_element << build('sink') do |sink_element|
-                        sink_element << build('node', sink_bits[0]) if sink_bits[0]
-                        sink_element << build('port', sink_bits[1]) if sink_bits[1]
-                      end
+                    datalink_element << build('sink') do |sink_element|
+                      sink_element << build('node', sink_bits[0]) if sink_bits[0]
+                      sink_element << build('port', sink_bits[1]) if sink_bits[1]
+                    end
 
-                      datalink_element << build('source') do |source_element|
-                        source_element << build('node', source_bits[0]) if source_bits[0]
-                        source_element << build('port', source_bits[1]) if source_bits[1]
-                      end
+                    datalink_element << build('source') do |source_element|
+                      source_element << build('node', source_bits[0]) if source_bits[0]
+                      source_element << build('port', source_bits[1]) if source_bits[1]
                     end
                   end
                 end
-
-                dataflow_element << build_semantic_annotation_element(dataflow.annotations) if dataflow.annotations.semantic_annotation
               end
+
+              dataflow_element << build_semantic_annotation_element(dataflow.annotations) if dataflow.annotations.semantic_annotation
             end
           end
         end
       end
+    end
 
-      aux(@t2flow_model, @t2flow_model, 'components')
+    def get_components
+      get_components_aux(@t2flow_model, @t2flow_model, 'components')
     end
     
     def extract_metadata(workflow)

Modified: trunk/lib/workflow_processors/taverna_scufl.rb (3552 => 3553)


--- trunk/lib/workflow_processors/taverna_scufl.rb	2013-05-20 14:37:31 UTC (rev 3552)
+++ trunk/lib/workflow_processors/taverna_scufl.rb	2013-05-21 13:07:41 UTC (rev 3553)
@@ -181,112 +181,111 @@
       return get_scufl_metadata(@scufl_model)
     end
 
-    def get_components
+    def build(name, text = nil, &blk)
+      node = XML::Node.new(name)
+      node << text if text
+      yield(node) if blk
+      node
+    end
 
-      def build(name, text = nil, &blk)
-        node = XML::Node.new(name)
-        node << text if text
-        yield(node) if blk
-        node
-      end
+    def get_components_aux(model, tag)
 
-      def aux(model, tag)
+      build(tag) do |element|
 
-        build(tag) do |element|
-
-          element << build('sources') do |sources_element|
-            model.sources.each do |source|
-              sources_element << build('source') do |source_element|
-                source_element << build('name',        source.name)        if source.name
-                source_element << build('description', source.description) if source.description
-              end
+        element << build('sources') do |sources_element|
+          model.sources.each do |source|
+            sources_element << build('source') do |source_element|
+              source_element << build('name',        source.name)        if source.name
+              source_element << build('description', source.description) if source.description
             end
           end
+        end
 
-          element << build('sinks') do |sinks_element|
-            model.sinks.each do |sink|
-              sinks_element << build('sink') do |sink_element|
-                sink_element << build('name',        sink.name)        if sink.name
-                sink_element << build('description', sink.description) if sink.description
-              end
+        element << build('sinks') do |sinks_element|
+          model.sinks.each do |sink|
+            sinks_element << build('sink') do |sink_element|
+              sink_element << build('name',        sink.name)        if sink.name
+              sink_element << build('description', sink.description) if sink.description
             end
           end
+        end
 
-          element << build('processors') do |processors_element|
+        element << build('processors') do |processors_element|
 
-            model.processors.each do |processor|
+          model.processors.each do |processor|
 
-              processors_element << build('processor') do |processor_element|
+            processors_element << build('processor') do |processor_element|
 
-                processor_element << build('name',                   processor.name)                   if processor.name
-                processor_element << build('description',            processor.description)            if processor.description
-                processor_element << build('type',                   processor.type)                   if processor.type
-                processor_element << build('script',                 processor.script)                 if processor.script
-                processor_element << build('wsdl',                   processor.wsdl)                   if processor.wsdl
-                processor_element << build('wsdl-operation',         processor.wsdl_operation)         if processor.wsdl_operation
-                processor_element << build('endpoint',               processor.endpoint)               if processor.endpoint
-                processor_element << build('biomoby-authority-name', processor.biomoby_authority_name) if processor.biomoby_authority_name
-                processor_element << build('biomoby-service-name',   processor.biomoby_service_name)   if processor.biomoby_service_name
-                processor_element << build('biomoby-category',       processor.biomoby_category)       if processor.biomoby_category
-                processor_element << build('value',                  processor.value)                  if processor.value
+              processor_element << build('name',                   processor.name)                   if processor.name
+              processor_element << build('description',            processor.description)            if processor.description
+              processor_element << build('type',                   processor.type)                   if processor.type
+              processor_element << build('script',                 processor.script)                 if processor.script
+              processor_element << build('wsdl',                   processor.wsdl)                   if processor.wsdl
+              processor_element << build('wsdl-operation',         processor.wsdl_operation)         if processor.wsdl_operation
+              processor_element << build('endpoint',               processor.endpoint)               if processor.endpoint
+              processor_element << build('biomoby-authority-name', processor.biomoby_authority_name) if processor.biomoby_authority_name
+              processor_element << build('biomoby-service-name',   processor.biomoby_service_name)   if processor.biomoby_service_name
+              processor_element << build('biomoby-category',       processor.biomoby_category)       if processor.biomoby_category
+              processor_element << build('value',                  processor.value)                  if processor.value
 
-                if processor.inputs
-                  processor_element << build('inputs') do |inputs_element|
-                    processor.inputs.each do |input|
-                      inputs_element << build('input', input)
-                    end
+              if processor.inputs
+                processor_element << build('inputs') do |inputs_element|
+                  processor.inputs.each do |input|
+                    inputs_element << build('input', input)
                   end
                 end
+              end
 
-                if processor.outputs
-                  processor_element << build('outputs') do |outputs_element|
-                    processor.outputs.each do |output|
-                      outputs_element << build('output', output)
-                    end
+              if processor.outputs
+                processor_element << build('outputs') do |outputs_element|
+                  processor.outputs.each do |output|
+                    outputs_element << build('output', output)
                   end
                 end
+              end
 
-                if processor.model
-                  processor_element << aux(processor.model, 'model')
-                end
+              if processor.model
+                processor_element << get_components_aux(processor.model, 'model')
               end
             end
           end
+        end
 
-          element << build('links') do |links_element|
+        element << build('links') do |links_element|
 
-            model.links.each do |link|
+          model.links.each do |link|
 
-              links_element << build('link') do |link_element|
+            links_element << build('link') do |link_element|
 
-                sink_bits   = link.sink.split(':')
-                source_bits = link.source.split(':')
+              sink_bits   = link.sink.split(':')
+              source_bits = link.source.split(':')
 
-                link_element << build('sink') do |sink_element|
-                  sink_element << build('node', sink_bits[0]) if sink_bits[0]
-                  sink_element << build('port', sink_bits[1]) if sink_bits[1]
-                end
+              link_element << build('sink') do |sink_element|
+                sink_element << build('node', sink_bits[0]) if sink_bits[0]
+                sink_element << build('port', sink_bits[1]) if sink_bits[1]
+              end
 
-                link_element << build('source') do |source_element|
-                  source_element << build('node', source_bits[0]) if source_bits[0]
-                  source_element << build('port', source_bits[1]) if source_bits[1]
-                end
+              link_element << build('source') do |source_element|
+                source_element << build('node', source_bits[0]) if source_bits[0]
+                source_element << build('port', source_bits[1]) if source_bits[1]
               end
             end
           end
+        end
 
-          element << build('coordinations') do |coordinations_element|
-            model.coordinations.each do |coordination|
-              coordinations_element << build('coordination') do |coordination_element|
-                coordination_element << build('controller', coordination.controller) if coordination.controller
-                coordination_element << build('target',     coordination.target)     if coordination.target
-              end
+        element << build('coordinations') do |coordinations_element|
+          model.coordinations.each do |coordination|
+            coordinations_element << build('coordination') do |coordination_element|
+              coordination_element << build('controller', coordination.controller) if coordination.controller
+              coordination_element << build('target',     coordination.target)     if coordination.target
             end
           end
         end
       end
+    end
 
-      aux(@scufl_model, 'components')
+    def get_components
+      get_components_aux(@scufl_model, 'components')
     end
 
     def extract_metadata(workflow)

reply via email to

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