+sub FindDependencies {
+ my $self = shift;
+ my ($walker, $deps) = @_;
+
+ $self->SUPER::FindDependencies($walker, $deps);
+
+ $deps->Add( out => $self->QueueObj ) if $self->QueueObj->Id;
+}
+
+sub __DependsOn {
+ my $self = shift;
+ my %args = (
+ Shredder => undef,
+ Dependencies => undef,
+ @_,
+ );
+ my $deps = $args{'Dependencies'};
+ my $list = [];
+
+# Scrips
+ push( @$list, $self->UsedBy );
+
+ $deps->_PushDependencies(
+ BaseObject => $self,
+ Flags => RT::Shredder::Constants::DEPENDS_ON,
+ TargetObjects => $list,
+ Shredder => $args{'Shredder'},
+ );
+
+ return $self->SUPER::__DependsOn( %args );
+}
+
+sub PreInflate {
+ my $class = shift;
+ my ($importer, $uid, $data) = @_;
+
+ $class->SUPER::PreInflate( $importer, $uid, $data );
+
+ my $obj = RT::Template->new( RT->SystemUser );
+ if ($data->{Queue} == 0) {
+ $obj->LoadGlobalTemplate( $data->{Name} );
+ } else {
+ $obj->LoadQueueTemplate( Queue => $data->{Queue}, Name => $data->{Name} );
+ }
+
+ if ($obj->Id) {
+ $importer->Resolve( $uid => ref($obj) => $obj->Id );
+ return;
+ }
+
+ return 1;
+}
+