1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
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
47 my $config = CwsConfig
::get_config
();
49 ##### class data #####
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(),
64 my $class = ref($invocant) || $invocant;
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)
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,
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)) {
112 my $ucdatum = uc($datum);
114 # set item in database
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
120 || $self->set_item_in_eis($datum, $item) )
122 $self->{uc($datum)} = $item;
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)) {
141 # get current item list
142 # fetch list from EIS database if called the first time
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)) {
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
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);
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
194 sub is_cws_name_available
198 my $is_available = $self->is_cws_name_available_in_eis();
199 return $is_available;
202 # Register new child workspace with the EIS database.
207 my $location = shift;
209 my $child_id = $self->register_child_with_eis($vcsid, $location);
213 # Promote a child workspace with status 'planned' to a full CWS
218 my $location = shift;
220 my $rc = $self->promote_child_in_eis($vcsid, $location);
224 # New style add_module method. Takes an additional bool indicating if
225 # a module is public or private. Obsoletes add_modules()
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.
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.
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.
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);
285 # Add a file to the patch file list.
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);
306 # Procedure retrieves the workspace which
307 # is based on cvs head (not branch)
310 my $eis = Cws
::eis
();
312 eval { $result = $eis->getCVSHead() };
314 carp
("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
319 #### public class methods ####
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 ) {
337 return 'mws_' . lc($master);
343 my $eis = Cws
::eis
();
345 my $child = Eis
::to_string
($self->child());
346 eval { $masters = $eis->getMastersForCWS($child) };
348 carp
("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
353 # Returns the branch and root tags for child workspace.
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();
366 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
370 my $childws = $self->child();
371 # check if child workspace is a clone,
372 if ( $childws =~ /(\w+)_[[:upper:]]{3}\d{3}/ ) {
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");
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
401 return $self->get_owner_from_eis();
404 # get childworkspace qarep
409 return $self->get_qarep_from_eis();
412 # store an Attachment to a given CWS
417 my $mediatype = 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.
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
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
449 my $milestone = 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
460 return $self->get_creation_master_from_eis();
463 # Get the 'public' flag indicating whether a CWS is visible on OOo
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
477 return $self->get_publicmaster_flag_from_eis();
481 sub get_subversion_flag
{
485 return $self->get_subversion_flag_from_eis();
488 sub set_subversion_flag
{
493 return $self->set_subversion_flag_in_eis($value);
499 return $self->get_scm_from_eis();
504 my $scm_name = shift;
506 return $self->set_scm_in_eis($scm_name);
510 # Check if milestone exists
515 my $milestone = shift;
517 return $self->is_milestone_registered_with_eis($master, $milestone);
520 # Check if this cws contains new ui
525 return $self->is_uirelevant_from_eis();
528 # Check if this cws contains new online help
533 return $self->is_helprelevant_from_eis();
536 # Set the l10n status
542 return $self->set_l10n_status_in_eis( $status );
545 # Get the l10n status
550 return $self->get_l10n_status_from_eis();
555 my $language = shift;
556 my $wordcount = shift;
558 return $self->set_word_count_in_eis( $language , $wordcount );
562 # Get target release for CWS
567 return $self->get_release_from_eis();
575 return $self->get_due_date_from_eis();
583 return $self->get_due_date_qa_from_eis();
586 # Query master milestone combination for being used by an
588 sub is_milestone_used
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
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
613 return $self->get_current_milestone_from_eis($master);
616 sub get_milestone_integrated
620 return $self->get_milestone_integrated_from_eis();
629 return $self->get_masters_from_eis();
632 # Get milestones for MWS.
638 return $self->get_milestones_from_eis($master);
640 # get build string for CWS
645 my $master = $self->master();
646 my $milestone = $self->milestone();
647 if ( ! defined($milestone) ) {
650 my $bid=$self->get_buildid($master,$milestone);
651 if ( ! defined($bid) ) {
654 return $self->expand_buildid($bid);
659 # expand build for given cwsname
664 return $self->expand_buildid_in_eis($bid);
668 # Set BuildID of milestone
669 sub set_milestone_buildid
673 my $milestone = 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
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
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.
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
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
734 my $ref_taskids = shift;
735 return @
{$self->get_task_prios_of_tasks($ref_taskids)};
738 # Check is CWS is cloneable for specified master
744 return $self->get_is_cws_cloneable_from_eis($master);
747 # Clone CWS for specified master
753 return $self->clone_cws_in_eis($master);
759 my $commandline = shift;
764 return $self->set_log_entry_in_eis($commandline, $vcsid, $start, $stop, $comment);
767 sub set_log_entry_extended
770 my $commandname = shift;
771 my $parameter = 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);
785 # class data accessor methods
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)) {
801 shift; # ignore calling class/object
802 return $CwsClassData{uc($datum)};
806 #### helper 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.
819 my $optional_data = shift;
822 if ( $type eq 'modules' ) {
823 $items_ref = $self->modules();
825 elsif ( $type eq 'taskids' ) {
826 $items_ref = $self->taskids();
829 # fall through, can't happen
830 carp
("ERROR: wrong item type\n");
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);
850 # something went wrong
857 # Get EIS id for workspace from EIS database
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() ) {
868 my $master = Eis
::to_string
($self->master());
869 my $child = Eis
::to_string
($self->child());
872 eval { $result = int($eis->getChildWorkspaceId($master, $child)) };
874 carp
("ERROR: get_eis_id(): EIS database transaction failed. Reason:\n$@\n");
879 sub fetch_item_from_eis
884 my $eis = Cws
::eis
();
885 my $id = $self->eis_id();
888 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
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
}
902 # fall through, can't happen
903 carp
("ERROR: wrong item type\n");
907 carp
("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n");
918 my $eis = Cws
::eis
();
919 my $id = $self->eis_id();
922 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
926 # make certain that the item is a string, otherwise
927 # autotyping will occasionally choose the wrong type
928 $item = Eis
::to_string
($item);
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) };
942 # fall through, can't happen
943 carp
("ERROR: wrong item type\n");
948 carp
("ERROR: set_item(): EIS database transaction failed. Reason:\n$@\n");
955 sub set_master_and_milestone_in_eis
959 my $milestone = shift;
961 my $eis = Cws
::eis
();
962 my $id = $self->eis_id();
965 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
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);
975 # this operation invalidates the cached tags list
976 $self->{_CACHED_TAGS
} = undef;
977 eval { $result = $eis->setMasterWorkspaceAndMilestone($id, $master, $milestone) };
980 carp
("ERROR: set_master_and_milestone(): EIS database transaction failed. Reason:\n$@\n");
987 sub fetch_items_from_eis
992 my $eis = Cws
::eis
();
993 my $id = $self->eis_id();
996 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
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) };
1023 # fall through, can't happen
1024 carp
("ERROR: wrong item type\n");
1028 carp
("ERROR: fetch_item(): EIS database transaction failed. Reason:\n$@\n");
1033 sub add_items_to_eis
1037 my $optional_data = shift;
1038 my $item_ref = shift;
1040 my $eis = Cws
::eis
();
1041 my $id = $self->eis_id();
1044 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1048 # make certain that all items are strings, otherwise
1049 # autotyping will occasionally choose the wrong type
1051 foreach ( @
{$item_ref} ) {
1052 push(@items, Eis
::to_string
($_));
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) };
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) };
1070 # fall through, can't happen
1071 carp
("ERROR: wrong item type\n");
1076 carp
("ERROR: add_item(): EIS database transaction failed. Reason:\n$@\n");
1079 return 1 if $result;
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();
1098 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
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 ...
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;
1112 push(@taskids, Eis
::to_string
(''));
1116 $revision = Eis
::to_string
($revision);
1118 if ( !$archive_path ) {
1119 $archive_path = Eis
::to_string
('');
1124 $result = $eis->addFile($id, $module, $file, $archive_path,
1125 $revision, $authors_ref, \
@taskids)
1128 carp
("ERROR: add_file(): EIS database transaction failed. Reason:\n$@\n");
1131 return 1 if $result;
1135 sub add_patch_file_to_eis
1140 my $eis = Cws
::eis
();
1141 my $id = $self->eis_id();
1144 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1149 eval { $result = $eis->addOutputFile($id, $file) };
1151 carp
("ERROR: add_patch_file(): EIS database transaction failed. Reason:\n$@\n");
1154 return $1;# appOutputFile has void as return value ...
1157 sub is_cws_name_available_in_eis
1161 if ( !$self->master() ) {
1162 carp
("ERROR: master workspace name not set\n");
1166 if ( !$self->child() ) {
1167 carp
("ERROR: child workspace name not set\n");
1171 my $eis = Cws
::eis
();
1172 my $master = Eis
::to_string
($self->master());
1173 my $child = Eis
::to_string
($self->child());
1176 eval { $result = $eis->isChildWorkspaceUnique($master, $child) };
1178 carp
("ERROR: is_cws_name_available(): EIS database transaction failed. Reason:\n$@\n");
1183 sub register_child_with_eis
1187 my $location = shift;
1189 if ( !$self->master() ) {
1190 carp
("ERROR: master workspace name not set\n");
1194 if ( !$self->milestone() ) {
1195 carp
("ERROR: master milestone not set\n");
1199 if ( !$self->child() ) {
1200 carp
("ERROR: child workspace name not set\n");
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);
1217 $result = $eis->createChildWorkspace($master, $milestone, $child,
1222 carp
("ERROR: create_child_wortkspace(): EIS database transaction failed. Reason:\n$@\n");
1225 # set EIS_ID directly, since $self->eis_id() is not
1226 # supposed to take parameters.
1227 $self->{EIS_ID
} = $result;
1231 sub promote_child_in_eis
1235 my $location = shift;
1237 my $eis = Cws
::eis
();
1238 my $id = $self->eis_id();
1241 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1245 if ( !$self->milestone() ) {
1246 carp
("ERROR: master milestone not set\n");
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);
1260 $result = $eis->initializeChildWorkspace($id, $milestone, $vcsid, $location)
1263 eval { $result = $eis->getStatus($id) };
1265 carp
("ERROR: promote(): EIS database transaction failed. Reason:\n$@\n");
1271 # Get child workspace owner from EIS,
1272 # return undef in case of error.
1273 sub get_owner_from_eis
1277 # check if child workspace is valid
1278 my $id = $self->eis_id();
1280 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1284 my $eis = Cws
::eis
();
1286 eval { $result = $eis->getOwnerEmail($id) };
1288 carp
("ERROR: get_OwnerEmail(): EIS database transaction failed. Reason:\n$@\n");
1293 # Get child workspace qarep from EIS,
1294 # return undef in case of error.
1295 sub get_qarep_from_eis
1299 # check if child workspace is valid
1300 my $id = $self->eis_id();
1302 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1306 my $eis = Cws
::eis
();
1308 eval { $result = $eis->getQARepresentativeEmail($id) };
1310 carp
("ERROR: get_qarep(): EIS database transaction failed. Reason:\n$@\n");
1315 # store an attachment to a given CWS
1316 # return undef in case of error.
1317 sub save_attachment_in_eis
1321 my $mediatype = shift;
1324 # check if child workspace is valid
1325 my $eisid = $self->eis_id();
1328 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
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
();
1339 eval { $result = $eis->saveAttachment($eisid, $eisname, $eismediatype, $eistextstring ) };
1341 carp
("ERROR: save_attachment_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1346 # Get child workspace approval status from EIS,
1347 # return undef in case of error.
1348 sub get_status_from_eis
1352 # check if child workspace is valid
1353 my $id = $self->eis_id();
1355 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1359 my $eis = Cws
::eis
();
1361 eval { $result = $eis->getStatus($id) };
1363 carp
("ERROR: get_status(): EIS database transaction failed. Reason:\n$@\n");
1368 # Get child workspace approval status from EIS,
1369 # return undef in case of error.
1370 sub set_status_in_eis
1375 $method .= (defined $status) ?
$status : 'Integrated';
1377 # check if child workspace is valid
1378 my $id = $self->eis_id();
1380 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1383 my $eis = Cws
::eis
();
1385 if (defined $status) {
1386 eval { $result = $eis->setFixedOnMaster($id) };
1388 eval { $result = $eis->setIntegrated($id) };
1391 carp
("ERROR: $method(): EIS database transaction failed. Reason:\n$@\n");
1396 # Get child workspace approval status from EIS,
1397 # return undef in case of error.
1398 sub set_integration_milestone_in_eis
1401 my $milestone = shift;
1402 my $buildid = shift;
1404 # check if child workspace is valid
1405 my $id = $self->eis_id();
1407 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1411 my $eis = Cws
::eis
();
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
('');
1422 $buildid = Eis
::to_string
($buildid);
1426 eval { $result = $eis->setIntegrationMilestone($id, $milestone, $buildid) };
1428 carp
("ERROR: set_integration_milestone(): EIS database transaction failed. Reason:\n$@\n");
1433 sub set_milestone_buildid_in_eis
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
();
1446 eval { $result = $eis->setMilestoneBuild( $master, $milestone, $buildid ) };
1448 carp
("ERROR: set_milestone_buildid(): EIS database transaction failed. Reason:\n$@\n");
1453 sub set_current_milestone_in_eis
1457 my $milestone = shift;
1459 $master = Eis
::to_string
($master);
1460 $milestone = Eis
::to_string
($milestone);
1462 my $eis = Cws
::eis
();
1464 eval { $result = $eis->setCurrentMilestone( $master, $milestone ) };
1466 carp
("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1471 sub get_current_milestone_from_eis
1476 $master = Eis
::to_string
($master);
1478 my $eis = Cws
::eis
();
1480 eval { $result = $eis->getCurrentMilestone( $master ) };
1482 carp
("ERROR: get_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1487 sub get_masters_from_eis
1491 my $eis = Cws
::eis
();
1493 eval { @result = $eis->getMasterWorkspaces() };
1495 carp
("ERROR: get_masters(): EIS database transaction failed. Reason:\n$@\n");
1500 while ( defined($result[0][$i]) ) {
1501 push @result2,$result[0][$i];
1508 sub get_milestones_from_eis
1513 $master = Eis
::to_string
($master);
1515 my $eis = Cws
::eis
();
1517 eval { @result = $eis->getMilestones( $master ) };
1519 carp
("ERROR: get_milestones(): EIS database transaction failed. Reason:\n$@\n");
1523 while ( defined($result[0][$i]) ) {
1524 push @result2,$result[0][$i];
1530 # Get child workspace owner from EIS,
1531 # return undef in case of error.
1532 sub expand_buildid_in_eis
1537 # check if child workspace is valid
1538 my $id = $self->eis_id();
1540 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1544 my $name = $self->child();
1546 my $eis = Cws
::eis
();
1548 eval { $result = $eis->expandBuildId($bid, $name) };
1550 carp
("ERROR: expand_builid(): EIS database transaction failed. Reason:\n$@\n");
1555 sub set_milestone_removed_in_eis
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 ) };
1567 carp
("ERROR: set_current_milestone(): EIS database transaction failed. Reason:\n$@\n");
1572 sub is_milestone_registered_with_eis
1576 my $milestone = shift;
1578 $master = Eis
::to_string
($master);
1579 $milestone = Eis
::to_string
($milestone);
1581 my $eis = Cws
::eis
();
1583 eval { $result = $eis->isMilestoneValid($master, $milestone) };
1585 carp
("ERROR: is_milestone(): EIS database transaction failed. Reason:\n$@\n");
1590 sub get_is_milestone_used_from_eis
1594 my $milestone = shift;
1596 $master = Eis
::to_string
($master);
1597 $milestone = Eis
::to_string
($milestone);
1599 my $eis = Cws
::eis
();
1601 eval { $result = $eis->isMilestoneInUse($master, $milestone) };
1603 carp
("ERROR: is_milestone_used(): EIS database transaction failed. Reason:\n$@\n");
1608 sub get_buildid_for_milestone
1612 my $milestone = shift;
1614 $master = Eis
::to_string
($master);
1615 $milestone = Eis
::to_string
($milestone);
1617 my $eis = Cws
::eis
();
1619 eval { $result = $eis->getMilestoneBuild($master, $milestone) };
1621 carp
("ERROR: get_buildid_for_milestone(): EIS database transaction failed. Reason:\n$@\n");
1626 sub get_childworkspaces_for_milestone
1630 my $milestone = shift;
1632 $master = Eis
::to_string
($master);
1633 $milestone = Eis
::to_string
($milestone);
1635 my $eis = Cws
::eis
();
1637 eval { $result = $eis->searchChildWorkspacesForMilestone($master, $milestone) };
1639 carp
("ERROR: get_childworkspaces_for_milestone(): EIS database transaction failed. Reason:\n$@\n");
1644 sub get_cws_with_state_from_eis
{
1649 my $eis = Cws
::eis
();
1651 eval { $result = $eis->getCWSWithState($mws, $status) };
1653 carp
("ERROR: get_cws_with_state_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1658 sub get_task_prios_of_tasks
1661 my $ref_taskids = shift;
1663 my $eis = Cws
::eis
();
1666 foreach ( @
{$ref_taskids} ) {
1667 push(@items, Eis
::to_string
($_));
1670 eval { $result = $eis->getTasksPriorities( \
@items ) };
1672 carp
("ERROR: get_task_prios_of_tasks(): EIS database transaction failed. Reason:\n$@\n");
1677 sub get_creation_master_from_eis
1681 # check if child workspace is valid
1682 my $id = $self->eis_id();
1684 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1688 my $eis = Cws
::eis
();
1690 eval { $result = $eis->getCreationMasterWorkspace($id) };
1692 carp
("ERROR: get_creation_master(): EIS database transaction failed. Reason:\n$@\n");
1698 sub get_milestone_integrated_from_eis
1702 # check if child workspace is valid
1703 my $id = $self->eis_id();
1705 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1709 my $eis = Cws
::eis
();
1711 eval { $result = $eis->getMilestoneIntegrated($id) };
1713 carp
("ERROR: get_milestone_integrated(): EIS database transaction failed. Reason:\n$@\n");
1719 # get isPublic flag from eis
1720 sub get_public_flag_from_eis
1724 # check if child workspace is valid
1725 my $id = $self->eis_id();
1727 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1731 my $eis = Cws
::eis
();
1733 eval { $result = $eis->isPublic($id) };
1735 carp
("ERROR: get_public_flag(): EIS database transaction failed. Reason:\n$@\n");
1740 # get isPublicMaster flag from eis
1741 sub get_publicmaster_flag_from_eis
1745 # check if child workspace is valid
1746 my $master = $self->master();
1748 carp
("ERROR: MasterWorkspace not defined.\n");
1752 my $eis = Cws
::eis
();
1754 eval { $result = $eis->isPublicMaster($master) };
1756 carp
("ERROR: get_publicmaster_flag(): EIS database transaction failed. Reason:\n$@\n");
1761 # get isSubVersion flag from eis
1762 sub get_subversion_flag_from_eis
1766 # check if child workspace is valid
1767 my $id = $self->eis_id();
1769 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1773 my $eis = Cws
::eis
();
1775 eval { $result = $eis->isSubVersion($id) };
1777 carp
("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n");
1782 # set isSubVersion flag in eis
1783 sub set_subversion_flag_in_eis
1788 my $bool_status=SOAP
::Data
->type(boolean
=> $status);
1790 # check if child workspace is valid
1791 my $id = $self->eis_id();
1793 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1797 my $eis = Cws
::eis
();
1799 eval { $result = $eis->setSubVersion($id,$bool_status) };
1801 carp
("ERROR: get_subversion_flag(): EIS database transaction failed. Reason:\n$@\n");
1806 sub get_scm_from_eis
1810 # check if child workspace is valid
1811 my $id = $self->eis_id();
1813 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1817 my $eis = Cws
::eis
();
1819 eval { $result = $eis->getSCMName($id) };
1821 carp
("ERROR: get_scm_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1829 my $scm_name = shift;
1831 # check if child workspace is valid
1832 my $id = $self->eis_id();
1834 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1838 my $eis = Cws
::eis
();
1839 eval { $eis->setSCMName($id, $scm_name) };
1841 carp
("ERROR: set_scm_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1847 sub is_uirelevant_from_eis
1851 # check if child workspace is valid
1852 my $id = $self->eis_id();
1854 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1858 my $eis = Cws
::eis
();
1860 eval { $result = $eis->isUIRelevant($id) };
1862 carp
("ERROR: is_uirelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1868 sub is_helprelevant_from_eis
1872 # check if child workspace is valid
1873 my $id = $self->eis_id();
1875 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1879 my $eis = Cws
::eis
();
1881 eval { $result = $eis->isHelpRelevant( $id ) };
1883 carp
("ERROR: is_helprelevant_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1888 sub set_word_count_in_eis
1891 my $language = shift;
1892 my $wordcount = shift;
1894 # check if child workspace is valid
1895 my $id = $self->eis_id();
1897 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1901 my $eis = Cws
::eis
();
1903 eval { $result = $eis->setWordCount( $id , $language , $wordcount ) };
1905 carp
("ERROR: set_word_count_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1912 sub get_l10n_status_from_eis
1916 # check if child workspace is valid
1917 my $id = $self->eis_id();
1919 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1923 my $eis = Cws
::eis
();
1925 eval { $result = $eis->getL10n( $id ) };
1927 carp
("ERROR: get_l10n_status_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1933 sub set_l10n_status_in_eis
1936 my $status = Eis
::to_string
( shift );
1938 # check if child workspace is valid
1939 my $id = $self->eis_id();
1941 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1945 my $eis = Cws
::eis
();
1948 eval { $result = $eis->setL10n( $id , $status ) };
1950 carp
("ERROR: set_l10n_status_in_eis(): EIS database transaction failed. Reason:\n$@\n");
1956 sub get_is_cws_cloneable_from_eis
1959 my $master = Eis
::to_string
( shift );
1961 # check if child workspace is valid
1962 my $id = $self->eis_id();
1964 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1968 my $eis = Cws
::eis
();
1971 eval { $result = $eis->isClonableForMaster($id, $master) };
1973 carp
("ERROR: get_is_cws_cloneable_from_eis(): EIS database transaction failed. Reason:\n$@\n");
1979 sub clone_cws_in_eis
1982 my $master = Eis
::to_string
( shift );
1984 # check if child workspace is valid
1985 my $id = $self->eis_id();
1987 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
1991 my $eis = Cws
::eis
();
1994 eval { $eis->cloneForMaster($id, $master) };
1996 carp
("ERROR: clone_cws_in_eis(): EIS database transaction failed. Reason:\n$@\n");
2003 sub get_release_from_eis
2006 my $master = Eis
::to_string
( shift );
2008 # check if child workspace is valid
2009 my $id = $self->eis_id();
2011 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
2015 my $eis = Cws
::eis
();
2018 eval { $result = $eis->getRelease($id) };
2020 carp
("ERROR: get_release_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2026 sub get_due_date_from_eis
2029 my $master = Eis
::to_string
( shift );
2031 # check if child workspace is valid
2032 my $id = $self->eis_id();
2034 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
2038 my $eis = Cws
::eis
();
2041 eval { $result = $eis->getDueDate($id) };
2043 carp
("ERROR: get_due_date_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2049 sub get_due_date_qa_from_eis
2052 my $master = Eis
::to_string
( shift );
2054 # check if child workspace is valid
2055 my $id = $self->eis_id();
2057 carp
("ERROR: Childworkspace not (yet) registered with EIS.\n");
2061 my $eis = Cws
::eis
();
2064 eval { $result = $eis->getDueDateQA($id) };
2066 carp
("ERROR: get_due_date_qa_from_eis(): EIS database transaction failed. Reason:\n$@\n");
2074 sub set_log_entry_in_eis
2077 my $commandline = 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 #=====================================================
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
();
2097 eval { $result = $eis->storeCommandLogEntry( $commandline, $vcsid, $start, $end, $comment ) };
2099 carp
("ERROR: set_log_entry(): Logging failed. Reason:\n$@\n");
2104 #set_log_entry_extended_in_eis($commandname, $parameter, $vcsid, $start, $stop, $comment, $mastername, $childname);
2105 sub set_log_entry_extended_in_eis
2108 my $commandname = shift;
2109 my $parameter = 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 #=====================================================
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
();
2134 eval { $result = $eis->storeCommandLogEntry($commandname, $parameter, $vcsid, $start, $end, $comment, $mastername, $childname) };
2136 carp
("ERROR: set_log_entry_extended(): Logging failed. Reason:\n$@\n");
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
()
2155 1; # needed by "use" or "require"
2156 # vim: set ts=4 shiftwidth=4 expandtab syntax=perl: