NAME

BuildForge::Services::DBO::Environment


SYNOPSIS

        use BuildForge::Services;
        $conn = new BuildForge::Services::Connection($hostname);
        $token = $conn->authUser($user, $pass);
        
        # Getting existing environments
        $allEnvironments = BuildForge::Services::DBO::Environment->findAll($conn);
        $oldenvironment = BuildForge::Services::DBO::Environment->findById($conn, $envId);
        $oldenvironment = BuildForge::Services::DBO::Environment->findByName($conn, 'EnvironmentName');
        # Getter / setter functions
        $id = $oldenvironment->getEnvGroupId();
        $name = $oldenvironment->getEnvGroupName();
        $name = $oldenvironment->getEnvironmentName();
        $accessGroupId = $oldenvironment->getLevel();
        $variable1 = $oldenvironment->getEntry(0);
        $variable2 = $oldenvironment->getEntry('VARIABLE_NAME');
        $variables = $oldenvironment->getEntries();
        
        $oldenvironment->setEnvGroupName('New Name');
        $oldenvironment->setEnvironmentName('New Name');
        $level = BuildForge::Services::DBO::AccessGroup->findByName($conn, 'MyAccessGroup');
        $oldenvironment->setLevel($level->getLevel());
        $oldenvironment->update();
        
        # Environment creation, modification, deletion
        $newenvironment = new BuildForge::Services::DBO::Environment($conn);
        $newenvironment->setEnvironmentName('New Environment');
        $newenvironment->setLevel(4);
        $newenvironment->create();
        
        $newenvironment2 = $newenvironment->clone();
        $newenvironment2->setEnvironmentName('Duplicate');
        $newenvironment2->create();
        
        $newenvironment->setEnvironmentName('New Name For New Environment');
        $newenvironment->update();
        $var = new BuildForge::Services::DBO::EnvironmentEntry($conn);
        $var->setEntryName('VARIABLE_NAME');
        $var->setEntryValue('Value');
        $newenvironment->addEnvironmentEntry($var);
        $newenvironment->copyEnvironmentEntry(0, 1);
        $newenvironment->moveEnvironmentEntry(1, 0);
        $newenvironment->removeEnvironmentEntry(1);
        $newenvironment->removeEnvironmentEntry($var);
        
        $newenvironment->delete();
                
        $conn->logout;
        $conn->close;


DESCRIPTION

Environment allows you to create, modify, and delete environment groups.


METHODS

new BuildForge::Services::DBO::Environment(connection, {EnvParamsHashRef})

Returns a new instance of an Environment object.

connection

A connected BuildForge::Services::Connection object.

EnvParamsHashRef

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

name

The name of the environment group.

level

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

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

Returns a reference to an array of all the BuildForge::Services::DBO::Environment objects the user has access to in the database. These objects will not contain their EnvironmentEntry subobjects. To get the entries, use BuildForge::Services::DBO::Environment->findById() or findByName() with the environment's ID.

connection

A connected BuildForge::Services::Connection object.

BuildForge::Services::DBO::Environment->findById(connection, envGroupId)

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

connection

A connected BuildForge::Services::Connection object.

envGroupId

The ID of the desired environment group (from $environment->getEnvironmentGroupId()).

BuildForge::Services::DBO::Environment->findByName(connection, envGroupName)

Returns the BuildForge::Services::DBO::Environment object corresponding to the given environment group name, or undef if no such environment group exists.

connection

A connected BuildForge::Services::Connection object.

envGroupName

The name of the desired environment group (from $environment->getEnvironmentGroupName()).

$environment->create()

Creates the environment group within the database.

$environment->clone()

Returns a copy of the BuildForge::Services::DBO::Environment object and all of its EnvironmentEntry variables. The copy will not exist in the database unless it is created with $environment->create().

$environment->update()

Updates the database with the new environment group settings.

$environment->addEnvironmentEntry(entry, index)

Adds an environment variable to the environment group within the database.

entry

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

index

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

$environment->moveEnvironmentEntry(from, to)

Moves an environment variable within the list of variables in the database.

from

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

to

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

$environment->copyEnvironmentEntry(from, to)

Copies an environment variable within the environment group in the database.

from

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

to

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

$environment->removeEnvironmentEntry(variable)

Removes an environment variable from the variable list in the database.

variable

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

$environment->delete()

Deletes the environment and all of its variables from the database.

$environment->getEnvGroupId()

Returns the ID of the environment group. Identical to $environment->getEnvironmentId().

$environment->getEnvironmentId()

Returns the ID of the environment group. Identical to $environment->getEnvGroupId().

$environment->getEnvGroupName()

Returns the name of the environment group. Identical to $environment->getEnvironmentName().

$environment->getEnvironmentName()

Returns the name of the environment group. Identical to $environment->getEnvGroupName().

$environment->getLevel()

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

$environment->getEntry(variable)

Returns the BuildForge::Services::DBO::EnvironmentEntry object that corresponds to the requested variable.

variable

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

$environment->getEntries()

Returns a reference to an array of BuildForge::Services::DBO::EnvironmentEntry objects for all variables in the environment group.

$environment->setEnvGroupName(envGroupName)

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

envGroupName

The new name for the environment group.

$environment->setEnvironmentName(envGroupName)

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

envGroupName

The new name for the environment group.

$environment->setLevel(accessGroupId)

Sets the environment group's access group. Users who do not belong to this access group will not be able to view, edit, or use the environment. $environment->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.