aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2005-10-19 10:10:24 +0000
committerdakkar <dakkar@luxion>2005-10-19 10:10:24 +0000
commitd1cee65858943465d74738fbea11ea7e96c7b786 (patch)
tree948fd41b38b5932d439e3db69ecfaf7f9dd0016b /lib/WebCoso
parentaggiunto il supporto per i nomi delle collezioni (diff)
downloadWebCoso-d1cee65858943465d74738fbea11ea7e96c7b786.tar.gz
WebCoso-d1cee65858943465d74738fbea11ea7e96c7b786.tar.bz2
WebCoso-d1cee65858943465d74738fbea11ea7e96c7b786.zip
aggiunto supporto per parent/child tra collezioni
git-svn-id: svn://luxion/repos/WebCoso/trunk@6 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib/WebCoso')
-rw-r--r--lib/WebCoso/Config.pm5
-rw-r--r--lib/WebCoso/Config/Collection.pm33
2 files changed, 37 insertions, 1 deletions
diff --git a/lib/WebCoso/Config.pm b/lib/WebCoso/Config.pm
index 74c150b..929b071 100644
--- a/lib/WebCoso/Config.pm
+++ b/lib/WebCoso/Config.pm
@@ -73,9 +73,12 @@ sub res {
}
sub coll {
- my ($name)=@_;
+ my ($name,$parents,$children,$resources)=@_;
WebCoso::Config::Collection->new({
name=>$name,
+ parents=>$parents||[],
+ children=>$children||[],
+ resources=>$resources||[],
});
}
diff --git a/lib/WebCoso/Config/Collection.pm b/lib/WebCoso/Config/Collection.pm
index 6b5d201..28e1892 100644
--- a/lib/WebCoso/Config/Collection.pm
+++ b/lib/WebCoso/Config/Collection.pm
@@ -6,6 +6,9 @@ use WebCoso::Config;
{
my %names_of :ATTR( :get<names> );
+my %parents_of :ATTR;
+my %children_of :ATTR;
+my %resources_of :ATTR( :init_arg<resources> );
sub BUILD {
my ($self,$ident,$args_ref)=@_;
@@ -15,6 +18,14 @@ sub BUILD {
$names={''=>$names} unless ref($names) eq 'HASH';
$names_of{$ident}=$names;
+ my $parents=$args_ref->{parents};
+ $_->add_child($self) for @$parents;
+ $parents_of{$ident}=$parents;
+
+ my $children=$args_ref->{children};
+ $_->add_parent($self) for @$children;
+ $children_of{$ident}=$children;
+
WebCoso::Config->add_collection($self);
}
@@ -49,6 +60,28 @@ sub properties {
}
}
+sub add_child {
+ my ($self,$child)=@_;
+ push @{ $children_of{ ident($self) } },$child;
+}
+sub add_parent {
+ my ($self,$parent)=@_;
+ push @{ $parents_of{ ident($self) } },$parent;
+}
+
+sub get_parents {
+ my ($self)=@_;
+ return @{ $parents_of{ ident($self) } };
+}
+sub get_children {
+ my ($self)=@_;
+ return @{ $children_of{ ident($self) } };
+}
+sub get_resources {
+ my ($self)=@_;
+ return @{ $resources_of{ ident($self) } };
+}
+
}
1;