TODO: Synopsis here.
None available.
sub _new
{ my ($self) = @_;
$self->SUPER::_new();
$self->attr('query',undef);
$self->attr('original_attributes',undef);
$self->attr('result_table',undef);
$self->attr('attribute_positions',undef); $self->attr('attribute_url_positions',undef); $self->attr('attribute_url',undef); $self->attr('dataset1_end',undef); }
} |
sub getTextDisplayNames
{ my ($self,$separator) = @_;
my $original_attributes = $self->get('original_attributes');
my $final_dataset_order = $self->get('query')->finalDatasetOrder;
my @attribute_display_names;
my @original_dataset_attributes;
foreach my $dataset(reverse @$final_dataset_order){
foreach (@{$original_attributes}){
push @original_dataset_attributes,$_
if ($_->dataSetName eq $dataset);
}
}
foreach my $original_attribute(@original_dataset_attributes){
push @attribute_display_names, $original_attribute->displayName;
}
return @attribute_display_names; } |
sub resultTable
{ my ($self,$result_table) = @_;
if ($result_table){
$self->set('result_table',$result_table);
}
return $self->get('result_table'); } |
sub setHTMLAttributes
{ my ($self, $query) = @_;
if($query->getAllAttributes())
{
my $registry = $query->getRegistry;
my $attributes = [@{$query->getAllAttributes()}];
foreach my $attribute (@$attributes){
if ($attribute->link){
my @link = split(/\|/,$attribute->link);
if (@link > 2){ for (my $i = 2; $i < @link; $i++){
next if ($link[$i] eq $attribute->name);
next if (!$query->getRegistry
->getDatasetByName($query->virtualSchema, $attribute->dataSetName)
->getConfigurationTree($attribute->interface)
->getAttributeByName($link[$i]));
if($query->get('currentDS') ne $attribute->dataSetName)
{
my $tempDS = $query->get('currentDS');
$query->setDataset($attribute->dataSetName);
$query->addAttribute($link[$i], $attribute->interface);
$query->setDataset($tempDS);
}
else
{
$query->addAttribute($link[$i], $attribute->interface);
}
}
}
}
}
my $final_dataset_order = $query->finalDatasetOrder;
my $original_attributes = $self->get('original_attributes');
my @attribute_positions;
my @attribute_url_positions;
my @attribute_url;
my $att_counter = 0;
my $extra_att_counter = 0;
my $dataset_start = 0;
my $extra_att_start = 0;
foreach my $dataset(reverse @$final_dataset_order){
my @original_dataset_attributes;
foreach (@{$original_attributes}){
push @original_dataset_attributes,$_
if ($_->dataSetName eq $dataset);
}
$dataset_start = $extra_att_start + $extra_att_counter;
$extra_att_start = $dataset_start + @original_dataset_attributes;
$att_counter = 0;
$extra_att_counter = 0;
foreach my $original_attribute(@original_dataset_attributes){
my @url_positions;
my @link;
if ($original_attribute->link){
@link = split(/\|/,$original_attribute->link);
if (@link > 2){ for (my $i = 2; $i < @link; $i++){
next if (!$query->getRegistry
->getDatasetByName($query->virtualSchema,
$original_attribute->dataSetName)
->getConfigurationTree($original_attribute->interface)
->getAttributeByName($link[$i]));
if ($link[$i] eq $original_attribute->name){
push @url_positions, $dataset_start+$att_counter;
}
else{
push @url_positions,
$extra_att_start+$extra_att_counter;
$extra_att_counter++;
}
}
}
else{
push @url_positions,$dataset_start+$att_counter;
}
}
else{
push @url_positions,$dataset_start+$att_counter;
}
push @attribute_url_positions,\@ url_positions;
push @attribute_positions, $dataset_start+$att_counter;
my %prefixes;
my $mart_registry = $query->getRegistry();
my $hash = $mart_registry->settingsParams();
foreach(keys %$hash) {
if($_ eq "urlPrefixes") {
%prefixes = %{$hash->{$_}};
}
}
my $resolvedLink =
$link[1]
? (
(substr($link[1],0,1) eq '/')
? $prefixes{$link[0]} . $link[1]
: $link[1]
)
: $link[0];
push @attribute_url, $resolvedLink;
$att_counter++;
}
}
$self->set('attribute_positions',\@attribute_positions);
$self->set('attribute_url_positions',\@attribute_url_positions);
$self->set('attribute_url',\@attribute_url);
my @original_dataset_attributes;
foreach my $dataset(reverse @$final_dataset_order){
foreach (@{$original_attributes}){
push @original_dataset_attributes,$_
if ($_->dataSetName eq $dataset);
}
}
my ($first_dataset,$dataset1_end);
foreach my $original_attribute(@original_dataset_attributes){
my $dataset_name = $original_attribute->pointedFromDataset ||
$original_attribute->dataSetName;
if ($first_dataset && $first_dataset ne $dataset_name){
$self->set('dataset1_end',$dataset1_end-1);
last;
}
$dataset1_end++;
$self->set('dataset1_end',$dataset1_end-1);
$first_dataset = $dataset_name;
}
}
return $query; } |