create()
update()
delete()
getName()
getProjectId()
getStepId()
getDescription()
getFrom()
getSubject()
getBodyText()
getLocale()
setName(templateKey)
setProjectId(projectId)
setStepId(stepNumber)
setDescription(description)
setFrom(from)
setSubject(subject)
setBodyText(body)
setLocale(locale)
BuildForge::Services::DBO::Template
use BuildForge::Services;
$conn = new BuildForge::Services::Connection($hostname); $token = $conn->authUser($user, $pass); # Getting existing templates $allProjectTemplates = BuildForge::Services::DBO::Template->findByProjectId($conn, $projectId); $oldtemplate = BuildForge::Services::DBO::Template->findById($conn, $projectId, $stepId, $templateName);
# Getter / setter functions $projectId = $oldtemplate->getProjectId(); $stepId = $oldtemplate->getStepId(); $templateName = $oldtemplate->getName(); $description = $oldtemplate->getDescription(); $from = $oldtemplate->getFrom(); $subject = $oldtemplate->getSubject(); $body = $oldtemplate->getBodyText(); $locale = $oldtemplate->getLocale();
$oldtemplate->setProjectId($projectId); $oldtemplate->setStepId($stepId); $oldtemplate->setName('build_break'); $oldtemplate->setDescription('New Template Description'); $oldtemplate->setFrom('user@company.com'); $oldtemplate->setSubject('Subject of email message'); $oldtemplate->setBodyText('Body of email message'); $oldtemplate->setLocale('en_US'); $oldtemplate->update(); # Template creation, updating, deletion $newtemplate = new BuildForge::Services::DBO::Template($conn); $newtemplate->setProjectId($projectId); $newtemplate->setStepId($stepId); $newtemplate->setName('build_pass'); $newtemplate->setLocale('es_ES'); $newtemplate->create();
$newtemplate->setDescription('Another Template Description'); $newtemplate->update(); $newtemplate->delete(); BuildForge::Services::DBO::Template->deleteById($conn, $projectId, $stepId, $templateName); $conn->logout; $conn->close;
Template allows you to create, access, and delete BuildForge notification templates, used to send emails to users upon encountering various alert events.
Returns a new instance of a Template object.
A connected BuildForge::Services::Connection object.
An optional reference to a hash containing any or all of the following fields.
The project ID (from $project->getProjectId())
of the project that the template is connected to.
A value of 0 indicates that this is one of the base templates which get used in the absence
of a specific project template. Base templates should not be created or deleted, only
edited.
The step number (from $step->getStepOrdinal())
of the step that the template is used for
for step-specific templates. A value of 0 (the default) indicates that this template is
used for all steps and for project-specific purposes.
The key for the template type. This should be identical to one of the keys for the base templates.
The code for the locale of the template. Defaults to 'en_US', the English language locale. A template for a given locale will be sent to users from that locale when the appropriate event is kicked off. For example, if a build is set to send an email on success to a given access group, it'll send the 'en_US' template to the english speakers, the 'es_ES' template to the spanish speakers, etc.
The description of the template.
The ``From'' field of the outgoing email message.
The ``Subject'' field of the outgoing email message. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
The body of the outgoing email message. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
Returns a reference to an array of BuildForge::Services::DBO::Template objects corresponding to all templates in the database for the given project.
A connected BuildForge::Services::Connection object.
The project ID of the project that the templates relate to (from $project->getProjectId()), or 0 to get all of the base templates.
Returns the BuildForge::Services::DBO::Template object corresponding to the given database template, or undef if no such object exists.
A connected BuildForge::Services::Connection object.
The project ID of the project that the template relates to (from $project->getProjectId()), or 0 to get one of the base templates.
The step number of the step that the project relates to (from $step->getStepOrdinal()), or 0 for the all-step or project-specific templates.
The key for the template (from $template->getName()).
create()
Creates the template record within the database. Base templates (those with project ID of 0) cannot be created.
update()
Updates the template record within the database.
delete()
Deletes the template record from the database. Base templates (those with project ID of 0) cannot be deleted.
Deletes the template record from the database with the given project, step, and ID. Base templates (those with project ID of 0) cannot be deleted.
A connected BuildForge::Services::Connection object.
The project ID of the project that the template relates to (from $project->getProjectId()).
The step number of the step that the project relates to (from $step->getStepOrdinal()), or 0 for the all-step or project-specific templates.
The key for the template (from $template->getName()).
getName()
Returns the template's key.
getProjectId()
Returns the project ID for the project the template is connected to, or 0 for the base templates.
getStepId()
Returns the step number for the step the template is connected to, or 0 for the all-step or project-specific templates.
getDescription()
Returns the template's description.
getFrom()
Returns the ``From'' field of the emails the template sends out.
getSubject()
Returns the ``Subject'' field of the emails the template sends out. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
getBodyText()
Returns the body of the emails the template sends out. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
getLocale()
Returns the code for the locale of the template. A template for a given locale will be sent to users from that locale when the appropriate event is kicked off. For example, if a build is set to send an email on success to a given access group, it'll send the 'en_US' template to the english speakers, the 'es_ES' template to the spanish speakers, etc.
setName(templateKey)
Sets the template's key.
$template->update()
must be run before changes are replicated in the database.
The new key for the template. This should be identical to one of the keys of the base templates.
setProjectId(projectId)
Sets the project that the template is connected to.
$template->update()
must be run before changes are replicated in the database.
The project ID (from $project->getProjectId())
of the project that this template will get connected to.
setStepId(stepNumber)
Sets the step that the template is connected to.
$template->update()
must be run before changes are replicated in the database.
The step number (from $step->getStepOrdinal())
that the template is connected to
or 0 for templates connected to all project steps or used for project-specific
purposes.
setDescription(description)
Sets the description of the template.
$template->update()
must be run before changes are replicated in the database.
The new template description.
setFrom(from)
Sets the ``From'' field for the emails sent with this template.
$template->update()
must be run before changes are replicated in the database.
The email address this message is listed as coming from.
setSubject(subject)
Sets the ``Subject'' field for the emails sent with this template.
$template->update()
must be run before changes are replicated in the database.
The new email subject line. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
setBodyText(body)
Sets the message body for the emails sent with this template.
$template->update()
must be run before changes are replicated in the database.
The new email body. This may have a number of template-specific variables included. For more details of the variables, see the BuildForge online help topic Setting Up Notification->Notification Templates->Special Notification Template Variables.
setLocale(locale)
Sets the template's locale.
A template for a given locale will be sent
to users from that locale when the appropriate event is kicked off. For example, if a build
is set to send an email on success to a given access group, it'll send the 'en_US' template to
the english speakers, the 'es_ES' template to the spanish speakers, etc.
$template->update()
must be run before changes are replicated in the database.
The key for the locale to set.
Copyright (c)2006-2007 International Business Machines, Inc. All rights reserved.