annotate Lib/IMPL/ORM/Entity.pm @ 245:7c517134c42f

Added Unsupported media type Web exception corrected resourceLocation setting in the resource Implemented localizable resources for text messages fixed TT view scopings, INIT block in controls now sets globals correctly.
author sergey
date Mon, 29 Oct 2012 03:15:22 +0400
parents 4267a2ac3d46
children 4ddb27ff4a0b
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: 28
diff changeset
1 package IMPL::ORM::Entity;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
4
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 49
diff changeset
5 use parent qw(IMPL::Object);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
7 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
9 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
10 public _direct property Name => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
11 public _direct property Class => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
12 public _direct property Values => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
13 public _direct property Schema => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
14 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
15
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
16 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
17 my ($this,$class,$schema) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
18
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
19 $this->{$Class} = $class;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
20 (my $name = $class) =~ s/::/_/g;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
21 $this->{$Name} = $name;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
22 $this->Schema = $schema;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
23 $this->{$Values} = {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
24 map {$_->{name},{type => $_->{type}, virtual => $_->{virtual}}} @$schema
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
25 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
26 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
27
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
28 sub Store;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
29 *Store = \&dbgStore;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
30
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
31 sub dbgStore {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
32 my ($this,$prop,$value) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
34 if ( my $container = $this->{$Values}{$prop} ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
35 $container->{oldValue} = $container->{value};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
36 $container->{value} = $value;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
37 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
38 die new IMPL::InvalidOperationException("Property not found",$this->Name,$prop);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
39 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
40 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
41
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
42 sub Get {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
43 my ($this,$prop) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
45 return $this->{$Values}{$prop}{value};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
46 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
47
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
48 1;