Bric::Biz::Site - Interface to Bricolage Site Objects
use Bric::Biz::Site;
# Constructors.
my $site = Bric::Biz::Site->new($init);
$site = Bric::Biz::Site->lookup({ id => $id });
my @sites = Bric::Biz::Site->list($params);
# Class Methods.
my @site_ids = Bric::Biz::Site->list_ids($params);
my $meths = Bric::Biz::Site->my_meths;
# Instance methods.
$id = $site->get_id;
my $name = $site->get_name;
$site = $site->set_name($name)
my $desc = $site->get_description;
$site = $site->set_description($desc);
my $domain_name = $site->get_domain_name;
$site = $site->set_domain_name($domain_name);
$site = $site->activate;
$site = $site->deactivate;
$site = $site->is_active;
# Save the changes to the database
$site = $site->save;
Sites are first-class Bricolage objects designed to manage different sites from within a single Bricolage instance.
my $site = Bric::Biz::Site->new;
$site = Bric::Biz::Site->new($init);
Constructs a new site object and returns it. An anonymous hash of initial values may be passed. The supported keys for that hash references are:
The name and domain_name attributes must be globally unique or an exception will be thrown.
Throws:
my $site = Bric::Biz::Site->lookup({ id => $id });
$site = Bric::Biz::Site->lookup({ name => $name });
$site = Bric::Biz::Site->lookup({ domain_name => $domain_name });
Looks up and constructs an existing site object in the database and returns it. A Site ID, name, or domain name can be used as the site object unique identifier to look up. If no site object is found in the database, then lookup() will return undef.
Throws:
my @sites = Bric::Biz::Site->list($params);
my $sites_aref = Bric::Biz::Site->list($params);
Returns a list or anonymous array of site objects based on the search parameters passed via an anonymous hash. The supported lookup keys that may use valid SQL wild card characters are:
The ANY() operator may be used to specify a list of values for any of these parameters.
The supported lookup keys that must be an exact value are:
Site ID. May use ANY for a list of possible values.
A boolean value indicating if the site is active.
A Bric::Util::Grp::Site object ID. May use ANY for a list of possible values.
A Bric::Biz::ElementType (element type) ID. May use ANY for a list of possible values.
A Bric::Biz:OutputChannel ID. Pass in undef to check for when it's NULL, and "not null" to check for when it's NOT NULL. May use ANY for a list of possible values.
Throws:
my $sites_href = Bric::Biz::Site->href($params);
Returns an anonymous hash of site objects based on the search parameters passed via an anonymous hash. The hash keys will be the site IDs, and the values will be the corresponding sites. The supported lookup keys are the same as those for list().
Throws:
my @site_ids = Bric::Biz::Site->list_ids($params);
my $site_ids_aref = Bric::Biz::Site->list_ids($params);
Returns a list or anonymous array of site object IDs based on the search parameters passed via an anonymous hash. The supported lookup keys are the same as for the list() method.
Throws:
my $meths = Bric::Biz::Site->my_meths
my @meths = Bric::Biz::Site->my_meths(1);
my $meths_aref = Bric::Biz::Site->my_meths(1);
@meths = Bric::Biz::Site->my_meths(0, 1);
$meths_aref = Bric::Biz::Site->my_meths(0, 1);
Returns Bric::Biz::Site attribute accessor introspection data. See Bric for complete documtation of the format of that data. Returns accessor introspection data for the following attributes:
The site name. A unique identifier attribute.
The site domain name. A unique identifier attribute.
A description of the site.
The site's active status boolean.
my $id = $site->get_id;
Returns the site object's unique database ID.
my $name = $site->get_name;
$site = $site->set_name($name);
Get and set the site object's unique name. The value of this attribute must be case-insensitively globally unique. If a non-unique value is passed to set_name(), an exception will be thrown.
Throws:
my $description = $site->get_description;
$site = $site->set_description($description);
Get and set the site object's description. The setter converts non-Unix line endings.
my $domain_name = $site->get_domain_name;
$site = $site->set_domain_name($domain_name);
Get and set the site object's unique domain name. The value of this attribute must be case-insensitively globally unique. If a non-unique value is passed to set_domain_name(), an exception will be thrown.
Throws:
$site = $site->activate;
$site = $site->deactivate;
$site = $site->is_active;
Get and set the site object's active status. activate() and deactivate() each return the site object. is_active() returns the site object when the site is active, and undef when it is not.
$site = $site->save;
Saves any changes to the site object to the database. Returns the site object on success and throws an exception on failure.
Side Effects: Creates five internal permanent groups. One is a Bric::Util::Grp::Asset group. Its ID is used for the site ID, so that it can easily be used by Bric::Biz::Asset to add the ID to its grp_ids attribute because every asset is related to a site. The other four are Bric::Util::Grp::User groups, and one is created for each permission, READ, EDIT, CREATE, and DENY. Furthermore, a Bric::Util::Priv object is created for each of these user groups in turn, to grant their users the appropriate permissions to any assets associated with the site.
Thows:
David Wheeler <david@kineticode.com>
Each category object is associated with a site.
Each output channel object is associated with a site.
Each top-level element object is associated with one or more site.
Each workflow object is associated with a site.
Each asseet object is associated with a site.
Each destination object is associated with a site.
Copyright (c) 2003 Kineticode, Inc. See Bric::License for complete license terms and conditions.