+ my %args = (
+ Type => "ticket",
+ Name => '',
+ @_,
+ );
+
+ if (defined $args{Name} and exists $LIFECYCLES_CACHE{ $args{Name} }) {
+ $self->{'name'} = $args{Name};
+ $self->{'data'} = $LIFECYCLES_CACHE{ $args{Name} };
+ $self->{'type'} = $args{Type};
+
+ my $found_type = $self->{'data'}{'type'};
+ warn "Found type of $found_type ne $args{Type}" if $found_type ne $args{Type};
+ } elsif (not $args{Name} and exists $LIFECYCLES_TYPES{ $args{Type} }) {
+ $self->{'data'} = $LIFECYCLES_TYPES{ $args{Type} };
+ $self->{'type'} = $args{Type};
+ } else {
+ return undef;
+ }
+
+ my $class = "RT::Lifecycle::".ucfirst($args{Type});
+ bless $self, $class if $class->require;