From bf7a208fcc65100976b89899e33fa1a2a8dd8cd7 2017-12-11 09:29:38 From: Alexandre Leroux Date: 2017-12-11 09:29:38 Subject: [PATCH] Uses previous class to set url when retrieving data --- diff --git a/plugins/amda/src/AmdaProvider.cpp b/plugins/amda/src/AmdaProvider.cpp index 1d91a89..8eab704 100644 --- a/plugins/amda/src/AmdaProvider.cpp +++ b/plugins/amda/src/AmdaProvider.cpp @@ -1,6 +1,7 @@ #include "AmdaProvider.h" #include "AmdaDefs.h" #include "AmdaResultParser.h" +#include "AmdaServer.h" #include #include @@ -17,12 +18,6 @@ Q_LOGGING_CATEGORY(LOG_AmdaProvider, "AmdaProvider") namespace { -/// URL of the default AMDA server -const auto AMDA_SERVER_URL = QStringLiteral("amda.irap.omp.eu"); - -/// URL of the AMDA test server -const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdatest.irap.omp.eu"); - /// URL format for a request on AMDA server. The parameters are as follows: /// - %1: server URL /// - %2: start date @@ -44,18 +39,6 @@ QString dateFormat(double sqpRange) noexcept return dateTime.toString(AMDA_TIME_FORMAT); } -/// Returns the URL of the AMDA server queried for requests, depending on the type of server passed -/// as a parameter -QString serverURL(const QString &server) -{ - if (server == QString{"amdatest"}) { - return AMDA_TEST_SERVER_URL; - } - else { - return AMDA_SERVER_URL; - } -} - AmdaResultParser::ValueType valueType(const QString &valueType) { if (valueType == QStringLiteral("scalar")) { @@ -190,9 +173,6 @@ void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa // scalar, vector... auto productValueType = valueType(data.value(AMDA_DATA_TYPE_KEY).toString()); - // Gets the server being queried to retrieve the product. It's then used to set the server URL - auto productServer = data.value(AMDA_SERVER_KEY).toString(); - // /////////// // // Creates URL // // /////////// // @@ -201,7 +181,7 @@ void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa auto endDate = dateFormat(dateTime.m_TEnd); auto url = QUrl{ - QString{AMDA_URL_FORMAT}.arg(serverURL(productServer), startDate, endDate, productId)}; + QString{AMDA_URL_FORMAT}.arg(AmdaServer::instance().url(), startDate, endDate, productId)}; qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url; auto tempFile = std::make_shared();