Mantid
|
#include <CatalogHelper.h>
Public Member Functions | |
const std::vector< std::string > | downloadDataFiles (const std::vector< std::pair< int64_t, std::string > > &userSelectedFiles, const std::string &downloadPath, const std::string &sessionID) |
Download dataFile (via HTTP or copy if access to archive) and return the path to it. More... | |
void | executeGetDataFiles (const std::string &investigationId, const std::string &sessionID) |
Search for all related dataFiles for the specified investigation. More... | |
void | executeSearch (const std::map< std::string, std::string > &userInputs, const int &offset, const int &limit, const std::vector< std::string > &sessionIDs) |
Run the search algorithm with the given user input. More... | |
const std::vector< std::string > | getInstrumentList (const std::vector< std::string > &sessionIDs) |
Obtain the list of instruments that are available for the given session information. More... | |
const std::vector< std::string > | getInvestigationTypeList (const std::vector< std::string > &sessionIDs) |
Obtain the list of instruments that are available. More... | |
int64_t | getNumberOfSearchResults (const std::map< std::string, std::string > &userInputFields, const std::vector< std::string > &sessionIDs) |
Obtain the number of search results to be returned by the query of the user. More... | |
time_t | getTimevalue (const std::string &inputDate) |
Creates a time_t value from an input date ("23/06/2003") for comparison. More... | |
void | showLoginDialog () |
Executes the catalog login algorithm dialog, returning immediately. More... | |
void | showPublishDialog () |
Create a publishing dialog. More... | |
const std::map< std::string, std::string > | validateProperties (const std::map< std::string, std::string > &inputFields) |
Validate each input field against the related algorithm property. More... | |
Private Member Functions | |
Mantid::API::IAlgorithm_sptr | createCatalogAlgorithm (const std::string &algName) |
Creates an algorithm with the name provided. More... | |
void | executeAsynchronously (const Mantid::API::IAlgorithm_sptr &algorithm) |
Execute the given algorithm asynchronously. More... | |
const std::string | propertyDocumentation (const std::vector< Mantid::Kernel::Property * > &properties, const std::string &name) |
Obtain the documentation for a given name from the given algorithm properties. More... | |
void | setSearchProperties (const Mantid::API::IAlgorithm_sptr &catalogAlgorithm, const std::map< std::string, std::string > &userInputFields) |
Set the "search" properties to their related input fields. More... | |
Definition at line 14 of file CatalogHelper.h.
|
private |
Creates an algorithm with the name provided.
Creates an algorithm with the provided name.
algName | :: The name of the algorithm to create. |
Definition at line 300 of file CatalogHelper.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by downloadDataFiles(), executeGetDataFiles(), executeSearch(), getInstrumentList(), getInvestigationTypeList(), getNumberOfSearchResults(), and validateProperties().
const std::vector< std::string > MantidQt::MantidWidgets::CatalogHelper::downloadDataFiles | ( | const std::vector< std::pair< int64_t, std::string > > & | userSelectedFiles, |
const std::string & | downloadPath, | ||
const std::string & | sessionID | ||
) |
Download dataFile (via HTTP or copy if access to archive) and return the path to it.
Retrieve the path(s) to the file that was downloaded (via HTTP) or is stored in the archive.
userSelectedFiles | :: The file(s) the user has selected and wants to download. |
downloadPath | :: The location to save the datafile(s). |
sessionID | :: The sessions ID of the selected investigation. |
Definition at line 157 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), and executeAsynchronously().
Referenced by MantidQt::MantidWidgets::CatalogSearch::downloadDataFiles(), and MantidQt::MantidWidgets::CatalogSearch::loadDataFiles().
|
private |
Execute the given algorithm asynchronously.
algorithm | :: The algorithm to execute. |
Definition at line 309 of file CatalogHelper.cpp.
Referenced by downloadDataFiles(), executeGetDataFiles(), executeSearch(), getInstrumentList(), getInvestigationTypeList(), and getNumberOfSearchResults().
void MantidQt::MantidWidgets::CatalogHelper::executeGetDataFiles | ( | const std::string & | investigationId, |
const std::string & | sessionID | ||
) |
Search for all related dataFiles for the specified investigation.
Search the archives for all dataFiles related to an "investigation id" then save results to workspace ("dataFileResults").
sessionID | :: The sessions ID of the selected investigation. |
investigationId | :: The investigation id to use for the search. |
Definition at line 137 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), and executeAsynchronously().
Referenced by MantidQt::MantidWidgets::CatalogSearch::investigationSelected().
void MantidQt::MantidWidgets::CatalogHelper::executeSearch | ( | const std::map< std::string, std::string > & | userInputFields, |
const int & | offset, | ||
const int & | limit, | ||
const std::vector< std::string > & | sessionIDs | ||
) |
Run the search algorithm with the given user input.
Search the archive with the user input terms provided and save them to a workspace ("searchResults").
userInputFields | :: A map containing all users' search fields - (key => FieldName, value => FieldValue). |
offset | :: skip this many rows and start returning rows from this point. |
limit | :: limit the number of rows returned by the query. |
sessionIDs | :: The sessions information of each active catalog. |
Definition at line 81 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), executeAsynchronously(), Mantid::Kernel::SingletonHolder< T >::Instance(), and setSearchProperties().
Referenced by MantidQt::MantidWidgets::CatalogSearch::searchClicked().
const std::vector< std::string > MantidQt::MantidWidgets::CatalogHelper::getInstrumentList | ( | const std::vector< std::string > & | sessionIDs | ) |
Obtain the list of instruments that are available for the given session information.
Obtain a list of instruments for specified catalogs based on session information.
sessionIDs | :: The sessions information of each active catalog. |
Definition at line 27 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), executeAsynchronously(), and Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by MantidQt::MantidWidgets::CatalogSearch::populateInstrumentBox().
const std::vector< std::string > MantidQt::MantidWidgets::CatalogHelper::getInvestigationTypeList | ( | const std::vector< std::string > & | sessionIDs | ) |
Obtain the list of instruments that are available.
Obtain the list of investigation types for specified catalogs based on session information.
sessionIDs | :: The sessions information of each active catalog. |
Definition at line 55 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), executeAsynchronously(), and Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by MantidQt::MantidWidgets::CatalogSearch::populateInvestigationTypeBox().
int64_t MantidQt::MantidWidgets::CatalogHelper::getNumberOfSearchResults | ( | const std::map< std::string, std::string > & | userInputFields, |
const std::vector< std::string > & | sessionIDs | ||
) |
Obtain the number of search results to be returned by the query of the user.
The number of results returned by the search query (based on values of input fields).
userInputFields | :: A map containing the users' search input (key => FieldName, value => FieldValue). |
sessionIDs | :: The sessions information of each active catalog. |
Definition at line 110 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), executeAsynchronously(), Mantid::Kernel::SingletonHolder< T >::Instance(), and setSearchProperties().
Referenced by MantidQt::MantidWidgets::CatalogSearch::searchClicked().
time_t MantidQt::MantidWidgets::CatalogHelper::getTimevalue | ( | const std::string & | inputDate | ) |
Creates a time_t value from an input date ("23/06/2003") for comparison.
inputDate | :: string containing the date. |
Definition at line 238 of file CatalogHelper.cpp.
Referenced by MantidQt::MantidWidgets::CatalogSearch::validateDates(), and validateProperties().
|
private |
Obtain the documentation for a given name from the given algorithm properties.
Obtain the algorithm documentation for the given property.
properties | :: A list of properties for a provided algorithm. |
name | :: The name of the property to search for. |
Definition at line 285 of file CatalogHelper.cpp.
Referenced by validateProperties().
|
private |
Set the "search" properties to their related input fields.
catalogAlgorithm | :: Algorithm to set the search properties for. |
userInputFields | :: The search properties to set against the algorithm. |
Definition at line 322 of file CatalogHelper.cpp.
References value.
Referenced by executeSearch(), and getNumberOfSearchResults().
void MantidQt::MantidWidgets::CatalogHelper::showLoginDialog | ( | ) |
Executes the catalog login algorithm dialog, returning immediately.
Opens auto-generated dialog, and executes the catalog login algorithm.
Returns true if login was a success.
Definition at line 257 of file CatalogHelper.cpp.
References MantidQt::API::InterfaceManager::createDialogFromName().
void MantidQt::MantidWidgets::CatalogHelper::showPublishDialog | ( | ) |
Create a publishing dialog.
Creates a publishing dialog GUI and runs the publishing algorithm when "Run" is pressed.
Definition at line 270 of file CatalogHelper.cpp.
References MantidQt::API::InterfaceManager::createDialogFromName().
const std::map< std::string, std::string > MantidQt::MantidWidgets::CatalogHelper::validateProperties | ( | const std::map< std::string, std::string > & | inputFields | ) |
Validate each input field against the related algorithm property.
inputFields | :: The name of the input field and value of the field (key => "StartDate", value => "00/00/0000"). |
Definition at line 197 of file CatalogHelper.cpp.
References createCatalogAlgorithm(), getTimevalue(), and propertyDocumentation().
Referenced by MantidQt::MantidWidgets::CatalogSearch::searchClicked().