annotate Lib/IMPL/DOM/Schema/SimpleNode.pm @ 355:8dfb9df07d02

added support for the custom resolvers for the TTView
author sergey
date Thu, 17 Oct 2013 01:04:37 +0400
parents 4ddb27ff4a0b
children 648dfaf642e0
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;
152
1e7f03414b65 DOM: schema improvements
wizard
parents: 124
diff changeset
7 use IMPL::DOM::Property qw(_dom);
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
8
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
9 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
10 public _dom _direct property inflator => prop_get;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
11 public _dom _direct property messageInflateError => prop_get;
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
12 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
13
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
14 our %CTOR = (
124
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
15 'IMPL::DOM::Schema::Node' => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 my %args = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
17 $args{nodeName} ||= 'SimpleNode';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
18 delete @args{qw(inflator messageInflateError)};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
19 %args
124
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
20 }
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
21 );
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
22
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
23 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
24 my ($this,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
25
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
26 if ( $args{inflator} ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 $this->{$inflator} = $args{inflator} ;
238
b8c724f6de36 DOM model refactoring
sergey
parents: 194
diff changeset
28 $this->{$messageInflateError} = exists $args{messageInflateError} ? $args{messageInflateError} : 'Failed to inflate nodeValue %node.path%: %error%';
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 }
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
30 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
31
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
32 sub Validate {
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
33 my ($this,$node,$ctx) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
34
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
35 my @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
36
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
37 push @result, $_->Validate($node,$ctx) foreach $this->childNodes;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
38
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
39 return @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
40 }
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 sub inflateValue {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
43 my ($this,$value) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
44
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45 if ( my $inflator = $this->inflator ) {
248
814d755e5d12 Minor fixes
sergey
parents: 238
diff changeset
46 return $inflator->new($value,$this);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
47 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
48 return $value;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
49 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
50 }
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 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
53
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
54 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
56 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
57
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
58 =head1 NAME
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
59
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
60 C<IMPL::DOM::SimpleNode> - узел с текстом.
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
61
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
62 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
63
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
64 Узел имеющий простое значение. Данный узел может содержать ограничения
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
65 на простое значение.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
66
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
67 Производит валидацию содержимого, при постоении DOM модели не имеет специального
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
68 типа и будет создан в виде C<IMPL::DOM::Node>.
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
69
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
70 Также определяет как будет воссоздано значение узла в DOM модели.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
71
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
72 =cut