TODO: Synopsis here.
sub _addOption
{ my ($parentObject,$xmlOption,$dataSetName,$interfaceType,
$configurationTree) = @_;
my $option = BioMart::Configuration::Option->new(
'name' => $xmlOption->{'internalName'},
'displayName' => $xmlOption->{'displayName'},
'description' => $xmlOption->{'description'},
'dataSetName' => $dataSetName,
'value' => $xmlOption->{'value'}
);
$option->operation($xmlOption->{'qualifier'});
if ($xmlOption->{'tableConstraint'} && $xmlOption->{'field'}){ my $attribute;
$attribute = $configurationTree->
getAttributeByName($xmlOption->{'internalName'});
if (!$attribute){
$attribute = BioMart::Configuration::Attribute->new(
'name' => $xmlOption->{'internalName'},
'imageURL' => $xmlOption->{'imageURL'},
'displayName' => $xmlOption->{'displayName'},
'description' => $xmlOption->{'description'},
'table' => $xmlOption->{'tableConstraint'},
'relational_attribute' => $xmlOption->{'field'},
'key' => lc($xmlOption->{'key'}),
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'dependsOnType' => $xmlOption->{'dependsOnType'},
'dependsOn' => $xmlOption->{'dependsOn'},
);
}
my $filter;
if ($xmlOption->{'type'} && $xmlOption->{'type'} eq 'boolean'){
$filter = BioMart::Configuration::BooleanFilter->new(
'name' => $xmlOption->{'internalName'},
'imageURL' => $xmlOption->{'imageURL'},
'displayName' => $xmlOption->{'displayName'},
'description' => $xmlOption->{'description'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'type' => $xmlOption->{'type'},
'dependsOnType' => $xmlOption->{'dependsOnType'},
'dependsOn' => $xmlOption->{'dependsOn'},
'legalQualifiers' => $xmlOption->{'legal_qualifiers'},
);
$filter->attribute($attribute);
$filter->setAttribute($xmlOption->{'setAttribute'});
}
elsif ($xmlOption->{'type'} && $xmlOption->{'type'} eq 'boolean_num'){
$filter = BioMart::Configuration::BooleanFilter->new(
'name' => $xmlOption->{'internalName'},
'imageURL' => $xmlOption->{'imageURL'},
'displayName' => $xmlOption->{'displayName'},
'description' => $xmlOption->{'description'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'type' => $xmlOption->{'type'},
'dependsOnType' => $xmlOption->{'dependsOnType'},
'dependsOn' => $xmlOption->{'dependsOn'},
'legalQualifiers' => $xmlOption->{'legal_qualifiers'},
);
$filter->setNumberFlag();
$filter->attribute($attribute);
$filter->setAttribute($xmlOption->{'setAttribute'});
}
else{
$filter = BioMart::Configuration::ValueFilter->new(
'name' => $xmlOption->{'internalName'},
'description' => $xmlOption->{'description'},
'displayName' => $xmlOption->{'displayName'},
'imageURL' => $xmlOption->{'imageURL'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'buttonURL' => $xmlOption->{'buttonURL'},
'type' => $xmlOption->{'type'},
'dependsOnType' => $xmlOption->{'dependsOnType'},
'dependsOn' => $xmlOption->{'dependsOn'},
'legalQualifiers' => $xmlOption->{'legal_qualifiers'},
);
$filter->attribute($attribute);
$filter->operation($xmlOption->{'qualifier'});
$filter->setAttribute($xmlOption->{'setAttribute'});
}
$filter->displayType($xmlOption->{'displayType'});
$filter->multipleValues($xmlOption->{'multipleValues'});
$filter->style($xmlOption->{'style'});
$filter->graph($xmlOption->{'graph'});
$filter->autoCompletion($xmlOption->{'autoCompletion'});
$option->filter($filter);
}
foreach my $xmlSubOption(@{ $xmlOption->{'Option'} }) {
next if ($xmlSubOption->{'hidden'} &&
$xmlSubOption->{'hidden'} eq 'true');
$option = _addOption($option,$xmlSubOption,$dataSetName,
$interfaceType,$configurationTree);
}
foreach my $xmlPushAction(@{ $xmlOption->{'PushAction'} }) {
next if ($xmlPushAction->{'hidden'} &&
$xmlPushAction->{'hidden'} eq 'true');
$option = _addPushAction($option,$xmlPushAction,$dataSetName,
$interfaceType,$configurationTree);
}
$parentObject->addOption($option);
return $parentObject; } |
sub addPlaceHolders
{ my ($self, $configTree, $virtualSchemaName, $dataSetName, $interface) = @_;
my $xml = $configTree->toXML(); my $registry = $self->get('registry');
my $dataSet = $registry->getDatasetByName($virtualSchemaName,
$dataSetName);
my $xmlHash = XMLin($xml, forcearray => [qw(AttributePage AttributeGroup
AttributeCollection AttributeDescription FilterPage FilterGroup
FilterCollection FilterDescription Importable Exportable Key MainTable
BatchSize SeqModule Option PushAction)], keyattr => []);
foreach my $xmlAttributeTree (@{ $xmlHash->{'AttributePage'} }) {
my $attributePage = $configTree->
getAttributeTreeByName($xmlAttributeTree->{'internalName'});
next unless $attributePage;
foreach my $xmlAttributeGroup
(@{ $xmlAttributeTree->{'AttributeGroup'} }) {
my $attributeGroup = $attributePage->
getAttributeGroupByName($xmlAttributeGroup->{'internalName'});
next unless $attributeGroup;
foreach my $xmlAttributeCollection
(@{ $xmlAttributeGroup->{'AttributeCollection'} }) {
my $attributeCollection = $attributeGroup->
getAttributeCollectionByName(
$xmlAttributeCollection->{'internalName'});
next unless $attributeCollection;
foreach my $xmlAttribute
(@{ $xmlAttributeCollection->{'AttributeDescription'} }) {
my $attribute;
if ( ($xmlAttribute->{'pointerDataset'} &&
$xmlAttribute->{'pointerInterface'} &&
$xmlAttribute->{'pointerAttribute'} || $xmlAttribute->{'pointerFilter'} )){
my ($pointerDatasetName, $pointerInterface,
$pointerAttribute, $pointerFilter);
if ($xmlAttribute->{'pointerDataset'}){
$pointerDatasetName =
$xmlAttribute->{'pointerDataset'};
$pointerInterface =
$xmlAttribute->{'pointerInterface'};
$pointerAttribute =
$xmlAttribute->{'pointerAttribute'};
$pointerFilter =
$xmlAttribute->{'pointerFilter'};
}
my $pointerDataset = $registry->getDatasetByName(
$virtualSchemaName, $pointerDatasetName) || next;
my $pointerConfigurationTree = $pointerDataset->
getConfigurationTree($pointerInterface) || next;
if ($pointerFilter){
my $filter = $pointerConfigurationTree->
getFilterByName($pointerFilter) || next;
my $newName = $pointerFilter; my $new_filter;
if ($filter->isa
("BioMart::Configuration::BooleanFilter")){
$new_filter =
BioMart::Configuration::BooleanFilter->new(
'name' => $newName, 'imageURL' => $filter->imageURL,
'displayName' => $filter->displayName,
'dataSetName' => $filter->dataSetName,
'interface' => $filter->interface,
'buttonURL' => $filter->buttonURL,
'setAttributePage' =>
$filter->setAttributePage,
'type' => $filter->type,
'dependsOn' => $filter->dependsOn,
'dependsOnType' => $filter->dependsOnType,
'hidden' => $xmlAttribute->{'hidden'},
'legalQualifiers' => $filter->legalQualifiers,
);
$new_filter->attribute($filter->attribute);
$new_filter->defaultOn($filter->defaultOn);
$new_filter->setAttribute($filter->setAttribute);
$new_filter->setNumberFlag($filter->getNumberFlag);
}
elsif ($filter->isa
("BioMart::Configuration::ValueFilter")){
$new_filter =
BioMart::Configuration::ValueFilter->new(
'name' => $newName,
'imageURL' => $filter->imageURL,
'displayName' => $filter->displayName,
'dataSetName' => $filter->dataSetName,
'interface' => $filter->interface,
'buttonURL' => $filter->buttonURL,
'setAttributePage' =>
$filter->setAttributePage,
'type' => $filter->type,
'hidden' => $xmlAttribute->{'hidden'},
'dependsOn' => $filter->dependsOn,
'dependsOnType' => $filter->dependsOnType,
'legalQualifiers' => $filter->legalQualifiers,
);
$new_filter->attribute($filter->attribute);
$new_filter->operation($filter->operation);
$new_filter->otherFilters($filter->otherFilters);
$new_filter->regexp($filter->regexp);
$new_filter->defaultValue($filter->defaultValue);
$new_filter->defaultOn($filter->defaultOn);
$new_filter->setAttribute($filter->setAttribute);
$new_filter->addOptions($filter->getAllOptions);
}
$new_filter->pointedFromDataset($dataSetName);
$new_filter->pointedFromInterface($interface);
if ($registry->getPath($virtualSchemaName,
$dataSetName,
$pointerDatasetName)){
$new_filter->displayType($filter->displayType);
$new_filter->multipleValues(
$filter->multipleValues);
$new_filter->style($filter->style);
$new_filter->graph($filter->graph);
$new_filter->autoCompletion(
$filter->autoCompletion);
$attributeCollection->addAttribute($new_filter);
}
}
else{
my $newName = $pointerAttribute;
$attribute = $pointerConfigurationTree->
getAttributeByName($pointerAttribute) || next;
my $new_attribute =
BioMart::Configuration::Attribute->new(
'name' => $newName, 'imageURL' => $attribute->imageURL,
'displayName' => $attribute->displayName,
'table' => $attribute->table,
'relational_attribute' =>
$attribute->relationalAttribute,
'key' => $attribute->key,
'width' => $attribute->width,
'link' => $attribute->link,
'datasetLink' => $attribute->datasetLink,
'default' => $attribute->default,
'hidden' => $xmlAttribute->{'hidden'},
'dataSetName' => $attribute->dataSetName,
'attributes' => $attribute->attributes,
'interface' => $attribute->interface,
'dependsOn' => $attribute->dependsOn,
'dependsOnType' => $attribute->dependsOnType
);
$new_attribute->pointedFromDataset($dataSetName);
$new_attribute->pointedFromInterface($interface);
$new_attribute->pointedFromAttribute($xmlAttribute->{'internalName'});
if ($registry->getPath($virtualSchemaName,
$dataSetName,
$pointerDatasetName)){
$attributeCollection->
addAttribute($new_attribute);
}
}
}
}
}
}
}
foreach my $xmlFilterTree (@{ $xmlHash->{'FilterPage'} }) {
my $filterPage = $configTree->getFilterTreeByName(
$xmlFilterTree->{'internalName'});
next unless $filterPage;
foreach my $xmlFilterGroup (@{ $xmlFilterTree->{'FilterGroup'} }) {
my $filterGroup = $filterPage->getFilterGroupByName(
$xmlFilterGroup->{'internalName'});
next unless $filterGroup;
foreach my $xmlFilterCollection
(@{ $xmlFilterGroup->{'FilterCollection'} }) {
my $filterCollection = $filterGroup->getFilterCollectionByName
($xmlFilterCollection->{'internalName'});
next unless $filterCollection;
foreach my $xmlFilter
(@{ $xmlFilterCollection->{'FilterDescription'} }) {
my $filter;
if ( ($xmlFilter->{'pointerDataset'}
&& $xmlFilter->{'pointerInterface'}
&& $xmlFilter->{'pointerFilter'})){
my ($pointerDatasetName,$pointerInterface,
$pointerFilter);
if ($xmlFilter->{'pointerDataset'}){
$pointerDatasetName =
$xmlFilter->{'pointerDataset'};
$pointerInterface =
$xmlFilter->{'pointerInterface'};
$pointerFilter =
$xmlFilter->{'pointerFilter'};
}
my $pointerDataset = $registry->getDatasetByName
($virtualSchemaName, $pointerDatasetName) || next;
my $pointerConfigurationTree = $pointerDataset->
getConfigurationTree($pointerInterface) || next;
$filter = $pointerConfigurationTree->getFilterByName
($pointerFilter) || next;
my $newName = $pointerFilter;
if ($configTree->getFilterByName($newName)){
warn("Placeholder Filter $newName from $pointerDatasetName has an internalName clash in dataset $dataSetName\n");
next;
}
my $new_filter;
if ($filter->isa
("BioMart::Configuration::BooleanFilter")){
$new_filter =
BioMart::Configuration::BooleanFilter->new(
'name' => $newName,
'imageURL' => $filter->imageURL,
'displayName' => $filter->displayName,
'dataSetName' => $filter->dataSetName,
'interface' => $filter->interface,
'buttonURL' => $filter->buttonURL,
'hidden' => $xmlFilter->{'hidden'},
'setAttributePage' =>
$filter->setAttributePage,
'type' => $filter->type,
'dependsOn' => $filter->dependsOn,
'dependsOnType' => $filter->dependsOnType,
'legalQualifiers' => $filter->legalQualifiers,
);
$new_filter->attribute($filter->attribute);
$new_filter->defaultOn($filter->defaultOn);
$new_filter->setAttribute($filter->setAttribute);
$new_filter->setNumberFlag($filter->getNumberFlag);
$new_filter->addOptions($filter->getAllOptions);
}
elsif ($filter->isa
("BioMart::Configuration::ValueFilter")){
$new_filter =
BioMart::Configuration::ValueFilter->new(
'name' => $newName,
'imageURL' => $filter->imageURL,
'displayName' => $filter->displayName,
'dataSetName' => $filter->dataSetName,
'interface' => $filter->interface,
'buttonURL' => $filter->buttonURL,
'hidden' => $xmlFilter->{'hidden'},
'setAttributePage' =>
$filter->setAttributePage,
'type' => $filter->type,
'dependsOn' => $filter->dependsOn,
'dependsOnType' => $filter->dependsOnType,
'legalQualifiers' => $filter->legalQualifiers,
);
$new_filter->attribute($filter->attribute);
$new_filter->operation($filter->operation);
$new_filter->otherFilters($filter->otherFilters);
$new_filter->regexp($filter->regexp);
$new_filter->defaultValue($filter->defaultValue);
$new_filter->defaultOn($filter->defaultOn);
$new_filter->setAttribute($filter->setAttribute);
$new_filter->addOptions($filter->getAllOptions);
}
$new_filter->pointedFromDataset($dataSetName);
$new_filter->pointedFromInterface($interface);
if ($registry->getPath($virtualSchemaName,
$pointerDatasetName,
$dataSetName)){
$new_filter->displayType($filter->displayType);
$new_filter->multipleValues(
$filter->multipleValues);
$new_filter->style($filter->style);
$new_filter->graph($filter->graph);
$new_filter->autoCompletion(
$filter->autoCompletion);
$filterCollection->addFilter($new_filter);
}
}
}
}
}
}
EXP: foreach my $exportable (@{ $xmlHash->{'Exportable'} })
{
if (($exportable->{'attributes'} =~ /__/) || ($exportable->{'pointer'} && $exportable->{'pointer'} eq 'true'))
{
my $attributeList = BioMart::Configuration::AttributeList->new(
'name' => $exportable->{'name'},
'displayName' => $exportable->{'displayName'},
'linkName' => $exportable->{'linkName'},
'linkVersion' => $exportable->{'linkVersion'},
'attribute_string' => $exportable->{'attributes'},
'orderby_string' => $exportable->{'orderBy'},
'dataSetName' => $dataSetName,
'interface' => $interface,
'type' => $exportable->{'type'} || 'link'
);
if ($exportable->{'default'}) { $attributeList->setDefault()}
foreach my $attributeName (split (/,/, $exportable->{'attributes'})) {
my $attributeWithName = $attributeName;
if($attributeName =~ m/__/) # test for old style gtf exportable, ens 41 and before { my @attributeName = split(/__/,$attributeName); $attributeWithName = $attributeName[1];
}
my $attribute = $configTree->getAttributeByName($attributeWithName);
$attributeList->addAttribute($attribute);
}
if ($exportable->{'orderBy'}) {
foreach my $attributeName (split (/,/, $exportable->{'orderBy'})) {
my $attributeWithName = $attributeName;
if($attributeName =~ m/__/) # test for old style gtf exportable, ens 41 and before { my @attributeName = split(/__/,$attributeName); $attributeWithName = $attributeName[1];
}
my $attribute = $configTree->getAttributeByName($attributeWithName);
$attributeList->addOrderByAttribute($attribute);
}
}
my $exportables = $dataSet->get('exportables');
$exportables->{$attributeList->linkName()}->{$interface} = $attributeList;
$dataSet->set('exportables', $exportables);
}
else
{
next EXP;
}
}
foreach my $fpage (@{$configTree->getAllFilterTrees}){
foreach my $fgroup (@{$fpage->getAllFilterGroups}){
foreach my $fcollection(@{$fgroup->getAllCollections}){
foreach my $filter(@{$fcollection->getAllFilters}){
my $options = $filter->getAllOptions;
next if (!$$options[0]);
my $push_actions = $$options[0]->getAllPushActions;
next if (!$push_actions);
foreach my $push_action(@{$push_actions}){
my $filter_to_fix =
$configTree->getFilterByName($push_action->ref);
if ($filter_to_fix) {
$filter_to_fix->displayType('list');
$filter_to_fix->style('menu');
}
}
}
}
}
}
return $configTree;
}
1;
} |
sub getConfigurationTree
{ my ($self, $virtualSchema, $dataSetName, $interfaceType,$dsCounter) = @_;
my $registry = $self->get('registry');
my $dataSet = $registry->getDatasetByName($virtualSchema, $dataSetName);
my $xml;
my $xmlFile = $registry->getDirPath();
$xmlFile .= $virtualSchema."/XML/";
$xmlFile .= $self->get('location')->name().".".$dataSetName.".".$interfaceType;
if(-e $xmlFile) {
$xml = ${retrieve($xmlFile)};
print STDERR $self->get('location')->name(), "...", $dataSetName, "...", $interfaceType, "...", "Retrieving xml from DISK: ";
}
else {
$xml = $self->get('location')->getDatasetConfigXML($virtualSchema,
$dataSetName,
$interfaceType,
$dsCounter);
$xml =~ s/M[^a-zA-Z]{1}ller/Muller/mg;
my $tempXMLHash = XMLin($xml, forcearray => [qw(AttributePage AttributeGroup
AttributeCollection AttributeDescription FilterPage FilterGroup
FilterCollection FilterDescription Importable Exportable Key
MainTable BatchSize SeqModule Option PushAction)], keyattr => []);
my $softwareVersion = $tempXMLHash->{'softwareVersion'};
if (!$softwareVersion || ($softwareVersion eq '0.4'))
{
print STDERR "-> upgrading to 0.5 ... ";
my $params=BioMart::Web::CGIXSLT::read_https();
open(STDOUTTEMP, ">temp.xml");
print STDOUTTEMP $xml;
close(STDOUTTEMP);
$params->{'source'} = 'temp.xml';
$params->{'style'} = $registry->getDirPath().'../mart_0_4_0_5.xsl';
my $new_xml;
eval{$new_xml=BioMart::Web::CGIXSLT::transform();};
if($@){BioMart::Web::CGIXSLT::print_error("Exception: Configurator Cannot parse xml as per xsl. $@\n"); exit;};
$xml = BioMart::Web::CGIXSLT::print_output($new_xml);
if (-e 'temp.xml') {
unlink 'temp.xml';
}
print STDERR "-> upgrading to 0.6/0.7 ... ";
$params=();
$params=BioMart::Web::CGIXSLT::read_https();
open(STDOUTTEMP, ">temp.xml");
print STDOUTTEMP $xml;
close(STDOUTTEMP);
$params->{'source'} = 'temp.xml';
$params->{'style'} = $registry->getDirPath().'../mart_0_5_0_6.xsl';
eval{$new_xml=BioMart::Web::CGIXSLT::transform();};
if($@){BioMart::Web::CGIXSLT::print_error("Exception: Configurator Cannot parse xml as per xsl. $@\n"); exit;};
$xml = BioMart::Web::CGIXSLT::print_output($new_xml);
if (-e 'temp.xml') {
unlink 'temp.xml';
}
}
if ($softwareVersion && $softwareVersion eq '0.5')
{
print STDERR "-> upgrading to 0.6/0.7 ... ";
my $params=BioMart::Web::CGIXSLT::read_https();
open(STDOUTTEMP, ">temp.xml");
print STDOUTTEMP $xml;
close(STDOUTTEMP);
$params->{'source'} = 'temp.xml';
$params->{'style'} = $registry->getDirPath().'../mart_0_5_0_6.xsl';
my $new_xml;
eval{$new_xml=BioMart::Web::CGIXSLT::transform();};
if($@){BioMart::Web::CGIXSLT::print_error("Exception: Configurator Cannot parse xml as per xsl. $@\n"); exit;};
$xml = BioMart::Web::CGIXSLT::print_output($new_xml);
if (-e 'temp.xml') {
unlink 'temp.xml';
}
}
store(\$xml, $xmlFile);
}
unless ($xml) {
BioMart::Exception::Configuration->throw("Could not get xml for $dataSetName, interface $interfaceType\n");
}
my $xmlHash = XMLin($xml, forcearray => [qw(AttributePage AttributeGroup
AttributeCollection AttributeDescription AttributeList FilterPage FilterGroup
FilterCollection FilterDescription Importable Exportable Key
MainTable BatchSize SeqModule Option PushAction)], keyattr => []);
my $configurationTree = BioMart::Configuration::ConfigurationTree->new(
'dataSetName' => $dataSetName,
);
my $restricted_pk = $xmlHash->{'primaryKeyRestriction'};
if ($restricted_pk) {
$configurationTree->primaryKeyRestriction($restricted_pk);
}
my $entry_label = $xmlHash->{'entryLabel'};
if ($entry_label) {
$configurationTree->entryLabel($entry_label);
}
my $opt_params = $xmlHash->{'optional_parameters'};
if ($opt_params) {
$configurationTree->optionalParameters($opt_params);
}
if ($xmlHash->{'defaultDataset'}
&& $xmlHash->{'defaultDataset'} eq 'true') {
$configurationTree->defaultDataset('true');
}
if ($xmlHash->{'visibleFilterPage'}
&& $xmlHash->{'visibleFilterPage'} == 1) {
$configurationTree->visibleFilterPage('true');
}
my $mart_users = $xmlHash->{'martUsers'};
$configurationTree->mart_Users($mart_users);
my $softwareVersion = $xmlHash->{'softwareVersion'};
if (!$softwareVersion)
{
$configurationTree->software_version('0.4'); }
else
{
$configurationTree->software_version($softwareVersion);
}
foreach my $xmlAttributeTree (@{ $xmlHash->{'AttributePage'} }) {
next if ($xmlAttributeTree->{'hidden'}
&& $xmlAttributeTree->{'hidden'} eq 'true');
my $outFormats = $xmlAttributeTree->{'outFormats'};
$outFormats =~ s/,,/,/g if ($outFormats);
my $attributeTree = BioMart::Configuration::AttributeTree->new(
'name' => $xmlAttributeTree->{'internalName'},
'displayName' => $xmlAttributeTree->{'displayName'},
'description' => $xmlAttributeTree->{'description'},
'hideDisplay' => $xmlAttributeTree->{'hideDisplay'},
'outFormats' => $outFormats,
'maxSelect' => $xmlAttributeTree->{'maxSelect'},
);
foreach my $xmlAttributeGroup
(@{ $xmlAttributeTree->{'AttributeGroup'} }) {
next if ($xmlAttributeGroup->{'hidden'}
&& $xmlAttributeGroup->{'hidden'} eq 'true');
my $attributeGroup = BioMart::Configuration::AttributeGroup->new(
'name' => $xmlAttributeGroup->{'internalName'},
'displayName' => $xmlAttributeGroup->{'displayName'},
'description' => $xmlAttributeGroup->{'description'},
'maxSelect' => $xmlAttributeGroup->{'maxSelect'},
);
foreach my $xmlAttributeCollection
(@{ $xmlAttributeGroup->{'AttributeCollection'} }) {
next if ($xmlAttributeCollection->{'hidden'}
&& $xmlAttributeCollection->{'hidden'}eq 'true');
my $attributeCollection =
BioMart::Configuration::AttributeCollection->new(
'name' => lc($xmlAttributeCollection->{'internalName'}),
'displayName' => $xmlAttributeCollection->{'displayName'},
'description' => $xmlAttributeCollection->{'description'},
'maxSelect' => $xmlAttributeCollection->{'maxSelect'},
'selectAll' => $xmlAttributeCollection->{'enableSelectAll'} || 'false',
);
foreach my $xmlAttribute
(@{ $xmlAttributeCollection->{'AttributeDescription'} }) {
next if ($xmlAttribute->{'hidden'}
&& $xmlAttribute->{'hidden'} eq 'true');
my $attribute;
if ($xmlAttribute->{'pointerDataset'}
&& $xmlAttribute->{'pointerInterface'}
&& ($xmlAttribute->{'pointerAttribute'}
|| $xmlAttribute->{'pointerFilter'})){
next; }
else{
$attribute =
BioMart::Configuration::Attribute->new(
'name' => lc($xmlAttribute->{'internalName'}),
'displayName' => $xmlAttribute->{'displayName'},
'description' => $xmlAttribute->{'description'},
'imageURL' => $xmlAttribute->{'imageURL'},
'table' => $xmlAttribute->{'tableConstraint'},
'relational_attribute' => $xmlAttribute->{'field'},
'key' => lc($xmlAttribute->{'key'}), 'width' => $xmlAttribute->{'maxLength'},
'link' => $xmlAttribute->{'linkoutURL'},
'datasetLink' => $xmlAttribute->{'datasetLink'},
'default' => $xmlAttribute->{'default'},
'dependsOnType' => $xmlAttribute->{'dependsOnType'},
'dependsOn' => $xmlAttribute->{'dependsOn'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
);
$attributeCollection->addAttribute($attribute);
}
}
foreach my $xmlAttribute
(@{ $xmlAttributeCollection->{'AttributeList'} }) {
my $attribute;
$attribute =
BioMart::Configuration::AttributeList->new(
'name' => lc($xmlAttribute->{'internalName'}),
'displayName' => $xmlAttribute->{'displayName'},
'description' => $xmlAttribute->{'description'},
'imageURL' => $xmlAttribute->{'imageURL'},
'table' => $xmlAttribute->{'tableConstraint'},
'relational_attribute' => $xmlAttribute->{'field'},
'key' => lc($xmlAttribute->{'key'}), 'width' => $xmlAttribute->{'maxLength'},
'link' => $xmlAttribute->{'linkoutURL'},
'datasetLink' => $xmlAttribute->{'datasetLink'},
'default' => $xmlAttribute->{'default'},
'dependsOnType' => $xmlAttribute->{'dependsOnType'},
'dependsOn' => $xmlAttribute->{'dependsOn'},
'attribute_string' => $xmlAttribute->{'attributes'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
);
$attributeCollection->addAttribute($attribute);
}
$attributeGroup->addCollection($attributeCollection);
}
$attributeTree->addAttributeGroup($attributeGroup);
}
$configurationTree->addAttributeTree($attributeTree);
}
foreach my $xmlFilterTree (@{ $xmlHash->{'FilterPage'} }) {
next if ($xmlFilterTree->{'hidden'}
&& $xmlFilterTree->{'hidden'} eq 'true');
my $filterTree = BioMart::Configuration::FilterTree->new(
'name' => $xmlFilterTree->{'internalName'},
'displayName' => $xmlFilterTree->{'displayName'},
'hideDisplay' => $xmlFilterTree->{'hideDisplay'}
);
foreach my $xmlFilterGroup (@{ $xmlFilterTree->{'FilterGroup'} }) {
next if ($xmlFilterGroup->{'hidden'}
&& $xmlFilterGroup->{'hidden'} eq 'true');
my $filterGroup = BioMart::Configuration::FilterGroup->new(
'name' => $xmlFilterGroup->{'internalName'},
'displayName' => $xmlFilterGroup->{'displayName'},
'description' => $xmlFilterGroup->{'description'},
);
foreach my $xmlFilterCollection
(@{ $xmlFilterGroup->{'FilterCollection'} }) {
next if ($xmlFilterCollection->{'hidden'}
&& $xmlFilterCollection->{'hidden'} eq 'true');
my $filterCollection =
BioMart::Configuration::FilterCollection->new(
'name' => lc($xmlFilterCollection->{'internalName'}),
'displayName' => $xmlFilterCollection->{'displayName'},
'description' => $xmlFilterCollection->{'description'},
);
foreach my $xmlFilter
(@{ $xmlFilterCollection->{'FilterDescription'} }) {
next if ($xmlFilter->{'hidden'}
&& $xmlFilter->{'hidden'} eq 'true');
my $attribute;
$attribute = $configurationTree->
getAttributeByName($xmlFilter->{'internalName'});
if (!$attribute){
$attribute = BioMart::Configuration::Attribute->new(
'name' => lc($xmlFilter->{'internalName'}),
'imageURL' => $xmlFilter->{'imageURL'},
'displayName' => $xmlFilter->{'displayName'},
'description' => $xmlFilter->{'description'},
'table' => $xmlFilter->{'tableConstraint'},
'relational_attribute' => $xmlFilter->{'field'},
'key' => lc($xmlFilter->{'key'}),
'dependsOnType' => $xmlFilter->{'dependsOnType'},
'dependsOn' => $xmlFilter->{'dependsOn'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
);
}
my $filter;
if ($xmlFilter->{'pointerDataset'}
&& $xmlFilter->{'pointerInterface'} &&
$xmlFilter->{'pointerFilter'}){
next;
}
elsif ($xmlFilter->{'filterList'}) {
$filter = BioMart::Configuration::FilterList_List->new(
'name' => $xmlFilter->{'internalName'},
'displayName' => $xmlFilter->{'displayName'},
'description' => $xmlFilter->{'description'},
'filter_string' => $xmlFilter->{'filterList'},
'orderby_string' => $xmlFilter->{'orderby_string'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'type' => $xmlFilter->{'type'},
'displayType' => $xmlFilter->{'displayType'},
'hideDisplay' => $xmlFilter->{'hideDisplay'},
'legalQualifiers' => $xmlFilter->{'legal_qualifiers'},
);
}
elsif ($xmlFilter->{'type'}
&& $xmlFilter->{'type'} eq 'boolean'){
$filter = BioMart::Configuration::BooleanFilter->new(
'name' => $xmlFilter->{'internalName'},
'imageURL' => $xmlFilter->{'imageURL'},
'displayName' => $xmlFilter->{'displayName'},
'description' => $xmlFilter->{'description'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'buttonURL' => $xmlFilter->{'buttonURL'},
'setAttributePage' =>
$xmlFilter->{'setAttributePage'},
'type' => $xmlFilter->{'type'},
'dependsOnType' => $xmlFilter->{'dependsOnType'},
'dependsOn' => $xmlFilter->{'dependsOn'},
'hideDisplay' => $xmlFilter->{'hideDisplay'},
'legalQualifiers' => $xmlFilter->{'legal_qualifiers'},
);
$filter->attribute($attribute);
$filter->defaultOn($xmlFilter->{'defaultOn'});
$filter->setAttribute($xmlFilter->{'setAttribute'});
}
elsif ($xmlFilter->{'type'}
&& $xmlFilter->{'type'} eq 'boolean_num'){
$filter =
BioMart::Configuration::BooleanFilter->new(
'name' => $xmlFilter->{'internalName'},
'imageURL' => $xmlFilter->{'imageURL'},
'displayName' => $xmlFilter->{'displayName'},
'description' => $xmlFilter->{'description'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'buttonURL' => $xmlFilter->{'buttonURL'},
'setAttributePage' =>
$xmlFilter->{'setAttributePage'},
'type' => $xmlFilter->{'type'},
'dependsOnType' => $xmlFilter->{'dependsOnType'},
'dependsOn' => $xmlFilter->{'dependsOn'},
'hideDisplay' => $xmlFilter->{'hideDisplay'},
'legalQualifiers' => $xmlFilter->{'legal_qualifiers'},
);
$filter->setNumberFlag();
$filter->attribute($attribute);
$filter->defaultOn($xmlFilter->{'defaultOn'});
$filter->setAttribute($xmlFilter->{'setAttribute'});
}
else
{
$filter =
BioMart::Configuration::ValueFilter->new(
'name' => $xmlFilter->{'internalName'},
'imageURL' => $xmlFilter->{'imageURL'},
'displayName' => $xmlFilter->{'displayName'},
'description' => $xmlFilter->{'description'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'buttonURL' => $xmlFilter->{'buttonURL'},
'setAttributePage' =>
$xmlFilter->{'setAttributePage'},
'type' => $xmlFilter->{'type'},
'dependsOnType' => $xmlFilter->{'dependsOnType'},
'dependsOn' => $xmlFilter->{'dependsOn'},
'hideDisplay' => $xmlFilter->{'hideDisplay'},
'legalQualifiers' => $xmlFilter->{'legal_qualifiers'},
);
$filter->attribute($attribute);
$filter->operation($xmlFilter->{'qualifier'});
$filter->otherFilters(
$xmlFilter->{'otherFilters'});
$filter->regexp($xmlFilter->{'regexp'});
$filter->defaultValue(
$xmlFilter->{'defaultValue'});
$filter->defaultOn($xmlFilter->{'defaultOn'});
$filter->setAttribute(
$xmlFilter->{'setAttribute'});
}
foreach my $xmlOption (@{ $xmlFilter->{'Option'} }) {
next if ($xmlOption->{'hidden'}
&& $xmlOption->{'hidden'} eq 'true');
$filter = _addOption($filter,$xmlOption,
$dataSetName,$interfaceType,
$configurationTree);
}
if (@{ $xmlFilter->{'Option'} } > 200){
print STDERR ("\nWarning: Too many Options for filter [ ", $xmlFilter->{'internalName'}, " ] possible rendering problems for Martview ");
}
$filter->displayType($xmlFilter->{'displayType'});
$filter->multipleValues($xmlFilter->{'multipleValues'});
$filter->style($xmlFilter->{'style'});
$filter->graph($xmlFilter->{'graph'});
$filter->autoCompletion($xmlFilter->{'autoCompletion'});
$filterCollection->addFilter($filter);
}
$filterGroup->addCollection($filterCollection);
}
$filterTree->addFilterGroup($filterGroup);
}
$configurationTree->addFilterTree($filterTree);
}
foreach my $filterTree (@{$configurationTree->getAllFilterTrees()}){
foreach my $group(@{$filterTree->getAllFilterGroups()}){
foreach my $collection (@{$group->getAllCollections()}){
foreach my $filter (@{$collection->getAllFilters()}){
if ($filter->isa("BioMart::Configuration::FilterList_List")) {
foreach my $filterName (split (/,/, $filter->filterString)) {
my $filterListItem = $configurationTree->getFilterByName($filterName);
$filter->addFilter($filterListItem);
}
}
}
}
}
}
my $extraAttTree = BioMart::Configuration::AttributeTree->new(
'name' => 'extra_importable_atts',
'displayName' => '',
'hideDisplay' => 'true'
);
my $extraAttGroup = BioMart::Configuration::AttributeGroup->new(
'name' => 'extra_importable_atts',
'displayName' => ''
);
my $extraAttCollection = BioMart::Configuration::AttributeCollection->new(
'name' => 'extra_importable_atts',
'displayName' => ''
);
IMP: foreach my $importable (@{ $xmlHash->{'Importable'} }) {
my $filterList = BioMart::Configuration::FilterList->new(
'name' => $importable->{'name'},
'displayName' => $importable->{'displayName'},
'description' => $importable->{'description'},
'linkName' => $importable->{'linkName'},
'linkVersion' => $importable->{'linkVersion'},
'filter_string' => $importable->{'filters'},
'orderby_string' => $importable->{'orderBy'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'type' => $importable->{'type'} || 'link'
);
foreach my $filterName (split (/,/, $importable->{'filters'})) {
my $filter =
$configurationTree->getFilterByName($filterName);
unless ($filter) {
my $op = $configurationTree->getOptionByName($filterName);
next IMP unless ($op);
$filter = $op->filter;
}
if ($filter){
my $attribute = $filter->attribute;
if (!$configurationTree->getAttributeByName(
$attribute->name)){
$extraAttCollection->addAttribute($attribute);
}
$filterList->addFilter($filter);
}
}
my $importables = $dataSet->get('importables');
$importables->{$filterList->linkName}->{$interfaceType} =
$filterList;
$dataSet->set('importables', $importables);
}
$extraAttGroup->addCollection($extraAttCollection);
$extraAttTree->addAttributeGroup($extraAttGroup);
$configurationTree->addAttributeTree($extraAttTree);
EXP:foreach my $exportable (@{ $xmlHash->{'Exportable'} }) {
my $attributeList = BioMart::Configuration::AttributeList->new(
'name' => $exportable->{'name'},
'displayName' => $exportable->{'displayName'},
'description' => $exportable->{'description'},
'linkName' => $exportable->{'linkName'},
'linkVersion' => $exportable->{'linkVersion'},
'attribute_string' => $exportable->{'attributes'},
'orderby_string' => $exportable->{'orderBy'},
'dataSetName' => $dataSetName,
'interface' => $interfaceType,
'type' => $exportable->{'type'} || 'link'
);
if ($exportable->{'default'}) { $attributeList->setDefault()}
next EXP if($exportable->{'pointer'} && $exportable->{'pointer'} eq 'true');
foreach my $attributeName (split (/,/, $exportable->{'attributes'})) {
next EXP if ($attributeName =~ /__/);
my $attribute = $configurationTree->getAttributeByName($attributeName);
$attributeList->addAttribute($attribute);
}
if ($exportable->{'orderBy'}) {
foreach my $attributeName (split (/,/, $exportable->{'orderBy'})) {
my $attribute =
$configurationTree->getAttributeByName($attributeName);
$attributeList->addOrderByAttribute($attribute);
}
}
my $exportables = $dataSet->get('exportables');
$exportables->{$attributeList->linkName()}->{$interfaceType} = $attributeList;
$dataSet->set('exportables', $exportables);
}
foreach my $main (@{ $xmlHash->{'MainTable'} }) {
next if ($xmlHash->{'type'} ne "TableSet");
my $mains = $dataSet->get('mains');
push @{ $mains }, $main;
$dataSet->set('mains', $mains);
}
foreach my $key (@{ $xmlHash->{'Key'} }) {
next if ($xmlHash->{'type'} ne "TableSet");
my $keys = $dataSet->get('keys');
push @{ $keys }, lc($key); $dataSet->set('keys', $keys);
}
foreach my $batchSize (@{ $xmlHash->{'BatchSize'} }) {
$dataSet->set('batch_size', $batchSize);
}
foreach my $seqModule (@{ $xmlHash->{'SeqModule'} }) {
my $seqModules = $dataSet->get('seqModules');
$seqModules->{$seqModule->{'linkName'}}{'moduleName'} =
$seqModule->{'moduleName'};
$dataSet->set('seqModules', $seqModules);
}
print STDERR " OK\n";
$configurationTree->toXML($xml);
return $configurationTree; } |