NAME

BuildForge::Services::DBO::Filter


SYNOPSIS

        use BuildForge::Services;
        $conn = new BuildForge::Services::Connection($hostname);
        $token = $conn->authUser($user, $pass);
        
        # Getting existing filters
        $allFilters = BuildForge::Services::DBO::Filter->findAll($conn);
        $oldfilter = BuildForge::Services::DBO::Filter->findById($conn, $filterId);
        # Getter / setter functions
        $id = $oldfilter->getFilterId();
        $name = $oldfilter->getFilterName();
        $accessGroupId = $oldfilter->getLevel();
        $pattern1 = $oldfilter->getPattern(1);
        $pattern2 = $oldfilter->getPattern('VARIABLE_NAME');
        $patterns = $oldfilter->getPatterns();
        
        $oldfilter->setFilterName('New Name');
        $level = BuildForge::Services::DBO::AccessGroup->findByName($conn, 'MyAccessGroup');
        $oldfilter->setLevel($level->getLevel());
        $oldfilter->update();
        
        # Filter creation, modification, deletion
        $newfilter = new BuildForge::Services::DBO::Filter($conn);
        $newfilter->setFilterName('New Filter');
        $newfilter->create();
        
        $newfilter2 = $newfilter->clone();
        $newfilter2->setFilterName('Duplicate');
        $newfilter2->create();
        
        $newfilter->setFilterName('New Name For New Filter');
        $newfilter->update();
        $var = new BuildForge::Services::DBO::FilterPattern($conn);
        $var->setPattern('VARIABLE_NAME');
        $newfilter->addFilterPattern($var);
        $newfilter->copyFilterPattern(0, 1);
        $newfilter->moveFilterPattern(1, 0);
        $newfilter->removeFilterPattern(1);
        $newfilter->removeFilterPattern($var);
        
        $newfilter->delete();
                
        $conn->logout;
        $conn->close;


DESCRIPTION

Filter allows you to create, modify, and delete filter groups.


METHODS


METHODS

new BuildForge::Services::DBO::Filter(connection, {FilterParamsHashRef})

Returns a new instance of a Filter object.

connection

A connected BuildForge::Services::Connection object.

FilterParamsHashRef

An optional reference to a hash containing any or all of the following fields.

name

The name of the filter group.

level

The access group ID (from $accessGroup->getLevel()) of the access group the filter belongs to. Users who do not belong to this access group will not be able to view, edit, or use the filter.

BuildForge::Services::DBO::Filter->findAll(connection)

Returns a reference to an array of all the BuildForge::Services::DBO::Filter objects the user has access to in the database. These objects will not contain their FilterPattern subobjects. To get the patterns, use BuildForge::Services::DBO::Filter->findById() with the filter's ID.

connection

A connected BuildForge::Services::Connection object.

BuildForge::Services::DBO::Filter->findById(connection, filterId)

Returns the BuildForge::Services::DBO::Filter object corresponding to the given filter group ID, or undef if no such filter group exists.

connection

A connected BuildForge::Services::Connection object.

filterId

The ID of the desired filter group (from $filter->getFilterId()).

$filter->create()

Creates the filter group within the database.

$filter->clone()

Returns a copy of the BuildForge::Services::DBO::Filter object and all of its FilterPattern patterns. The copy will not exist in the database unless it is created with $filter->create().

$filter->update()

Updates the database with the new filter group settings.

$filter->addFilterPattern(pattern, index)

Adds a filter pattern to the filter group within the database.

pattern

The BuildForge::Services::DBO::FilterPattern object to be added.

index

The optional location at which to add the pattern within the list. 0 adds it to the front of the list, 1 adds it after the first pattern, etc. Leaving it unset adds the pattern to the end of the pattern list.

$filter->moveFilterPattern(from, to)

Moves a filter pattern within the list of patterns in the database.

from

The index of the pattern to move. 0 moves the first pattern, 1 moves the second, etc.

to

The index of the new location for the pattern. 0 moves it to the first position, 1 to the second, etc.

$filter->copyFilterPattern(from, to)

Copies a filter pattern within the filter group in the database.

from

The index of the pattern to be copied. 0 copies the first pattern, 1 copies the second, etc.

to

The index of the location for the new pattern copy. 0 copies it to the first position, 1 to the second, etc.

$filter->removeFilterPattern(pattern)

Removes a filter pattern from the pattern list in the database.

pattern

This may be an index, in which case the pattern at that position is deleted (0 deletes the first pattern, 1 the second, etc.), or a BuildForge::Services::DBO::FilterPattern object, in which case that filter pattern is the one deleted.

$filter->delete()

Deletes the filter and all of its patterns from the database.

$filter->getFilterId()

Returns the ID of the filter group.

$filter->getFilterName()

Returns the name of the filter group.

$filter->getLevel()

Returns the access group ID of the access group the filter belongs to. Users who are not in this access group cannot view, edit, or use the filter group.

$filter->getPattern(pattern)

Returns the BuildForge::Services::DBO::FilterPattern object that corresponds to the requested pattern.

pattern

This may be an index, in which case that pattern is the one returned (0 for the first pattern, 1 for the second, etc.), or a pattern name, in which case the first pattern with that name in the filter group is returned.

$filter->getPatterns()

Returns a reference to an array of BuildForge::Services::DBO::FilterPattern objects for all patterns in the filter group.

$filter->setFilterName(filterName)

Sets the filter group's name. $filter->update() must be run before changes are replicated in the database.

filterName

The new name for the filter group.

$filter->setLevel(accessGroupId)

Sets the filter group's access group. Users who do not belong to this access group will not be able to view, edit, or use the filter. $filter->update() must be run before changes are replicated in the database.

accessGroupId

The access group ID (from $accessGroup->getLevel()) for the desired access group.


COPYRIGHT

Copyright (c)2006-2007 International Business Machines, Inc. All rights reserved.