Skip to content

Commit

Permalink
Added dataFileDescription to getUploadURL. Refs #8742.
Browse files Browse the repository at this point in the history
- Added implementation to icat4catalog's getUploadURL.
  • Loading branch information
jawrainey committed Jan 23, 2014
1 parent 1fe04cb commit e9940ca
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/ICatalog.h
Expand Up @@ -68,7 +68,7 @@ class DLLExport ICatalog
/// get URLs of the files
virtual void getDownloadURL(const long long& fileid,std::string&)=0;
/// get URL of where to PUT (publish) files.
virtual const std::string getUploadURL(const std::string &, const std::string &)=0;
virtual const std::string getUploadURL(const std::string&,const std::string&,const std::string&)=0;
/// keep alive
virtual void keepAlive()=0;
///keep alive in minutes
Expand Down
Expand Up @@ -65,7 +65,8 @@ namespace Mantid
/// get urls
virtual void getDownloadURL(const long long& fileid,std::string & fileLocation);
/// get URL of where to PUT (publish) files.
virtual const std::string getUploadURL(const std::string &investigationID, const std::string &createFileName);
virtual const std::string getUploadURL(
const std::string &investigationID, const std::string &createFileName, const std::string &dataFileDescription);
/// keep alive
virtual void keepAlive();
/// keep alive in minutes
Expand Down
Expand Up @@ -65,7 +65,8 @@ namespace Mantid
/// Get the url(s) based on the fileID.
virtual void getDownloadURL(const long long& fileID,std::string & url);
/// get URL of where to PUT (publish) files.
virtual const std::string getUploadURL(const std::string &investigationID, const std::string &createFileName);
virtual const std::string getUploadURL(
const std::string &investigationID, const std::string &createFileName, const std::string &dataFileDescription);
/// Keep current session alive
virtual void keepAlive();
/// Keep alive in minutes
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/Framework/ICat/src/ICat3/ICat3Catalog.cpp
Expand Up @@ -103,10 +103,12 @@ namespace Mantid
* @param createFileName :: The name to give to the file being saved.
* @return URL to PUT datafiles to.
*/
const std::string ICat3Catalog::getUploadURL(const std::string &investigationID, const std::string &createFileName)
const std::string ICat3Catalog::getUploadURL(
const std::string &investigationID, const std::string &createFileName, const std::string &dataFileDescription)
{
UNUSED_ARG(investigationID);
UNUSED_ARG(createFileName);
UNUSED_ARG(dataFileDescription);
throw std::runtime_error("ICat3Catalog does not support publishing.");
}

Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Expand Up @@ -738,7 +738,8 @@ namespace Mantid
* @param createFileName :: The name to give to the file being saved.
* @return URL to PUT datafiles to.
*/
const std::string ICat4Catalog::getUploadURL(const std::string &investigationID, const std::string &createFileName)
const std::string ICat4Catalog::getUploadURL(
const std::string &investigationID, const std::string &createFileName, const std::string &dataFileDescription)
{
// Obtain the URL from the Facilities.xml file.
std::string url = ConfigService::Instance().getFacility().catalogInfo().externalDownloadURL();
Expand All @@ -749,9 +750,10 @@ namespace Mantid
if (sessionID.empty()) throw std::runtime_error("You are not currently logged into the cataloging system.");
std::string name = "&name=" + createFileName;
std::string datasetId = "&datasetId=" + boost::lexical_cast<std::string>(getDatasetId(investigationID));
std::string description = "&description=" + dataFileDescription;

// Add pieces of URL together.
url += ("put?" + session + name + datasetId + "&datafileFormatId=1");
url += ("put?" + session + name + datasetId + description + "&datafileFormatId=1");
g_log.debug() << "ICat4Catalog::getUploadURL url is: " << url << std::endl;
return url;
}
Expand Down

0 comments on commit e9940ca

Please sign in to comment.