1*9780544fSAndrew Rist#************************************************************** 2*9780544fSAndrew Rist# 3*9780544fSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 4*9780544fSAndrew Rist# or more contributor license agreements. See the NOTICE file 5*9780544fSAndrew Rist# distributed with this work for additional information 6*9780544fSAndrew Rist# regarding copyright ownership. The ASF licenses this file 7*9780544fSAndrew Rist# to you under the Apache License, Version 2.0 (the 8*9780544fSAndrew Rist# "License"); you may not use this file except in compliance 9*9780544fSAndrew Rist# with the License. You may obtain a copy of the License at 10*9780544fSAndrew Rist# 11*9780544fSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 12*9780544fSAndrew Rist# 13*9780544fSAndrew Rist# Unless required by applicable law or agreed to in writing, 14*9780544fSAndrew Rist# software distributed under the License is distributed on an 15*9780544fSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9780544fSAndrew Rist# KIND, either express or implied. See the License for the 17*9780544fSAndrew Rist# specific language governing permissions and limitations 18*9780544fSAndrew Rist# under the License. 19*9780544fSAndrew Rist# 20*9780544fSAndrew Rist#************************************************************** 21*9780544fSAndrew Rist 22*9780544fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir# 26cdf0e10cSrcweir# Cws.pm - package for accessing/manipulating child workspaces 27cdf0e10cSrcweir# 28cdf0e10cSrcweir 29cdf0e10cSrcweir# TODO: needs some cleanup 30cdf0e10cSrcweir 31cdf0e10cSrcweirpackage Cws; 32cdf0e10cSrcweiruse strict; 33cdf0e10cSrcweir 34cdf0e10cSrcweiruse Eis; 35cdf0e10cSrcweiruse CwsConfig; 36cdf0e10cSrcweiruse Carp; 37cdf0e10cSrcweiruse URI::Escape; 38cdf0e10cSrcweir 39cdf0e10cSrcweirmy $config = CwsConfig::get_config(); 40cdf0e10cSrcweir 41cdf0e10cSrcweir##### class data ##### 42cdf0e10cSrcweir 43cdf0e10cSrcweirmy %CwsClassData = ( 44cdf0e10cSrcweir # EIS database connectivity 45cdf0e10cSrcweir EIS_URI => 'urn:ChildWorkspaceDataService', 46cdf0e10cSrcweir EIS_PROXY_LIST => $config->cws_db_url_list_ref(), 47cdf0e10cSrcweir NET_PROXY => $config->net_proxy(), 48cdf0e10cSrcweir EIS => undef 49cdf0e10cSrcweir); 50cdf0e10cSrcweir 51cdf0e10cSrcweir##### ctor ##### 52cdf0e10cSrcweir 53cdf0e10cSrcweirsub new 54cdf0e10cSrcweir{ 55cdf0e10cSrcweir my $invocant = shift; 56cdf0e10cSrcweir my $class = ref($invocant) || $invocant; 57cdf0e10cSrcweir my $self = {}; 58cdf0e10cSrcweir # instance data 59cdf0e10cSrcweir # initialize CWS name from environment 60cdf0e10cSrcweir $self->{CHILD} = undef; # name of child workspace 61cdf0e10cSrcweir $self->{MASTER} = undef; # name of master workspace 62cdf0e10cSrcweir $self->{EIS_ID} = undef; # id of child workspace in EIS 63cdf0e10cSrcweir $self->{FILES} = undef; # list of files registered with child 64cdf0e10cSrcweir # any file can be registered multiple times 65cdf0e10cSrcweir $self->{PATCH_FILES} = undef # list of product patch files registered with 66cdf0e10cSrcweir # child, each file can be added only once 67cdf0e10cSrcweir $self->{MILESTONE} = undef; # master milestone to which child is related 68cdf0e10cSrcweir $self->{MODULES} = undef; # list of modules belonging to child 69cdf0e10cSrcweir $self->{INCOMPATIBLE_MODULES} = undef; # list of modules belonging to child 70cdf0e10cSrcweir $self->{NEW_MODULES} = undef; # list of public new modules belonging to child 71cdf0e10cSrcweir $self->{NEW_MODULES_PRIV} = undef; # list of private new modules belonging to child 72cdf0e10cSrcweir $self->{TASKIDS} = undef; # list of tasks registered with child 73cdf0e10cSrcweir $self->{_CACHED_TAGS} = undef; # list of cached tags (tags are looked up frequently) 74cdf0e10cSrcweir bless($self, $class); 75cdf0e10cSrcweir return $self; 76cdf0e10cSrcweir} 77cdf0e10cSrcweir 78cdf0e10cSrcweir#### methods to access instance data #### 79cdf0e10cSrcweir 80cdf0e10cSrcweir# Get the EIS ID for child workspace, 81cdf0e10cSrcweir# return value: undef => not yet asked EIS for ID 82cdf0e10cSrcweir# or connection failed 83cdf0e10cSrcweir# 0 => queried EIS but didn't find such 84cdf0e10cSrcweir# a child workspace for this master 85cdf0e10cSrcweir# silently ignore any parameter, only the EIS database, 86cdf0e10cSrcweir# hands out EIS IDs. 87cdf0e10cSrcweirsub eis_id 88cdf0e10cSrcweir{ 89cdf0e10cSrcweir my $self = shift; 90cdf0e10cSrcweir if ( !defined($self->{EIS_ID} ) ) { 91cdf0e10cSrcweir $self->{EIS_ID} = $self->get_eis_id(); 92cdf0e10cSrcweir } 93cdf0e10cSrcweir return $self->{EIS_ID}; 94cdf0e10cSrcweir} 95cdf0e10cSrcweir 96cdf0e10cSrcweir# Generate remaining instance data accessor methods; 97cdf0e10cSrcweir# if this looks strange see 'perldoc perltootc' 98cdf0e10cSrcweir 99cdf0e10cSrcweir# Accessor methods for single value instance data 100cdf0e10cSrcweirfor my $datum (qw(master milestone)) { 101cdf0e10cSrcweir no strict "refs"; 102cdf0e10cSrcweir *$datum = sub { 103cdf0e10cSrcweir my $self = shift; 104cdf0e10cSrcweir my $ucdatum = uc($datum); 105cdf0e10cSrcweir if ( @_ ) { 106cdf0e10cSrcweir # set item in database 107cdf0e10cSrcweir my $item = shift; 108cdf0e10cSrcweir # if we already have a valid EIS registered CWS then reset EIS value 109cdf0e10cSrcweir # otherwise just set member to the given value 110cdf0e10cSrcweir if ( !$self->{uc($datum)} # keep order of evaluation 111cdf0e10cSrcweir || !$self->eis_id() 112cdf0e10cSrcweir || $self->set_item_in_eis($datum, $item) ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir $self->{uc($datum)} = $item; 115cdf0e10cSrcweir 116cdf0e10cSrcweir } 117cdf0e10cSrcweir } 118cdf0e10cSrcweir else { 119cdf0e10cSrcweir if ( !defined($self->{$ucdatum} ) ) { 120cdf0e10cSrcweir # fetch item from database 121cdf0e10cSrcweir $self->{$ucdatum} = $self->fetch_item_from_eis($datum); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir } 124cdf0e10cSrcweir return $self->{uc($datum)}; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir} 127cdf0e10cSrcweir 128cdf0e10cSrcweir# Accessor methods for instance data consisting of item lists 129cdf0e10cSrcweir# like modules and taskids 130cdf0e10cSrcweirfor my $datum (qw(files patch_files modules incompatible_modules new_modules new_modules_priv taskids)) { 131cdf0e10cSrcweir no strict "refs"; 132cdf0e10cSrcweir *$datum = sub { 133cdf0e10cSrcweir # get current item list 134cdf0e10cSrcweir # fetch list from EIS database if called the first time 135cdf0e10cSrcweir my $self = shift; 136cdf0e10cSrcweir my $ucdatum = uc($datum); 137cdf0e10cSrcweir if ( !defined($self->{$ucdatum}) ) { 138cdf0e10cSrcweir # fetch item list from databse 139cdf0e10cSrcweir $self->{$ucdatum} = $self->fetch_items_from_eis($datum); 140cdf0e10cSrcweir return undef if !defined($self->{$ucdatum}); 141cdf0e10cSrcweir } 142cdf0e10cSrcweir return wantarray ? @{$self->{$ucdatum}} : $self->{$ucdatum} 143cdf0e10cSrcweir } 144cdf0e10cSrcweir} 145cdf0e10cSrcweir 146cdf0e10cSrcweirfor my $datum (qw(child)) { 147cdf0e10cSrcweir no strict "refs"; 148cdf0e10cSrcweir *$datum = sub { 149cdf0e10cSrcweir my $self = shift; 150cdf0e10cSrcweir $self->{uc($datum)} = shift if @_; 151cdf0e10cSrcweir return $self->{uc($datum)}; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir} 154cdf0e10cSrcweir 155cdf0e10cSrcweir 156cdf0e10cSrcweir#### additional public methods #### 157cdf0e10cSrcweir 158cdf0e10cSrcweir# For resync: Sets master and milestone simultaneously 159cdf0e10cSrcweir# In case of a cross master resync it does not make sense to 160cdf0e10cSrcweir# change both items separately 161cdf0e10cSrcweirsub set_master_and_milestone 162cdf0e10cSrcweir{ 163cdf0e10cSrcweir my $self = shift; 164cdf0e10cSrcweir my $master = shift or return undef; 165cdf0e10cSrcweir my $milestone = shift or return undef; 166cdf0e10cSrcweir 167cdf0e10cSrcweir # if we do not yet have a valid EIS registered CWS use the above more basic methods 168cdf0e10cSrcweir if ( !$self->master() 169cdf0e10cSrcweir || !$self->milestone() 170cdf0e10cSrcweir || !$self->eis_id() ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir $self->master($master); 173cdf0e10cSrcweir $self->milestone($milestone); 174cdf0e10cSrcweir } else { 175cdf0e10cSrcweir if ( $self->set_master_and_milestone_in_eis($master, $milestone) ) { 176cdf0e10cSrcweir $self->{'MASTER'} = $self->fetch_item_from_eis('master'); 177cdf0e10cSrcweir $self->{'MILESTONE'} = $self->fetch_item_from_eis('milestone'); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir } 180cdf0e10cSrcweir my @retarray = ($self->{'MASTER'}, $self->{'MILESTONE'}); 181cdf0e10cSrcweir return wantarray ? @retarray : \@retarray; 182cdf0e10cSrcweir} 183cdf0e10cSrcweir 184cdf0e10cSrcweir# Query if CWS name is still available. Does not yet register 185cdf0e10cSrcweir# anything with EIS. 186cdf0e10cSrcweirsub is_cws_name_available 187cdf0e10cSrcweir{ 188cdf0e10cSrcweir my $self = shift; 189cdf0e10cSrcweir 190cdf0e10cSrcweir my $is_available = $self->is_cws_name_available_in_eis(); 191cdf0e10cSrcweir return $is_available; 192cdf0e10cSrcweir} 193cdf0e10cSrcweir 194cdf0e10cSrcweir# Register new child workspace with the EIS database. 195cdf0e10cSrcweirsub register 196cdf0e10cSrcweir{ 197cdf0e10cSrcweir my $self = shift; 198cdf0e10cSrcweir my $vcsid = shift; 199cdf0e10cSrcweir my $location = shift; 200cdf0e10cSrcweir 201cdf0e10cSrcweir my $child_id = $self->register_child_with_eis($vcsid, $location); 202cdf0e10cSrcweir return $child_id; 203cdf0e10cSrcweir} 204cdf0e10cSrcweir 205cdf0e10cSrcweir# Promote a child workspace with status 'planned' to a full CWS 206cdf0e10cSrcweirsub promote 207cdf0e10cSrcweir{ 208cdf0e10cSrcweir my $self = shift; 209cdf0e10cSrcweir my $vcsid = shift; 210cdf0e10cSrcweir my $location = shift; 211cdf0e10cSrcweir 212cdf0e10cSrcweir my $rc = $self->promote_child_in_eis($vcsid, $location); 213cdf0e10cSrcweir return $rc; 214cdf0e10cSrcweir} 215cdf0e10cSrcweir 216cdf0e10cSrcweir# New style add_module method. Takes an additional bool indicating if 217cdf0e10cSrcweir# a module is public or private. Obsoletes add_modules() 218cdf0e10cSrcweirsub add_module 219cdf0e10cSrcweir{ 220cdf0e10cSrcweir my $self = shift; 221cdf0e10cSrcweir my $module = shift; 222cdf0e10cSrcweir my $public = shift; 223cdf0e10cSrcweir 224cdf0e10cSrcweir my $items_ref = $self->add_items('modules', $public, $module); 225cdf0e10cSrcweir if (defined ($items_ref->[0]) && ($items_ref->[0] eq $module)) { 226cdf0e10cSrcweir return 1; # module has been added 227cdf0e10cSrcweir } 228cdf0e10cSrcweir elsif ( defined($items_ref) ) { 229cdf0e10cSrcweir return 0; # module was already add 230cdf0e10cSrcweir } 231cdf0e10cSrcweir return undef; # something went wrong 232cdf0e10cSrcweir} 233cdf0e10cSrcweir 234cdf0e10cSrcweir# Add module to modules list. 235cdf0e10cSrcweirsub add_modules 236cdf0e10cSrcweir{ 237cdf0e10cSrcweir my $self = shift; 238cdf0e10cSrcweir 239cdf0e10cSrcweir my $items_ref = $self->add_items('modules', undef, @_); 240cdf0e10cSrcweir return undef unless defined($items_ref); 241cdf0e10cSrcweir return wantarray ? @{$items_ref} : $items_ref; 242cdf0e10cSrcweir} 243cdf0e10cSrcweir 244cdf0e10cSrcweir# Add tasksids to taskids list. 245cdf0e10cSrcweirsub add_taskids 246cdf0e10cSrcweir{ 247cdf0e10cSrcweir my $self = shift; 248cdf0e10cSrcweir my $vcsid = shift; 249cdf0e10cSrcweir 250cdf0e10cSrcweir my $items_ref = $self->add_items('taskids', $vcsid, @_); 251cdf0e10cSrcweir return undef unless defined($items_ref); 252cdf0e10cSrcweir return wantarray ? @{$items_ref} : $items_ref; 253cdf0e10cSrcweir} 254cdf0e10cSrcweir 255cdf0e10cSrcweir# Add a file to the files list. 256cdf0e10cSrcweirsub add_file 257cdf0e10cSrcweir{ 258cdf0e10cSrcweir my $self = shift; 259cdf0e10cSrcweir my $module = shift; 260cdf0e10cSrcweir my $file = shift; 261cdf0e10cSrcweir my $revision = shift; 262cdf0e10cSrcweir my $authors_ref = shift; 263cdf0e10cSrcweir my $taskids_ref = shift; 264cdf0e10cSrcweir my $archive_path = shift; 265cdf0e10cSrcweir 266cdf0e10cSrcweir my $files_ref = $self->files(); 267cdf0e10cSrcweir 268cdf0e10cSrcweir if ( $self->add_file_to_eis($module, $file, $revision, 269cdf0e10cSrcweir $authors_ref, $taskids_ref, $archive_path) ) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir push(@{$files_ref}, $file); 272cdf0e10cSrcweir return 1; 273cdf0e10cSrcweir } 274cdf0e10cSrcweir return 0; 275cdf0e10cSrcweir} 276cdf0e10cSrcweir 277cdf0e10cSrcweir# Add a file to the patch file list. 278cdf0e10cSrcweirsub add_patch_file 279cdf0e10cSrcweir{ 280cdf0e10cSrcweir my $self = shift; 281cdf0e10cSrcweir my $file = shift; 282cdf0e10cSrcweir 283cdf0e10cSrcweir my $patch_files_ref = $self->patch_files(); 284cdf0e10cSrcweir 285cdf0e10cSrcweir foreach (@{$patch_files_ref}) { 286cdf0e10cSrcweir return 0 if $file eq $_; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir if ( $self->add_patch_file_to_eis($file) ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir push(@{$patch_files_ref}, $file); 292cdf0e10cSrcweir return 1; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir return 0; 295cdf0e10cSrcweir} 296cdf0e10cSrcweir 297cdf0e10cSrcweir# 298cdf0e10cSrcweir# Procedure retrieves the workspace which 299cdf0e10cSrcweir# is based on cvs head (not branch) 300cdf0e10cSrcweir# 301cdf0e10cSrcweirsub get_cvs_head { 302cdf0e10cSrcweir my $eis = Cws::eis(); 303cdf0e10cSrcweir my $result; 304cdf0e10cSrcweir eval { $result = $eis->getCVSHead() }; 305cdf0e10cSrcweir if ( $@ ) { 306cdf0e10cSrcweir carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n"); 307cdf0e10cSrcweir } 308cdf0e10cSrcweir return $result; 309cdf0e10cSrcweir}; 310cdf0e10cSrcweir 311cdf0e10cSrcweir#### public class methods #### 312cdf0e10cSrcweir 313cdf0e10cSrcweirsub get_master_tag { 314cdf0e10cSrcweir my ($self, $master, $milestone) = @_; 315cdf0e10cSrcweir $master = $self->master() if (!defined $master); 316cdf0e10cSrcweir $milestone = $self->milestone() if (!defined $milestone); 317cdf0e10cSrcweir return uc($master) . '_' . lc($milestone); 318cdf0e10cSrcweir}; 319cdf0e10cSrcweir 320cdf0e10cSrcweirsub get_master_branch_tag { 321cdf0e10cSrcweir my ($self, $master) = @_; 322cdf0e10cSrcweir $master = $self->master() if (!defined $master); 323cdf0e10cSrcweir # check in environment if master is on the the HEAD branch 324cdf0e10cSrcweir my $cvs_head = get_cvs_head(); 325cdf0e10cSrcweir if ( $master eq $cvs_head ) { 326cdf0e10cSrcweir return undef; 327cdf0e10cSrcweir } 328cdf0e10cSrcweir else { 329cdf0e10cSrcweir return 'mws_' . lc($master); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir}; 332cdf0e10cSrcweir 333cdf0e10cSrcweirsub get_mws { 334cdf0e10cSrcweir my $self = shift; 335cdf0e10cSrcweir my $eis = Cws::eis(); 336cdf0e10cSrcweir my $masters; 337cdf0e10cSrcweir my $child = Eis::to_string($self->child()); 338cdf0e10cSrcweir eval { $masters = $eis->getMastersForCWS($child) }; 339cdf0e10cSrcweir if ( $@ ) { 340cdf0e10cSrcweir carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n"); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir return $$masters[0]; 343cdf0e10cSrcweir}; 344cdf0e10cSrcweir 345cdf0e10cSrcweir# Returns the branch and root tags for child workspace. 346cdf0e10cSrcweirsub get_tags 347cdf0e10cSrcweir{ 348cdf0e10cSrcweir my $self = shift; 349cdf0e10cSrcweir 350cdf0e10cSrcweir # look up if tags have already been retrieved 351cdf0e10cSrcweir if ( defined($self->{_CACHED_TAGS}) ) { 352cdf0e10cSrcweir return @{$self->{_CACHED_TAGS}}; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir # check if child workspace is valid 356cdf0e10cSrcweir my $id = $self->eis_id(); 357cdf0e10cSrcweir if ( !$id ) { 358cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 359cdf0e10cSrcweir return undef; 360cdf0e10cSrcweir } 361cdf0e10cSrcweir 362cdf0e10cSrcweir my $childws = $self->child(); 363cdf0e10cSrcweir # check if child workspace is a clone, 364cdf0e10cSrcweir if ( $childws =~ /(\w+)_[[:upper:]]{3}\d{3}/ ) { 365cdf0e10cSrcweir $childws = $1; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir # check in environment if master is on the the HEAD branch 369cdf0e10cSrcweir my $cvs_head = get_cvs_head(); 370cdf0e10cSrcweir my $current_master = $self->master(); 371cdf0e10cSrcweir my $creation_master = $self->get_creation_master(); 372cdf0e10cSrcweir if ( !$creation_master ) { 373cdf0e10cSrcweir carp("ERROR: Can't determine creation MWS.\n"); 374cdf0e10cSrcweir return undef; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir my $milestone = $self->milestone(); 377cdf0e10cSrcweir 378cdf0e10cSrcweir my $master_branch_tag 379cdf0e10cSrcweir = (lc($current_master) eq lc($cvs_head)) ? '' : 'mws_' . lc($current_master); 380cdf0e10cSrcweir my $cws_branch_tag = 'cws_' . lc($creation_master) . '_' . lc($childws); 381cdf0e10cSrcweir my $cws_root_tag = uc($cws_branch_tag) . "_ANCHOR"; 382cdf0e10cSrcweir my $master_milestone_tag = uc($current_master) . "_" . $milestone; 383cdf0e10cSrcweir 384cdf0e10cSrcweir $self->{_CACHED_TAGS} = [$master_branch_tag, $cws_branch_tag, $cws_root_tag, $master_milestone_tag]; 385cdf0e10cSrcweir return @{$self->{_CACHED_TAGS}}; 386cdf0e10cSrcweir} 387cdf0e10cSrcweir 388cdf0e10cSrcweir# Get childworkspace owner 389cdf0e10cSrcweirsub get_owner 390cdf0e10cSrcweir{ 391cdf0e10cSrcweir my $self = shift; 392cdf0e10cSrcweir 393cdf0e10cSrcweir return $self->get_owner_from_eis(); 394cdf0e10cSrcweir} 395cdf0e10cSrcweir 396cdf0e10cSrcweir# get childworkspace qarep 397cdf0e10cSrcweirsub get_qarep 398cdf0e10cSrcweir{ 399cdf0e10cSrcweir my $self = shift; 400cdf0e10cSrcweir 401cdf0e10cSrcweir return $self->get_qarep_from_eis(); 402cdf0e10cSrcweir} 403cdf0e10cSrcweir 404cdf0e10cSrcweir# store an Attachment to a given CWS 405cdf0e10cSrcweirsub save_attachment 406cdf0e10cSrcweir{ 407cdf0e10cSrcweir my $self = shift; 408cdf0e10cSrcweir my $name = shift; 409cdf0e10cSrcweir my $mediatype = shift; 410cdf0e10cSrcweir my $data = shift; 411cdf0e10cSrcweir 412cdf0e10cSrcweir return $self->save_attachment_in_eis($name, $mediatype, $data); 413cdf0e10cSrcweir} 414cdf0e10cSrcweir 415cdf0e10cSrcweir# Get child workspace approval status, 416cdf0e10cSrcweir# return values can be: 417cdf0e10cSrcweir# 'planned', 'new', 'nominated', 'integrated' 418cdf0e10cSrcweir# and undef in case of error. 419cdf0e10cSrcweirsub get_approval 420cdf0e10cSrcweir{ 421cdf0e10cSrcweir my $self = shift; 422cdf0e10cSrcweir 423cdf0e10cSrcweir return $self->get_status_from_eis(); 424cdf0e10cSrcweir} 425cdf0e10cSrcweir 426cdf0e10cSrcweir# Set child workspace approval status 427cdf0e10cSrcweir# to 'integrated'. Return true if successful 428cdf0e10cSrcweir# or undef in case of error 429cdf0e10cSrcweirsub set_integrated 430cdf0e10cSrcweir{ 431cdf0e10cSrcweir my $self = shift; 432cdf0e10cSrcweir 433cdf0e10cSrcweir return $self->set_status_in_eis(); 434cdf0e10cSrcweir} 435cdf0e10cSrcweir 436cdf0e10cSrcweir# Set child workspace integration milestone 437cdf0e10cSrcweir# Return true if successful or undef in case of error 438cdf0e10cSrcweirsub set_integration_milestone 439cdf0e10cSrcweir{ 440cdf0e10cSrcweir my $self = shift; 441cdf0e10cSrcweir my $milestone = shift; 442cdf0e10cSrcweir my $buildid = shift; 443cdf0e10cSrcweir 444cdf0e10cSrcweir return $self->set_integration_milestone_in_eis($milestone, $buildid); 445cdf0e10cSrcweir} 446cdf0e10cSrcweir 447cdf0e10cSrcweir# Get the MWS on which a CWS was created 448cdf0e10cSrcweirsub get_creation_master 449cdf0e10cSrcweir{ 450cdf0e10cSrcweir my $self = shift; 451cdf0e10cSrcweir 452cdf0e10cSrcweir return $self->get_creation_master_from_eis(); 453cdf0e10cSrcweir} 454cdf0e10cSrcweir 455cdf0e10cSrcweir# Get the 'public' flag indicating whether a CWS is visible on OOo 456cdf0e10cSrcweirsub get_public_flag 457cdf0e10cSrcweir{ 458cdf0e10cSrcweir my $self = shift; 459cdf0e10cSrcweir 460cdf0e10cSrcweir return $self->get_public_flag_from_eis(); 461cdf0e10cSrcweir} 462cdf0e10cSrcweir 463cdf0e10cSrcweir 464cdf0e10cSrcweir# Get the 'publicmaster' flag indicating whether a MWS is visible on OOo 465cdf0e10cSrcweirsub get_publicmaster_flag 466cdf0e10cSrcweir{ 467cdf0e10cSrcweir my $self = shift; 468cdf0e10cSrcweir 469cdf0e10cSrcweir return $self->get_publicmaster_flag_from_eis(); 470cdf0e10cSrcweir} 471cdf0e10cSrcweir 472cdf0e10cSrcweir 473cdf0e10cSrcweirsub get_subversion_flag { 474cdf0e10cSrcweir 475cdf0e10cSrcweir my $self = shift; 476cdf0e10cSrcweir 477cdf0e10cSrcweir return $self->get_subversion_flag_from_eis(); 478cdf0e10cSrcweir} 479cdf0e10cSrcweir 480cdf0e10cSrcweirsub set_subversion_flag { 481cdf0e10cSrcweir 482cdf0e10cSrcweir my $self = shift; 483cdf0e10cSrcweir my $value = shift; 484cdf0e10cSrcweir 485cdf0e10cSrcweir return $self->set_subversion_flag_in_eis($value); 486cdf0e10cSrcweir} 487cdf0e10cSrcweir 488cdf0e10cSrcweirsub get_scm { 489cdf0e10cSrcweir my $self = shift; 490cdf0e10cSrcweir 491cdf0e10cSrcweir return $self->get_scm_from_eis(); 492cdf0e10cSrcweir} 493cdf0e10cSrcweir 494cdf0e10cSrcweirsub set_scm { 495cdf0e10cSrcweir my $self = shift; 496cdf0e10cSrcweir my $scm_name = shift; 497cdf0e10cSrcweir 498cdf0e10cSrcweir return $self->set_scm_in_eis($scm_name); 499cdf0e10cSrcweir} 500cdf0e10cSrcweir 501cdf0e10cSrcweir 502cdf0e10cSrcweir# Check if milestone exists 503cdf0e10cSrcweirsub is_milestone 504cdf0e10cSrcweir{ 505cdf0e10cSrcweir my $self = shift; 506cdf0e10cSrcweir my $master = shift; 507cdf0e10cSrcweir my $milestone = shift; 508cdf0e10cSrcweir 509cdf0e10cSrcweir return $self->is_milestone_registered_with_eis($master, $milestone); 510cdf0e10cSrcweir} 511cdf0e10cSrcweir 512cdf0e10cSrcweir# Check if this cws contains new ui 513cdf0e10cSrcweirsub is_uirelevant 514cdf0e10cSrcweir{ 515cdf0e10cSrcweir my $self = shift; 516cdf0e10cSrcweir 517cdf0e10cSrcweir return $self->is_uirelevant_from_eis(); 518cdf0e10cSrcweir} 519cdf0e10cSrcweir 520cdf0e10cSrcweir# Check if this cws contains new online help 521cdf0e10cSrcweirsub is_helprelevant 522cdf0e10cSrcweir{ 523cdf0e10cSrcweir my $self = shift; 524cdf0e10cSrcweir 525cdf0e10cSrcweir return $self->is_helprelevant_from_eis(); 526cdf0e10cSrcweir} 527cdf0e10cSrcweir 528cdf0e10cSrcweir# Set the l10n status 529cdf0e10cSrcweirsub set_l10n_status 530cdf0e10cSrcweir{ 531cdf0e10cSrcweir my $self = shift; 532cdf0e10cSrcweir my $status = shift; 533cdf0e10cSrcweir 534cdf0e10cSrcweir return $self->set_l10n_status_in_eis( $status ); 535cdf0e10cSrcweir} 536cdf0e10cSrcweir 537cdf0e10cSrcweir# Get the l10n status 538cdf0e10cSrcweirsub get_l10n_status 539cdf0e10cSrcweir{ 540cdf0e10cSrcweir my $self = shift; 541cdf0e10cSrcweir 542cdf0e10cSrcweir return $self->get_l10n_status_from_eis(); 543cdf0e10cSrcweir} 544cdf0e10cSrcweirsub set_word_count 545cdf0e10cSrcweir{ 546cdf0e10cSrcweir my $self = shift; 547cdf0e10cSrcweir my $language = shift; 548cdf0e10cSrcweir my $wordcount = shift; 549cdf0e10cSrcweir 550cdf0e10cSrcweir return $self->set_word_count_in_eis( $language , $wordcount ); 551cdf0e10cSrcweir} 552cdf0e10cSrcweir 553cdf0e10cSrcweir 554cdf0e10cSrcweir# Get target release for CWS 555cdf0e10cSrcweirsub get_release 556cdf0e10cSrcweir{ 557cdf0e10cSrcweir my $self = shift; 558cdf0e10cSrcweir 559cdf0e10cSrcweir return $self->get_release_from_eis(); 560cdf0e10cSrcweir} 561cdf0e10cSrcweir 562cdf0e10cSrcweir# Get due date 563cdf0e10cSrcweirsub get_due_date 564cdf0e10cSrcweir{ 565cdf0e10cSrcweir my $self = shift; 566cdf0e10cSrcweir 567cdf0e10cSrcweir return $self->get_due_date_from_eis(); 568cdf0e10cSrcweir} 569cdf0e10cSrcweir 570cdf0e10cSrcweir# Get due date QA 571cdf0e10cSrcweirsub get_due_date_qa 572cdf0e10cSrcweir{ 573cdf0e10cSrcweir my $self = shift; 574cdf0e10cSrcweir 575cdf0e10cSrcweir return $self->get_due_date_qa_from_eis(); 576cdf0e10cSrcweir} 577cdf0e10cSrcweir 578cdf0e10cSrcweir# Query master milestone combination for being used by an 579cdf0e10cSrcweir# active CWS 580cdf0e10cSrcweirsub is_milestone_used 581cdf0e10cSrcweir{ 582cdf0e10cSrcweir my $self = shift; 583cdf0e10cSrcweir my $master = shift; 584cdf0e10cSrcweir my $milestone = shift; 585cdf0e10cSrcweir 586cdf0e10cSrcweir return $self->get_is_milestone_used_from_eis($master, $milestone); 587cdf0e10cSrcweir} 588cdf0e10cSrcweir 589cdf0e10cSrcweir# Set current milestone for MWS. 590cdf0e10cSrcweirsub set_current_milestone 591cdf0e10cSrcweir{ 592cdf0e10cSrcweir my $self = shift; 593cdf0e10cSrcweir my $master = shift; 594cdf0e10cSrcweir my $milestone = shift; 595cdf0e10cSrcweir 596cdf0e10cSrcweir return $self->set_current_milestone_in_eis($master, $milestone); 597cdf0e10cSrcweir} 598cdf0e10cSrcweir 599cdf0e10cSrcweir# Get current milestone for MWS. 600cdf0e10cSrcweirsub get_current_milestone 601cdf0e10cSrcweir{ 602cdf0e10cSrcweir my $self = shift; 603cdf0e10cSrcweir my $master = shift; 604cdf0e10cSrcweir 605cdf0e10cSrcweir return $self->get_current_milestone_from_eis($master); 606cdf0e10cSrcweir} 607cdf0e10cSrcweir 608cdf0e10cSrcweirsub get_milestone_integrated 609cdf0e10cSrcweir{ 610cdf0e10cSrcweir my $self = shift; 611cdf0e10cSrcweir 612cdf0e10cSrcweir return $self->get_milestone_integrated_from_eis(); 613cdf0e10cSrcweir} 614cdf0e10cSrcweir 615cdf0e10cSrcweir# Get masters 616cdf0e10cSrcweirsub get_masters 617cdf0e10cSrcweir{ 618cdf0e10cSrcweir 619cdf0e10cSrcweir my $self = shift; 620cdf0e10cSrcweir 621cdf0e10cSrcweir return $self->get_masters_from_eis(); 622cdf0e10cSrcweir} 623cdf0e10cSrcweir 624cdf0e10cSrcweir# Get milestones for MWS. 625cdf0e10cSrcweirsub get_milestones 626cdf0e10cSrcweir{ 627cdf0e10cSrcweir my $self = shift; 628cdf0e10cSrcweir my $master = shift; 629cdf0e10cSrcweir 630cdf0e10cSrcweir return $self->get_milestones_from_eis($master); 631cdf0e10cSrcweir} 632cdf0e10cSrcweir# get build string for CWS 633cdf0e10cSrcweir 634cdf0e10cSrcweirsub get_build 635cdf0e10cSrcweir{ 636cdf0e10cSrcweir my $self = shift; 637cdf0e10cSrcweir my $master = $self->master(); 638cdf0e10cSrcweir my $milestone = $self->milestone(); 639cdf0e10cSrcweir if ( ! defined($milestone) ) { 640cdf0e10cSrcweir return undef; 641cdf0e10cSrcweir } 642cdf0e10cSrcweir my $bid=$self->get_buildid($master,$milestone); 643cdf0e10cSrcweir if ( ! defined($bid) ) { 644cdf0e10cSrcweir return undef; 645cdf0e10cSrcweir } 646cdf0e10cSrcweir return $self->expand_buildid($bid); 647cdf0e10cSrcweir} 648cdf0e10cSrcweir 649cdf0e10cSrcweir 650cdf0e10cSrcweir 651cdf0e10cSrcweir# expand build for given cwsname 652cdf0e10cSrcweirsub expand_buildid 653cdf0e10cSrcweir{ 654cdf0e10cSrcweir my $self = shift; 655cdf0e10cSrcweir my $bid = shift; 656cdf0e10cSrcweir return $self->expand_buildid_in_eis($bid); 657cdf0e10cSrcweir} 658cdf0e10cSrcweir 659cdf0e10cSrcweir 660cdf0e10cSrcweir# Set BuildID of milestone 661cdf0e10cSrcweirsub set_milestone_buildid 662cdf0e10cSrcweir{ 663cdf0e10cSrcweir my $self = shift; 664cdf0e10cSrcweir my $master = shift; 665cdf0e10cSrcweir my $milestone = shift; 666cdf0e10cSrcweir my $buildid = shift; 667cdf0e10cSrcweir 668cdf0e10cSrcweir return $self->set_milestone_buildid_in_eis($master, $milestone, $buildid); 669cdf0e10cSrcweir} 670cdf0e10cSrcweir 671cdf0e10cSrcweir# Declare milestone 'removed' 672cdf0e10cSrcweir# This triggers EIS to send emails to all (SO-internal) CWS owners 673cdf0e10cSrcweir# with living CWSs based on that milestone. 674cdf0e10cSrcweirsub milestone_removed 675cdf0e10cSrcweir{ 676cdf0e10cSrcweir my $self = shift; 677cdf0e10cSrcweir my $master = shift; 678cdf0e10cSrcweir my $milestone = shift; 679cdf0e10cSrcweir 680cdf0e10cSrcweir return $self->set_milestone_removed_in_eis($master, $milestone); 681cdf0e10cSrcweir} 682cdf0e10cSrcweir 683cdf0e10cSrcweir 684cdf0e10cSrcweir# Get all child workspaces which have been integrated on a 685cdf0e10cSrcweir# given master and milestone. 686cdf0e10cSrcweirsub get_integrated_cws 687cdf0e10cSrcweir{ 688cdf0e10cSrcweir my $self = shift; 689cdf0e10cSrcweir my $master = shift; 690cdf0e10cSrcweir my $milestone = shift; 691cdf0e10cSrcweir 692cdf0e10cSrcweir my $childworkspaces_arrref = $self->get_childworkspaces_for_milestone($master, $milestone); 693cdf0e10cSrcweir if ( !$childworkspaces_arrref ) { 694cdf0e10cSrcweir $childworkspaces_arrref = []; 695cdf0e10cSrcweir } 696cdf0e10cSrcweir return wantarray ? @$childworkspaces_arrref : $childworkspaces_arrref; 697cdf0e10cSrcweir} 698cdf0e10cSrcweir 699cdf0e10cSrcweir 700cdf0e10cSrcweir# Get builid for given master and milestone. 701cdf0e10cSrcweirsub get_buildid 702cdf0e10cSrcweir{ 703cdf0e10cSrcweir my $self = shift; 704cdf0e10cSrcweir my $master = shift; 705cdf0e10cSrcweir my $milestone = shift; 706cdf0e10cSrcweir 707cdf0e10cSrcweir return $self->get_buildid_for_milestone($master, $milestone); 708cdf0e10cSrcweir} 709cdf0e10cSrcweir 710cdf0e10cSrcweir# 711cdf0e10cSrcweir# Get all cws' with a status passed 712cdf0e10cSrcweir# 713cdf0e10cSrcweirsub get_cws_with_state 714cdf0e10cSrcweir{ 715cdf0e10cSrcweir my $self = shift; 716cdf0e10cSrcweir my $mws = shift; 717cdf0e10cSrcweir my $status = shift; 718cdf0e10cSrcweir 719cdf0e10cSrcweir return wantarray ? @{$self->get_cws_with_state_from_eis($mws, $status)} 720cdf0e10cSrcweir : $self->get_cws_with_state_from_eis($mws, $status); 721cdf0e10cSrcweir} 722cdf0e10cSrcweir 723cdf0e10cSrcweirsub get_task_prio_cws 724cdf0e10cSrcweir{ 725cdf0e10cSrcweir my $self = shift; 726cdf0e10cSrcweir my $ref_taskids = shift; 727cdf0e10cSrcweir return @{$self->get_task_prios_of_tasks($ref_taskids)}; 728cdf0e10cSrcweir} 729cdf0e10cSrcweir 730cdf0e10cSrcweir# Check is CWS is cloneable for specified master 731cdf0e10cSrcweirsub is_cws_cloneable 732cdf0e10cSrcweir{ 733cdf0e10cSrcweir my $self = shift; 734cdf0e10cSrcweir my $master = shift; 735cdf0e10cSrcweir 736cdf0e10cSrcweir return $self->get_is_cws_cloneable_from_eis($master); 737cdf0e10cSrcweir} 738cdf0e10cSrcweir 739cdf0e10cSrcweir# Clone CWS for specified master 740cdf0e10cSrcweirsub clone_cws 741cdf0e10cSrcweir{ 742cdf0e10cSrcweir my $self = shift; 743cdf0e10cSrcweir my $master = shift; 744cdf0e10cSrcweir 745cdf0e10cSrcweir return $self->clone_cws_in_eis($master); 746cdf0e10cSrcweir} 747cdf0e10cSrcweir 748cdf0e10cSrcweirsub set_log_entry 749cdf0e10cSrcweir{ 750cdf0e10cSrcweir my $self = shift; 751cdf0e10cSrcweir my $commandline = shift; 752cdf0e10cSrcweir my $vcsid = shift; 753cdf0e10cSrcweir my $start = shift; 754cdf0e10cSrcweir my $stop = shift; 755cdf0e10cSrcweir my $comment = shift; 756cdf0e10cSrcweir return $self->set_log_entry_in_eis($commandline, $vcsid, $start, $stop, $comment); 757cdf0e10cSrcweir} 758cdf0e10cSrcweir 759cdf0e10cSrcweirsub set_log_entry_extended 760cdf0e10cSrcweir{ 761cdf0e10cSrcweir my $self = shift; 762cdf0e10cSrcweir my $commandname = shift; 763cdf0e10cSrcweir my $parameter = shift; 764cdf0e10cSrcweir my $vcsid = shift; 765cdf0e10cSrcweir my $start = shift; 766cdf0e10cSrcweir my $stop = shift; 767cdf0e10cSrcweir my $comment = shift; 768cdf0e10cSrcweir my $mastername = shift; 769cdf0e10cSrcweir my $childname = shift; 770cdf0e10cSrcweir#set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname); 771cdf0e10cSrcweir return $self->set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname); 772cdf0e10cSrcweir} 773cdf0e10cSrcweir 774cdf0e10cSrcweir 775cdf0e10cSrcweir#### private #### 776cdf0e10cSrcweir 777cdf0e10cSrcweir# class data accessor methods 778cdf0e10cSrcweirsub eis 779cdf0e10cSrcweir{ 780cdf0e10cSrcweir shift; # ignore calling class/object 781cdf0e10cSrcweir $CwsClassData{EIS} = shift if @_; 782cdf0e10cSrcweir if ( !defined($CwsClassData{EIS}) ) { 783cdf0e10cSrcweir $CwsClassData{EIS} = init_eis_connector(); 784cdf0e10cSrcweir } 785cdf0e10cSrcweir return $CwsClassData{EIS}; 786cdf0e10cSrcweir} 787cdf0e10cSrcweir 788cdf0e10cSrcweir# generate remaining class data accessor methods 789cdf0e10cSrcweir# if this looks strange see 'perldoc perltootc' 790cdf0e10cSrcweirfor my $datum (qw(eis_uri eis_proxy_list net_proxy)) { 791cdf0e10cSrcweir no strict "refs"; 792cdf0e10cSrcweir *$datum = sub { 793cdf0e10cSrcweir shift; # ignore calling class/object 794cdf0e10cSrcweir return $CwsClassData{uc($datum)}; 795cdf0e10cSrcweir } 796cdf0e10cSrcweir} 797cdf0e10cSrcweir 798cdf0e10cSrcweir#### helper methods #### 799cdf0e10cSrcweir 800cdf0e10cSrcweir# instance methods 801cdf0e10cSrcweir 802cdf0e10cSrcweir# Add item to items list, 803cdf0e10cSrcweir# update eis database, 804cdf0e10cSrcweir# returns a list of newly added items, 805cdf0e10cSrcweir# specifying an existing item is not an 806cdf0e10cSrcweir# error, but it want appear in the return list. 807cdf0e10cSrcweirsub add_items 808cdf0e10cSrcweir{ 809cdf0e10cSrcweir my $self = shift; 810cdf0e10cSrcweir my $type = shift; 811cdf0e10cSrcweir my $optional_data = shift; 812cdf0e10cSrcweir 813cdf0e10cSrcweir my $items_ref; 814cdf0e10cSrcweir if ( $type eq 'modules' ) { 815cdf0e10cSrcweir $items_ref = $self->modules(); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir elsif ( $type eq 'taskids' ) { 818cdf0e10cSrcweir $items_ref = $self->taskids(); 819cdf0e10cSrcweir } 820cdf0e10cSrcweir else { 821cdf0e10cSrcweir # fall through, can't happen 822cdf0e10cSrcweir carp("ERROR: wrong item type\n"); 823cdf0e10cSrcweir return undef; 824cdf0e10cSrcweir } 825cdf0e10cSrcweir 826cdf0e10cSrcweir my $item; 827cdf0e10cSrcweir my @new_items = (); 828cdf0e10cSrcweir return undef if !defined($items_ref); 829cdf0e10cSrcweir # find which items which are not already in items list 830cdf0e10cSrcweir ITEM: while ( $item = shift ) { 831cdf0e10cSrcweir foreach ( @{$items_ref} ) { 832cdf0e10cSrcweir next ITEM if $_ eq $item; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir push(@new_items, $item); 835cdf0e10cSrcweir } 836cdf0e10cSrcweir if ( $#new_items > -1 ) { 837cdf0e10cSrcweir # add items to database 838cdf0e10cSrcweir if ( $self->add_items_to_eis($type, $optional_data, \@new_items) ) { 839cdf0e10cSrcweir push(@{$items_ref}, @new_items); 840cdf0e10cSrcweir } 841cdf0e10cSrcweir else { 842cdf0e10cSrcweir # something went wrong 843cdf0e10cSrcweir return undef; 844cdf0e10cSrcweir } 845cdf0e10cSrcweir } 846cdf0e10cSrcweir return \@new_items; 847cdf0e10cSrcweir} 848cdf0e10cSrcweir 849cdf0e10cSrcweir# Get EIS id for workspace from EIS database 850cdf0e10cSrcweirsub get_eis_id 851cdf0e10cSrcweir{ 852cdf0e10cSrcweir my $self = shift; 853cdf0e10cSrcweir my $eis = Cws::eis(); 854cdf0e10cSrcweir 855cdf0e10cSrcweir # It's not an error if one of these is unset, so don't carp(). 856cdf0e10cSrcweir if ( !$self->master() || !$self->child() ) { 857cdf0e10cSrcweir return undef; 858cdf0e10cSrcweir } 859cdf0e10cSrcweir 860cdf0e10cSrcweir my $master = Eis::to_string($self->master()); 861cdf0e10cSrcweir my $child = Eis::to_string($self->child()); 862cdf0e10cSrcweir 863cdf0e10cSrcweir my $result; 864cdf0e10cSrcweir eval { $result = int($eis->getChildWorkspaceId($master, $child)) }; 865cdf0e10cSrcweir if ( $@ ) { 866cdf0e10cSrcweir carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n"); 867cdf0e10cSrcweir } 868cdf0e10cSrcweir return $result; 869cdf0e10cSrcweir} 870cdf0e10cSrcweir 871cdf0e10cSrcweirsub fetch_item_from_eis 872cdf0e10cSrcweir{ 873cdf0e10cSrcweir my $self = shift; 874cdf0e10cSrcweir my $type = shift; 875cdf0e10cSrcweir 876cdf0e10cSrcweir my $eis = Cws::eis(); 877cdf0e10cSrcweir my $id = $self->eis_id(); 878cdf0e10cSrcweir 879cdf0e10cSrcweir if ( !$id ) { 880cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 881cdf0e10cSrcweir return undef; 882cdf0e10cSrcweir } 883cdf0e10cSrcweir 884cdf0e10cSrcweir my $result; 885cdf0e10cSrcweir if ( $type eq 'milestone' ) { 886cdf0e10cSrcweir eval { $result = $eis->getMilestone($id) }; 887cdf0e10cSrcweir } 888cdf0e10cSrcweir elsif ( $type eq 'master' ) { 889cdf0e10cSrcweir # master can't be queried from the EIS database, 890cdf0e10cSrcweir # just return what already in member 891cdf0e10cSrcweir return $self->{MASTER} 892cdf0e10cSrcweir } 893cdf0e10cSrcweir else { 894cdf0e10cSrcweir # fall through, can't happen 895cdf0e10cSrcweir carp("ERROR: wrong item type\n"); 896cdf0e10cSrcweir return undef; 897cdf0e10cSrcweir } 898cdf0e10cSrcweir if ( $@ ) { 899cdf0e10cSrcweir carp("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n"); 900cdf0e10cSrcweir } 901cdf0e10cSrcweir return $result; 902cdf0e10cSrcweir} 903cdf0e10cSrcweir 904cdf0e10cSrcweirsub set_item_in_eis 905cdf0e10cSrcweir{ 906cdf0e10cSrcweir my $self = shift; 907cdf0e10cSrcweir my $type = shift; 908cdf0e10cSrcweir my $item = shift; 909cdf0e10cSrcweir 910cdf0e10cSrcweir my $eis = Cws::eis(); 911cdf0e10cSrcweir my $id = $self->eis_id(); 912cdf0e10cSrcweir 913cdf0e10cSrcweir if ( !$id ) { 914cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 915cdf0e10cSrcweir return undef; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir # make certain that the item is a string, otherwise 919cdf0e10cSrcweir # autotyping will occasionally choose the wrong type 920cdf0e10cSrcweir $item = Eis::to_string($item); 921cdf0e10cSrcweir 922cdf0e10cSrcweir my $result; 923cdf0e10cSrcweir if ( $type eq 'milestone' ) { 924cdf0e10cSrcweir # this operation invalidates the cached tags list 925cdf0e10cSrcweir $self->{_CACHED_TAGS} = undef; 926cdf0e10cSrcweir eval { $result = $eis->setMilestone($id, $item) }; 927cdf0e10cSrcweir } 928cdf0e10cSrcweir elsif ( $type eq 'master' ) { 929cdf0e10cSrcweir # this operation invalidates the cached tags list 930cdf0e10cSrcweir $self->{_CACHED_TAGS} = undef; 931cdf0e10cSrcweir eval { $result = $eis->setMasterWorkspace($id, $item) }; 932cdf0e10cSrcweir } 933cdf0e10cSrcweir else { 934cdf0e10cSrcweir # fall through, can't happen 935cdf0e10cSrcweir carp("ERROR: wrong item type\n"); 936cdf0e10cSrcweir return 0; 937cdf0e10cSrcweir } 938cdf0e10cSrcweir 939cdf0e10cSrcweir if ( $@ ) { 940cdf0e10cSrcweir carp("ERROR: set_item(): EIS database transaction failed. Reason:\n$@\n"); 941cdf0e10cSrcweir return undef; 942cdf0e10cSrcweir } 943cdf0e10cSrcweir return 1 if $result; 944cdf0e10cSrcweir return 0; 945cdf0e10cSrcweir} 946cdf0e10cSrcweir 947cdf0e10cSrcweirsub set_master_and_milestone_in_eis 948cdf0e10cSrcweir{ 949cdf0e10cSrcweir my $self = shift; 950cdf0e10cSrcweir my $master = shift; 951cdf0e10cSrcweir my $milestone = shift; 952cdf0e10cSrcweir 953cdf0e10cSrcweir my $eis = Cws::eis(); 954cdf0e10cSrcweir my $id = $self->eis_id(); 955cdf0e10cSrcweir 956cdf0e10cSrcweir if ( !$id ) { 957cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 958cdf0e10cSrcweir return undef; 959cdf0e10cSrcweir } 960cdf0e10cSrcweir 961cdf0e10cSrcweir # make certain that the item is a string, otherwise 962cdf0e10cSrcweir # autotyping will occasionally choose the wrong type 963cdf0e10cSrcweir $master = Eis::to_string($master); 964cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 965cdf0e10cSrcweir 966cdf0e10cSrcweir my $result; 967cdf0e10cSrcweir # this operation invalidates the cached tags list 968cdf0e10cSrcweir $self->{_CACHED_TAGS} = undef; 969cdf0e10cSrcweir eval { $result = $eis->setMasterWorkspaceAndMilestone($id, $master, $milestone) }; 970cdf0e10cSrcweir 971cdf0e10cSrcweir if ( $@ ) { 972cdf0e10cSrcweir carp("ERROR: set_master_and_milestone(): EIS database transaction failed. Reason:\n$@\n"); 973cdf0e10cSrcweir return undef; 974cdf0e10cSrcweir } 975cdf0e10cSrcweir return 1 if $result; 976cdf0e10cSrcweir return 0; 977cdf0e10cSrcweir} 978cdf0e10cSrcweir 979cdf0e10cSrcweirsub fetch_items_from_eis 980cdf0e10cSrcweir{ 981cdf0e10cSrcweir my $self = shift; 982cdf0e10cSrcweir my $type = shift; 983cdf0e10cSrcweir 984cdf0e10cSrcweir my $eis = Cws::eis(); 985cdf0e10cSrcweir my $id = $self->eis_id(); 986cdf0e10cSrcweir 987cdf0e10cSrcweir if ( !$id ) { 988cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 989cdf0e10cSrcweir return undef; 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir my $result; 993cdf0e10cSrcweir if ( $type eq 'modules' ) { 994cdf0e10cSrcweir eval { $result = $eis->getModules($id) }; 995cdf0e10cSrcweir } 996cdf0e10cSrcweir elsif ( $type eq 'incompatible_modules' ) { 997cdf0e10cSrcweir eval { $result = $eis->getIncompatibleModules($id) }; 998cdf0e10cSrcweir } 999cdf0e10cSrcweir elsif ( $type eq 'new_modules' ) { 1000cdf0e10cSrcweir eval { $result = $eis->getNewModules($id) }; 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir elsif ( $type eq 'new_modules_priv' ) { 1003cdf0e10cSrcweir eval { $result = $eis->getNewModulesPriv($id) }; 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir elsif ( $type eq 'taskids' ) { 1006cdf0e10cSrcweir eval { $result = $eis->getTaskIds($id) }; 1007cdf0e10cSrcweir } 1008cdf0e10cSrcweir elsif ( $type eq 'files' ) { 1009cdf0e10cSrcweir eval { $result = $eis->getFiles($id) }; 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir elsif ( $type eq 'patch_files' ) { 1012cdf0e10cSrcweir eval { $result = $eis->getOutputFiles($id) }; 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir else { 1015cdf0e10cSrcweir # fall through, can't happen 1016cdf0e10cSrcweir carp("ERROR: wrong item type\n"); 1017cdf0e10cSrcweir return undef; 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir if ( $@ ) { 1020cdf0e10cSrcweir carp("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n"); 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir return $result; 1023cdf0e10cSrcweir} 1024cdf0e10cSrcweir 1025cdf0e10cSrcweirsub add_items_to_eis 1026cdf0e10cSrcweir{ 1027cdf0e10cSrcweir my $self = shift; 1028cdf0e10cSrcweir my $type = shift; 1029cdf0e10cSrcweir my $optional_data = shift; 1030cdf0e10cSrcweir my $item_ref = shift; 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir my $eis = Cws::eis(); 1033cdf0e10cSrcweir my $id = $self->eis_id(); 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir if ( !$id ) { 1036cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1037cdf0e10cSrcweir return undef; 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir # make certain that all items are strings, otherwise 1041cdf0e10cSrcweir # autotyping will occasionally choose the wrong type 1042cdf0e10cSrcweir my @items = (); 1043cdf0e10cSrcweir foreach ( @{$item_ref} ) { 1044cdf0e10cSrcweir push(@items, Eis::to_string($_)); 1045cdf0e10cSrcweir } 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir my $result; 1048cdf0e10cSrcweir if ( $type eq 'modules' ) { 1049cdf0e10cSrcweir if ( defined($optional_data) ) { 1050cdf0e10cSrcweir # add a module new style, with public attribute 1051cdf0e10cSrcweir eval { $result = $eis->addModule($id, $items[0], $optional_data) }; 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir else { 1054cdf0e10cSrcweir # old style, add a list of modules 1055cdf0e10cSrcweir eval { $result = $eis->addModules($id, \@items) }; 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir elsif ( $type eq 'taskids' ) { 1059cdf0e10cSrcweir eval { $result = $eis->addTaskIds($id, \@items, $optional_data) }; 1060cdf0e10cSrcweir } 1061cdf0e10cSrcweir else { 1062cdf0e10cSrcweir # fall through, can't happen 1063cdf0e10cSrcweir carp("ERROR: wrong item type\n"); 1064cdf0e10cSrcweir return 0; 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir 1067cdf0e10cSrcweir if ( $@ ) { 1068cdf0e10cSrcweir carp("ERROR: add_item(): EIS database transaction failed. Reason:\n$@\n"); 1069cdf0e10cSrcweir return undef; 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir return 1 if $result; 1072cdf0e10cSrcweir return 0; 1073cdf0e10cSrcweir} 1074cdf0e10cSrcweir 1075cdf0e10cSrcweirsub add_file_to_eis 1076cdf0e10cSrcweir{ 1077cdf0e10cSrcweir my $self = shift; 1078cdf0e10cSrcweir my $module = shift; 1079cdf0e10cSrcweir my $file = shift; 1080cdf0e10cSrcweir my $revision = shift; 1081cdf0e10cSrcweir my $authors_ref = shift; 1082cdf0e10cSrcweir my $taskids_ref = shift; 1083cdf0e10cSrcweir my $archive_path = shift; 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir my $eis = Cws::eis(); 1087cdf0e10cSrcweir my $id = $self->eis_id(); 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir if ( !$id ) { 1090cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1091cdf0e10cSrcweir return undef; 1092cdf0e10cSrcweir } 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir # make certain that all task_ids are strings, otherwise 1095cdf0e10cSrcweir # autotyping will choose the wrong type 1096cdf0e10cSrcweir # Note: I think typing just the first element should suffice, but ... 1097cdf0e10cSrcweir my @taskids = (); 1098cdf0e10cSrcweir foreach ( @{$taskids_ref} ) { 1099cdf0e10cSrcweir push(@taskids, Eis::to_string($_)); 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir # HACK Its possible that we get no valid taskid. 1102cdf0e10cSrcweir # Autotyping will fail for a list without elements; 1103cdf0e10cSrcweir if ( !@taskids ) { 1104cdf0e10cSrcweir push(@taskids, Eis::to_string('')); 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir # same for revision 1108cdf0e10cSrcweir $revision = Eis::to_string($revision); 1109cdf0e10cSrcweir 1110cdf0e10cSrcweir if ( !$archive_path ) { 1111cdf0e10cSrcweir $archive_path = Eis::to_string(''); 1112cdf0e10cSrcweir } 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir my $result; 1115cdf0e10cSrcweir eval { 1116cdf0e10cSrcweir $result = $eis->addFile($id, $module, $file, $archive_path, 1117cdf0e10cSrcweir $revision, $authors_ref, \@taskids) 1118cdf0e10cSrcweir }; 1119cdf0e10cSrcweir if ( $@ ) { 1120cdf0e10cSrcweir carp("ERROR: add_file(): EIS database transaction failed. Reason:\n$@\n"); 1121cdf0e10cSrcweir return undef; 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir return 1 if $result; 1124cdf0e10cSrcweir return 0; 1125cdf0e10cSrcweir} 1126cdf0e10cSrcweir 1127cdf0e10cSrcweirsub add_patch_file_to_eis 1128cdf0e10cSrcweir{ 1129cdf0e10cSrcweir my $self = shift; 1130cdf0e10cSrcweir my $file = shift; 1131cdf0e10cSrcweir 1132cdf0e10cSrcweir my $eis = Cws::eis(); 1133cdf0e10cSrcweir my $id = $self->eis_id(); 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir if ( !$id ) { 1136cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1137cdf0e10cSrcweir return undef; 1138cdf0e10cSrcweir } 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir my $result; 1141cdf0e10cSrcweir eval { $result = $eis->addOutputFile($id, $file) }; 1142cdf0e10cSrcweir if ( $@ ) { 1143cdf0e10cSrcweir carp("ERROR: add_patch_file(): EIS database transaction failed. Reason:\n$@\n"); 1144cdf0e10cSrcweir return undef; 1145cdf0e10cSrcweir } 1146cdf0e10cSrcweir return $1;# appOutputFile has void as return value ... 1147cdf0e10cSrcweir} 1148cdf0e10cSrcweir 1149cdf0e10cSrcweirsub is_cws_name_available_in_eis 1150cdf0e10cSrcweir{ 1151cdf0e10cSrcweir my $self = shift; 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir if ( !$self->master() ) { 1154cdf0e10cSrcweir carp("ERROR: master workspace name not set\n"); 1155cdf0e10cSrcweir return undef; 1156cdf0e10cSrcweir } 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir if ( !$self->child() ) { 1159cdf0e10cSrcweir carp("ERROR: child workspace name not set\n"); 1160cdf0e10cSrcweir return undef; 1161cdf0e10cSrcweir } 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir my $eis = Cws::eis(); 1164cdf0e10cSrcweir my $master = Eis::to_string($self->master()); 1165cdf0e10cSrcweir my $child = Eis::to_string($self->child()); 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir my $result; 1168cdf0e10cSrcweir eval { $result = $eis->isChildWorkspaceUnique($master, $child) }; 1169cdf0e10cSrcweir if ( $@ ) { 1170cdf0e10cSrcweir carp("ERROR: is_cws_name_available(): EIS database transaction failed. Reason:\n$@\n"); 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir return $result; 1173cdf0e10cSrcweir} 1174cdf0e10cSrcweir 1175cdf0e10cSrcweirsub register_child_with_eis 1176cdf0e10cSrcweir{ 1177cdf0e10cSrcweir my $self = shift; 1178cdf0e10cSrcweir my $vcsid = shift; 1179cdf0e10cSrcweir my $location = shift; 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir if ( !$self->master() ) { 1182cdf0e10cSrcweir carp("ERROR: master workspace name not set\n"); 1183cdf0e10cSrcweir return undef; 1184cdf0e10cSrcweir } 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir if ( !$self->milestone() ) { 1187cdf0e10cSrcweir carp("ERROR: master milestone not set\n"); 1188cdf0e10cSrcweir return undef; 1189cdf0e10cSrcweir } 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir if ( !$self->child() ) { 1192cdf0e10cSrcweir carp("ERROR: child workspace name not set\n"); 1193cdf0e10cSrcweir return undef; 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir $vcsid = '' unless $vcsid; 1197cdf0e10cSrcweir $location = '' unless $location; 1198cdf0e10cSrcweir 1199cdf0e10cSrcweir my $eis = Cws::eis(); 1200cdf0e10cSrcweir my $master = Eis::to_string($self->master()); 1201cdf0e10cSrcweir my $milestone = Eis::to_string($self->milestone()); 1202cdf0e10cSrcweir my $child = Eis::to_string($self->child()); 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir $vcsid = Eis::to_string($vcsid); 1205cdf0e10cSrcweir $location = Eis::to_string($location); 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir my $result; 1208cdf0e10cSrcweir eval { 1209cdf0e10cSrcweir $result = $eis->createChildWorkspace($master, $milestone, $child, 1210cdf0e10cSrcweir $vcsid, $location) 1211cdf0e10cSrcweir }; 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir if ( $@ ) { 1214cdf0e10cSrcweir carp("ERROR: create_child_workspace(): EIS database transaction failed. Reason:\n$@\n"); 1215cdf0e10cSrcweir return undef; 1216cdf0e10cSrcweir } 1217cdf0e10cSrcweir # set EIS_ID directly, since $self->eis_id() is not 1218cdf0e10cSrcweir # supposed to take parameters. 1219cdf0e10cSrcweir $self->{EIS_ID} = $result; 1220cdf0e10cSrcweir return $result; 1221cdf0e10cSrcweir} 1222cdf0e10cSrcweir 1223cdf0e10cSrcweirsub promote_child_in_eis 1224cdf0e10cSrcweir{ 1225cdf0e10cSrcweir my $self = shift; 1226cdf0e10cSrcweir my $vcsid = shift; 1227cdf0e10cSrcweir my $location = shift; 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir my $eis = Cws::eis(); 1230cdf0e10cSrcweir my $id = $self->eis_id(); 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir if ( !$id ) { 1233cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1234cdf0e10cSrcweir return undef; 1235cdf0e10cSrcweir } 1236cdf0e10cSrcweir 1237cdf0e10cSrcweir if ( !$self->milestone() ) { 1238cdf0e10cSrcweir carp("ERROR: master milestone not set\n"); 1239cdf0e10cSrcweir return undef; 1240cdf0e10cSrcweir } 1241cdf0e10cSrcweir 1242cdf0e10cSrcweir my $milestone = Eis::to_string($self->milestone()); 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir $vcsid = '' unless $vcsid; 1245cdf0e10cSrcweir $location = '' unless $location; 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir $vcsid = Eis::to_string($vcsid); 1248cdf0e10cSrcweir $location = Eis::to_string($location); 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir my $result; 1251cdf0e10cSrcweir eval { 1252cdf0e10cSrcweir $result = $eis->initializeChildWorkspace($id, $milestone, $vcsid, $location) 1253cdf0e10cSrcweir }; 1254cdf0e10cSrcweir 1255cdf0e10cSrcweir eval { $result = $eis->getStatus($id) }; 1256cdf0e10cSrcweir if ( $@ ) { 1257cdf0e10cSrcweir carp("ERROR: promote(): EIS database transaction failed. Reason:\n$@\n"); 1258cdf0e10cSrcweir return 0; 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir return 1; 1261cdf0e10cSrcweir} 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir# Get child workspace owner from EIS, 1264cdf0e10cSrcweir# return undef in case of error. 1265cdf0e10cSrcweirsub get_owner_from_eis 1266cdf0e10cSrcweir{ 1267cdf0e10cSrcweir my $self = shift; 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir # check if child workspace is valid 1270cdf0e10cSrcweir my $id = $self->eis_id(); 1271cdf0e10cSrcweir if ( !$id ) { 1272cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1273cdf0e10cSrcweir return undef; 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir my $eis = Cws::eis(); 1277cdf0e10cSrcweir my $result; 1278cdf0e10cSrcweir eval { $result = $eis->getOwnerEmail($id) }; 1279cdf0e10cSrcweir if ( $@ ) { 1280cdf0e10cSrcweir carp("ERROR: get_OwnerEmail(): EIS database transaction failed. Reason:\n$@\n"); 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir return $result; 1283cdf0e10cSrcweir} 1284cdf0e10cSrcweir 1285cdf0e10cSrcweir# Get child workspace qarep from EIS, 1286cdf0e10cSrcweir# return undef in case of error. 1287cdf0e10cSrcweirsub get_qarep_from_eis 1288cdf0e10cSrcweir{ 1289cdf0e10cSrcweir my $self = shift; 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir # check if child workspace is valid 1292cdf0e10cSrcweir my $id = $self->eis_id(); 1293cdf0e10cSrcweir if ( !$id ) { 1294cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1295cdf0e10cSrcweir return undef; 1296cdf0e10cSrcweir } 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir my $eis = Cws::eis(); 1299cdf0e10cSrcweir my $result; 1300cdf0e10cSrcweir eval { $result = $eis->getQARepresentativeEmail($id) }; 1301cdf0e10cSrcweir if ( $@ ) { 1302cdf0e10cSrcweir carp("ERROR: get_qarep(): EIS database transaction failed. Reason:\n$@\n"); 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir return $result; 1305cdf0e10cSrcweir} 1306cdf0e10cSrcweir 1307cdf0e10cSrcweir# store an attachment to a given CWS 1308cdf0e10cSrcweir# return undef in case of error. 1309cdf0e10cSrcweirsub save_attachment_in_eis 1310cdf0e10cSrcweir{ 1311cdf0e10cSrcweir my $self = shift; 1312cdf0e10cSrcweir my $name = shift; 1313cdf0e10cSrcweir my $mediatype = shift; 1314cdf0e10cSrcweir my $text = shift; 1315cdf0e10cSrcweir 1316cdf0e10cSrcweir # check if child workspace is valid 1317cdf0e10cSrcweir my $eisid = $self->eis_id(); 1318cdf0e10cSrcweir if ( !$eisid ) 1319cdf0e10cSrcweir { 1320cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1321cdf0e10cSrcweir return undef; 1322cdf0e10cSrcweir } 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir my $eisname = Eis::to_string($name); 1325cdf0e10cSrcweir my $eismediatype = Eis::to_string($mediatype); 1326cdf0e10cSrcweir my $eistextstring = Eis::to_string($text); 1327cdf0e10cSrcweir 1328cdf0e10cSrcweir my $eis = Cws::eis(); 1329cdf0e10cSrcweir my $result; 1330cdf0e10cSrcweir 1331cdf0e10cSrcweir eval { $result = $eis->saveAttachment($eisid, $eisname, $eismediatype, $eistextstring ) }; 1332cdf0e10cSrcweir if ( $@ ) { 1333cdf0e10cSrcweir carp("ERROR: save_attachment_in_eis(): EIS database transaction failed. Reason:\n$@\n"); 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir return $result; 1336cdf0e10cSrcweir} 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir# Get child workspace approval status from EIS, 1339cdf0e10cSrcweir# return undef in case of error. 1340cdf0e10cSrcweirsub get_status_from_eis 1341cdf0e10cSrcweir{ 1342cdf0e10cSrcweir my $self = shift; 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir # check if child workspace is valid 1345cdf0e10cSrcweir my $id = $self->eis_id(); 1346cdf0e10cSrcweir if ( !$id ) { 1347cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1348cdf0e10cSrcweir return undef; 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir my $eis = Cws::eis(); 1352cdf0e10cSrcweir my $result; 1353cdf0e10cSrcweir eval { $result = $eis->getStatus($id) }; 1354cdf0e10cSrcweir if ( $@ ) { 1355cdf0e10cSrcweir carp("ERROR: get_status(): EIS database transaction failed. Reason:\n$@\n"); 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir return $result; 1358cdf0e10cSrcweir} 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir# Get child workspace approval status from EIS, 1361cdf0e10cSrcweir# return undef in case of error. 1362cdf0e10cSrcweirsub set_status_in_eis 1363cdf0e10cSrcweir{ 1364cdf0e10cSrcweir my $self = shift; 1365cdf0e10cSrcweir my $status = shift; 1366cdf0e10cSrcweir my $method = 'set'; 1367cdf0e10cSrcweir $method .= (defined $status) ? $status : 'Integrated'; 1368cdf0e10cSrcweir 1369cdf0e10cSrcweir # check if child workspace is valid 1370cdf0e10cSrcweir my $id = $self->eis_id(); 1371cdf0e10cSrcweir if ( !$id ) { 1372cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1373cdf0e10cSrcweir return undef; 1374cdf0e10cSrcweir } 1375cdf0e10cSrcweir my $eis = Cws::eis(); 1376cdf0e10cSrcweir my $result; 1377cdf0e10cSrcweir if (defined $status) { 1378cdf0e10cSrcweir eval { $result = $eis->setFixedOnMaster($id) }; 1379cdf0e10cSrcweir } else { 1380cdf0e10cSrcweir eval { $result = $eis->setIntegrated($id) }; 1381cdf0e10cSrcweir } 1382cdf0e10cSrcweir if ( $@ ) { 1383cdf0e10cSrcweir carp("ERROR: $method(): EIS database transaction failed. Reason:\n$@\n"); 1384cdf0e10cSrcweir } 1385cdf0e10cSrcweir return $result; 1386cdf0e10cSrcweir} 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir# Get child workspace approval status from EIS, 1389cdf0e10cSrcweir# return undef in case of error. 1390cdf0e10cSrcweirsub set_integration_milestone_in_eis 1391cdf0e10cSrcweir{ 1392cdf0e10cSrcweir my $self = shift; 1393cdf0e10cSrcweir my $milestone = shift; 1394cdf0e10cSrcweir my $buildid = shift; 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir # check if child workspace is valid 1397cdf0e10cSrcweir my $id = $self->eis_id(); 1398cdf0e10cSrcweir if ( !$id ) { 1399cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1400cdf0e10cSrcweir return undef; 1401cdf0e10cSrcweir } 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir my $eis = Cws::eis(); 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir # just in case ... 1406cdf0e10cSrcweir if ( !defined($milestone) ) { 1407cdf0e10cSrcweir $milestone = Eis::to_string(''); 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir # $buildid must be transfered as string 1410cdf0e10cSrcweir if ( !defined($buildid) ) { 1411cdf0e10cSrcweir $buildid = Eis::to_string(''); 1412cdf0e10cSrcweir } 1413cdf0e10cSrcweir else { 1414cdf0e10cSrcweir $buildid = Eis::to_string($buildid); 1415cdf0e10cSrcweir } 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir my $result; 1418cdf0e10cSrcweir eval { $result = $eis->setIntegrationMilestone($id, $milestone, $buildid) }; 1419cdf0e10cSrcweir if ( $@ ) { 1420cdf0e10cSrcweir carp("ERROR: set_integration_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir return $result; 1423cdf0e10cSrcweir} 1424cdf0e10cSrcweir 1425cdf0e10cSrcweirsub set_milestone_buildid_in_eis 1426cdf0e10cSrcweir{ 1427cdf0e10cSrcweir my $self = shift; 1428cdf0e10cSrcweir my $master = shift; 1429cdf0e10cSrcweir my $milestone = shift; 1430cdf0e10cSrcweir my $buildid = shift; 1431cdf0e10cSrcweir 1432cdf0e10cSrcweir $master = Eis::to_string($master); 1433cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1434cdf0e10cSrcweir $buildid = Eis::to_string($buildid); 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir my $eis = Cws::eis(); 1437cdf0e10cSrcweir my $result; 1438cdf0e10cSrcweir eval { $result = $eis->setMilestoneBuild( $master, $milestone, $buildid ) }; 1439cdf0e10cSrcweir if ( $@ ) { 1440cdf0e10cSrcweir carp("ERROR: set_milestone_buildid(): EIS database transaction failed. Reason:\n$@\n"); 1441cdf0e10cSrcweir } 1442cdf0e10cSrcweir return $result; 1443cdf0e10cSrcweir} 1444cdf0e10cSrcweir 1445cdf0e10cSrcweirsub set_current_milestone_in_eis 1446cdf0e10cSrcweir{ 1447cdf0e10cSrcweir my $self = shift; 1448cdf0e10cSrcweir my $master = shift; 1449cdf0e10cSrcweir my $milestone = shift; 1450cdf0e10cSrcweir 1451cdf0e10cSrcweir $master = Eis::to_string($master); 1452cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1453cdf0e10cSrcweir 1454cdf0e10cSrcweir my $eis = Cws::eis(); 1455cdf0e10cSrcweir my $result; 1456cdf0e10cSrcweir eval { $result = $eis->setCurrentMilestone( $master, $milestone ) }; 1457cdf0e10cSrcweir if ( $@ ) { 1458cdf0e10cSrcweir carp("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1459cdf0e10cSrcweir } 1460cdf0e10cSrcweir return $result; 1461cdf0e10cSrcweir} 1462cdf0e10cSrcweir 1463cdf0e10cSrcweirsub get_current_milestone_from_eis 1464cdf0e10cSrcweir{ 1465cdf0e10cSrcweir my $self = shift; 1466cdf0e10cSrcweir my $master = shift; 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir $master = Eis::to_string($master); 1469cdf0e10cSrcweir 1470cdf0e10cSrcweir my $eis = Cws::eis(); 1471cdf0e10cSrcweir my $result; 1472cdf0e10cSrcweir eval { $result = $eis->getCurrentMilestone( $master ) }; 1473cdf0e10cSrcweir if ( $@ ) { 1474cdf0e10cSrcweir carp("ERROR: get_current_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1475cdf0e10cSrcweir } 1476cdf0e10cSrcweir return $result; 1477cdf0e10cSrcweir} 1478cdf0e10cSrcweir 1479cdf0e10cSrcweirsub get_masters_from_eis 1480cdf0e10cSrcweir{ 1481cdf0e10cSrcweir my $self = shift; 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir my $eis = Cws::eis(); 1484cdf0e10cSrcweir my @result; 1485cdf0e10cSrcweir eval { @result = $eis->getMasterWorkspaces() }; 1486cdf0e10cSrcweir if ( $@ ) { 1487cdf0e10cSrcweir carp("ERROR: get_masters(): EIS database transaction failed. Reason:\n$@\n"); 1488cdf0e10cSrcweir } 1489cdf0e10cSrcweir 1490cdf0e10cSrcweir my @result2=(); 1491cdf0e10cSrcweir my $i=0; 1492cdf0e10cSrcweir while ( defined($result[0][$i]) ) { 1493cdf0e10cSrcweir push @result2,$result[0][$i]; 1494cdf0e10cSrcweir $i++; 1495cdf0e10cSrcweir } 1496cdf0e10cSrcweir return @result2; 1497cdf0e10cSrcweir} 1498cdf0e10cSrcweir 1499cdf0e10cSrcweir 1500cdf0e10cSrcweirsub get_milestones_from_eis 1501cdf0e10cSrcweir{ 1502cdf0e10cSrcweir my $self = shift; 1503cdf0e10cSrcweir my $master = shift; 1504cdf0e10cSrcweir 1505cdf0e10cSrcweir $master = Eis::to_string($master); 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir my $eis = Cws::eis(); 1508cdf0e10cSrcweir my @result; 1509cdf0e10cSrcweir eval { @result = $eis->getMilestones( $master ) }; 1510cdf0e10cSrcweir if ( $@ ) { 1511cdf0e10cSrcweir carp("ERROR: get_milestones(): EIS database transaction failed. Reason:\n$@\n"); 1512cdf0e10cSrcweir } 1513cdf0e10cSrcweir my @result2=(); 1514cdf0e10cSrcweir my $i=0; 1515cdf0e10cSrcweir while ( defined($result[0][$i]) ) { 1516cdf0e10cSrcweir push @result2,$result[0][$i]; 1517cdf0e10cSrcweir $i++; 1518cdf0e10cSrcweir } 1519cdf0e10cSrcweir return @result2; 1520cdf0e10cSrcweir} 1521cdf0e10cSrcweir 1522cdf0e10cSrcweir# Get child workspace owner from EIS, 1523cdf0e10cSrcweir# return undef in case of error. 1524cdf0e10cSrcweirsub expand_buildid_in_eis 1525cdf0e10cSrcweir{ 1526cdf0e10cSrcweir my $self = shift; 1527cdf0e10cSrcweir my $bid = shift; 1528cdf0e10cSrcweir 1529cdf0e10cSrcweir # check if child workspace is valid 1530cdf0e10cSrcweir my $id = $self->eis_id(); 1531cdf0e10cSrcweir if ( !$id ) { 1532cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1533cdf0e10cSrcweir return undef; 1534cdf0e10cSrcweir } 1535cdf0e10cSrcweir 1536cdf0e10cSrcweir my $name = $self->child(); 1537cdf0e10cSrcweir 1538cdf0e10cSrcweir my $eis = Cws::eis(); 1539cdf0e10cSrcweir my $result; 1540cdf0e10cSrcweir eval { $result = $eis->expandBuildId($bid, $name) }; 1541cdf0e10cSrcweir if ( $@ ) { 1542cdf0e10cSrcweir carp("ERROR: expand_builid(): EIS database transaction failed. Reason:\n$@\n"); 1543cdf0e10cSrcweir } 1544cdf0e10cSrcweir return $result; 1545cdf0e10cSrcweir} 1546cdf0e10cSrcweir 1547cdf0e10cSrcweirsub set_milestone_removed_in_eis 1548cdf0e10cSrcweir{ 1549cdf0e10cSrcweir my $self = shift; 1550cdf0e10cSrcweir my $master = shift; 1551cdf0e10cSrcweir my $milestone = shift; 1552cdf0e10cSrcweir 1553cdf0e10cSrcweir $master = Eis::to_string($master); 1554cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1555cdf0e10cSrcweir 1556cdf0e10cSrcweir my $eis = Cws::eis(); 1557cdf0e10cSrcweir eval { $eis->minorRemoved( $master, $milestone ) }; 1558cdf0e10cSrcweir if ( $@ ) { 1559cdf0e10cSrcweir carp("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1560cdf0e10cSrcweir } 1561cdf0e10cSrcweir return; 1562cdf0e10cSrcweir} 1563cdf0e10cSrcweir 1564cdf0e10cSrcweirsub is_milestone_registered_with_eis 1565cdf0e10cSrcweir{ 1566cdf0e10cSrcweir my $self = shift; 1567cdf0e10cSrcweir my $master = shift; 1568cdf0e10cSrcweir my $milestone = shift; 1569cdf0e10cSrcweir 1570cdf0e10cSrcweir $master = Eis::to_string($master); 1571cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1572cdf0e10cSrcweir 1573cdf0e10cSrcweir my $eis = Cws::eis(); 1574cdf0e10cSrcweir my $result; 1575cdf0e10cSrcweir eval { $result = $eis->isMilestoneValid($master, $milestone) }; 1576cdf0e10cSrcweir if ( $@ ) { 1577cdf0e10cSrcweir carp("ERROR: is_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1578cdf0e10cSrcweir } 1579cdf0e10cSrcweir return $result; 1580cdf0e10cSrcweir} 1581cdf0e10cSrcweir 1582cdf0e10cSrcweirsub get_is_milestone_used_from_eis 1583cdf0e10cSrcweir{ 1584cdf0e10cSrcweir my $self = shift; 1585cdf0e10cSrcweir my $master = shift; 1586cdf0e10cSrcweir my $milestone = shift; 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir $master = Eis::to_string($master); 1589cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir my $eis = Cws::eis(); 1592cdf0e10cSrcweir my $result; 1593cdf0e10cSrcweir eval { $result = $eis->isMilestoneInUse($master, $milestone) }; 1594cdf0e10cSrcweir if ( $@ ) { 1595cdf0e10cSrcweir carp("ERROR: is_milestone_used(): EIS database transaction failed. Reason:\n$@\n"); 1596cdf0e10cSrcweir } 1597cdf0e10cSrcweir return $result; 1598cdf0e10cSrcweir} 1599cdf0e10cSrcweir 1600cdf0e10cSrcweirsub get_buildid_for_milestone 1601cdf0e10cSrcweir{ 1602cdf0e10cSrcweir my $self = shift; 1603cdf0e10cSrcweir my $master = shift; 1604cdf0e10cSrcweir my $milestone = shift; 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir $master = Eis::to_string($master); 1607cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir my $eis = Cws::eis(); 1610cdf0e10cSrcweir my $result; 1611cdf0e10cSrcweir eval { $result = $eis->getMilestoneBuild($master, $milestone) }; 1612cdf0e10cSrcweir if ( $@ ) { 1613cdf0e10cSrcweir carp("ERROR: get_buildid_for_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1614cdf0e10cSrcweir } 1615cdf0e10cSrcweir return $result; 1616cdf0e10cSrcweir} 1617cdf0e10cSrcweir 1618cdf0e10cSrcweirsub get_childworkspaces_for_milestone 1619cdf0e10cSrcweir{ 1620cdf0e10cSrcweir my $self = shift; 1621cdf0e10cSrcweir my $master = shift; 1622cdf0e10cSrcweir my $milestone = shift; 1623cdf0e10cSrcweir 1624cdf0e10cSrcweir $master = Eis::to_string($master); 1625cdf0e10cSrcweir $milestone = Eis::to_string($milestone); 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir my $eis = Cws::eis(); 1628cdf0e10cSrcweir my $result; 1629cdf0e10cSrcweir eval { $result = $eis->searchChildWorkspacesForMilestone($master, $milestone) }; 1630cdf0e10cSrcweir if ( $@ ) { 1631cdf0e10cSrcweir carp("ERROR: get_childworkspaces_for_milestone(): EIS database transaction failed. Reason:\n$@\n"); 1632cdf0e10cSrcweir } 1633cdf0e10cSrcweir return $result; 1634cdf0e10cSrcweir} 1635cdf0e10cSrcweir 1636cdf0e10cSrcweirsub get_cws_with_state_from_eis { 1637cdf0e10cSrcweir my $self = shift; 1638cdf0e10cSrcweir my $mws = shift; 1639cdf0e10cSrcweir my $status = shift; 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir my $eis = Cws::eis(); 1642cdf0e10cSrcweir my $result; 1643cdf0e10cSrcweir eval { $result = $eis->getCWSWithState($mws, $status) }; 1644cdf0e10cSrcweir if ( $@ ) { 1645cdf0e10cSrcweir carp("ERROR: get_cws_with_state_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1646cdf0e10cSrcweir } 1647cdf0e10cSrcweir return $result; 1648cdf0e10cSrcweir} 1649cdf0e10cSrcweir 1650cdf0e10cSrcweirsub get_task_prios_of_tasks 1651cdf0e10cSrcweir{ 1652cdf0e10cSrcweir my $self = shift; 1653cdf0e10cSrcweir my $ref_taskids = shift; 1654cdf0e10cSrcweir 1655cdf0e10cSrcweir my $eis = Cws::eis(); 1656cdf0e10cSrcweir my $result; 1657cdf0e10cSrcweir my @items = (); 1658cdf0e10cSrcweir foreach ( @{$ref_taskids} ) { 1659cdf0e10cSrcweir push(@items, Eis::to_string($_)); 1660cdf0e10cSrcweir } 1661cdf0e10cSrcweir 1662cdf0e10cSrcweir eval { $result = $eis->getTasksPriorities( \@items ) }; 1663cdf0e10cSrcweir if ( $@ ) { 1664cdf0e10cSrcweir carp("ERROR: get_task_prios_of_tasks(): EIS database transaction failed. Reason:\n$@\n"); 1665cdf0e10cSrcweir } 1666cdf0e10cSrcweir return $result; 1667cdf0e10cSrcweir} 1668cdf0e10cSrcweir 1669cdf0e10cSrcweirsub get_creation_master_from_eis 1670cdf0e10cSrcweir{ 1671cdf0e10cSrcweir my $self = shift; 1672cdf0e10cSrcweir 1673cdf0e10cSrcweir # check if child workspace is valid 1674cdf0e10cSrcweir my $id = $self->eis_id(); 1675cdf0e10cSrcweir if ( !$id ) { 1676cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1677cdf0e10cSrcweir return undef; 1678cdf0e10cSrcweir } 1679cdf0e10cSrcweir 1680cdf0e10cSrcweir my $eis = Cws::eis(); 1681cdf0e10cSrcweir my $result; 1682cdf0e10cSrcweir eval { $result = $eis->getCreationMasterWorkspace($id) }; 1683cdf0e10cSrcweir if ( $@ ) { 1684cdf0e10cSrcweir carp("ERROR: get_creation_master(): EIS database transaction failed. Reason:\n$@\n"); 1685cdf0e10cSrcweir } 1686cdf0e10cSrcweir return $result; 1687cdf0e10cSrcweir 1688cdf0e10cSrcweir} 1689cdf0e10cSrcweir 1690cdf0e10cSrcweirsub get_milestone_integrated_from_eis 1691cdf0e10cSrcweir{ 1692cdf0e10cSrcweir my $self = shift; 1693cdf0e10cSrcweir 1694cdf0e10cSrcweir # check if child workspace is valid 1695cdf0e10cSrcweir my $id = $self->eis_id(); 1696cdf0e10cSrcweir if ( !$id ) { 1697cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1698cdf0e10cSrcweir return undef; 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir 1701cdf0e10cSrcweir my $eis = Cws::eis(); 1702cdf0e10cSrcweir my $result; 1703cdf0e10cSrcweir eval { $result = $eis->getMilestoneIntegrated($id) }; 1704cdf0e10cSrcweir if ( $@ ) { 1705cdf0e10cSrcweir carp("ERROR: get_milestone_integrated(): EIS database transaction failed. Reason:\n$@\n"); 1706cdf0e10cSrcweir } 1707cdf0e10cSrcweir return $result; 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir} 1710cdf0e10cSrcweir 1711cdf0e10cSrcweir# get isPublic flag from eis 1712cdf0e10cSrcweirsub get_public_flag_from_eis 1713cdf0e10cSrcweir{ 1714cdf0e10cSrcweir my $self = shift; 1715cdf0e10cSrcweir 1716cdf0e10cSrcweir # check if child workspace is valid 1717cdf0e10cSrcweir my $id = $self->eis_id(); 1718cdf0e10cSrcweir if ( !$id ) { 1719cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1720cdf0e10cSrcweir return undef; 1721cdf0e10cSrcweir } 1722cdf0e10cSrcweir 1723cdf0e10cSrcweir my $eis = Cws::eis(); 1724cdf0e10cSrcweir my $result; 1725cdf0e10cSrcweir eval { $result = $eis->isPublic($id) }; 1726cdf0e10cSrcweir if ( $@ ) { 1727cdf0e10cSrcweir carp("ERROR: get_public_flag(): EIS database transaction failed. Reason:\n$@\n"); 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir return $result; 1730cdf0e10cSrcweir} 1731cdf0e10cSrcweir 1732cdf0e10cSrcweir# get isPublicMaster flag from eis 1733cdf0e10cSrcweirsub get_publicmaster_flag_from_eis 1734cdf0e10cSrcweir{ 1735cdf0e10cSrcweir my $self = shift; 1736cdf0e10cSrcweir 1737cdf0e10cSrcweir # check if child workspace is valid 1738cdf0e10cSrcweir my $master = $self->master(); 1739cdf0e10cSrcweir if ( !$master ) { 1740cdf0e10cSrcweir carp("ERROR: MasterWorkspace not defined.\n"); 1741cdf0e10cSrcweir return undef; 1742cdf0e10cSrcweir } 1743cdf0e10cSrcweir 1744cdf0e10cSrcweir my $eis = Cws::eis(); 1745cdf0e10cSrcweir my $result; 1746cdf0e10cSrcweir eval { $result = $eis->isPublicMaster($master) }; 1747cdf0e10cSrcweir if ( $@ ) { 1748cdf0e10cSrcweir carp("ERROR: get_publicmaster_flag(): EIS database transaction failed. Reason:\n$@\n"); 1749cdf0e10cSrcweir } 1750cdf0e10cSrcweir return $result; 1751cdf0e10cSrcweir} 1752cdf0e10cSrcweir 1753cdf0e10cSrcweir# get isSubVersion flag from eis 1754cdf0e10cSrcweirsub get_subversion_flag_from_eis 1755cdf0e10cSrcweir{ 1756cdf0e10cSrcweir my $self = shift; 1757cdf0e10cSrcweir 1758cdf0e10cSrcweir # check if child workspace is valid 1759cdf0e10cSrcweir my $id = $self->eis_id(); 1760cdf0e10cSrcweir if ( !$id ) { 1761cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1762cdf0e10cSrcweir return undef; 1763cdf0e10cSrcweir } 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir my $eis = Cws::eis(); 1766cdf0e10cSrcweir my $result; 1767cdf0e10cSrcweir eval { $result = $eis->isSubVersion($id) }; 1768cdf0e10cSrcweir if ( $@ ) { 1769cdf0e10cSrcweir carp("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n"); 1770cdf0e10cSrcweir } 1771cdf0e10cSrcweir return $result; 1772cdf0e10cSrcweir} 1773cdf0e10cSrcweir 1774cdf0e10cSrcweir# set isSubVersion flag in eis 1775cdf0e10cSrcweirsub set_subversion_flag_in_eis 1776cdf0e10cSrcweir{ 1777cdf0e10cSrcweir my $self=shift; 1778cdf0e10cSrcweir my $status=shift; 1779cdf0e10cSrcweir 1780cdf0e10cSrcweir my $bool_status=SOAP::Data->type(boolean => $status); 1781cdf0e10cSrcweir 1782cdf0e10cSrcweir # check if child workspace is valid 1783cdf0e10cSrcweir my $id = $self->eis_id(); 1784cdf0e10cSrcweir if ( !$id ) { 1785cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1786cdf0e10cSrcweir return undef; 1787cdf0e10cSrcweir } 1788cdf0e10cSrcweir 1789cdf0e10cSrcweir my $eis = Cws::eis(); 1790cdf0e10cSrcweir my $result; 1791cdf0e10cSrcweir eval { $result = $eis->setSubVersion($id,$bool_status) }; 1792cdf0e10cSrcweir if ( $@ ) { 1793cdf0e10cSrcweir carp("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n"); 1794cdf0e10cSrcweir } 1795cdf0e10cSrcweir return $result; 1796cdf0e10cSrcweir} 1797cdf0e10cSrcweir 1798cdf0e10cSrcweirsub get_scm_from_eis 1799cdf0e10cSrcweir{ 1800cdf0e10cSrcweir my $self = shift; 1801cdf0e10cSrcweir 1802cdf0e10cSrcweir # check if child workspace is valid 1803cdf0e10cSrcweir my $id = $self->eis_id(); 1804cdf0e10cSrcweir if ( !$id ) { 1805cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1806cdf0e10cSrcweir return undef; 1807cdf0e10cSrcweir } 1808cdf0e10cSrcweir 1809cdf0e10cSrcweir my $eis = Cws::eis(); 1810cdf0e10cSrcweir my $result; 1811cdf0e10cSrcweir eval { $result = $eis->getSCMName($id) }; 1812cdf0e10cSrcweir if ( $@ ) { 1813cdf0e10cSrcweir carp("ERROR: get_scm_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1814cdf0e10cSrcweir } 1815cdf0e10cSrcweir return $result; 1816cdf0e10cSrcweir} 1817cdf0e10cSrcweir 1818cdf0e10cSrcweirsub set_scm_in_eis 1819cdf0e10cSrcweir{ 1820cdf0e10cSrcweir my $self = shift; 1821cdf0e10cSrcweir my $scm_name = shift; 1822cdf0e10cSrcweir 1823cdf0e10cSrcweir $scm_name = Eis::to_string($scm_name); 1824cdf0e10cSrcweir # check if child workspace is valid 1825cdf0e10cSrcweir my $id = $self->eis_id(); 1826cdf0e10cSrcweir if ( !$id ) { 1827cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1828cdf0e10cSrcweir return undef; 1829cdf0e10cSrcweir } 1830cdf0e10cSrcweir 1831cdf0e10cSrcweir my $eis = Cws::eis(); 1832cdf0e10cSrcweir eval { $eis->setSCMName($id, $scm_name) }; 1833cdf0e10cSrcweir if ( $@ ) { 1834cdf0e10cSrcweir carp("ERROR: set_scm_in_eis(): EIS database transaction failed. Reason:\n$@\n"); 1835cdf0e10cSrcweir return 0; 1836cdf0e10cSrcweir } 1837cdf0e10cSrcweir return 1; 1838cdf0e10cSrcweir} 1839cdf0e10cSrcweir 1840cdf0e10cSrcweirsub is_uirelevant_from_eis 1841cdf0e10cSrcweir{ 1842cdf0e10cSrcweir my $self = shift; 1843cdf0e10cSrcweir 1844cdf0e10cSrcweir # check if child workspace is valid 1845cdf0e10cSrcweir my $id = $self->eis_id(); 1846cdf0e10cSrcweir if ( !$id ) { 1847cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1848cdf0e10cSrcweir return undef; 1849cdf0e10cSrcweir } 1850cdf0e10cSrcweir 1851cdf0e10cSrcweir my $eis = Cws::eis(); 1852cdf0e10cSrcweir my $result; 1853cdf0e10cSrcweir eval { $result = $eis->isUIRelevant($id) }; 1854cdf0e10cSrcweir if ( $@ ) { 1855cdf0e10cSrcweir carp("ERROR: is_uirelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1856cdf0e10cSrcweir } 1857cdf0e10cSrcweir 1858cdf0e10cSrcweir return $result; 1859cdf0e10cSrcweir} 1860cdf0e10cSrcweir 1861cdf0e10cSrcweirsub is_helprelevant_from_eis 1862cdf0e10cSrcweir{ 1863cdf0e10cSrcweir my $self = shift; 1864cdf0e10cSrcweir 1865cdf0e10cSrcweir # check if child workspace is valid 1866cdf0e10cSrcweir my $id = $self->eis_id(); 1867cdf0e10cSrcweir if ( !$id ) { 1868cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1869cdf0e10cSrcweir return undef; 1870cdf0e10cSrcweir } 1871cdf0e10cSrcweir 1872cdf0e10cSrcweir my $eis = Cws::eis(); 1873cdf0e10cSrcweir my $result; 1874cdf0e10cSrcweir eval { $result = $eis->isHelpRelevant( $id ) }; 1875cdf0e10cSrcweir if ( $@ ) { 1876cdf0e10cSrcweir carp("ERROR: is_helprelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1877cdf0e10cSrcweir } 1878cdf0e10cSrcweir 1879cdf0e10cSrcweir return $result; 1880cdf0e10cSrcweir} 1881cdf0e10cSrcweirsub set_word_count_in_eis 1882cdf0e10cSrcweir{ 1883cdf0e10cSrcweir my $self = shift; 1884cdf0e10cSrcweir my $language = shift; 1885cdf0e10cSrcweir my $wordcount = shift; 1886cdf0e10cSrcweir 1887cdf0e10cSrcweir # check if child workspace is valid 1888cdf0e10cSrcweir my $id = $self->eis_id(); 1889cdf0e10cSrcweir if ( !$id ) { 1890cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1891cdf0e10cSrcweir return undef; 1892cdf0e10cSrcweir } 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir my $eis = Cws::eis(); 1895cdf0e10cSrcweir my $result; 1896cdf0e10cSrcweir eval { $result = $eis->setWordCount( $id , $language , $wordcount ) }; 1897cdf0e10cSrcweir if ( $@ ) { 1898cdf0e10cSrcweir carp("ERROR: set_word_count_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1899cdf0e10cSrcweir } 1900cdf0e10cSrcweir 1901cdf0e10cSrcweir return $result; 1902cdf0e10cSrcweir} 1903cdf0e10cSrcweir 1904cdf0e10cSrcweir 1905cdf0e10cSrcweirsub get_l10n_status_from_eis 1906cdf0e10cSrcweir{ 1907cdf0e10cSrcweir my $self = shift; 1908cdf0e10cSrcweir 1909cdf0e10cSrcweir # check if child workspace is valid 1910cdf0e10cSrcweir my $id = $self->eis_id(); 1911cdf0e10cSrcweir if ( !$id ) { 1912cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1913cdf0e10cSrcweir return undef; 1914cdf0e10cSrcweir } 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir my $eis = Cws::eis(); 1917cdf0e10cSrcweir my $result; 1918cdf0e10cSrcweir eval { $result = $eis->getL10n( $id ) }; 1919cdf0e10cSrcweir if ( $@ ) { 1920cdf0e10cSrcweir carp("ERROR: get_l10n_status_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1921cdf0e10cSrcweir } 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir return $result; 1924cdf0e10cSrcweir} 1925cdf0e10cSrcweir 1926cdf0e10cSrcweirsub set_l10n_status_in_eis 1927cdf0e10cSrcweir{ 1928cdf0e10cSrcweir my $self = shift; 1929cdf0e10cSrcweir my $status = Eis::to_string( shift ); 1930cdf0e10cSrcweir 1931cdf0e10cSrcweir # check if child workspace is valid 1932cdf0e10cSrcweir my $id = $self->eis_id(); 1933cdf0e10cSrcweir if ( !$id ) { 1934cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1935cdf0e10cSrcweir return undef; 1936cdf0e10cSrcweir } 1937cdf0e10cSrcweir 1938cdf0e10cSrcweir my $eis = Cws::eis(); 1939cdf0e10cSrcweir my $result; 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir eval { $result = $eis->setL10n( $id , $status ) }; 1942cdf0e10cSrcweir if ( $@ ) { 1943cdf0e10cSrcweir carp("ERROR: set_l10n_status_in_eis(): EIS database transaction failed. Reason:\n$@\n"); 1944cdf0e10cSrcweir } 1945cdf0e10cSrcweir 1946cdf0e10cSrcweir return $result; 1947cdf0e10cSrcweir} 1948cdf0e10cSrcweir 1949cdf0e10cSrcweirsub get_is_cws_cloneable_from_eis 1950cdf0e10cSrcweir{ 1951cdf0e10cSrcweir my $self = shift; 1952cdf0e10cSrcweir my $master = Eis::to_string( shift ); 1953cdf0e10cSrcweir 1954cdf0e10cSrcweir # check if child workspace is valid 1955cdf0e10cSrcweir my $id = $self->eis_id(); 1956cdf0e10cSrcweir if ( !$id ) { 1957cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1958cdf0e10cSrcweir return undef; 1959cdf0e10cSrcweir } 1960cdf0e10cSrcweir 1961cdf0e10cSrcweir my $eis = Cws::eis(); 1962cdf0e10cSrcweir my $result; 1963cdf0e10cSrcweir 1964cdf0e10cSrcweir eval { $result = $eis->isClonableForMaster($id, $master) }; 1965cdf0e10cSrcweir if ( $@ ) { 1966cdf0e10cSrcweir carp("ERROR: get_is_cws_cloneable_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 1967cdf0e10cSrcweir } 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir return $result; 1970cdf0e10cSrcweir} 1971cdf0e10cSrcweir 1972cdf0e10cSrcweirsub clone_cws_in_eis 1973cdf0e10cSrcweir{ 1974cdf0e10cSrcweir my $self = shift; 1975cdf0e10cSrcweir my $master = Eis::to_string( shift ); 1976cdf0e10cSrcweir 1977cdf0e10cSrcweir # check if child workspace is valid 1978cdf0e10cSrcweir my $id = $self->eis_id(); 1979cdf0e10cSrcweir if ( !$id ) { 1980cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 1981cdf0e10cSrcweir return undef; 1982cdf0e10cSrcweir } 1983cdf0e10cSrcweir 1984cdf0e10cSrcweir my $eis = Cws::eis(); 1985cdf0e10cSrcweir my $result; 1986cdf0e10cSrcweir 1987cdf0e10cSrcweir eval { $eis->cloneForMaster($id, $master) }; 1988cdf0e10cSrcweir if ( $@ ) { 1989cdf0e10cSrcweir carp("ERROR: clone_cws_in_eis(): EIS database transaction failed. Reason:\n$@\n"); 1990cdf0e10cSrcweir return 0; 1991cdf0e10cSrcweir } 1992cdf0e10cSrcweir 1993cdf0e10cSrcweir return 1; 1994cdf0e10cSrcweir} 1995cdf0e10cSrcweir 1996cdf0e10cSrcweirsub get_release_from_eis 1997cdf0e10cSrcweir{ 1998cdf0e10cSrcweir my $self = shift; 1999cdf0e10cSrcweir my $master = Eis::to_string( shift ); 2000cdf0e10cSrcweir 2001cdf0e10cSrcweir # check if child workspace is valid 2002cdf0e10cSrcweir my $id = $self->eis_id(); 2003cdf0e10cSrcweir if ( !$id ) { 2004cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 2005cdf0e10cSrcweir return undef; 2006cdf0e10cSrcweir } 2007cdf0e10cSrcweir 2008cdf0e10cSrcweir my $eis = Cws::eis(); 2009cdf0e10cSrcweir my $result; 2010cdf0e10cSrcweir 2011cdf0e10cSrcweir eval { $result = $eis->getRelease($id) }; 2012cdf0e10cSrcweir if ( $@ ) { 2013cdf0e10cSrcweir carp("ERROR: get_release_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 2014cdf0e10cSrcweir } 2015cdf0e10cSrcweir 2016cdf0e10cSrcweir return $result; 2017cdf0e10cSrcweir} 2018cdf0e10cSrcweir 2019cdf0e10cSrcweirsub get_due_date_from_eis 2020cdf0e10cSrcweir{ 2021cdf0e10cSrcweir my $self = shift; 2022cdf0e10cSrcweir my $master = Eis::to_string( shift ); 2023cdf0e10cSrcweir 2024cdf0e10cSrcweir # check if child workspace is valid 2025cdf0e10cSrcweir my $id = $self->eis_id(); 2026cdf0e10cSrcweir if ( !$id ) { 2027cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 2028cdf0e10cSrcweir return undef; 2029cdf0e10cSrcweir } 2030cdf0e10cSrcweir 2031cdf0e10cSrcweir my $eis = Cws::eis(); 2032cdf0e10cSrcweir my $result; 2033cdf0e10cSrcweir 2034cdf0e10cSrcweir eval { $result = $eis->getDueDate($id) }; 2035cdf0e10cSrcweir if ( $@ ) { 2036cdf0e10cSrcweir carp("ERROR: get_due_date_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 2037cdf0e10cSrcweir } 2038cdf0e10cSrcweir 2039cdf0e10cSrcweir return $result; 2040cdf0e10cSrcweir} 2041cdf0e10cSrcweir 2042cdf0e10cSrcweirsub get_due_date_qa_from_eis 2043cdf0e10cSrcweir{ 2044cdf0e10cSrcweir my $self = shift; 2045cdf0e10cSrcweir my $master = Eis::to_string( shift ); 2046cdf0e10cSrcweir 2047cdf0e10cSrcweir # check if child workspace is valid 2048cdf0e10cSrcweir my $id = $self->eis_id(); 2049cdf0e10cSrcweir if ( !$id ) { 2050cdf0e10cSrcweir carp("ERROR: Childworkspace not (yet) registered with EIS.\n"); 2051cdf0e10cSrcweir return undef; 2052cdf0e10cSrcweir } 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir my $eis = Cws::eis(); 2055cdf0e10cSrcweir my $result; 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir eval { $result = $eis->getDueDateQA($id) }; 2058cdf0e10cSrcweir if ( $@ ) { 2059cdf0e10cSrcweir carp("ERROR: get_due_date_qa_from_eis(): EIS database transaction failed. Reason:\n$@\n"); 2060cdf0e10cSrcweir } 2061cdf0e10cSrcweir 2062cdf0e10cSrcweir return $result; 2063cdf0e10cSrcweir} 2064cdf0e10cSrcweir 2065cdf0e10cSrcweir 2066cdf0e10cSrcweir#logging 2067cdf0e10cSrcweirsub set_log_entry_in_eis 2068cdf0e10cSrcweir{ 2069cdf0e10cSrcweir my $self = shift; 2070cdf0e10cSrcweir my $commandline = shift; 2071cdf0e10cSrcweir my $vcsid = shift; 2072cdf0e10cSrcweir my $start = shift; 2073cdf0e10cSrcweir my $end = shift; 2074cdf0e10cSrcweir my $comment = shift; 2075cdf0e10cSrcweir 2076cdf0e10cSrcweir $commandline = SOAP::Data->type(string => $commandline); 2077cdf0e10cSrcweir $comment = SOAP::Data->type(string => $comment); 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir # *format* for $start and $end = "2003-05-28 12:34:59"; 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir#===================================================== 2082cdf0e10cSrcweir #TO DO: 2083cdf0e10cSrcweir #experimenell f�r saubere schnittstelle 2084cdf0e10cSrcweir #$start = SOAP::Data->type(dateTime => $start); 2085cdf0e10cSrcweir #$end = SOAP::Data->type(dateTime => $end); 2086cdf0e10cSrcweir#===================================================== 2087cdf0e10cSrcweir 2088cdf0e10cSrcweir my $eis = Cws::eis(); 2089cdf0e10cSrcweir my $result; 2090cdf0e10cSrcweir eval { $result = $eis->storeCommandLogEntry( $commandline, $vcsid, $start, $end, $comment ) }; 2091cdf0e10cSrcweir if ( $@ ) { 2092cdf0e10cSrcweir carp("ERROR: set_log_entry(): Logging failed. Reason:\n$@\n"); 2093cdf0e10cSrcweir } 2094cdf0e10cSrcweir return $result; 2095cdf0e10cSrcweir} 2096cdf0e10cSrcweir 2097cdf0e10cSrcweir#set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname); 2098cdf0e10cSrcweirsub set_log_entry_extended_in_eis 2099cdf0e10cSrcweir{ 2100cdf0e10cSrcweir my $self = shift; 2101cdf0e10cSrcweir my $commandname = shift; 2102cdf0e10cSrcweir my $parameter = shift; 2103cdf0e10cSrcweir my $vcsid = shift; 2104cdf0e10cSrcweir my $start = shift; 2105cdf0e10cSrcweir my $end = shift; 2106cdf0e10cSrcweir my $comment = shift; 2107cdf0e10cSrcweir my $mastername = shift; 2108cdf0e10cSrcweir my $childname = shift; 2109cdf0e10cSrcweir 2110cdf0e10cSrcweir $commandname = SOAP::Data->type(string => $commandname); 2111cdf0e10cSrcweir $parameter = SOAP::Data->type(string => $parameter); 2112cdf0e10cSrcweir $comment = SOAP::Data->type(string => $comment); 2113cdf0e10cSrcweir $mastername = SOAP::Data->type(string => $mastername); 2114cdf0e10cSrcweir $childname = SOAP::Data->type(string => $childname); 2115cdf0e10cSrcweir 2116cdf0e10cSrcweir # *format* for $start and $end = "2003-05-28 12:34:59"; 2117cdf0e10cSrcweir 2118cdf0e10cSrcweir#===================================================== 2119cdf0e10cSrcweir #TO DO: 2120cdf0e10cSrcweir #experimenell f�r saubere schnittstelle 2121cdf0e10cSrcweir #$start = SOAP::Data->type(dateTime => $start); 2122cdf0e10cSrcweir #$end = SOAP::Data->type(dateTime => $end); 2123cdf0e10cSrcweir#===================================================== 2124cdf0e10cSrcweir 2125cdf0e10cSrcweir my $eis = Cws::eis(); 2126cdf0e10cSrcweir my $result; 2127cdf0e10cSrcweir eval { $result = $eis->storeCommandLogEntry($commandname, $parameter, $vcsid, $start, $end, $comment, $mastername, $childname) }; 2128cdf0e10cSrcweir if ( $@ ) { 2129cdf0e10cSrcweir carp("ERROR: set_log_entry_extended(): Logging failed. Reason:\n$@\n"); 2130cdf0e10cSrcweir } 2131cdf0e10cSrcweir return $result; 2132cdf0e10cSrcweir} 2133cdf0e10cSrcweir 2134cdf0e10cSrcweir 2135cdf0e10cSrcweir#### class methods #### 2136cdf0e10cSrcweir 2137cdf0e10cSrcweirsub init_eis_connector 2138cdf0e10cSrcweir{ 2139cdf0e10cSrcweir my $eis = Eis->new( uri => Cws::eis_uri(), 2140cdf0e10cSrcweir proxy_list => Cws::eis_proxy_list(), 2141cdf0e10cSrcweir net_proxy => Cws::net_proxy() 2142cdf0e10cSrcweir ); 2143cdf0e10cSrcweir return $eis; 2144cdf0e10cSrcweir} 2145cdf0e10cSrcweir 2146cdf0e10cSrcweir#### 2147cdf0e10cSrcweir 2148cdf0e10cSrcweir1; # needed by "use" or "require" 2149cdf0e10cSrcweir# vim: set ts=4 shiftwidth=4 expandtab syntax=perl: 2150