This file is indexed.

/usr/share/perl5/Autodia/Handler/umbrello.pm is in autodia 2.14-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
package Autodia::Handler::umbrello;
require Exporter;
use strict;

=head1 NAME

Autodia::Handler::umbrello - AutoDia handler for umbrello

=head1 DESCRIPTION

This provides Autodia with the ability to read umbrello files, allowing you to convert them via the Diagram Export methods to images (using GraphViz and VCG) or html/xml using custom templates.

The umbrello handler will parse umbrello xml/xmi files using XML::Simple and populating the diagram object with class, superclass and package objects.

the umbrello handler is registered in the Autodia.pm module, which contains a hash of language names and the name of their respective language - in this case:

=head1 SYNOPSIS

use Autodia::Handler::umbrello;

my $handler = Autodia::Handler::umbrello->New(\%Config);

$handler->Parse(filename); # where filename includes full or relative path.

=cut

use vars qw($VERSION @ISA @EXPORT);
use Autodia::Handler;

@ISA = ('Autodia::Handler' ,'Exporter');

use Autodia::Diagram;
use Data::Dumper;

use XML::Simple;

=head1 METHODS

=head2 CONSTRUCTION METHOD

use Autodia::Handler::umbrello;

my $handler = Autodia::Handler::umbrello->New(\%Config);
This creates a new handler using the Configuration hash to provide rules selected at the command line.

=head2 ACCESS METHODS

$handler->Parse(filename); # where filename includes full or relative path.

This parses the named file and returns 1 if successful or 0 if the file could not be opened.

=cut


#####################
# Constructor Methods

# new inherited from Autodia::Handler

#------------------------------------------------------------------------
# Access Methods

# parse_file inherited from Autodia::Handler

#-----------------------------------------------------------------------------
# Internal Methods

# _initialise inherited from Autodia::Handler

sub _parse {
  my $self     = shift;
  my $fh       = shift;
  my $filename = shift;

  my $Diagram  = $self->{Diagram};
  my $xmldoc = XMLin($filename, ForceArray => 1, ForceContent => 1);

  # get version
  my $version = $xmldoc->{'XMI.header'}[0]{'XMI.documentation'}[0]{'XMI.exporterVersion'}[0]{content};
  my $is_newstyle = 0;
  if ($version =~ /(\d\.\d).\d/) {
      $is_newstyle = 1 if ($1 > 1.1);
  }
  my $umlclasses_are_here = ( $is_newstyle ) ? 'UML:Model' : 'umlobjects' ;
  my @relationships;

  foreach my $classname (keys %{$xmldoc->{'XMI.content'}[0]{$umlclasses_are_here}[0]{'UML:Class'}}) {
      print "handling Class $classname : \n";
      my $class = $xmldoc->{'XMI.content'}[0]{$umlclasses_are_here}[0]{'UML:Class'}{$classname};
      my $Class = Autodia::Diagram::Class->new($classname);
      $Diagram->add_class($Class);

      foreach my $method ( @{get_methods($class)} ) {
	  $Class->add_operation($method);
      }
      foreach my $attribute (@{get_attributes($class)}) {
	  $Class->add_attribute( $attribute );
      }

      # get superclass / stereotype
      if ($class->{stereotype}) {
	  my $Superclass = Autodia::Diagram::Superclass->new($class->{stereotype});
	  # add superclass to diagram
	  my $exists_already = $Diagram->add_superclass($Superclass);
	  if (ref $exists_already) {
	      $Superclass = $exists_already;
	  }
	  # create new inheritance
	  my $Inheritance = Autodia::Diagram::Inheritance->new($Class, $Superclass);
	  # add inheritance to superclass
	  $Superclass->add_inheritance($Inheritance);
	  # add inheritance to class
	  $Class->add_inheritance($Inheritance);
	  # add inheritance to diagram
	  $Diagram->add_inheritance($Inheritance);
      }
  }
  return;
}


############################

sub get_methods {
  my $class = shift;
  my $return = [];

  foreach my $methodname (keys %{$class->{'UML:Operation'}}) {
      my $type = $class->{'UML:Operation'}{$methodname}{type};
      my $arguments = get_parameters($class->{'UML:Operation'}{$methodname}{'UML:Parameter'});
      push(@$return,{name=>$methodname,type=>$type,Params=>$arguments, visibility=>0});
  }
  return $return;
}

sub get_attributes {
  my $class = shift;
  my $return = [];
  foreach my $attrname (keys %{$class->{'UML:Attribute'}}) {
      my $type = $class->{'UML:Attribute'}{$attrname}{type};
      push(@$return,{name=>$attrname,type=>$type, visibility=>0});
  }
  return $return;
}


sub get_parameters {
  my $arguments = shift;
  my $return = [];
  if (ref $arguments) {
      @$return = map ( {Type=>$arguments->{$_}{type},Name=>$_}, keys %$arguments);
  }
  return $return;
}

###############################################################################

=head1 SEE ALSO

Autodia::Handler

Autodia::Diagram

=head1 AUTHOR

Aaron Trevena, E<lt>aaron.trevena@gmail.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2001-2007 by Aaron Trevena

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.1 or,
at your option, any later version of Perl 5 you may have available.

=cut


1;