Bric::Util::Grp::Parts::Member(3)

NAME
Bric::Util::Grp::Parts::Member - A Class for associating Members of a Group with attribute with in the group

VERSION
$LastChangedRevision$

DATE
$LastChangedDate: 2004-11-09 04:32:57 +0100 (Tue, 09 Nov 2004) $

SYNOPSIS
  # Constructors.
  my $member = Bric::Util::Grp::Parts::Member->new( $initial_state );
  $member = Bric::Util::Grp::Parts::Member->lookup( { id => $id} );
  my ($member_list||@members) = Bric::Util::Grp::Parts::Member->list($params);
  my $member_href = Bric::Util::Grp::Parts::Member->href($params);

  # Class methods.
  ($ids || @ids ) = Bric::Util::Grp::Parts::Member->list_ids({grp => $grp })

  # Instances methods.
  my $id = $member->get_id;
  $member = $member->activate;
  $member = $member->deactivate;

  # Attribute methods.
  $member = $member->set_attrs( [name=> $name,subsys=> $subsys,val => $val}]);
  ($val_list||@vals) = $member->get_attrs([ {name=> $name,subsys=> $subsys}]);

  # Retrieve the underlying Bric object.
  $object = $member->get_object;

DESCRIPTION
A Member is a container for an object and any properties that it may have with in the group it is associated with that it would not have by its self.

INTERFACE

  Constructors

$member = Bric::Util::Grp::Parts::Member->new( $initial_state )
    This will create a new member object with the defined initial state

    Supported Keys:

    object_class_id
    object_package
    grp
    active

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$member = Bric::Util::Grp::Parts::Member->lookup({ id => $id });
    Looks up a member object for a given ID.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

($mbr_list||@mbrs) = Bric::Util::Grp::Parts::Member->list($params);
    This will return a list or list ref of blessed Member objects that are a member of said a group. The $params hash reference supports the following keys:

    grp A Bric::Util::Grp object, the members of which are to be returned.

    grp_package
        The package name of a Bric::Util::Grp subclass, the members of which are to be returned.

    object
        A Bric object for which a list of group memberships will be returned.

    object_package
        The package name of a Bric object for which a list of group memberships will be returned. Use in combination with the "object_id" parameter.

    object_id
        The ID of a Bric object for which a list of group memberships will be returned. Use in combination with the "object_package" parameter.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

my $memb_href = Bric::Util::Grp::Parts::Member->href($params);
    Returns an anonymous hash of group members. The hash values are Bric::Util::Grp::Parts::Member objects. Takes the same arguments as the "list()" method, although either the "grp" or "grp_package" parameter is required. If the group class method "get_object_class_id()" returns a value, then the hash keys will be the IDs of the objecs represented by the members. Otherwise, the keys will be the IDs of the member objects themselves.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Destructors

$contrib->DESTROY
    Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

  Public Class Methods

($ids||@ids ) = Bric::Util::Grp::Parts::Member->list_ids($params);
    Return a list or anonymous array of Member object ids. The supported keys in the $params hash reference are the same as for the "list()" method.

    Throws: NONE.

    Side Effects: NONE.

    Notes: NONE.

$meths = Bric::Util::Grp::Parts::Member->my_meths
(@meths || $meths_aref) = Bric::Util::Grp::Parts::Member->my_meths(TRUE)
my (@meths || $meths_aref) = Bric::Util::Grp->my_meths(0, TRUE)
    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:

    name
        The name of the property or attribute. Is the same as the hash key when an anonymous hash is returned.

    disp
        The display name of the property or attribute.

    get_meth
        A reference to the method that will retrieve the value of the property or attribute.

    get_args
        An anonymous array of arguments to pass to a call to get_meth in order to retrieve the value of the property or attribute.

    set_meth
        A reference to the method that will set the value of the property or attribute.

    set_args
        An anonymous array of arguments to pass to a call to set_meth in order to set the value of the property or attribute.

    type
        The type of value the property or attribute contains. There are only three types:

        short
        date
        blob
    len If the value is a 'short' value, this hash key contains the length of the field.

    search
        The property is searchable via the list() and list_ids() methods.

    req The property or attribute is required.

    props
        An anonymous hash of properties used to display the property or attribute. Possible keys include:

        type
            The display field type. Possible values are

            text
            textarea
            password
            hidden
            radio
            checkbox
            select
        length
            The Length, in letters, to display a text or password field.

        maxlength
            The maximum length of the property or value - usually defined by the SQL DDL.

    rows
        The number of rows to format in a textarea field.

    cols
        The number of columns to format in a textarea field.

    vals
        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.

