blib/lib/blx/xsdsql/xsd_parser/node/attributeGroup.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 60 CC 6 SCAR 25.0
CC
6
Cov
0%
trigger_at_start_node
20.0
trigger_at_end_node
12.0
BEGIN
2.0
CRAP 12.2
1 package blx::xsdsql::xsd_parser::node::attributeGroup;
2 use base qw(blx::xsdsql::xsd_parser::node);
3 use strict; # use strict is for PBP
4 use Filter::Include;
5 include blx::xsdsql::include;
6 #line 7
7  
8  
9 sub trigger_at_start_node {
10 my ($self,%params)=@_;
11 my $schema=$self->get_attrs_value(qw(STACK))->[1];
12 if (defined (my $name=$self->get_attrs_value(qw(name)))) {
13 my $table= $self->get_attrs_value(qw(TABLE_CLASS))->new (
14 ATTRIBUTE_GROUP => 1
15 ,NAME => $name
16 );
17 $self->set_attrs_value(TABLE => $table);
18 $schema->set_table_names($table);
19 }
20 elsif (defined (my $ref=$self->get_attrs_value(qw(ref)))) {
21 $self->_debug(__LINE__,$ref,': element without name and with ref');
22 my ($ns,$base)=$ref=~/^([^:]+):(.*)$/;
23 if (defined $ns) { #search the namespace naame
24 $ref=$base;
25 my $namespace=$schema->find_namespace_from_abbr($ns);
26 affirm { defined $namespace } "$ns: not find URI from this namespace abbr";
27 $ns=$namespace;
28 }
29 my $parent_table=$self->_get_parent_table;
30 my $column = $schema->get_attrs_value(qw(COLUMN_CLASS))->new(
31 NAME => $ref
32 ,REF => 1
33 ,ELEMENT_FORM => $self->_resolve_form
34 ,URI => $ns
35 ,DEBUG => $self->get_attrs_value(qw(DEBUG))
36 ,ATTRIBUTE_GROUP => 1
37 ,TABLE_NAME => $parent_table
38 );
39 $parent_table->add_columns(
40 {
41 NO_SET_TABLE_NAME => 1
42 }
43 ,$column
44 );
45 $self->set_attrs_value(TABLE => $parent_table);
46 }
47 else {
48 $self->_debug(__LINE__,Dumper($self));
49 confess "node without name or ref is not supported\n";
50 }
51 $self;
52 }
53  
54 sub trigger_at_end_node {
55 my ($self,%params)=@_;
56 if (defined (my $table=$self->get_attrs_value(qw(TABLE)))) {
57 if ($table->get_attrs_value(qw(ATTRIBUTE_GROUP))) {
58 my $stackframe=$self->get_attrs_value(qw(STACK));
59 my $schema=$stackframe->[1];
60 $schema->add_attributes_group($table);
61 }
62 }
63 $self;
64 }
65  
66  
67 1;
68  
69 __END__