[Rt-commit] r19023 - rt/3.999/trunk/lib/RT/Shredder
ruz at bestpractical.com
ruz at bestpractical.com
Thu Apr 2 06:11:46 EDT 2009
Author: ruz
Date: Thu Apr 2 06:11:45 2009
New Revision: 19023
Modified:
rt/3.999/trunk/lib/RT/Shredder/ACE.pm
rt/3.999/trunk/lib/RT/Shredder/Attachment.pm
rt/3.999/trunk/lib/RT/Shredder/CachedGroupMember.pm
rt/3.999/trunk/lib/RT/Shredder/CustomField.pm
rt/3.999/trunk/lib/RT/Shredder/CustomFieldValue.pm
rt/3.999/trunk/lib/RT/Shredder/Group.pm
rt/3.999/trunk/lib/RT/Shredder/GroupMember.pm
rt/3.999/trunk/lib/RT/Shredder/Link.pm
rt/3.999/trunk/lib/RT/Shredder/ObjectCustomFieldValue.pm
rt/3.999/trunk/lib/RT/Shredder/Principal.pm
rt/3.999/trunk/lib/RT/Shredder/Record.pm
rt/3.999/trunk/lib/RT/Shredder/ScripAction.pm
rt/3.999/trunk/lib/RT/Shredder/ScripCondition.pm
rt/3.999/trunk/lib/RT/Shredder/Template.pm
rt/3.999/trunk/lib/RT/Shredder/Ticket.pm
rt/3.999/trunk/lib/RT/Shredder/Transaction.pm
rt/3.999/trunk/lib/RT/Shredder/User.pm
Log:
* delete all __relates functions in shredder, it was really bad
idea to fetch relations for validations one-by-one, new rt-validator
does much better job even if it's a pure SQL
Modified: rt/3.999/trunk/lib/RT/Shredder/ACE.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/ACE.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/ACE.pm Thu Apr 2 06:11:45 2009
@@ -76,23 +76,5 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Attachment.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Attachment.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Attachment.pm Thu Apr 2 06:11:45 2009
@@ -90,45 +90,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Parent, nested parts
- if ( $self->parent ) {
- if ( $self->parent_obj && $self->parent_id ) {
- push( @$list, $self->parent_obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no parent attachment #" . $self->parent . " object";
- }
- }
-
- # Transaction
- my $obj = $self->transaction;
- if ( defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related transaction #" . $self->transaction_id . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/CachedGroupMember.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/CachedGroupMember.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/CachedGroupMember.pm Thu Apr 2 06:11:45 2009
@@ -83,45 +83,4 @@
return $self->SUPER::__depends_on(%args);
}
-#TODO: If we plan write export tool we also should fetch parent groups
-# now we only wipeout things.
-
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- my $obj = $self->member_obj;
- if ( $obj && $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->member_id . " object.";
- }
-
- $obj = $self->group;
- if ( $obj && $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->group_id . " object.";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/CustomField.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/CustomField.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/CustomField.pm Thu Apr 2 06:11:45 2009
@@ -86,39 +86,5 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- my $obj = $self->object;
-
- # Queue
- # Skip if it's global CF
- if ( $self->queue ) {
- if ( $self->queue && $self->queue->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related queue #" . $self->queue . " object";
- }
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/CustomFieldValue.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/CustomFieldValue.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/CustomFieldValue.pm Thu Apr 2 06:11:45 2009
@@ -61,33 +61,4 @@
# I should decide is TicketCustomFieldValue depends by this or not.
# Today I think no. What would be tomorrow I don't know.
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- my $obj = $self->custom_field_obj;
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related CustomField #" . $self->id . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->__relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Group.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Group.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Group.pm Thu Apr 2 06:11:45 2009
@@ -127,50 +127,6 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Equivalence group id inconsistent without User
- if ( $self->domain eq 'ACLEquivalence' ) {
- my $obj = RT::Model::User->new( current_user => $self->current_user );
- $obj->load( $self->instance );
- if ( $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "ACLEguvivalence group have no related User #" . $self->instance . " object.";
- }
- }
-
- # Principal
- my $obj = $self->principal;
- if ( $obj && $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->id . " object.";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
sub before_wipeout {
my $self = shift;
if ( $self->domain eq 'SystemInternal' ) {
Modified: rt/3.999/trunk/lib/RT/Shredder/GroupMember.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/GroupMember.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/GroupMember.pm Thu Apr 2 06:11:45 2009
@@ -143,43 +143,4 @@
#TODO: If we plan write export tool we also should fetch parent groups
# now we only wipeout things.
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- my $obj = $self->member;
- if ( $obj && $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->member_id . " object.";
- }
-
- $obj = $self->group;
- if ( $obj && $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->group_id . " object.";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Link.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Link.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Link.pm Thu Apr 2 06:11:45 2009
@@ -121,19 +121,4 @@
#TODO: Link record has small strength, but should be encountered
# if we plan write export tool.
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # FIXME: if link is local then object should exist
-
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/ObjectCustomFieldValue.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/ObjectCustomFieldValue.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/ObjectCustomFieldValue.pm Thu Apr 2 06:11:45 2009
@@ -70,45 +70,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Ticket
- my $obj = $self->ticket_obj;
- if ( defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Ticket #" . $self->id . " object";
- }
-
- # Custom Field
- $obj = $self->custom_field_obj;
- if ( defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related CustomField #" . $self->id . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Principal.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Principal.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Principal.pm Thu Apr 2 06:11:45 2009
@@ -92,33 +92,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- my $obj = $self->object;
- if ( defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related " . $self->type . " #" . $self->id . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Record.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Record.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Record.pm Thu Apr 2 06:11:45 2009
@@ -168,59 +168,6 @@
return;
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- if ( $self->can('creator') ) {
- my $obj = RT::Model::Principal->new( current_user => $self->current_user );
- $obj->load( $self->creator );
-
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- push @{ $rec->{'description'} }, "Have no related User(creator) #" . $self->creator . " object";
- }
- }
-
- if ( $self->can('last_updated_by') ) {
- my $obj = RT::Model::Principal->new( current_user => $self->current_user );
- $obj->load( $self->last_updated_by );
-
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- push @{ $rec->{'description'} }, "Have no related User(last_updated_by) #" . $self->last_updated_by . " object";
- }
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
-
- # cause of this $self->SUPER::__Relates should be called last
- # in overridden subs
- my $rec = $args{'shredder'}->get_record( object => $self );
- $rec->{'state'} |= VALID unless ( $rec->{'state'} & INVALID );
-
- return;
-}
-
# implement proxy method because some RT classes
# override Delete method
sub __wipeout {
Modified: rt/3.999/trunk/lib/RT/Shredder/ScripAction.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/ScripAction.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/ScripAction.pm Thu Apr 2 06:11:45 2009
@@ -70,19 +70,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # TODO: Check here for exec module
-
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/ScripCondition.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/ScripCondition.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/ScripCondition.pm Thu Apr 2 06:11:45 2009
@@ -71,19 +71,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # TODO: Check here for exec module
-
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Template.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Template.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Template.pm Thu Apr 2 06:11:45 2009
@@ -70,36 +70,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Queue
- my $obj = $self->queue;
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related queue #" . $self->id . " object";
- }
-
- # TODO: Users(creator, last_updated_by)
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Ticket.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Ticket.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Ticket.pm Thu Apr 2 06:11:45 2009
@@ -91,34 +91,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Queue
- my $obj = $self->queue;
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related queue #" . $self->queue . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/Transaction.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Transaction.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/Transaction.pm Thu Apr 2 06:11:45 2009
@@ -78,36 +78,4 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Ticket
- my $obj = $self->ticket;
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Ticket #" . $self->id . " object";
- }
-
- # TODO: Users(creator, last_updated_by)
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
1;
Modified: rt/3.999/trunk/lib/RT/Shredder/User.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/User.pm (original)
+++ rt/3.999/trunk/lib/RT/Shredder/User.pm Thu Apr 2 06:11:45 2009
@@ -135,47 +135,6 @@
return $self->SUPER::__depends_on(%args);
}
-sub __relates {
- my $self = shift;
- my %args = (
- shredder => undef,
- dependencies => undef,
- @_,
- );
- my $deps = $args{'dependencies'};
- my $list = [];
-
- # Principal
- my $obj = $self->principal;
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related ACL equivalence Group object";
- }
-
- $obj = RT::Model::Group->new( current_user => RT->system_user );
- $obj->load_acl_equivalence( $self->principal );
- if ( $obj && defined $obj->id ) {
- push( @$list, $obj );
- } else {
- my $rec = $args{'shredder'}->get_record( object => $self );
- $self = $rec->{'object'};
- $rec->{'state'} |= INVALID;
- $rec->{'description'} = "Have no related Principal #" . $self->id . " object";
- }
-
- $deps->_push_dependencies(
- base_object => $self,
- flags => RELATES,
- target_objects => $list,
- shredder => $args{'shredder'}
- );
- return $self->SUPER::__Relates(%args);
-}
-
sub before_wipeout {
my $self = shift;
if ( $self->name =~ /^(RT_System|Nobody)$/ ) {
More information about the Rt-commit
mailing list