Changeset 14741


Ignore:
Timestamp:
2007-10-30T12:41:23+13:00 (15 years ago)
Author:
xiao
Message:

modify to read flaxActivity elements and write out as serviceRack to buildConfig.xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/cfgread4gs3.pm

    r14667 r14741  
    7878           "index" => "indexes",
    7979           "plugin" => "plugin",
    80                "plugout" => "plugout",
     80           "plugout" => "plugout",
    8181           "indexOption" => "indexoptions",
    8282           "searchType" => "searchtype",
     
    100100my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage)$/;
    101101my $arrayarrayexp= q/^(plugin|classifier)$/;
     102
    102103my $defaults = q/^(defaultIndex|defaultLevel|defaultIndexLanguage|languageMetadata)$/;
    103104
     
    114115    my $filter = $_{'filter'};
    115116
     117    # for flax activities
     118    my $desid = $_{'desid'};
     119    my $assigned = $_{'assigned'};
     120   
    116121    #@ Marking repeated block
    117122    if ($element =~ /$repeatedBlock/) {
     
    147152    $data->{$key} = [];
    148153      }
     154
    149155      push (@{$data->{$key}},$name);
    150156    }
     
    184190    }
    185191    }
     192
    186193    #@ use hash of hash of strings: hashexp
    187194    elsif ($element eq "subcollection") {
     
    225232
    226233    }
    227 
     234    #@ Handling each flaxActivity element (arrayarrayexp)
     235    elsif ($element eq "flaxActivity") {
     236        if (!defined $data->{'flaxActivity'}) {
     237            $data->{'flaxActivity'} = [];
     238        }
     239        if(defined $assigned and $assigned =~ /\w/ and $assigned eq "true") {
     240        if (defined $name and $name =~ /\w/) {
     241            push (@{$data->{'flaxActivity'}->[$currentIndex]}, 'name');
     242            push (@{$data->{'flaxActivity'}->[$currentIndex]}, $name);
     243        }
     244   
     245        if (defined $desid and $desid =~ /\w/) {
     246            push (@{$data->{'flaxActivity'}->[$currentIndex]}, 'desid');
     247            push (@{$data->{'flaxActivity'}->[$currentIndex]}, $desid);
     248        }       
     249        }
     250    }
    228251}
    229252
     
    232255    my $endTags = q/^(browse|pluginList)$/;   
    233256    if ($element =~ /$endTags/) {
    234     $currentIndex = 0;
    235     $currentLevel = "";
     257        $currentIndex = 0;
     258        $currentLevel = "";
    236259    }
    237260    # $arrayarrayexp contains classifier|plugin
    238     elsif($element =~ /$arrayarrayexp/){
     261    elsif($element =~ /$arrayarrayexp/ || $element eq "flaxActivity"){
    239262        $currentIndex = $currentIndex + 1;
    240       }
     263    }
    241264 
    242265}
     
    697720    &write_line('COLCFG', ["<serviceRack name=\"PhindPhraseBrowse\" />"]);
    698721    }
    699  
     722
     723    my $flaxActivities = $collectcfg->{"flaxActivity"};
     724    foreach my $fa (@$flaxActivities) {
     725        if(defined $fa and @$fa[0] =~ /\w/ and @$fa[1] =~ /\w/ and @$fa[2] =~ /\w/ and @$fa[3] =~ /\w/ ) {
     726            &write_line('COLCFG', ["<serviceRack ", @$fa[0], "=\"", @$fa[1], "\" ", @$fa[2], "=\"", @$fa[3], "\" />"]);
     727        }
     728    } 
     729   
    700730    &write_line('COLCFG', ["</serviceRackList>"]);
    701731    &write_line('COLCFG', ["</buildConfig>"]);
Note: See TracChangeset for help on using the changeset viewer.