annotate Lib/IMPL/DOM/Schema/Node.pm @ 105:a6e9759ff88a

Fixed a validation errors parameters
author wizard
date Tue, 11 May 2010 02:59:49 +0400
parents 196bf443b5e1
children e6447ad85cb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
1 package IMPL::DOM::Schema::Node;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
5 use base qw(IMPL::DOM::Node);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
7 use IMPL::DOM::Property qw(_dom);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
8 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
10 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
11 public _direct property minOccur => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
12 public _direct property maxOccur => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
13 public _direct property type => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
14 public _direct property name => prop_all;
100
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
15 public _direct property display => prop_all;
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
16 public _direct property display_no => prop_all;
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
17 public _direct property display_blame => prop_all;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
18 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
20 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
21 'IMPL::DOM::Node' => sub {my %args = @_; $args{nodeName} ||= 'Node'; %args}
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
22 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
23
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
24 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
25 my ($this,%args) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
27 $this->{$minOccur} = defined $args{minOccur} ? $args{minOccur} : 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
28 $this->{$maxOccur} = defined $args{maxOccur} ? $args{maxOccur} : 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
29 $this->{$type} = $args{type};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
30 $this->{$name} = $args{name} or die new IMPL::InvalidArgumentException('Argument is required','name');
100
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
31 $this->{$display} = $args{display};
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
32 $this->{$display_no} = $args{display_no};
df6b4f054957 Schema in progress
wizard
parents: 49
diff changeset
33 $this->{$display_blame} = $args{display_blame};
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
34 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
35
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
36 sub Validate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
37 my ($this,$node) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
39 if (my $schemaType = $this->{$type} ? $this->document->resolveType($this->{$type}) : undef ) {
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
40 my @errors = $schemaType->Validate($node,{Source => $this});
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
41 return @errors;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
42 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
43 return ();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
44 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
45 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
46
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
47 sub inflateValue {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
48 $_[1];
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
49 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
50
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
51 sub inflator { undef }
103
c289ed9662ca Schema beta 2
wizard
parents: 100
diff changeset
52
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
53 sub qname {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
54 $_[0]->nodeName.'[name='.$_[0]->{$name}.']';
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
55 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
56
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
57 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
58
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
59 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
60 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
61
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
62 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
63
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
64 package SchemaEntity;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
65 use base qw(IMPL::DOM::Schema::Node);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
67 sub Validate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
68 my ($this,$node) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
69 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
70
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
71 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
72
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
73 Базовый класс для элементов схемы.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
74
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
75 =cut