<<

# Bugzilla::Component

- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- CLASS METHODS

# NAME

Bugzilla::Component - Bugzilla product component class.

# 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_bug_type   = $component->default_bug_type;
        my $default_assignee   = $component->default_assignee;
        my $default_qa_contact = $component->default_qa_contact;
        my $initial_cc         = $component->initial_cc;
        my $triage_owner       = $component->triage_owner;
        my $product            = $component->product;
        my $bug_flag_types     = $component->flag_types->{'bug'};
        my $attach_flag_types  = $component->flag_types->{'attachment'};
        my $bug_desc_template  = $component->bug_description_template;

        my $component = Bugzilla::Component->check({ product => $product, name => $name });

        my $component =
          Bugzilla::Component->create({ name             => $name,
                                        product          => $product,
                                        default_bug_type => $default_bug_type,
                                        initialowner     => $user_login1,
                                        initialqacontact => $user_login2,
                                        triage_owner     => $user_login3,
                                        description      => $description});

        $component->set_name($new_name);
        $component->set_description($new_description);
        $component->set_default_bug_type($new_type);
        $component->set_default_assignee($new_login_name);
        $component->set_default_qa_contact($new_login_name);
        $component->set_cc_list(\@new_login_names);
        $component->set_triage_owner($new_triage_owner);
        $component->set_bug_description_template($new_template);
        $component->update();

        $component->remove_from_db;

# DESCRIPTION

Component.pm represents a Product Component object.

# 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. If you pass in a hash with the 'name'
                             and 'product' keys, then the value of the name
                             key is the name of a component being in the given
                             product.

       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_description_template()`

       Description: Returns the default description text for new bugs filed under this
                    component. If missing, the product's template, if any, will be
                    returned.

       Params:      none.

       Returns:     A string.

`bugs_ids()`

       Description: Returns all bug IDs that belong to the component.

       Params:      none.

       Returns:     A reference to an array of bug IDs.

`default_bug_type()`

       Description: Returns the default type for bugs filed under this component.
                    Returns the product's default type or the installation's global
                    default type if the component-specific default type is not set.

       Params:      none.

       Returns:     A string.

`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.

`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.

`triage_owner`

       Description: Returns the user responsible for performing triage on
                    bugs for this component.

       Params:      none

       Returns:     A Bugzilla::User object.

`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.

`find_first_flag_type($target_type, $name)`

       Description: Find the first named bug or attachment flag with a given
                    name on this component.

       Params:      $target_type - 'bug' or 'attachment'
                    $name        - the name of the flag

       Returns:     a new Bugzilla::FlagType object or undef

`set_bug_description_template($new_template)`

       Description: Changes the default description text for new bugs filed under this
                    component.

       Params:      $new_template - new description template of the component (string).

       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_bug_type($new_type)`

       Description: Changes the default bug type of the component.

       Params:      $new_type - one of legal bug types or undef.

       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.

`set_triage_owner`

       Description: Changes the triage owner of the component.

       Params:      $new_triage_owner - login name of the new triage owner (string).

`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.

# 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).
                    default_bug_type  - the default type for bugs filed under this
                                        component (string).
                    initialowner    - login name of the default assignee (string).
                    The following keys are optional:
                    initiaqacontact - 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.
                    triage_owner    - login name of the default triage owner

       Returns:     A Bugzilla::Component object.

<<