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