Skip to content

Commit

Permalink
Added external download support. Refs #8126.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Oct 22, 2013
1 parent f2194fe commit 4e300dc
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include "MantidICat/ICat4/GSoapGenerated/ICat4ICATPortBindingProxy.h"
#include "MantidICat/ICat4/ICat4Catalog.h"
#include "MantidICat/Session.h"
#include "MantidKernel/Strings.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/FacilityInfo.h"
#include "MantidKernel/Strings.h"

namespace Mantid
{
Expand Down Expand Up @@ -645,8 +647,20 @@ namespace Mantid
*/
void ICat4Catalog::getDownloadURL(const long long & fileID, std::string& url)
{
UNUSED_ARG(fileID);
UNUSED_ARG(url);
// Obtain the URL from the Facilities.xml file.
std::string urlToBuild = ConfigService::Instance().getFacility().catalogInfo().externalDownloadURL();

// Set the REST features of the URL.
std::string session = "sessionId=" + Session::Instance().getSessionId();
std::string datafile = "&datafileIds=" + boost::lexical_cast<std::string>(fileID);
std::string outname = "&outname=" + boost::lexical_cast<std::string>(fileID);

// Add all the REST pieces to the URL.
urlToBuild += ("getData?" + session + datafile + outname + "&zip=false");

g_log.debug() << "External URL is: " << urlToBuild << std::endl;

url = urlToBuild;
}

/**
Expand Down

0 comments on commit 4e300dc

Please sign in to comment.