1 #$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Attic/ObjectKeyword.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
2 # Released under the terms of the GNU Public License
6 RT::ObjectKeyword -- a keyword tied to an object in the database
10 use RT::ObjectKeyword;
15 This module should never be called directly by client code. it's an internal module which
16 should only be accessed through exported APIs in Ticket, Queue and other similar objects.
21 ok (require RT::TestHarness);
22 ok (require RT::ObjectKeyword);
30 package RT::ObjectKeyword;
36 @ISA = qw(RT::Record);
40 $self->{'table'} = "ObjectKeywords";
41 $self->SUPER::_Init(@_);
48 Keyword => 'read/write', #link to the B<RT::Keyword>
49 KeywordSelect => 'read/write', #link to the B<RT::KeywordSelect>
50 ObjectType => 'read/write', #currently only C<Ticket>
51 ObjectId => 'read/write', #link to the object specified in I<ObjectType>
53 return ($self->SUPER::_Accessible( @_, %cols));
58 # TODO - post 2.0. add in _Set and _Value, so we can ACL them. protected at another API level
63 RT::ObjectKeyword - Manipulate an RT::ObjectKeyword record
67 use RT::ObjectKeyword;
69 my $keyword = RT::ObjectKeyword->new($CurrentUser);
74 An B<RT::ObjectKeyword> object associates an B<RT::Keyword> with another
75 object (currently only B<RT::Ticket>.
77 This module should B<NEVER> be called directly by client code. its API is entirely through RT ticket or other objects which can have keywords assigned.
84 =item new CURRENT_USER
86 Takes a single argument, an RT::CurrentUser object. Instantiates a new
87 (uncreated) RT::ObjectKeyword object.
93 =item Create KEY => VALUE, ...
95 Takes a list of key/value pairs and creates a the object. Returns the id of
96 the newly created record, or false if there was an error.
100 Keyword - link to the B<RT::Keyword>
101 ObjectType - currently only C<Ticket>
102 ObjectId - link to the object specified in I<ObjectType>
109 my %args = (Keyword => undef,
110 KeywordSelect => undef,
115 #TODO post 2.0 ACL check
117 return ($self->SUPER::Create( Keyword => $args{'Keyword'},
118 KeywordSelect => $args{'KeywordSelect'},
119 ObjectType => $args{'ObjectType'},
120 ObjectId => $args{'ObjectId'}))
128 Returns an B<RT::Keyword> object of the Keyword associated with this ObjectKeyword.
134 my $keyword = new RT::Keyword($self->CurrentUser);
135 $keyword->Load($self->Keyword);
140 # {{{ sub KeywordSelectObj
142 =item KeywordSelectObj
144 Returns an B<RT::KeywordSelect> object of the KeywordSelect associated with this ObjectKeyword.
148 sub KeywordSelectObj {
150 my $keyword_sel = new RT::KeywordSelect($self->CurrentUser);
151 $keyword_sel->Load($self->KeywordSelect);
152 return ($keyword_sel);
156 # {{{ sub KeywordRelativePath
158 =item KeywordRelativePath
160 Returns a string of the Keyword's path relative to this ObjectKeyword's KeywordSelect
166 sub KeywordRelativePath {
168 return($self->KeywordObj->RelativePath(
169 $self->KeywordSelectObj->KeywordObj->Path));
178 Ivan Kohler <ivan-rt@420.am>
186 L<RT::ObjectKeywords>, L<RT::Keyword>, L<RT::Keywords>, L<RT::Ticket>,