Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
MantidQt::MantidWidgets::CatalogHelper Class Reference

#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...
 

Detailed Description

Definition at line 14 of file CatalogHelper.h.

Member Function Documentation

◆ createCatalogAlgorithm()

Mantid::API::IAlgorithm_sptr MantidQt::MantidWidgets::CatalogHelper::createCatalogAlgorithm ( const std::string &  algName)
private

Creates an algorithm with the name provided.

Creates an algorithm with the provided name.

Parameters
algName:: The name of the algorithm to create.
Returns
A shared pointer to the algorithm created.

Definition at line 300 of file CatalogHelper.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by downloadDataFiles(), executeGetDataFiles(), executeSearch(), getInstrumentList(), getInvestigationTypeList(), getNumberOfSearchResults(), and validateProperties().

◆ downloadDataFiles()

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.

Parameters
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.
Returns
A vector containing the paths to the file(s) the user wants.

Definition at line 157 of file CatalogHelper.cpp.

References createCatalogAlgorithm(), and executeAsynchronously().

Referenced by MantidQt::MantidWidgets::CatalogSearch::downloadDataFiles(), and MantidQt::MantidWidgets::CatalogSearch::loadDataFiles().

◆ executeAsynchronously()

void MantidQt::MantidWidgets::CatalogHelper::executeAsynchronously ( const Mantid::API::IAlgorithm_sptr algorithm)
private

Execute the given algorithm asynchronously.

Parameters
algorithm:: The algorithm to execute.

Definition at line 309 of file CatalogHelper.cpp.

Referenced by downloadDataFiles(), executeGetDataFiles(), executeSearch(), getInstrumentList(), getInvestigationTypeList(), and getNumberOfSearchResults().

◆ executeGetDataFiles()

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").

Parameters
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().

◆ executeSearch()

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").

Parameters
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().

◆ getInstrumentList()

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.

Parameters
sessionIDs:: The sessions information of each active catalog.
Returns
A vector containing the list of all instruments available.

Definition at line 27 of file CatalogHelper.cpp.

References createCatalogAlgorithm(), executeAsynchronously(), and Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by MantidQt::MantidWidgets::CatalogSearch::populateInstrumentBox().

◆ getInvestigationTypeList()

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.

Parameters
sessionIDs:: The sessions information of each active catalog.
Returns
A vector containing the list of all investigation types available.

Definition at line 55 of file CatalogHelper.cpp.

References createCatalogAlgorithm(), executeAsynchronously(), and Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by MantidQt::MantidWidgets::CatalogSearch::populateInvestigationTypeBox().

◆ getNumberOfSearchResults()

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).

Parameters
userInputFields:: A map containing the users' search input (key => FieldName, value => FieldValue).
sessionIDs:: The sessions information of each active catalog.
Returns
Number of results returned by the search query.

Definition at line 110 of file CatalogHelper.cpp.

References createCatalogAlgorithm(), executeAsynchronously(), Mantid::Kernel::SingletonHolder< T >::Instance(), and setSearchProperties().

Referenced by MantidQt::MantidWidgets::CatalogSearch::searchClicked().

◆ getTimevalue()

time_t MantidQt::MantidWidgets::CatalogHelper::getTimevalue ( const std::string &  inputDate)

Creates a time_t value from an input date ("23/06/2003") for comparison.

Parameters
inputDate:: string containing the date.
Returns
time_t value of date

Definition at line 238 of file CatalogHelper.cpp.

Referenced by MantidQt::MantidWidgets::CatalogSearch::validateDates(), and validateProperties().

◆ propertyDocumentation()

const std::string MantidQt::MantidWidgets::CatalogHelper::propertyDocumentation ( const std::vector< Mantid::Kernel::Property * > &  properties,
const std::string &  name 
)
private

Obtain the documentation for a given name from the given algorithm properties.

Obtain the algorithm documentation for the given property.

Parameters
properties:: A list of properties for a provided algorithm.
name:: The name of the property to search for.
Returns
The documentation for a given property name.

Definition at line 285 of file CatalogHelper.cpp.

Referenced by validateProperties().

◆ setSearchProperties()

void MantidQt::MantidWidgets::CatalogHelper::setSearchProperties ( const Mantid::API::IAlgorithm_sptr catalogAlgorithm,
const std::map< std::string, std::string > &  userInputFields 
)
private

Set the "search" properties to their related input fields.

Parameters
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().

◆ showLoginDialog()

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().

◆ showPublishDialog()

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().

◆ validateProperties()

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.

Parameters
inputFields:: The name of the input field and value of the field (key => "StartDate", value => "00/00/0000").
Returns
The name of the input field(s) marker to update and related error to throw.

Definition at line 197 of file CatalogHelper.cpp.

References createCatalogAlgorithm(), getTimevalue(), and propertyDocumentation().

Referenced by MantidQt::MantidWidgets::CatalogSearch::searchClicked().


The documentation for this class was generated from the following files: