annotate Lib/IMPL/DOM/Schema/SimpleNode.pm @ 169:fd92830036c3

corrected IMPL::SQL::Schema::Diff
author sourcer
date Tue, 17 May 2011 00:04:28 +0400
parents 76515373dac0
children d1676be8afcc
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: 20
diff changeset
1 package IMPL::DOM::Schema::SimpleNode;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
4
165
76515373dac0 Added Class::Template,
wizard
parents: 152
diff changeset
5 use parent qw(IMPL::DOM::Schema::Node);
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
6 use IMPL::Class::Property;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
7 use IMPL::Class::Property::Direct;
152
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
8 use IMPL::DOM::Property qw(_dom);
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
9
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
10 BEGIN {
152
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
11 public _dom _direct property inflator => prop_get;
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
12 public _dom _direct property messageInflateError => prop_get;
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
13 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
15 our %CTOR = (
124
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
16 'IMPL::DOM::Schema::Node' => sub {
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
17 my %args = @_;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
18 $args{nodeName} ||= 'SimpleNode';
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
19 delete @args{qw(inflator messageInflateError)};
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
20 %args
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
21 }
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
22 );
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
23
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
24 sub CTOR {
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
25 my ($this,%args) = @_;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
26
152
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
27 if ( $args{inflator} ) {
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
28 $this->{$inflator} = $args{inflator} ;
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
29 $this->{$messageInflateError} = exists $args{messageInflateError} ? $args{messageInflateError} : 'Failed to inflate nodeValue %Node.path%: %Error%';
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
30 }
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
31 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
32
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
33 sub Validate {
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
34 my ($this,$node,$ctx) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
35
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
36 my @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
37
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
38 push @result, $_->Validate($node,$ctx) foreach $this->childNodes;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
39
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
40 return @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
41 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
42
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
43 sub inflateValue {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
44 my ($this,$value) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
45
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
46 if ( my $inflator = $this->inflator ) {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
47 return $inflator->new($value);
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
48 } else {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
49 return $value;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
50 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
51 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
52
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
53 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
54
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
56
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
57 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
58
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
59 =head1 NAME
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
60
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
61 C<IMPL::DOM::SimpleNode> - узел с текстом.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
62
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
63 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
64
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
65 Узел имеющий простое значение. Данный узел может содержать ограничения
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
66 на простое значение.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
67
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
68 Производит валидацию содержимого, при постоении DOM модели не имеет специального
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
69 типа и будет создан в виде C<IMPL::DOM::Node>.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
70
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
71 Также определяет как будет воссоздано значение узла в DOM модели.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
72
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
73 =cut