From 26400bb7b344398643313022101d44296e7e1e52 Mon Sep 17 00:00:00 2001
From: Leo Gordon <lg4@ebi.ac.uk>
Date: Wed, 2 Oct 2013 10:43:19 +0100
Subject: [PATCH] moved the call to branch_name_2_code() from HiveGeneric into
 the DataflowRule object's setter

---
 modules/Bio/EnsEMBL/Hive/DataflowRule.pm                | 7 ++++---
 modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Hive/DataflowRule.pm b/modules/Bio/EnsEMBL/Hive/DataflowRule.pm
index df36e6f2c..ba87de597 100644
--- a/modules/Bio/EnsEMBL/Hive/DataflowRule.pm
+++ b/modules/Bio/EnsEMBL/Hive/DataflowRule.pm
@@ -104,8 +104,9 @@ sub new {
 sub branch_code {
     my $self = shift @_;
 
-    if(@_) { # setter mode
-        $self->{'_branch_code'} = shift @_;
+    if(@_) {
+        my $branch_name_or_code = shift @_;
+        $self->{'_branch_code'} = $branch_name_or_code && Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor::branch_name_2_code( $branch_name_or_code );
     }
     return $self->{'_branch_code'};
 }
@@ -136,7 +137,7 @@ sub funnel_dataflow_rule_id {
 sub input_id_template {
     my $self = shift @_;
 
-    if(@_) { # setter mode
+    if(@_) {
         my $input_id_template = shift @_;
         $self->{'_input_id_template'} = (ref($input_id_template) ? stringify($input_id_template) : $input_id_template),
     }
diff --git a/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm b/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
index fd4c0c8d1..6b64236dc 100644
--- a/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
+++ b/modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
@@ -691,7 +691,7 @@ sub run {
                         my $df_rule = Bio::EnsEMBL::Hive::DataflowRule->new(
                             -from_analysis              => $analysis,
                             -to_analysis_url            => $heir_url,
-                            -branch_code                => $dataflow_rule_adaptor->branch_name_2_code( $branch_name_or_code ),
+                            -branch_code                => $branch_name_or_code,
                             -input_id_template          => $input_id_template,
                             -funnel_dataflow_rule_id    => $funnel_dataflow_rule_id,
                         );
-- 
GitLab