5.7.16. Bugzilla::Component¶
5.7.16.1. NAME¶
Bugzilla::Component - Bugzilla product component class.
5.7.16.2. SYNOPSIS¶
use Bugzilla::Component;
my $component = new Bugzilla::Component($comp_id);
my $component = new Bugzilla::Component({ product => $product, name => $name });
my $bug_count = $component->bug_count();
my $bug_ids = $component->bug_ids();
my $id = $component->id;
my $name = $component->name;
my $description = $component->description;
my $product_id = $component->product_id;
my $default_assignee = $component->default_assignee;
my $default_qa_contact = $component->default_qa_contact;
my $initial_cc = $component->initial_cc;
my $product = $component->product;
my $bug_flag_types = $component->flag_types->{'bug'};
my $attach_flag_types = $component->flag_types->{'attachment'};
my $component = Bugzilla::Component->check({ product => $product, name => $name });
my $component =
Bugzilla::Component->create({ name => $name,
product => $product,
initialowner => $user_login1,
initialqacontact => $user_login2,
description => $description});
$component->set_name($new_name);
$component->set_description($new_description);
$component->set_default_assignee($new_login_name);
$component->set_default_qa_contact($new_login_name);
$component->set_cc_list(\@new_login_names);
$component->update();
$component->remove_from_db;
5.7.16.3. DESCRIPTION¶
Component.pm represents a Product Component object.
5.7.16.4. METHODS¶
new($param)
Description: The constructor is used to load an existing component by passing a component ID or a hash with the product object the component belongs to and the component name. Params: $param - If you pass an integer, the integer is the component ID from the database that we want to read in. However, If you pass in a hash, it must contain two keys: name (string): the name of the component product (object): an object of Bugzilla::Product representing the product that the component belongs to. Returns: A Bugzilla::Component object.
bug_count()
Description: Returns the total of bugs that belong to the component. Params: none. Returns: Integer with the number of bugs.
bug_ids()
Description: Returns all bug IDs that belong to the component. Params: none. Returns: A reference to an array of bug IDs.
default_assignee()
Description: Returns a user object that represents the default assignee for the component. Params: none. Returns: A Bugzilla::User object.
default_qa_contact()
Description: Returns a user object that represents the default QA contact for the component. Params: none. Returns: A Bugzilla::User object if the default QA contact is defined for the component. Otherwise, returns undef.
initial_cc
Description: Returns a list of user objects representing users being in the initial CC list. Params: none. Returns: An arrayref of L<Bugzilla::User> objects.
flag_types()
Description: Returns all bug and attachment flagtypes available for the component. Params: none. Returns: Two references to an array of flagtype objects.
product()
Description: Returns the product the component belongs to. Params: none. Returns: A Bugzilla::Product object.
set_name($new_name)
Description: Changes the name of the component. Params: $new_name - new name of the component (string). This name must be unique within the product. Returns: Nothing.
set_description($new_desc)
Description: Changes the description of the component. Params: $new_desc - new description of the component (string). Returns: Nothing.
set_default_assignee($new_assignee)
Description: Changes the default assignee of the component. Params: $new_owner - login name of the new default assignee of the component (string). This user account must already exist. Returns: Nothing.
set_default_qa_contact($new_qa_contact)
Description: Changes the default QA contact of the component. Params: $new_qa_contact - login name of the new QA contact of the component (string). This user account must already exist. Returns: Nothing.
set_cc_list(\@cc_list)
Description: Changes the list of users being in the CC list by default. Params: \@cc_list - list of login names (string). All the user accounts must already exist. Returns: Nothing.
update()
Description: Write changes made to the component into the DB. Params: none. Returns: A hashref with changes made to the component object.
remove_from_db()
Description: Deletes the current component from the DB. The object itself is not destroyed. Params: none. Returns: Nothing.
5.7.16.5. CLASS METHODS¶
create(\%params)
Description: Create a new component for the given product. Params: The hashref must have the following keys: name - name of the new component (string). This name must be unique within the product. product - a Bugzilla::Product object to which the Component is being added. description - description of the new component (string). initialowner - login name of the default assignee (string). The following keys are optional: initialqacontact - login name of the default QA contact (string), or an empty string to clear it. initial_cc - an arrayref of login names to add to the CC list by default. Returns: A Bugzilla::Component object.