changeset 23:716b287d4795

merge
author Sergey
date Wed, 30 Sep 2009 17:43:52 +0400
parents da5bc24b3d3c (current diff) fafe56cfcd69 (diff)
children 7f00786f8210
files impl.kpf
diffstat 5 files changed, 95 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Node.pm	Wed Sep 30 17:41:32 2009 +0400
+++ b/Lib/IMPL/DOM/Node.pm	Wed Sep 30 17:43:52 2009 +0400
@@ -234,7 +234,7 @@
     join '', $this->nodeValue || '', map $_->nodeValue || '', @{$this->childNodes};
 }
 
-sub Property {
+sub nodeProperty {
     my $this = shift;
     my $name = shift;
     
--- a/Lib/IMPL/DOM/Schema.pm	Wed Sep 30 17:41:32 2009 +0400
+++ b/Lib/IMPL/DOM/Schema.pm	Wed Sep 30 17:43:52 2009 +0400
@@ -79,24 +79,28 @@
                 IMPL::DOM::Schema::Node->new(name => 'NodeSet', minOccur => 0, type => 'NodeSet'),
                 IMPL::DOM::Schema::Node->new(name => 'NodeList', minOccur => 0, type => 'NodeSet'),
                 IMPL::DOM::Schema::SimpleNode->new(name => 'Node', minOccur => 0, maxOccur => 'unbounded')
-            )
+            ),
+            new IMPL::DOM::Schema::Property(name => 'type')
         ),
         IMPL::DOM::Schema::ComplexType->new(type => 'ComplexNode', nativeType => 'IMPL::DOM::Schema::ComplexNode')->appendRange(
             IMPL::DOM::Schema::NodeList->new()->appendRange(
                 IMPL::DOM::Schema::Node->new(name => 'NodeSet', minOccur => 0, type => 'NodeSet'),
                 IMPL::DOM::Schema::Node->new(name => 'NodeList', minOccur => 0, type => 'NodeSet'),
                 IMPL::DOM::Schema::SimpleNode->new(name => 'Node', minOccur => 0, maxOccur => 'unbounded')
-            )
+            ),
+            new IMPL::DOM::Schema::Property(name => 'name')
         ),
         IMPL::DOM::Schema::ComplexType->new(type => 'SimpleType', nativeType => 'IMPL::DOM::Schema::SimpleType')->appendRange(
             IMPL::DOM::Schema::NodeSet->new()->appendRange(
                 IMPL::DOM::Schema::AnyNode->new(maxOccur => 'unbounded', minOccur => 0)
-            )
+            ),
+            new IMPL::DOM::Schema::Property(name => 'type')
         ),
         IMPL::DOM::Schema::ComplexType->new(type => 'SimpleNode', nativeType => 'IMPL::DOM::Schema::SimpleNode')->appendRange(
             IMPL::DOM::Schema::NodeSet->new()->appendRange(
                 IMPL::DOM::Schema::AnyNode->new(maxOccur => 'unbounded', minOccur => 0)
-            )
+            ),
+            new IMPL::DOM::Schema::Property(name => 'name')
         )
     );
     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/DOM/Schema/Property.pm	Wed Sep 30 17:43:52 2009 +0400
@@ -0,0 +1,52 @@
+package IMPL::DOM::Schema::Property;
+use strict;
+use warnings;
+
+use base qw(IMPL::DOM::Schema::SimpleNode);
+require IMPL::DOM::Schema;
+require IMPL::DOM::Node;
+use IMPL::Class::Property;
+
+__PACKAGE__->PassThroughArgs;
+
+BEGIN {
+    public property RequiredMessage => prop_all;
+}
+
+our %CTOR = {
+    'IMPL::DOM::Schema::SimleNode' => sub {
+        my %args = @_;
+        
+        $args{maxOccur} = 1;
+        $args{minOccur} = delete $args{optional} ? 0 : 1;
+        $args{nodeName} ||= 'Property';
+        
+        return %args;
+    }
+};
+
+sub CTOR {
+    my ($this,%args) = @_;
+    
+    $this->RequiredMessage($args{RequiredMessage} || 'A property %Schema.name% is required');
+}
+
+sub Validate {
+    my ($this,$node) = @_;
+    
+    if ($this->minOccur) {
+        my $prop = $this->name;
+        my $nodeProp = new IMPL::DOM::Node(nodeName => '::property', nodeValue => $node->$prop() || $node->nodePropety($prop));
+        
+        if (! $nodeProp->nodeValue) {
+            return new IMPL::DOM::Schema::VaidationError(
+                Message => 
+            );
+        }
+        return $this->SUPER::Validate($nodeProp);
+    } else {
+        return ();
+    }
+}
+
+1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/ORM/Object.pm	Wed Sep 30 17:43:52 2009 +0400
@@ -0,0 +1,8 @@
+package IMPL::ORM::Object;
+use strict;
+use warnings;
+
+use base qw(IMPL::Object::Abstract);
+
+
+1;
--- a/impl.kpf	Wed Sep 30 17:41:32 2009 +0400
+++ b/impl.kpf	Wed Sep 30 17:43:52 2009 +0400
@@ -222,6 +222,32 @@
 </preference-set>
   <string id="lastInvocation">default</string>
 </preference-set>
+<preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/DOM/Schema/Property.pm">
+<preference-set id="Invocations">
+<preference-set id="default">
+  <string id="cookieparams"></string>
+  <string id="cwd"></string>
+  <long id="debugger.io-port">9011</long>
+  <string id="documentRoot"></string>
+  <string id="executable-params"></string>
+  <string relative="path" id="filename">Lib/IMPL/DOM/Schema/Property.pm</string>
+  <string id="getparams"></string>
+  <string id="language">Perl</string>
+  <string id="mpostparams"></string>
+  <string id="params"></string>
+  <string id="postparams"></string>
+  <string id="posttype">application/x-www-form-urlencoded</string>
+  <string id="request-method">GET</string>
+  <boolean id="show-dialog">1</boolean>
+  <boolean id="sim-cgi">0</boolean>
+  <boolean id="use-console">0</boolean>
+  <string id="userCGIEnvironment"></string>
+  <string id="userEnvironment"></string>
+  <string id="warnings">enabled</string>
+</preference-set>
+</preference-set>
+  <string id="lastInvocation">default</string>
+</preference-set>
 <preference-set idref="66c7d414-175f-45b6-92fe-dbda51c64843/Lib/IMPL/DOM/XMLReader.pm">
 <preference-set id="Invocations">
 <preference-set id="default">