NAME

BuildForge::Services::DBO::Collector


SYNOPSIS

        use BuildForge::Services;
        $conn = new BuildForge::Services::Connection($hostname);
        $token = $conn->authUser($user, $pass);
        
        # Getting existing collectors
        $allCollectors = BuildForge::Services::DBO::Collector->findAll($conn);
        $oldcollector = BuildForge::Services::DBO::Collector->findById($conn, 'CollectorName');
        # Getter / setter functions
        $id = $oldcollector->getCollectorId();
        $name = $oldcollector->getCollectorName();
        $property1 = $oldcollector->getProperty(1);
        $property2 = $oldcollector->getProperty('BF_JOBS');
        $allProperties = $oldcollector->getProperties();
        $builtInPropertyNames = $oldcollector->getBuiltIns();
        
        $oldcollector->setCollectorId('New Name');
        $oldcollector->setCollectorName('Another New Name');
        $oldcollector->update();
        
        # Collector creation, modification, deletion
        $newcollector = new BuildForge::Services::DBO::Collector($conn);
        $newcollector->setCollectorName('New Collector');
        $newcollector->create();
        
        $newcollector2 = $newcollector->clone();
        $newcollector2->setCollectorName('Duplicate');
        $newcollector2->create();
        
        $newcollector->setCollectorName('New Name For New Collector');
        $newcollector->update();
        $property = new BuildForge::Services::DBO::CollectorProperty($conn);
        $property->setPropertyName('PROP_NAME');
        $property->setPropertyValue('Value');
        $newcollector->addCollectorProperty($property);
        $newcollector->copyCollectorProperty(1, 2);
        $newcollector->moveCollectorProperty(2, 1);
        $newcollector->removeCollectorProperty(2);
        $newcollector->removeCollectorProperty($property);
        $newcollector->removeCollectorProperty($property->getPropertyName());
        
        $newcollector->delete();
                
        $conn->logout;
        $conn->close;


DESCRIPTION

Collector allows you to create and modify collectors for use with servers.


METHODS

new BuildForge::Services::DBO::Collector(connection, {CollectorParamsHashRef})

Returns a new instance of the Collector object.

connection

A connected BuildForge::Services::Connection object.

CollectorParamsHashRef

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

collectorId

The name/ID of the collector.

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

Returns a reference to an array of BuildForge::Services::DBO::Collector objects, one for each entry in the database that the current user has access to. These objects will not contain their CollectorProperties. To get the properties, use BuildForge::Services::DBO::Collector->findById with the collector's collector ID.

connection

A connected BuildForge::Services::Connection object.

BuildForge::Services::DBO::Collector->findById(connection, collectorId)

Returns the BuildForge::Services::DBO::Collector object that corresponds to the given ID, or undef if no such Collector exists.

connection

A connected BuildForge::Services::Connection object.

collectorId

The name/ID of the desired collector, from $collector->getCollectorId().

$collector->create()

Creates a record for the collector in the database.

$collector->clone()

Returns a copy of the Collector object with all of the same properties. This will not exist in the database until create() gets called on the new object.

$collector->update()

Updates the collector in the database to correspond to the current state of the Collector object.

$collector->addCollectorProperty(property, index)

Adds the property to the collector. Adding it creates the property in the database.

property

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

index

The optional location at which to add the object. 0 will add the property at the front of the list, 1 will add it after the first property, etc. Not setting a location will add the property to the end of the list.

$collector->moveCollectorProperty(from, to)

Moves a collector property within the property list.

from

The index from which to move the property. 0 moves the first property, 1 moves the second property, etc.

to

The index to which to move the property. 0 moves it to the first position, 1 moves it to the second position, and so on.

$collector->copyCollectorProperty(from, to)

Copies a collector property to somewhere else within the property list.

from

The index from which to copy the property. 0 copies the first property, 1 copies the second property, etc.

to

The index to which to copy the property. 0 copies it to the first position, 1 copies it to the second position, and so on.

$collector->removeCollectorProperty(property)

Deletes a collector property from the collector.

property

property may be either a BuildForge::Services::DBO::CollectorProperty object, in which that property gets deleted from the list, an index, in which case the property at that location gets deleted, or a collector property name, in which case that property gets deleted.

$collector->delete()

Deletes the collector and its properties from the database.

$collector->getCollectorId()

Returns the ID / name for the collector. An alias for $collector->getCollectorName().

$collector->getCollectorName()

Returns the ID / name for the collector.

$collector->getProperties()

Returns a reference to an array of BuildForge::Services::DBO::CollectorProperty objects for all collector properties in the collector.

$collector->getProperty(property)

Returns the BuildForge::Services::DBO::CollectorProperty object for the given property name / location, or undef if no such property exists.

property

This may be either the name or the index of the property to return.

$collector->getBuiltIns()

Returns a reference to an array of all the built-in collector property names.

$collector->setCollectorId(collectorId)

Sets the collector name / ID both within the object and (if the collector has been created) within the database. An alias to $collector->setCollectorName(collectorId).

collectorId

The new name / ID for the collector.

$collector->setCollectorName(collectorId)

Sets the collector name / ID both within the object and (if the collector has been created) within the database.

collectorId

The new name / ID for the collector.


COPYRIGHT

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