(@ids || $ids) = Bric::Util::Grp::Parts::Member->get_all_object_ids($grp_id)
    Returns a list of the object ids that this object is a member of

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

  Public Instance Methods

$package = $member->get_object_package();
    returns the package of the object that is the member

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$object = $member->get_object()
    Return the object that this member reflects

    Notes:

    The object class isn't loaded by the group class, so when using the Bric API outside of Bricolage, you need to require the object class on the fly; for example:

      my @members = $grp->get_members();
      foreach my $m (@members) {
          my $pkg = $m->get_object_package();
          eval "require $pkg";
          my $object = $m->get_object();
      }

    Throws: NONE

    Side Effects: NONE

$member = $member->set_attr($param)
    Sets an individual attribute on this member

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->delete_attr();
    Deletes attributes from this member

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->set_attrs( [ $param] )
    Takes a list of attributes and sets them upon the member object.

    Throws:

    NONE

    Side Effects:

    Sets a value on the attribute object

    Notes:

    NONE

(@subsys, $subsys) = $mbr->subsys_names()
    returns a list of the subsystems in use

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$val = $mbr->get_attr({ name => $attr })
    Returns a single attribute for the member.

    Throws:

    NONE

    Side Effects:

    Returns value from the attribute object

    Notes:

    NONE

($attrs || @attrs) = $member->get_attrs( [ $param ])
    Returns the attributes defined for this member object.

    Throws:

    NONE

    Side Effects:

    Returns value from the attribute object

    Notes:

    NONE

$member = $member->set_meta($param)
    Sets meta information on the attributes

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->delete_meta($param)
    Deletes meta information for this member

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$meta = $member->get_meta($param)
    Returns the meta information

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$all = $member->all_for_subsys( $subsys )
    Returns a hash ref of all

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$attrs = $member->get_attr_hash( $param )
    returns a hash ref of the attrs

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$id = $member->get_id()
    This will return the id for the object

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->activate()
    Activated a member object that has been deactivated

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->deactivate()
    Make this member object inactive

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

(undef || 1) $member->is_active()
    This will return undef if the member has been deactivated and one otherwise.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->remove()
    This will delete the member from the database (as opposed to deactivating)

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$member = $member->save()
    Saves changes to the data base

    Throws:

    *   The grp_id or grp property is required.

    Side Effects:

    NONE

    Notes:

    NONE

PRIVATE

  Private Class Methods

$results = _do_list($criteria);
    Executes the query for the list constructors

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

  Private Instance Methods

$class_id = $self->_get_class_id($package)
    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$table_name = $self->_get_map_table_name();
    Will return the proper mapping table name

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$package = $self->_get_package($class_id)
    Returns the package name for a given class id

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$group = $self->_get_group_obj()
    Returns the group that this is a member of

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_subsys_names()
    Returns a list or listref of subsys names

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_set_attr( $param)
    Will set an attribute on this member

    Throws:

    NONE

    Side Effects

    NONE

    Notes:

    NONE

$attr = $self->_get_attr($param, $group)
    check for attributes on the member, will check the group and the group's parents if the flags are passed

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_delete_meta()
    Deletes meta information from the attribute object or the cache

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_delete_attr($param);
    Deletes attributes from the attribute object or its cache

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$attr_hash = $self->_get_attr_hash( $param, $group)
    Returns a hash of the attributes that match the parameters. It will also return default values from the group if the $group argument is passed.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_set_meta($param)
    Sets meta information on the member attributes

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$meta = $self->_get_meta($param, $group, $group_parents)
    Returns meta information for a given attribute. Will check the group and the groups parents for defaults if the flags have been passed.

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$attr_obj = $self->_get_attr_obj()
    Returns the correct attribute object for this member

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_sync_attributes()
    Called by save this preforms all the updates for the attribute object

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_do_delete
    Handles the sql to prefore a delete from the database

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

$self = $self->_do_update()
    Preforms an update to the database

    Throws:

    NONE

    Side Effects:

    NONE

    Side Effects:

    NONE

$self = $self->_do_insert()
    Preforms the sql for an insert into the member tables

    Throws:

    NONE

    Side Effects:

    NONE

    Notes:

    NONE

NOTES
NONE

AUTHOR
michael soderstrom ( miraso@pacbell.net )

SEE ALSO
Bric, Bric::Util::Grp, Bric::Util::Attribute