[Rt-commit] [svn] r1505 - in experiments/Bamboo: . lib/Bamboo/Model lib/Bamboo/Model/ProxyObject/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Sat Sep 18 17:45:51 EDT 2004


Author: jesse
Date: Sat Sep 18 17:45:49 2004
New Revision: 1505

Added:
   experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/_Base.pm
Modified:
   experiments/Bamboo/   (props changed)
   experiments/Bamboo/lib/Bamboo/Model/ProxyObject.pm
   experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/Queue.pm
Log:
 r10293 at tinbook:  jesse | 2004-09-18T21:45:05.621033Z
 Added more code to start to actually instantiate proxied objects


Modified: experiments/Bamboo/lib/Bamboo/Model/ProxyObject.pm
==============================================================================
--- experiments/Bamboo/lib/Bamboo/Model/ProxyObject.pm	(original)
+++ experiments/Bamboo/lib/Bamboo/Model/ProxyObject.pm	Sat Sep 18 17:45:49 2004
@@ -100,13 +100,60 @@
     my $self = {};
     bless( $self, $class );
 
+    $self->current_user($args{'current_user'});
+
     return ($self);
 
 }
 
 # }}}
 
-sub proxy_for_object {
+
+# _current_user {{{ 
+
+=head2 current_user
+
+=over
+
+=item [current_user]
+
+An optional current_user that this method is a proxy for. Should be loaded just the once, when an current_user is instantiated.
+Proxy current_users shouldn't have their backend containers moving around
+
+=back
+
+=cut
+
+
+sub current_user {
+    my $self = shift;
+    if ( $_[0] ) {
+        my $current_user = shift;
+
+        $self->{_current_user} = $current_user;
+    }
+    return ( $self->{_current_user} );
+}
+
+# }}}
+
+# _proxy_for_object {{{ 
+
+=head2 _proxy_for_object
+
+=over
+
+=item [Object]
+
+An optional object that this method is a proxy for. Should be loaded just the once, when an object is instantiated.
+Proxy objects shouldn't have their backend containers moving around
+
+=back
+
+=cut
+
+
+sub _proxy_for_object {
     my $self = shift;
     if ( $_[0] ) {
         my $object = shift;
@@ -116,6 +163,8 @@
     return ( $self->{_object} );
 }
 
+# }}}
+
 # has_method {{{
 
 =head2 has_method method
@@ -124,7 +173,7 @@
 
 =over
 
-=item methodNAME
+=item METHODNAME
 
 Name of the method we're looking for
 
@@ -316,6 +365,14 @@
 
 # }}}
 
+# _record_note {{{
+
+=head2 _record_note
+
+Record some note, warning or error about this object for later presentation to the user
+
+=cut
+
 sub  _record_note {
     my $self = shift;
     my %args = ( object => 'No object',
@@ -327,11 +384,11 @@
                  @_
                 ); 
     
-    push @{$_NOTES{$args{'object'}}{$args{'method'}}}, \%args;
+    push @{ $_NOTES{ $args{'object'} }{ $args{'method'} } }, \%args;
 
 }
 
-
+# }}}
 
 =head1 What it needs to do
 
@@ -340,10 +397,6 @@
 Create a proxy object
 
 
-=head2 load_proxied_object
-
-Load the object behind the proxy object
-
 =head2 call_method
 
 Perform method calls on the object behind the proxy object.

Modified: experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/Queue.pm
==============================================================================
--- experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/Queue.pm	(original)
+++ experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/Queue.pm	Sat Sep 18 17:45:49 2004
@@ -5,7 +5,9 @@
 
 use base qw/Bamboo::Model::ProxyObject/;
 
-
+sub _proxied_class {
+    'RT::Queue'
+}
 
 
 =begin block

Added: experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/_Base.pm
==============================================================================
--- (empty file)
+++ experiments/Bamboo/lib/Bamboo/Model/ProxyObject/RT/_Base.pm	Sat Sep 18 17:45:49 2004
@@ -0,0 +1,19 @@
+package Bamboo::Model::ProxyObject::RT::_Base;
+
+use base qw/Bamboo::Model::ProxyObject/;
+
+sub new {
+  my $self = SUPER::new->(@_);
+
+    $self->_proxied_object($self->_new_object);
+
+}
+
+
+sub _new_object {
+    my $self = shift;
+    my $class = ref($self);
+
+    my $item = {$self->_proxied_class}->new($self->current_user);
+
+}


More information about the Rt-commit mailing list