correct enum encoding for _common_ fields too
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 15 Jul 2005 15:54:51 +0000 (15:54 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 15 Jul 2005 15:54:51 +0000 (15:54 +0000)
org.glite.lb.ws-interface/src/LBTypes.xml.T

index 95a7f18..9804182 100644 (file)
                </choice>
 
 @@@{
+       selectType $event '_common_';
+       for ($event->getFieldsOrdered) {
+               my $f = selectField $event $_;
+               if ($f->{codes}) {
+                       my $n = ucfirst getName $f;
+                       $n = $1.ucfirst $2 while $n =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
+                       gen qq{
+!              <enum name="$n">
+};
+                       for (@{$f->{codes}}) {
+                               my $uc = uc $_->{name};
+                               gen qq{
+!                      <val name="$uc">$_->{comment}</val>
+};
+                       }
+                       gen qq{
+!              </enum>
+!
+};
+               }
+       }
+
        for my $type (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } getTypes $event) {
                my $tn = $type;
                $tn = $1.ucfirst $2 while $tn =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
                                }
                                gen qq{
 !              </enum>
+!
 };
-
                        }
                }
 
                        my $ftn = $f->getType;
 
                        $fn = $1.ucfirst $2 while $fn =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
+                       $ftn = ucfirst $fn if ($f->{codes});
                        $ftn = $1.ucfirst $2 while $ftn =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
 
                        my $comment = getComment $f;
                        my $opt = $f->{optional} ? 'yes' : 'no';
-                       gen qq{
-                               <elem name="$fn" type="$ftn" optional="$opt">$comment</elem>
-                       };
+                       gen qq{\t\t\t\t<elem name="$fn" type="$ftn" optional="$opt">$comment</elem>
+};
                }
 
                selectType $event $type;
 
                        $fn = $1.ucfirst $2 while $fn =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
                        $ftn = $tn . '_' . $fn if ($f->{codes});
-
                        $ftn = $1.ucfirst $2 while $ftn =~ /([[:alpha:]]*)_([[:alpha:]_]*)/;
 
 
                        my $comment = getComment $f;
                        my $opt = $f->{optional} ? 'yes' : 'no';
-                       gen qq{
-                               <elem name="$fn" type="$ftn" optional="$opt">$comment</elem>
-                       };
+                       gen qq{\t\t\t\t<elem name="$fn" type="$ftn" optional="$opt">$comment</elem>
+};
                }
                gen "</struct>\n\n";
        }