New infrastructure for building the parents that an asset requires.
This commit is contained in:
parent
d966711f00
commit
e004eab9f5
1 changed files with 20 additions and 21 deletions
|
|
@ -24,23 +24,25 @@ sub list_of_tables {
|
||||||
return [qw/assetData/];
|
return [qw/assetData/];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getMyParent {
|
sub parent_list {
|
||||||
my $test = shift;
|
return [];
|
||||||
my $session = $test->session;
|
}
|
||||||
my $parentClasses = $test->class->valid_parent_classes;
|
|
||||||
my $default = WebGUI::Asset->getDefault($session);
|
sub getMyParents {
|
||||||
if (WebGUI::Utility::isIn('WebGUI::Asset', @{ $parentClasses}) ) {
|
my $test = shift;
|
||||||
return $default;
|
my $session = $test->session;
|
||||||
}
|
my $parent_classes = $test->parent_list;
|
||||||
else {
|
my @parents = ();
|
||||||
my $class = $parentClasses->[0];
|
my $default = WebGUI::Asset->getDefault($session);
|
||||||
note "Adding a parent of $class";
|
push @parents, $default;
|
||||||
my $parent = $default->addChild({
|
my $parent = $default;
|
||||||
className => $class,
|
foreach $parent_class (@{ $parent_classes }) {
|
||||||
}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
|
my $new_parent = $parent->addChild({className => $parent_class}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
|
||||||
addToCleanup($parent);
|
push @parents, $new_parent;
|
||||||
return $parent;
|
$parent = $new_parent;
|
||||||
|
addToCleanup($new_parent);
|
||||||
}
|
}
|
||||||
|
return @parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _constructor : Test(4) {
|
sub _constructor : Test(4) {
|
||||||
|
|
@ -194,11 +196,8 @@ sub keywords : Test(3) {
|
||||||
my $test = shift;
|
my $test = shift;
|
||||||
my $session = $test->session;
|
my $session = $test->session;
|
||||||
note "keywords for ".$test->class;
|
note "keywords for ".$test->class;
|
||||||
use Data::Dumper;
|
my @parents = $test->getMyParents;
|
||||||
warn Dumper $test->class->valid_parent_classes;
|
my $asset = $parents[-1]->addChild({
|
||||||
my $parent = $test->getMyParent;
|
|
||||||
note "got parent and it is a ".ref $parent;
|
|
||||||
my $asset = $parent->addChild({
|
|
||||||
className => $test->class,
|
className => $test->class,
|
||||||
}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
|
}, undef, undef, {skipNotification => 1, skipAutoCommitWorkflows => 1,});
|
||||||
addToCleanup($asset);
|
addToCleanup($asset);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue