merge the formfield patch from ooo-build
[ooovba.git] / solenv / bin / modules / Cws.pm
blob59eb2c99e2596849538ae5a22f1c3c1770dbbe04
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: Cws.pm,v $
11 # $Revision: 1.26 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
34 # Cws.pm - package for accessing/manipulating child workspaces
37 # TODO: needs some cleanup
39 package Cws;
40 use strict;
42 use Eis;
43 use CwsConfig;
44 use Carp;
45 use URI::Escape;
47 my $config = CwsConfig::get_config();
49 ##### class data #####
51 my %CwsClassData = (
52 # EIS database connectivity
53 EIS_URI => 'urn:ChildWorkspaceDataService',
54 EIS_PROXY_LIST => $config->cws_db_url_list_ref(),
55 NET_PROXY => $config->net_proxy(),
56 EIS => undef
59 ##### ctor #####
61 sub new
63 my $invocant = shift;
64 my $class = ref($invocant) || $invocant;
65 my $self = {};
66 # instance data
67 # initialize CWS name from environment
68 $self->{CHILD} = undef; # name of child workspace
69 $self->{MASTER} = undef; # name of master workspace
70 $self->{EIS_ID} = undef; # id of child workspace in EIS
71 $self->{FILES} = undef; # list of files registered with child
72 # any file can be registered multiple times
73 $self->{PATCH_FILES} = undef # list of product patch files registered with
74 # child, each file can be added only once
75 $self->{MILESTONE} = undef; # master milestone to which child is related
76 $self->{MODULES} = undef; # list of modules belonging to child
77 $self->{INCOMPATIBLE_MODULES} = undef; # list of modules belonging to child
78 $self->{NEW_MODULES} = undef; # list of public new modules belonging to child
79 $self->{NEW_MODULES_PRIV} = undef; # list of private new modules belonging to child
80 $self->{TASKIDS} = undef; # list of tasks registered with child
81 $self->{_CACHED_TAGS} = undef; # list of cached tags (tags are looked up frequently)
82 bless($self, $class);
83 return $self;
86 #### methods to access instance data ####
88 # Get the EIS ID for child workspace,
89 # return value: undef => not yet asked EIS for ID
90 # or connection failed
91 # 0 => queried EIS but didn't find such
92 # a child workspace for this master
93 # silently ignore any parameter, only the EIS database,
94 # hands out EIS IDs.
95 sub eis_id
97 my $self = shift;
98 if ( !defined($self->{EIS_ID} ) ) {
99 $self->{EIS_ID} = $self->get_eis_id();
101 return $self->{EIS_ID};
104 # Generate remaining instance data accessor methods;
105 # if this looks strange see 'perldoc perltootc'
107 # Accessor methods for single value instance data
108 for my $datum (qw(master milestone)) {
109 no strict "refs";
110 *$datum = sub {
111 my $self = shift;
112 my $ucdatum = uc($datum);
113 if ( @_ ) {
114 # set item in database
115 my $item = shift;
116 # if we already have a valid EIS registered CWS then reset EIS value
117 # otherwise just set member to the given value
118 if ( !$self->{uc($datum)} # keep order of evaluation
119 || !$self->eis_id()
120 || $self->set_item_in_eis($datum, $item) )
122 $self->{uc($datum)} = $item;
126 else {
127 if ( !defined($self->{$ucdatum} ) ) {
128 # fetch item from database
129 $self->{$ucdatum} = $self->fetch_item_from_eis($datum);
132 return $self->{uc($datum)};
136 # Accessor methods for instance data consisting of item lists
137 # like modules and taskids
138 for my $datum (qw(files patch_files modules incompatible_modules new_modules new_modules_priv taskids)) {
139 no strict "refs";
140 *$datum = sub {
141 # get current item list
142 # fetch list from EIS database if called the first time
143 my $self = shift;
144 my $ucdatum = uc($datum);
145 if ( !defined($self->{$ucdatum}) ) {
146 # fetch item list from databse
147 $self->{$ucdatum} = $self->fetch_items_from_eis($datum);
148 return undef if !defined($self->{$ucdatum});
150 return wantarray ? @{$self->{$ucdatum}} : $self->{$ucdatum}
154 for my $datum (qw(child)) {
155 no strict "refs";
156 *$datum = sub {
157 my $self = shift;
158 $self->{uc($datum)} = shift if @_;
159 return $self->{uc($datum)};
164 #### additional public methods ####
166 # For resync: Sets master and milestone simultaneously
167 # In case of a cross master resync it does not make sense to
168 # change both items separately
169 sub set_master_and_milestone
171 my $self = shift;
172 my $master = shift or return undef;
173 my $milestone = shift or return undef;
175 # if we do not yet have a valid EIS registered CWS use the above more basic methods
176 if ( !$self->master()
177 || !$self->milestone()
178 || !$self->eis_id() )
180 $self->master($master);
181 $self->milestone($milestone);
182 } else {
183 if ( $self->set_master_and_milestone_in_eis($master, $milestone) ) {
184 $self->{'MASTER'} = $self->fetch_item_from_eis('master');
185 $self->{'MILESTONE'} = $self->fetch_item_from_eis('milestone');
188 my @retarray = ($self->{'MASTER'}, $self->{'MILESTONE'});
189 return wantarray ? @retarray : \@retarray;
192 # Query if CWS name is still available. Does not yet register
193 # anything with EIS.
194 sub is_cws_name_available
196 my $self = shift;
198 my $is_available = $self->is_cws_name_available_in_eis();
199 return $is_available;
202 # Register new child workspace with the EIS database.
203 sub register
205 my $self = shift;
206 my $vcsid = shift;
207 my $location = shift;
209 my $child_id = $self->register_child_with_eis($vcsid, $location);
210 return $child_id;
213 # Promote a child workspace with status 'planned' to a full CWS
214 sub promote
216 my $self = shift;
217 my $vcsid = shift;
218 my $location = shift;
220 my $rc = $self->promote_child_in_eis($vcsid, $location);
221 return $rc;
224 # New style add_module method. Takes an additional bool indicating if
225 # a module is public or private. Obsoletes add_modules()
226 sub add_module
228 my $self = shift;
229 my $module = shift;
230 my $public = shift;
232 my $items_ref = $self->add_items('modules', $public, $module);
233 if (defined ($items_ref->[0]) && ($items_ref->[0] eq $module)) {
234 return 1; # module has been added
236 elsif ( defined($items_ref) ) {
237 return 0; # module was already add
239 return undef; # something went wrong
242 # Add module to modules list.
243 sub add_modules
245 my $self = shift;
247 my $items_ref = $self->add_items('modules', undef, @_);
248 return undef unless defined($items_ref);
249 return wantarray ? @{$items_ref} : $items_ref;
252 # Add tasksids to taskids list.
253 sub add_taskids
255 my $self = shift;
256 my $vcsid = shift;
258 my $items_ref = $self->add_items('taskids', $vcsid, @_);
259 return undef unless defined($items_ref);
260 return wantarray ? @{$items_ref} : $items_ref;
263 # Add a file to the files list.
264 sub add_file
266 my $self = shift;
267 my $module = shift;
268 my $file = shift;
269 my $revision = shift;
270 my $authors_ref = shift;
271 my $taskids_ref = shift;
272 my $archive_path = shift;
274 my $files_ref = $self->files();
276 if ( $self->add_file_to_eis($module, $file, $revision,
277 $authors_ref, $taskids_ref, $archive_path) )
279 push(@{$files_ref}, $file);
280 return 1;
282 return 0;
285 # Add a file to the patch file list.
286 sub add_patch_file
288 my $self = shift;
289 my $file = shift;
291 my $patch_files_ref = $self->patch_files();
293 foreach (@{$patch_files_ref}) {
294 return 0 if $file eq $_;
297 if ( $self->add_patch_file_to_eis($file) )
299 push(@{$patch_files_ref}, $file);
300 return 1;
302 return 0;
306 # Procedure retrieves the workspace which
307 # is based on cvs head (not branch)
309 sub get_cvs_head {
310 my $eis = Cws::eis();
311 my $result;
312 eval { $result = $eis->getCVSHead() };
313 if ( $@ ) {
314 carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
316 return $result;
319 #### public class methods ####
321 sub get_master_tag {
322 my ($self, $master, $milestone) = @_;
323 $master = $self->master() if (!defined $master);
324 $milestone = $self->milestone() if (!defined $milestone);
325 return uc($master) . '_' . lc($milestone);
328 sub get_master_branch_tag {
329 my ($self, $master) = @_;
330 $master = $self->master() if (!defined $master);
331 # check in environment if master is on the the HEAD branch
332 my $cvs_head = get_cvs_head();
333 if ( $master eq $cvs_head ) {
334 return undef;
336 else {
337 return 'mws_' . lc($master);
341 sub get_mws {
342 my $self = shift;
343 my $eis = Cws::eis();
344 my $masters;
345 my $child = Eis::to_string($self->child());
346 eval { $masters = $eis->getMastersForCWS($child) };
347 if ( $@ ) {
348 carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
350 return $$masters[0];
353 # Returns the branch and root tags for child workspace.
354 sub get_tags
356 my $self = shift;
358 # look up if tags have already been retrieved
359 if ( defined($self->{_CACHED_TAGS}) ) {
360 return @{$self->{_CACHED_TAGS}};
363 # check if child workspace is valid
364 my $id = $self->eis_id();
365 if ( !$id ) {
366 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
367 return undef;
370 my $childws = $self->child();
371 # check if child workspace is a clone,
372 if ( $childws =~ /(\w+)_[[:upper:]]{3}\d{3}/ ) {
373 $childws = $1;
376 # check in environment if master is on the the HEAD branch
377 my $cvs_head = get_cvs_head();
378 my $current_master = $self->master();
379 my $creation_master = $self->get_creation_master();
380 if ( !$creation_master ) {
381 carp("ERROR: Can't determine creation MWS.\n");
382 return undef;
384 my $milestone = $self->milestone();
386 my $master_branch_tag
387 = (lc($current_master) eq lc($cvs_head)) ? '' : 'mws_' . lc($current_master);
388 my $cws_branch_tag = 'cws_' . lc($creation_master) . '_' . lc($childws);
389 my $cws_root_tag = uc($cws_branch_tag) . "_ANCHOR";
390 my $master_milestone_tag = uc($current_master) . "_" . $milestone;
392 $self->{_CACHED_TAGS} = [$master_branch_tag, $cws_branch_tag, $cws_root_tag, $master_milestone_tag];
393 return @{$self->{_CACHED_TAGS}};
396 # Get childworkspace owner
397 sub get_owner
399 my $self = shift;
401 return $self->get_owner_from_eis();
404 # get childworkspace qarep
405 sub get_qarep
407 my $self = shift;
409 return $self->get_qarep_from_eis();
412 # store an Attachment to a given CWS
413 sub save_attachment
415 my $self = shift;
416 my $name = shift;
417 my $mediatype = shift;
418 my $data = shift;
420 return $self->save_attachment_in_eis($name, $mediatype, $data);
423 # Get child workspace approval status,
424 # return values can be:
425 # 'planned', 'new', 'nominated', 'integrated'
426 # and undef in case of error.
427 sub get_approval
429 my $self = shift;
431 return $self->get_status_from_eis();
434 # Set child workspace approval status
435 # to 'integrated'. Return true if successful
436 # or undef in case of error
437 sub set_integrated
439 my $self = shift;
441 return $self->set_status_in_eis();
444 # Set child workspace integration milestone
445 # Return true if successful or undef in case of error
446 sub set_integration_milestone
448 my $self = shift;
449 my $milestone = shift;
450 my $buildid = shift;
452 return $self->set_integration_milestone_in_eis($milestone, $buildid);
455 # Get the MWS on which a CWS was created
456 sub get_creation_master
458 my $self = shift;
460 return $self->get_creation_master_from_eis();
463 # Get the 'public' flag indicating whether a CWS is visible on OOo
464 sub get_public_flag
466 my $self = shift;
468 return $self->get_public_flag_from_eis();
472 # Get the 'publicmaster' flag indicating whether a MWS is visible on OOo
473 sub get_publicmaster_flag
475 my $self = shift;
477 return $self->get_publicmaster_flag_from_eis();
481 sub get_subversion_flag {
483 my $self = shift;
485 return $self->get_subversion_flag_from_eis();
488 sub set_subversion_flag {
490 my $self = shift;
491 my $value = shift;
493 return $self->set_subversion_flag_in_eis($value);
496 sub get_scm {
497 my $self = shift;
499 return $self->get_scm_from_eis();
502 sub set_scm {
503 my $self = shift;
504 my $scm_name = shift;
506 return $self->set_scm_in_eis($scm_name);
510 # Check if milestone exists
511 sub is_milestone
513 my $self = shift;
514 my $master = shift;
515 my $milestone = shift;
517 return $self->is_milestone_registered_with_eis($master, $milestone);
520 # Check if this cws contains new ui
521 sub is_uirelevant
523 my $self = shift;
525 return $self->is_uirelevant_from_eis();
528 # Check if this cws contains new online help
529 sub is_helprelevant
531 my $self = shift;
533 return $self->is_helprelevant_from_eis();
536 # Set the l10n status
537 sub set_l10n_status
539 my $self = shift;
540 my $status = shift;
542 return $self->set_l10n_status_in_eis( $status );
545 # Get the l10n status
546 sub get_l10n_status
548 my $self = shift;
550 return $self->get_l10n_status_from_eis();
552 sub set_word_count
554 my $self = shift;
555 my $language = shift;
556 my $wordcount = shift;
558 return $self->set_word_count_in_eis( $language , $wordcount );
562 # Get target release for CWS
563 sub get_release
565 my $self = shift;
567 return $self->get_release_from_eis();
570 # Get due date
571 sub get_due_date
573 my $self = shift;
575 return $self->get_due_date_from_eis();
578 # Get due date QA
579 sub get_due_date_qa
581 my $self = shift;
583 return $self->get_due_date_qa_from_eis();
586 # Query master milestone combination for being used by an
587 # active CWS
588 sub is_milestone_used
590 my $self = shift;
591 my $master = shift;
592 my $milestone = shift;
594 return $self->get_is_milestone_used_from_eis($master, $milestone);
597 # Set current milestone for MWS.
598 sub set_current_milestone
600 my $self = shift;
601 my $master = shift;
602 my $milestone = shift;
604 return $self->set_current_milestone_in_eis($master, $milestone);
607 # Get current milestone for MWS.
608 sub get_current_milestone
610 my $self = shift;
611 my $master = shift;
613 return $self->get_current_milestone_from_eis($master);
616 sub get_milestone_integrated
618 my $self = shift;
620 return $self->get_milestone_integrated_from_eis();
623 # Get masters
624 sub get_masters
627 my $self = shift;
629 return $self->get_masters_from_eis();
632 # Get milestones for MWS.
633 sub get_milestones
635 my $self = shift;
636 my $master = shift;
638 return $self->get_milestones_from_eis($master);
640 # get build string for CWS
642 sub get_build
644 my $self = shift;
645 my $master = $self->master();
646 my $milestone = $self->milestone();
647 if ( ! defined($milestone) ) {
648 return undef;
650 my $bid=$self->get_buildid($master,$milestone);
651 if ( ! defined($bid) ) {
652 return undef;
654 return $self->expand_buildid($bid);
659 # expand build for given cwsname
660 sub expand_buildid
662 my $self = shift;
663 my $bid = shift;
664 return $self->expand_buildid_in_eis($bid);
668 # Set BuildID of milestone
669 sub set_milestone_buildid
671 my $self = shift;
672 my $master = shift;
673 my $milestone = shift;
674 my $buildid = shift;
676 return $self->set_milestone_buildid_in_eis($master, $milestone, $buildid);
679 # Declare milestone 'removed'
680 # This triggers EIS to send emails to all (SO-internal) CWS owners
681 # with living CWSs based on that milestone.
682 sub milestone_removed
684 my $self = shift;
685 my $master = shift;
686 my $milestone = shift;
688 return $self->set_milestone_removed_in_eis($master, $milestone);
692 # Get all child workspaces which have been integrated on a
693 # given master and milestone.
694 sub get_integrated_cws
696 my $self = shift;
697 my $master = shift;
698 my $milestone = shift;
700 my $childworkspaces_arrref = $self->get_childworkspaces_for_milestone($master, $milestone);
701 if ( !$childworkspaces_arrref ) {
702 $childworkspaces_arrref = [];
704 return wantarray ? @$childworkspaces_arrref : $childworkspaces_arrref;
708 # Get builid for given master and milestone.
709 sub get_buildid
711 my $self = shift;
712 my $master = shift;
713 my $milestone = shift;
715 return $self->get_buildid_for_milestone($master, $milestone);
719 # Get all cws' with a status passed
721 sub get_cws_with_state
723 my $self = shift;
724 my $mws = shift;
725 my $status = shift;
727 return wantarray ? @{$self->get_cws_with_state_from_eis($mws, $status)}
728 : $self->get_cws_with_state_from_eis($mws, $status);
731 sub get_task_prio_cws
733 my $self = shift;
734 my $ref_taskids = shift;
735 return @{$self->get_task_prios_of_tasks($ref_taskids)};
738 # Check is CWS is cloneable for specified master
739 sub is_cws_cloneable
741 my $self = shift;
742 my $master = shift;
744 return $self->get_is_cws_cloneable_from_eis($master);
747 # Clone CWS for specified master
748 sub clone_cws
750 my $self = shift;
751 my $master = shift;
753 return $self->clone_cws_in_eis($master);
756 sub set_log_entry
758 my $self = shift;
759 my $commandline = shift;
760 my $vcsid = shift;
761 my $start = shift;
762 my $stop = shift;
763 my $comment = shift;
764 return $self->set_log_entry_in_eis($commandline, $vcsid, $start, $stop, $comment);
767 sub set_log_entry_extended
769 my $self = shift;
770 my $commandname = shift;
771 my $parameter = shift;
772 my $vcsid = shift;
773 my $start = shift;
774 my $stop = shift;
775 my $comment = shift;
776 my $mastername = shift;
777 my $childname = shift;
778 #set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname);
779 return $self->set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname);
783 #### private ####
785 # class data accessor methods
786 sub eis
788 shift; # ignore calling class/object
789 $CwsClassData{EIS} = shift if @_;
790 if ( !defined($CwsClassData{EIS}) ) {
791 $CwsClassData{EIS} = init_eis_connector();
793 return $CwsClassData{EIS};
796 # generate remaining class data accessor methods
797 # if this looks strange see 'perldoc perltootc'
798 for my $datum (qw(eis_uri eis_proxy_list net_proxy)) {
799 no strict "refs";
800 *$datum = sub {
801 shift; # ignore calling class/object
802 return $CwsClassData{uc($datum)};
806 #### helper methods ####
808 # instance methods
810 # Add item to items list,
811 # update eis database,
812 # returns a list of newly added items,
813 # specifying an existing item is not an
814 # error, but it want appear in the return list.
815 sub add_items
817 my $self = shift;
818 my $type = shift;
819 my $optional_data = shift;
821 my $items_ref;
822 if ( $type eq 'modules' ) {
823 $items_ref = $self->modules();
825 elsif ( $type eq 'taskids' ) {
826 $items_ref = $self->taskids();
828 else {
829 # fall through, can't happen
830 carp("ERROR: wrong item type\n");
831 return undef;
834 my $item;
835 my @new_items = ();
836 return undef if !defined($items_ref);
837 # find which items which are not already in items list
838 ITEM: while ( $item = shift ) {
839 foreach ( @{$items_ref} ) {
840 next ITEM if $_ eq $item;
842 push(@new_items, $item);
844 if ( $#new_items > -1 ) {
845 # add items to database
846 if ( $self->add_items_to_eis($type, $optional_data, \@new_items) ) {
847 push(@{$items_ref}, @new_items);
849 else {
850 # something went wrong
851 return undef;
854 return \@new_items;
857 # Get EIS id for workspace from EIS database
858 sub get_eis_id
860 my $self = shift;
861 my $eis = Cws::eis();
863 # It's not an error if one of these is unset, so don't carp().
864 if ( !$self->master() || !$self->child() ) {
865 return undef;
868 my $master = Eis::to_string($self->master());
869 my $child = Eis::to_string($self->child());
871 my $result;
872 eval { $result = int($eis->getChildWorkspaceId($master, $child)) };
873 if ( $@ ) {
874 carp("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
876 return $result;
879 sub fetch_item_from_eis
881 my $self = shift;
882 my $type = shift;
884 my $eis = Cws::eis();
885 my $id = $self->eis_id();
887 if ( !$id ) {
888 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
889 return undef;
892 my $result;
893 if ( $type eq 'milestone' ) {
894 eval { $result = $eis->getMilestone($id) };
896 elsif ( $type eq 'master' ) {
897 # master can't be queried from the EIS database,
898 # just return what already in member
899 return $self->{MASTER}
901 else {
902 # fall through, can't happen
903 carp("ERROR: wrong item type\n");
904 return undef;
906 if ( $@ ) {
907 carp("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n");
909 return $result;
912 sub set_item_in_eis
914 my $self = shift;
915 my $type = shift;
916 my $item = shift;
918 my $eis = Cws::eis();
919 my $id = $self->eis_id();
921 if ( !$id ) {
922 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
923 return undef;
926 # make certain that the item is a string, otherwise
927 # autotyping will occasionally choose the wrong type
928 $item = Eis::to_string($item);
930 my $result;
931 if ( $type eq 'milestone' ) {
932 # this operation invalidates the cached tags list
933 $self->{_CACHED_TAGS} = undef;
934 eval { $result = $eis->setMilestone($id, $item) };
936 elsif ( $type eq 'master' ) {
937 # this operation invalidates the cached tags list
938 $self->{_CACHED_TAGS} = undef;
939 eval { $result = $eis->setMasterWorkspace($id, $item) };
941 else {
942 # fall through, can't happen
943 carp("ERROR: wrong item type\n");
944 return 0;
947 if ( $@ ) {
948 carp("ERROR: set_item(): EIS database transaction failed. Reason:\n$@\n");
949 return undef;
951 return 1 if $result;
952 return 0;
955 sub set_master_and_milestone_in_eis
957 my $self = shift;
958 my $master = shift;
959 my $milestone = shift;
961 my $eis = Cws::eis();
962 my $id = $self->eis_id();
964 if ( !$id ) {
965 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
966 return undef;
969 # make certain that the item is a string, otherwise
970 # autotyping will occasionally choose the wrong type
971 $master = Eis::to_string($master);
972 $milestone = Eis::to_string($milestone);
974 my $result;
975 # this operation invalidates the cached tags list
976 $self->{_CACHED_TAGS} = undef;
977 eval { $result = $eis->setMasterWorkspaceAndMilestone($id, $master, $milestone) };
979 if ( $@ ) {
980 carp("ERROR: set_master_and_milestone(): EIS database transaction failed. Reason:\n$@\n");
981 return undef;
983 return 1 if $result;
984 return 0;
987 sub fetch_items_from_eis
989 my $self = shift;
990 my $type = shift;
992 my $eis = Cws::eis();
993 my $id = $self->eis_id();
995 if ( !$id ) {
996 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
997 return undef;
1000 my $result;
1001 if ( $type eq 'modules' ) {
1002 eval { $result = $eis->getModules($id) };
1004 elsif ( $type eq 'incompatible_modules' ) {
1005 eval { $result = $eis->getIncompatibleModules($id) };
1007 elsif ( $type eq 'new_modules' ) {
1008 eval { $result = $eis->getNewModules($id) };
1010 elsif ( $type eq 'new_modules_priv' ) {
1011 eval { $result = $eis->getNewModulesPriv($id) };
1013 elsif ( $type eq 'taskids' ) {
1014 eval { $result = $eis->getTaskIds($id) };
1016 elsif ( $type eq 'files' ) {
1017 eval { $result = $eis->getFiles($id) };
1019 elsif ( $type eq 'patch_files' ) {
1020 eval { $result = $eis->getOutputFiles($id) };
1022 else {
1023 # fall through, can't happen
1024 carp("ERROR: wrong item type\n");
1025 return undef;
1027 if ( $@ ) {
1028 carp("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n");
1030 return $result;
1033 sub add_items_to_eis
1035 my $self = shift;
1036 my $type = shift;
1037 my $optional_data = shift;
1038 my $item_ref = shift;
1040 my $eis = Cws::eis();
1041 my $id = $self->eis_id();
1043 if ( !$id ) {
1044 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1045 return undef;
1048 # make certain that all items are strings, otherwise
1049 # autotyping will occasionally choose the wrong type
1050 my @items = ();
1051 foreach ( @{$item_ref} ) {
1052 push(@items, Eis::to_string($_));
1055 my $result;
1056 if ( $type eq 'modules' ) {
1057 if ( defined($optional_data) ) {
1058 # add a module new style, with public attribute
1059 eval { $result = $eis->addModule($id, $items[0], $optional_data) };
1061 else {
1062 # old style, add a list of modules
1063 eval { $result = $eis->addModules($id, \@items) };
1066 elsif ( $type eq 'taskids' ) {
1067 eval { $result = $eis->addTaskIds($id, \@items, $optional_data) };
1069 else {
1070 # fall through, can't happen
1071 carp("ERROR: wrong item type\n");
1072 return 0;
1075 if ( $@ ) {
1076 carp("ERROR: add_item(): EIS database transaction failed. Reason:\n$@\n");
1077 return undef;
1079 return 1 if $result;
1080 return 0;
1083 sub add_file_to_eis
1085 my $self = shift;
1086 my $module = shift;
1087 my $file = shift;
1088 my $revision = shift;
1089 my $authors_ref = shift;
1090 my $taskids_ref = shift;
1091 my $archive_path = shift;
1094 my $eis = Cws::eis();
1095 my $id = $self->eis_id();
1097 if ( !$id ) {
1098 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1099 return undef;
1102 # make certain that all task_ids are strings, otherwise
1103 # autotyping will choose the wrong type
1104 # Note: I think typing just the first element should suffice, but ...
1105 my @taskids = ();
1106 foreach ( @{$taskids_ref} ) {
1107 push(@taskids, Eis::to_string($_));
1109 # HACK Its possible that we get no valid taskid.
1110 # Autotyping will fail for a list without elements;
1111 if ( !@taskids ) {
1112 push(@taskids, Eis::to_string(''));
1115 # same for revision
1116 $revision = Eis::to_string($revision);
1118 if ( !$archive_path ) {
1119 $archive_path = Eis::to_string('');
1122 my $result;
1123 eval {
1124 $result = $eis->addFile($id, $module, $file, $archive_path,
1125 $revision, $authors_ref, \@taskids)
1127 if ( $@ ) {
1128 carp("ERROR: add_file(): EIS database transaction failed. Reason:\n$@\n");
1129 return undef;
1131 return 1 if $result;
1132 return 0;
1135 sub add_patch_file_to_eis
1137 my $self = shift;
1138 my $file = shift;
1140 my $eis = Cws::eis();
1141 my $id = $self->eis_id();
1143 if ( !$id ) {
1144 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1145 return undef;
1148 my $result;
1149 eval { $result = $eis->addOutputFile($id, $file) };
1150 if ( $@ ) {
1151 carp("ERROR: add_patch_file(): EIS database transaction failed. Reason:\n$@\n");
1152 return undef;
1154 return $1;# appOutputFile has void as return value ...
1157 sub is_cws_name_available_in_eis
1159 my $self = shift;
1161 if ( !$self->master() ) {
1162 carp("ERROR: master workspace name not set\n");
1163 return undef;
1166 if ( !$self->child() ) {
1167 carp("ERROR: child workspace name not set\n");
1168 return undef;
1171 my $eis = Cws::eis();
1172 my $master = Eis::to_string($self->master());
1173 my $child = Eis::to_string($self->child());
1175 my $result;
1176 eval { $result = $eis->isChildWorkspaceUnique($master, $child) };
1177 if ( $@ ) {
1178 carp("ERROR: is_cws_name_available(): EIS database transaction failed. Reason:\n$@\n");
1180 return $result;
1183 sub register_child_with_eis
1185 my $self = shift;
1186 my $vcsid = shift;
1187 my $location = shift;
1189 if ( !$self->master() ) {
1190 carp("ERROR: master workspace name not set\n");
1191 return undef;
1194 if ( !$self->milestone() ) {
1195 carp("ERROR: master milestone not set\n");
1196 return undef;
1199 if ( !$self->child() ) {
1200 carp("ERROR: child workspace name not set\n");
1201 return undef;
1204 $vcsid = '' unless $vcsid;
1205 $location = '' unless $location;
1207 my $eis = Cws::eis();
1208 my $master = Eis::to_string($self->master());
1209 my $milestone = Eis::to_string($self->milestone());
1210 my $child = Eis::to_string($self->child());
1212 $vcsid = Eis::to_string($vcsid);
1213 $location = Eis::to_string($location);
1215 my $result;
1216 eval {
1217 $result = $eis->createChildWorkspace($master, $milestone, $child,
1218 $vcsid, $location)
1221 if ( $@ ) {
1222 carp("ERROR: create_child_wortkspace(): EIS database transaction failed. Reason:\n$@\n");
1223 return undef;
1225 # set EIS_ID directly, since $self->eis_id() is not
1226 # supposed to take parameters.
1227 $self->{EIS_ID} = $result;
1228 return $result;
1231 sub promote_child_in_eis
1233 my $self = shift;
1234 my $vcsid = shift;
1235 my $location = shift;
1237 my $eis = Cws::eis();
1238 my $id = $self->eis_id();
1240 if ( !$id ) {
1241 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1242 return undef;
1245 if ( !$self->milestone() ) {
1246 carp("ERROR: master milestone not set\n");
1247 return undef;
1250 my $milestone = Eis::to_string($self->milestone());
1252 $vcsid = '' unless $vcsid;
1253 $location = '' unless $location;
1255 $vcsid = Eis::to_string($vcsid);
1256 $location = Eis::to_string($location);
1258 my $result;
1259 eval {
1260 $result = $eis->initializeChildWorkspace($id, $milestone, $vcsid, $location)
1263 eval { $result = $eis->getStatus($id) };
1264 if ( $@ ) {
1265 carp("ERROR: promote(): EIS database transaction failed. Reason:\n$@\n");
1266 return 0;
1268 return 1;
1271 # Get child workspace owner from EIS,
1272 # return undef in case of error.
1273 sub get_owner_from_eis
1275 my $self = shift;
1277 # check if child workspace is valid
1278 my $id = $self->eis_id();
1279 if ( !$id ) {
1280 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1281 return undef;
1284 my $eis = Cws::eis();
1285 my $result;
1286 eval { $result = $eis->getOwnerEmail($id) };
1287 if ( $@ ) {
1288 carp("ERROR: get_OwnerEmail(): EIS database transaction failed. Reason:\n$@\n");
1290 return $result;
1293 # Get child workspace qarep from EIS,
1294 # return undef in case of error.
1295 sub get_qarep_from_eis
1297 my $self = shift;
1299 # check if child workspace is valid
1300 my $id = $self->eis_id();
1301 if ( !$id ) {
1302 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1303 return undef;
1306 my $eis = Cws::eis();
1307 my $result;
1308 eval { $result = $eis->getQARepresentativeEmail($id) };
1309 if ( $@ ) {
1310 carp("ERROR: get_qarep(): EIS database transaction failed. Reason:\n$@\n");
1312 return $result;
1315 # store an attachment to a given CWS
1316 # return undef in case of error.
1317 sub save_attachment_in_eis
1319 my $self = shift;
1320 my $name = shift;
1321 my $mediatype = shift;
1322 my $text = shift;
1324 # check if child workspace is valid
1325 my $eisid = $self->eis_id();
1326 if ( !$eisid )
1328 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1329 return undef;
1332 my $eisname = Eis::to_string($name);
1333 my $eismediatype = Eis::to_string($mediatype);
1334 my $eistextstring = Eis::to_string($text);
1336 my $eis = Cws::eis();
1337 my $result;
1339 eval { $result = $eis->saveAttachment($eisid, $eisname, $eismediatype, $eistextstring ) };
1340 if ( $@ ) {
1341 carp("ERROR: save_attachment_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1343 return $result;
1346 # Get child workspace approval status from EIS,
1347 # return undef in case of error.
1348 sub get_status_from_eis
1350 my $self = shift;
1352 # check if child workspace is valid
1353 my $id = $self->eis_id();
1354 if ( !$id ) {
1355 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1356 return undef;
1359 my $eis = Cws::eis();
1360 my $result;
1361 eval { $result = $eis->getStatus($id) };
1362 if ( $@ ) {
1363 carp("ERROR: get_status(): EIS database transaction failed. Reason:\n$@\n");
1365 return $result;
1368 # Get child workspace approval status from EIS,
1369 # return undef in case of error.
1370 sub set_status_in_eis
1372 my $self = shift;
1373 my $status = shift;
1374 my $method = 'set';
1375 $method .= (defined $status) ? $status : 'Integrated';
1377 # check if child workspace is valid
1378 my $id = $self->eis_id();
1379 if ( !$id ) {
1380 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1381 return undef;
1383 my $eis = Cws::eis();
1384 my $result;
1385 if (defined $status) {
1386 eval { $result = $eis->setFixedOnMaster($id) };
1387 } else {
1388 eval { $result = $eis->setIntegrated($id) };
1390 if ( $@ ) {
1391 carp("ERROR: $method(): EIS database transaction failed. Reason:\n$@\n");
1393 return $result;
1396 # Get child workspace approval status from EIS,
1397 # return undef in case of error.
1398 sub set_integration_milestone_in_eis
1400 my $self = shift;
1401 my $milestone = shift;
1402 my $buildid = shift;
1404 # check if child workspace is valid
1405 my $id = $self->eis_id();
1406 if ( !$id ) {
1407 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1408 return undef;
1411 my $eis = Cws::eis();
1413 # just in case ...
1414 if ( !defined($milestone) ) {
1415 $milestone = Eis::to_string('');
1417 # $buildid must be transfered as string
1418 if ( !defined($buildid) ) {
1419 $buildid = Eis::to_string('');
1421 else {
1422 $buildid = Eis::to_string($buildid);
1425 my $result;
1426 eval { $result = $eis->setIntegrationMilestone($id, $milestone, $buildid) };
1427 if ( $@ ) {
1428 carp("ERROR: set_integration_milestone(): EIS database transaction failed. Reason:\n$@\n");
1430 return $result;
1433 sub set_milestone_buildid_in_eis
1435 my $self = shift;
1436 my $master = shift;
1437 my $milestone = shift;
1438 my $buildid = shift;
1440 $master = Eis::to_string($master);
1441 $milestone = Eis::to_string($milestone);
1442 $buildid = Eis::to_string($buildid);
1444 my $eis = Cws::eis();
1445 my $result;
1446 eval { $result = $eis->setMilestoneBuild( $master, $milestone, $buildid ) };
1447 if ( $@ ) {
1448 carp("ERROR: set_milestone_buildid(): EIS database transaction failed. Reason:\n$@\n");
1450 return $result;
1453 sub set_current_milestone_in_eis
1455 my $self = shift;
1456 my $master = shift;
1457 my $milestone = shift;
1459 $master = Eis::to_string($master);
1460 $milestone = Eis::to_string($milestone);
1462 my $eis = Cws::eis();
1463 my $result;
1464 eval { $result = $eis->setCurrentMilestone( $master, $milestone ) };
1465 if ( $@ ) {
1466 carp("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1468 return $result;
1471 sub get_current_milestone_from_eis
1473 my $self = shift;
1474 my $master = shift;
1476 $master = Eis::to_string($master);
1478 my $eis = Cws::eis();
1479 my $result;
1480 eval { $result = $eis->getCurrentMilestone( $master ) };
1481 if ( $@ ) {
1482 carp("ERROR: get_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1484 return $result;
1487 sub get_masters_from_eis
1489 my $self = shift;
1491 my $eis = Cws::eis();
1492 my @result;
1493 eval { @result = $eis->getMasterWorkspaces() };
1494 if ( $@ ) {
1495 carp("ERROR: get_masters(): EIS database transaction failed. Reason:\n$@\n");
1498 my @result2=();
1499 my $i=0;
1500 while ( defined($result[0][$i]) ) {
1501 push @result2,$result[0][$i];
1502 $i++;
1504 return @result2;
1508 sub get_milestones_from_eis
1510 my $self = shift;
1511 my $master = shift;
1513 $master = Eis::to_string($master);
1515 my $eis = Cws::eis();
1516 my @result;
1517 eval { @result = $eis->getMilestones( $master ) };
1518 if ( $@ ) {
1519 carp("ERROR: get_milestones(): EIS database transaction failed. Reason:\n$@\n");
1521 my @result2=();
1522 my $i=0;
1523 while ( defined($result[0][$i]) ) {
1524 push @result2,$result[0][$i];
1525 $i++;
1527 return @result2;
1530 # Get child workspace owner from EIS,
1531 # return undef in case of error.
1532 sub expand_buildid_in_eis
1534 my $self = shift;
1535 my $bid = shift;
1537 # check if child workspace is valid
1538 my $id = $self->eis_id();
1539 if ( !$id ) {
1540 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1541 return undef;
1544 my $name = $self->child();
1546 my $eis = Cws::eis();
1547 my $result;
1548 eval { $result = $eis->expandBuildId($bid, $name) };
1549 if ( $@ ) {
1550 carp("ERROR: expand_builid(): EIS database transaction failed. Reason:\n$@\n");
1552 return $result;
1555 sub set_milestone_removed_in_eis
1557 my $self = shift;
1558 my $master = shift;
1559 my $milestone = shift;
1561 $master = Eis::to_string($master);
1562 $milestone = Eis::to_string($milestone);
1564 my $eis = Cws::eis();
1565 eval { $eis->minorRemoved( $master, $milestone ) };
1566 if ( $@ ) {
1567 carp("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1569 return;
1572 sub is_milestone_registered_with_eis
1574 my $self = shift;
1575 my $master = shift;
1576 my $milestone = shift;
1578 $master = Eis::to_string($master);
1579 $milestone = Eis::to_string($milestone);
1581 my $eis = Cws::eis();
1582 my $result;
1583 eval { $result = $eis->isMilestoneValid($master, $milestone) };
1584 if ( $@ ) {
1585 carp("ERROR: is_milestone(): EIS database transaction failed. Reason:\n$@\n");
1587 return $result;
1590 sub get_is_milestone_used_from_eis
1592 my $self = shift;
1593 my $master = shift;
1594 my $milestone = shift;
1596 $master = Eis::to_string($master);
1597 $milestone = Eis::to_string($milestone);
1599 my $eis = Cws::eis();
1600 my $result;
1601 eval { $result = $eis->isMilestoneInUse($master, $milestone) };
1602 if ( $@ ) {
1603 carp("ERROR: is_milestone_used(): EIS database transaction failed. Reason:\n$@\n");
1605 return $result;
1608 sub get_buildid_for_milestone
1610 my $self = shift;
1611 my $master = shift;
1612 my $milestone = shift;
1614 $master = Eis::to_string($master);
1615 $milestone = Eis::to_string($milestone);
1617 my $eis = Cws::eis();
1618 my $result;
1619 eval { $result = $eis->getMilestoneBuild($master, $milestone) };
1620 if ( $@ ) {
1621 carp("ERROR: get_buildid_for_milestone(): EIS database transaction failed. Reason:\n$@\n");
1623 return $result;
1626 sub get_childworkspaces_for_milestone
1628 my $self = shift;
1629 my $master = shift;
1630 my $milestone = shift;
1632 $master = Eis::to_string($master);
1633 $milestone = Eis::to_string($milestone);
1635 my $eis = Cws::eis();
1636 my $result;
1637 eval { $result = $eis->searchChildWorkspacesForMilestone($master, $milestone) };
1638 if ( $@ ) {
1639 carp("ERROR: get_childworkspaces_for_milestone(): EIS database transaction failed. Reason:\n$@\n");
1641 return $result;
1644 sub get_cws_with_state_from_eis {
1645 my $self = shift;
1646 my $mws = shift;
1647 my $status = shift;
1649 my $eis = Cws::eis();
1650 my $result;
1651 eval { $result = $eis->getCWSWithState($mws, $status) };
1652 if ( $@ ) {
1653 carp("ERROR: get_cws_with_state_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1655 return $result;
1658 sub get_task_prios_of_tasks
1660 my $self = shift;
1661 my $ref_taskids = shift;
1663 my $eis = Cws::eis();
1664 my $result;
1665 my @items = ();
1666 foreach ( @{$ref_taskids} ) {
1667 push(@items, Eis::to_string($_));
1670 eval { $result = $eis->getTasksPriorities( \@items ) };
1671 if ( $@ ) {
1672 carp("ERROR: get_task_prios_of_tasks(): EIS database transaction failed. Reason:\n$@\n");
1674 return $result;
1677 sub get_creation_master_from_eis
1679 my $self = shift;
1681 # check if child workspace is valid
1682 my $id = $self->eis_id();
1683 if ( !$id ) {
1684 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1685 return undef;
1688 my $eis = Cws::eis();
1689 my $result;
1690 eval { $result = $eis->getCreationMasterWorkspace($id) };
1691 if ( $@ ) {
1692 carp("ERROR: get_creation_master(): EIS database transaction failed. Reason:\n$@\n");
1694 return $result;
1698 sub get_milestone_integrated_from_eis
1700 my $self = shift;
1702 # check if child workspace is valid
1703 my $id = $self->eis_id();
1704 if ( !$id ) {
1705 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1706 return undef;
1709 my $eis = Cws::eis();
1710 my $result;
1711 eval { $result = $eis->getMilestoneIntegrated($id) };
1712 if ( $@ ) {
1713 carp("ERROR: get_milestone_integrated(): EIS database transaction failed. Reason:\n$@\n");
1715 return $result;
1719 # get isPublic flag from eis
1720 sub get_public_flag_from_eis
1722 my $self = shift;
1724 # check if child workspace is valid
1725 my $id = $self->eis_id();
1726 if ( !$id ) {
1727 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1728 return undef;
1731 my $eis = Cws::eis();
1732 my $result;
1733 eval { $result = $eis->isPublic($id) };
1734 if ( $@ ) {
1735 carp("ERROR: get_public_flag(): EIS database transaction failed. Reason:\n$@\n");
1737 return $result;
1740 # get isPublicMaster flag from eis
1741 sub get_publicmaster_flag_from_eis
1743 my $self = shift;
1745 # check if child workspace is valid
1746 my $master = $self->master();
1747 if ( !$master ) {
1748 carp("ERROR: MasterWorkspace not defined.\n");
1749 return undef;
1752 my $eis = Cws::eis();
1753 my $result;
1754 eval { $result = $eis->isPublicMaster($master) };
1755 if ( $@ ) {
1756 carp("ERROR: get_publicmaster_flag(): EIS database transaction failed. Reason:\n$@\n");
1758 return $result;
1761 # get isSubVersion flag from eis
1762 sub get_subversion_flag_from_eis
1764 my $self = shift;
1766 # check if child workspace is valid
1767 my $id = $self->eis_id();
1768 if ( !$id ) {
1769 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1770 return undef;
1773 my $eis = Cws::eis();
1774 my $result;
1775 eval { $result = $eis->isSubVersion($id) };
1776 if ( $@ ) {
1777 carp("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n");
1779 return $result;
1782 # set isSubVersion flag in eis
1783 sub set_subversion_flag_in_eis
1785 my $self=shift;
1786 my $status=shift;
1788 my $bool_status=SOAP::Data->type(boolean => $status);
1790 # check if child workspace is valid
1791 my $id = $self->eis_id();
1792 if ( !$id ) {
1793 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1794 return undef;
1797 my $eis = Cws::eis();
1798 my $result;
1799 eval { $result = $eis->setSubVersion($id,$bool_status) };
1800 if ( $@ ) {
1801 carp("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n");
1803 return $result;
1806 sub get_scm_from_eis
1808 my $self = shift;
1810 # check if child workspace is valid
1811 my $id = $self->eis_id();
1812 if ( !$id ) {
1813 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1814 return undef;
1817 my $eis = Cws::eis();
1818 my $result;
1819 eval { $result = $eis->getSCMName($id) };
1820 if ( $@ ) {
1821 carp("ERROR: get_scm_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1823 return $result;
1826 sub set_scm_in_eis
1828 my $self = shift;
1829 my $scm_name = shift;
1831 # check if child workspace is valid
1832 my $id = $self->eis_id();
1833 if ( !$id ) {
1834 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1835 return undef;
1838 my $eis = Cws::eis();
1839 eval { $eis->setSCMName($id, $scm_name) };
1840 if ( $@ ) {
1841 carp("ERROR: set_scm_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1842 return 0;
1844 return 1;
1847 sub is_uirelevant_from_eis
1849 my $self = shift;
1851 # check if child workspace is valid
1852 my $id = $self->eis_id();
1853 if ( !$id ) {
1854 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1855 return undef;
1858 my $eis = Cws::eis();
1859 my $result;
1860 eval { $result = $eis->isUIRelevant($id) };
1861 if ( $@ ) {
1862 carp("ERROR: is_uirelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1865 return $result;
1868 sub is_helprelevant_from_eis
1870 my $self = shift;
1872 # check if child workspace is valid
1873 my $id = $self->eis_id();
1874 if ( !$id ) {
1875 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1876 return undef;
1879 my $eis = Cws::eis();
1880 my $result;
1881 eval { $result = $eis->isHelpRelevant( $id ) };
1882 if ( $@ ) {
1883 carp("ERROR: is_helprelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1886 return $result;
1888 sub set_word_count_in_eis
1890 my $self = shift;
1891 my $language = shift;
1892 my $wordcount = shift;
1894 # check if child workspace is valid
1895 my $id = $self->eis_id();
1896 if ( !$id ) {
1897 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1898 return undef;
1901 my $eis = Cws::eis();
1902 my $result;
1903 eval { $result = $eis->setWordCount( $id , $language , $wordcount ) };
1904 if ( $@ ) {
1905 carp("ERROR: set_word_count_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1908 return $result;
1912 sub get_l10n_status_from_eis
1914 my $self = shift;
1916 # check if child workspace is valid
1917 my $id = $self->eis_id();
1918 if ( !$id ) {
1919 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1920 return undef;
1923 my $eis = Cws::eis();
1924 my $result;
1925 eval { $result = $eis->getL10n( $id ) };
1926 if ( $@ ) {
1927 carp("ERROR: get_l10n_status_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1930 return $result;
1933 sub set_l10n_status_in_eis
1935 my $self = shift;
1936 my $status = Eis::to_string( shift );
1938 # check if child workspace is valid
1939 my $id = $self->eis_id();
1940 if ( !$id ) {
1941 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1942 return undef;
1945 my $eis = Cws::eis();
1946 my $result;
1948 eval { $result = $eis->setL10n( $id , $status ) };
1949 if ( $@ ) {
1950 carp("ERROR: set_l10n_status_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1953 return $result;
1956 sub get_is_cws_cloneable_from_eis
1958 my $self = shift;
1959 my $master = Eis::to_string( shift );
1961 # check if child workspace is valid
1962 my $id = $self->eis_id();
1963 if ( !$id ) {
1964 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1965 return undef;
1968 my $eis = Cws::eis();
1969 my $result;
1971 eval { $result = $eis->isClonableForMaster($id, $master) };
1972 if ( $@ ) {
1973 carp("ERROR: get_is_cws_cloneable_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1976 return $result;
1979 sub clone_cws_in_eis
1981 my $self = shift;
1982 my $master = Eis::to_string( shift );
1984 # check if child workspace is valid
1985 my $id = $self->eis_id();
1986 if ( !$id ) {
1987 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
1988 return undef;
1991 my $eis = Cws::eis();
1992 my $result;
1994 eval { $eis->cloneForMaster($id, $master) };
1995 if ( $@ ) {
1996 carp("ERROR: clone_cws_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1997 return 0;
2000 return 1;
2003 sub get_release_from_eis
2005 my $self = shift;
2006 my $master = Eis::to_string( shift );
2008 # check if child workspace is valid
2009 my $id = $self->eis_id();
2010 if ( !$id ) {
2011 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
2012 return undef;
2015 my $eis = Cws::eis();
2016 my $result;
2018 eval { $result = $eis->getRelease($id) };
2019 if ( $@ ) {
2020 carp("ERROR: get_release_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2023 return $result;
2026 sub get_due_date_from_eis
2028 my $self = shift;
2029 my $master = Eis::to_string( shift );
2031 # check if child workspace is valid
2032 my $id = $self->eis_id();
2033 if ( !$id ) {
2034 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
2035 return undef;
2038 my $eis = Cws::eis();
2039 my $result;
2041 eval { $result = $eis->getDueDate($id) };
2042 if ( $@ ) {
2043 carp("ERROR: get_due_date_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2046 return $result;
2049 sub get_due_date_qa_from_eis
2051 my $self = shift;
2052 my $master = Eis::to_string( shift );
2054 # check if child workspace is valid
2055 my $id = $self->eis_id();
2056 if ( !$id ) {
2057 carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
2058 return undef;
2061 my $eis = Cws::eis();
2062 my $result;
2064 eval { $result = $eis->getDueDateQA($id) };
2065 if ( $@ ) {
2066 carp("ERROR: get_due_date_qa_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2069 return $result;
2073 #logging
2074 sub set_log_entry_in_eis
2076 my $self = shift;
2077 my $commandline = shift;
2078 my $vcsid = shift;
2079 my $start = shift;
2080 my $end = shift;
2081 my $comment = shift;
2083 $commandline = SOAP::Data->type(string => $commandline);
2084 $comment = SOAP::Data->type(string => $comment);
2086 # *format* for $start and $end = "2003-05-28 12:34:59";
2088 #=====================================================
2089 #TO DO:
2090 #experimenell für saubere schnittstelle
2091 #$start = SOAP::Data->type(dateTime => $start);
2092 #$end = SOAP::Data->type(dateTime => $end);
2093 #=====================================================
2095 my $eis = Cws::eis();
2096 my $result;
2097 eval { $result = $eis->storeCommandLogEntry( $commandline, $vcsid, $start, $end, $comment ) };
2098 if ( $@ ) {
2099 carp("ERROR: set_log_entry(): Logging failed. Reason:\n$@\n");
2101 return $result;
2104 #set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname);
2105 sub set_log_entry_extended_in_eis
2107 my $self = shift;
2108 my $commandname = shift;
2109 my $parameter = shift;
2110 my $vcsid = shift;
2111 my $start = shift;
2112 my $end = shift;
2113 my $comment = shift;
2114 my $mastername = shift;
2115 my $childname = shift;
2117 $commandname = SOAP::Data->type(string => $commandname);
2118 $parameter = SOAP::Data->type(string => $parameter);
2119 $comment = SOAP::Data->type(string => $comment);
2120 $mastername = SOAP::Data->type(string => $mastername);
2121 $childname = SOAP::Data->type(string => $childname);
2123 # *format* for $start and $end = "2003-05-28 12:34:59";
2125 #=====================================================
2126 #TO DO:
2127 #experimenell für saubere schnittstelle
2128 #$start = SOAP::Data->type(dateTime => $start);
2129 #$end = SOAP::Data->type(dateTime => $end);
2130 #=====================================================
2132 my $eis = Cws::eis();
2133 my $result;
2134 eval { $result = $eis->storeCommandLogEntry($commandname, $parameter, $vcsid, $start, $end, $comment, $mastername, $childname) };
2135 if ( $@ ) {
2136 carp("ERROR: set_log_entry_extended(): Logging failed. Reason:\n$@\n");
2138 return $result;
2142 #### class methods ####
2144 sub init_eis_connector
2146 my $eis = Eis->new( uri => Cws::eis_uri(),
2147 proxy_list => Cws::eis_proxy_list(),
2148 net_proxy => Cws::net_proxy()
2150 return $eis;
2153 ####
2155 1; # needed by "use" or "require"
2156 # vim: set ts=4 shiftwidth=4 expandtab syntax=perl: