annotate Lib/IMPL/DOM/Schema/SimpleNode.pm @ 136:f6af119ac741

url routines for templates
author wizard
date Fri, 25 Jun 2010 16:45:56 +0400
parents e30bdd040fe3
children 1e7f03414b65
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
5 use base 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;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
8
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
9 BEGIN {
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
10 public _direct property inflator => prop_get;
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
11 public _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 {
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
16 my %args = @_;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
17 $args{nodeName} ||= 'SimpleNode';
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
18 delete @args{qw(inflator messageInflateError)};
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 104
diff changeset
19 %args
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 {
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
24 my ($this,%args) = @_;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
25
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
26 $this->{$inflator} = $args{inflator} if $args{inflator};
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
27 $this->{$messageInflateError} = $args{messageInflateError} || 'Failed to inflate nodeValue %Node.path%: %Error%';
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
28 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
29
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
30 sub Validate {
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
31 my ($this,$node,$ctx) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
32
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
33 my @result;
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 push @result, $_->Validate($node,$ctx) foreach $this->childNodes;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
36
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
37 return @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
38 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
39
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
40 sub inflateValue {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
41 my ($this,$value) = @_;
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 if ( my $inflator = $this->inflator ) {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
44 return $inflator->new($value);
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
45 } else {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
46 return $value;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
47 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
48 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
50 1;
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 __END__
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 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
56 =head1 NAME
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
57
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
58 C<IMPL::DOM::SimpleNode> - узел с текстом.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
59
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
60 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
61
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
62 Узел имеющий простое значение. Данный узел может содержать ограничения
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
63 на простое значение.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
64
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
65 Производит валидацию содержимого, при постоении DOM модели не имеет специального
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
66 типа и будет создан в виде C<IMPL::DOM::Node>.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
67
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
68 Также определяет как будет воссоздано значение узла в DOM модели.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
69
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
70 =cut