Mercurial > pub > Impl
diff Lib/IMPL/Web/View/Metadata/ObjectMeta.pm @ 371:d5c8b955bf8d
refactoring
author | cin |
---|---|
date | Fri, 13 Dec 2013 16:49:47 +0400 |
parents | cbf4febf0930 |
children |
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/Metadata/ObjectMeta.pm Tue Dec 10 03:02:01 2013 +0400 +++ b/Lib/IMPL/Web/View/Metadata/ObjectMeta.pm Fri Dec 13 16:49:47 2013 +0400 @@ -2,7 +2,7 @@ use strict; use IMPL::lang; -use IMPL::Const qw(:prop); +use IMPL::Const qw(:prop :access); use IMPL::declare { require => { Exception => 'IMPL::Exception', @@ -49,8 +49,14 @@ my $modelType = $this->modelType; if ( isclass($modelType,AbstractObject) ) { - foreach my $pi ($this->modelType->GetMeta(PropertyInfo, sub { not($seen{$_}++) }, 1)) { - my $pv = $pi->getter->($this->model); + foreach my $pi ( + $this->modelType->GetMeta( + PropertyInfo, + sub { not($seen{$_}++) and $_->access == ACCESS_PUBLIC }, + 1 + ) + ) { + my $pv = $this->model && $pi->getter->($this->model); my $pt; my %args = (name => $pi->name); @@ -110,6 +116,18 @@ ); } +sub GetMetadataForModel { + my ($self,$model,$args) = @_; + + $args ||= {}; + + return $self->new( + $model, + delete $args->{modelType}, + $args + ) +} + 1; __END__