Bric::Biz::Keyword - A general class to manage keywords.
$Revision: 1.15.4.4 $
$Date: 2003/08/14 22:04:06 $
use Bric::Biz::Keyword;
# Create a new keyword object.
my $key = new Bric::Biz::Keyword($init);
# Lookup an existing keyword.
my $key = new Bric::Biz::Keyword($key_id);
# Create a list of keyword objects.
my $key = list Bric::Biz::Keyword($param);
# Get/set the keyword name.
$name = $key->get_name();
$success = $key->set_name($name);
# Get/set the screen (display) name.
$screen = $key->get_screen_name();
$success = $key->set_screen_name($screen);
# Mark this keyword inactive
$success = $key->delete();
# Save this asset to the database.
$success = $key->save();
# Link a keyword with a story (or media object or category)
$key->associate($story);
# Break the link between a keyword and a story (or media object or category)a
$key->dissociate($story);
The Keyword module allows assets to be characterized by a set of topical keywords. These keywords can be used to group assets or during a search on a particular topic.
Creates a new keyword and keyword object. Keys for %init are:
nameThe name of this keyword - required.
screen_nameThe way this name should be displayed on screen (ie name='George', screen name='George Washington'). If not specified name will be used for screen_name.
sort_nameThe word used to sort keywords. If not specified then name will be used for sort_name.
Throws: NONE
Side Effects: NONE
Notes: NONE
Retrieves a single existing keyword from the database. Takes either a keyword ID or the keyword name.
Throws:
Bad parameters passed to 'lookup'
Side Effects: NONE
Notes: NONE
Searches for keywords returning matches ordered by sort_name. The possible keys to $param are the following;
nameSearch for keywords by name. Matched with LIKE.
screen_nameSearch for keywords by screen name. Matched with LIKE.
sort_nameSearch for keywords by sort name. Matched with LIKE.
activeSearch for keywords by active flag. If you don't set this flag then active => 1 is implicitely used.
synonymsReturns all the synonyms for the given keyword or keyword ID. Cannot be legally combined with the object param.
objectReturns all keywords for a given object - may be a Bric::Biz::Category, Bric::Biz::Asse::Business::Media or a Bric::Biz::Asse::Business::Story object. Cannot be legally combined with the synonyms param.
Throws:
Unsupported object type : $ref
Synonyms search cannot be combined with object search.
Side Effects: NONE
Notes: NONE
Marks a keyword inactive in the database. Equivalent to calling set_active(0).
Throws: NONE
Side Effects: NONE
Notes: NONE
Returns an anonymous hash of introspection data for this object. If called with a true argument, it will return an ordered list or anonymous array of introspection data. If a second true argument is passed instead of a first, then a list or anonymous array of introspection data will be returned for properties that uniquely identify an object (excluding id, which is assumed).
Each hash key is the name of a property or attribute of the object. The value for a hash key is another anonymous hash containing the following keys:
The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.
The display name of the property or attribute.
A reference to the method that will retrieve the value of the property or attribute.
An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.
A reference to the method that will set the value of the property or attribute.
An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.
The type of value the property or attribute contains. There are only three types:
If the value is a 'short' value, this hash key contains the length of the field.
The property is searchable via the list() and list_ids() methods.
The property or attribute is required.
An anonymous hash of properties used to display the property or attribute. Possible keys include:
The display field type. Possible values are
The Length, in letters, to display a text or password field.
The maximum length of the property or value - usually defined by the SQL DDL.
The number of rows to format in a textarea field.
The number of columns to format in a textarea field.
An anonymous hash of key/value pairs reprsenting the values and display names to use in a select list.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Associates a keyword with an object. The object must by of a type that supports keywords - currently Bric::Biz::Asset::Business::Story, Bric::Biz::Asset:::Business::Media and Bric::Biz::Category. This call commits the change directly to the database. There is no need to call save() afterward.
Returns 0 if $key is already associated with $obj, 1 if a new relationship was created.
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: Cannot be called on an unsaved keyword. Call save() first.
Dissociates a keyword from an object. The object must by of a type that supports keywords - currently Bric::Biz::Asset::Business::Story, Bric::Biz::Asset:::Business::Media and Bric::Biz::Category. This call commits the change directly to the database. There is no need to call save() afterward.
Returns 0 if $key is not associated with $obj, 1 if the relationship was successfully removed.
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: Cannot be called on an unsaved keyword. Call save() first.
Returns the name of this keyword
Throws: NONE
Side Effects: NONE
Notes: NONE
Sets the name of this keyword
Throws: NONE
Side Effects: NONE
Notes: NONE
Returns the screen name of this keyword. The screen name is how the synonym should be displayed on screen (i.e. name='george' screen_name='Washington, George')
Throws: NONE
Side Effects: NONE
Notes: NONE
Sets the screen name of this keyword.
Throws: NONE
Side Effects: NONE
Notes: NONE
Deprecated alias for get_active().
Throws: NONE
Side Effects: NONE
Notes: NONE
Deprecated alias for set_active().
Throws: NONE
Side Effects: NONE
Notes: NONE
Save the keyword to the database.
Throws:
"Unable to save";
Side Effects:
Will give default values to screen_name and sort_name if they are not set.
Notes: NONE
NONE
Selects keywords from the database given an SQL where clause and a ref to an array of bind parameters. Returns fully constructed Bric::Biz::Keyword objects.
Updates the keyword object in the database.
Inserts the new keyword object into the database.
Returns the correct relationship table and field name for a given supported object. For example, for a story object it returns ("story_keyword", "story_id").
Throws:
Unsupported object type : $ref.
Side Effects: NONE
Notes: NONE
NONE
"Garth Webb" <garth@perijove.com> Bricolage Engineering
Sam Tregar <stregar@about-inc.com>