CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Public Member Functions | Protected Attributes | List of all members
ctkXnatSession Class Reference

The ctkXnatSession class reprents a session object associated with a specific XNAT connection. More...

#include <Libs/XNAT/Core/ctkXnatSession.h>

Inheritance diagram for ctkXnatSession:
Inheritance graph
[legend]
Collaboration diagram for ctkXnatSession:
Collaboration graph
[legend]

Public Types

typedef QMap< QByteArray, QByteArray > HttpRawHeaders
 
typedef QMap< QString, QString > UrlParameters
 

Public Slots

void onProgress (QUuid queryId, double onProgress)
 
void processResult (QUuid queryId, QList< QVariantMap > parameters)
 

Public Member Functions

Q_SIGNAL void aboutToTimeOut ()
 Signals that the session will time out in one minute. More...
 
void close ()
 Closes this XNAT session. More...
 
 ctkXnatSession (const ctkXnatLoginProfile &loginProfile)
 
ctkXnatDataModeldataModel () const
 
QString defaultDownloadDir () const
 returns the default download location More...
 
void download (const QString &fileName, const QString &resource, const UrlParameters &parameters=UrlParameters(), const HttpRawHeaders &rawHeaders=HttpRawHeaders())
 
bool exists (const ctkXnatObject *object)
 
QDateTime expirationDate () const
 Get the expiration date for this XNAT session. More...
 
QUuid httpGet (const QString &resource, const UrlParameters &parameters=UrlParameters(), const HttpRawHeaders &rawHeaders=HttpRawHeaders())
 TODO. More...
 
QUuid httpHead (const QString &resourceUri)
 Sends a http HEAD request to the xnat instance. More...
 
const QMap< QByteArray, QByteArray > httpHeadSync (const QUuid &uuid)
 Reads the result of a head request. More...
 
QUuid httpPut (const QString &resource, const UrlParameters &parameters=UrlParameters(), const HttpRawHeaders &rawHeaders=HttpRawHeaders())
 TODO. More...
 
QList< ctkXnatObject * > httpResults (const QUuid &uuid, const QString &schemaType)
 TODO. More...
 
QList< QVariantMap > httpSync (const QUuid &uuid)
 TODO. More...
 
bool isOpen () const
 Returns the open state of this XNAT session. More...
 
ctkXnatLoginProfile loginProfile () const
 Get the current login profile for this session object. More...
 
void open ()
 Open a new XNAT session. More...
 
QString password () const
 Get the password for this XNAT session. More...
 
Q_SIGNAL void progress (QUuid, double)
 
void remove (ctkXnatObject *object)
 
QDateTime renew ()
 Re-new the XNAT session. More...
 
Q_SIGNAL void sessionAboutToBeClosed ()
 Signals that the session is about to be closed. More...
 
QString sessionId () const
 Get the sessionId for this XNAT session. More...
 
Q_SIGNAL void sessionOpened ()
 Signals that the session was just opened. More...
 
Q_SIGNAL void sessionRenewed (const QDateTime &expirationDate)
 Signals that the session was re-newed. More...
 
void setDefaultDownloadDir (const QString &path)
 Sets the default location where files will be saved after being downloaded. More...
 
void setHttpNetworkProxy (const QNetworkProxy &proxy)
 Sets a network proxy that will be used to connect with XNAT. More...
 
Q_SIGNAL void timedOut ()
 Signals that the session has timed out. More...
 
void upload (ctkXnatFile *xnatFile, const UrlParameters &parameters=UrlParameters(), const HttpRawHeaders &rawHeaders=HttpRawHeaders())
 
QUrl url () const
 Get XNAT server url. More...
 
QString userName () const
 Get the user name for this XNAT session. More...
 
QString version () const
 Get the XNAT server version. More...
 
 ~ctkXnatSession ()
 

Protected Attributes

QScopedPointer< ctkXnatSessionPrivate > d_ptr
 

Detailed Description

The ctkXnatSession class reprents a session object associated with a specific XNAT connection.

Definition at line 51 of file ctkXnatSession.h.

Member Typedef Documentation

◆ HttpRawHeaders

typedef QMap<QByteArray, QByteArray> ctkXnatSession::HttpRawHeaders

Definition at line 58 of file ctkXnatSession.h.

◆ UrlParameters

typedef QMap<QString, QString> ctkXnatSession::UrlParameters

Definition at line 57 of file ctkXnatSession.h.

Constructor & Destructor Documentation

◆ ctkXnatSession()

ctkXnatSession::ctkXnatSession ( const ctkXnatLoginProfile loginProfile)

◆ ~ctkXnatSession()

ctkXnatSession::~ctkXnatSession ( )

Member Function Documentation

◆ aboutToTimeOut()

Q_SIGNAL void ctkXnatSession::aboutToTimeOut ( )

Signals that the session will time out in one minute.

◆ close()

void ctkXnatSession::close ( )

Closes this XNAT session.

◆ dataModel()

ctkXnatDataModel* ctkXnatSession::dataModel ( ) const

◆ defaultDownloadDir()

QString ctkXnatSession::defaultDownloadDir ( ) const

returns the default download location

Returns
the default download directory as string

◆ download()

void ctkXnatSession::download ( const QString &  fileName,
const QString &  resource,
const UrlParameters parameters = UrlParameters(),
const HttpRawHeaders rawHeaders = HttpRawHeaders() 
)

Downloads a file from the web service. fileName is the name of the output file. The resource and \parameters are used to compose the URL. rawHeaders can be used to set the raw headers of the request to send. These headers will be set additionally to those defined by the defaultRawHeaders property.

◆ exists()

bool ctkXnatSession::exists ( const ctkXnatObject object)

◆ expirationDate()

QDateTime ctkXnatSession::expirationDate ( ) const

Get the expiration date for this XNAT session.

See also
renew()
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns
The session expiration date.

◆ httpGet()

QUuid ctkXnatSession::httpGet ( const QString &  resource,
const UrlParameters parameters = UrlParameters(),
const HttpRawHeaders rawHeaders = HttpRawHeaders() 
)

TODO.

Parameters
resource
parameters
rawHeaders
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns

◆ httpHead()

QUuid ctkXnatSession::httpHead ( const QString &  resourceUri)

Sends a http HEAD request to the xnat instance.

Parameters
resourceUrithe URL to the server
Returns
the query uid

◆ httpHeadSync()

const QMap<QByteArray, QByteArray> ctkXnatSession::httpHeadSync ( const QUuid &  uuid)

Reads the result of a head request.

Parameters
uuidthe uid of the related query
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns
a QMap containing the retrieved header information

◆ httpPut()

QUuid ctkXnatSession::httpPut ( const QString &  resource,
const UrlParameters parameters = UrlParameters(),
const HttpRawHeaders rawHeaders = HttpRawHeaders() 
)

TODO.

Parameters
uuid
parameters
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns

◆ httpResults()

QList<ctkXnatObject*> ctkXnatSession::httpResults ( const QUuid &  uuid,
const QString &  schemaType 
)

TODO.

Parameters
uuid
schemaType
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns

◆ httpSync()

QList<QVariantMap> ctkXnatSession::httpSync ( const QUuid &  uuid)

TODO.

Parameters
uuid
Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns

◆ isOpen()

bool ctkXnatSession::isOpen ( ) const

Returns the open state of this XNAT session.

Returns
true if the session is open, false otherwise.

◆ loginProfile()

ctkXnatLoginProfile ctkXnatSession::loginProfile ( ) const

Get the current login profile for this session object.

Returns
A copy of the currently used login profile.

◆ onProgress

void ctkXnatSession::onProgress ( QUuid  queryId,
double  onProgress 
)
slot

◆ open()

void ctkXnatSession::open ( )

Open a new XNAT session.

This method must be called on all ctkXnatSession objects before any of the methods which communicate with an XNAT server are called.

If the session has already been opened, this method does nothing.

Exceptions
ctkXnatAuthenticationExceptionif the user credentials are invalid.
ctkXnatException(or one of its subclasses) if a network error occurred.

◆ password()

QString ctkXnatSession::password ( ) const

Get the password for this XNAT session.

The password is the one specified by the login profile.

Returns
The XNAT session password.

◆ processResult

void ctkXnatSession::processResult ( QUuid  queryId,
QList< QVariantMap >  parameters 
)
slot

◆ progress()

Q_SIGNAL void ctkXnatSession::progress ( QUuid  ,
double   
)

◆ remove()

void ctkXnatSession::remove ( ctkXnatObject object)

◆ renew()

QDateTime ctkXnatSession::renew ( )

Re-new the XNAT session.

Exceptions
ctkXnatInvalidSessionExceptionif the session is closed.
Returns
The new session expiration data.

◆ sessionAboutToBeClosed()

Q_SIGNAL void ctkXnatSession::sessionAboutToBeClosed ( )

Signals that the session is about to be closed.

◆ sessionId()

QString ctkXnatSession::sessionId ( ) const

Get the sessionId for this XNAT session.

Returns
The XNAT sessionId.

◆ sessionOpened()

Q_SIGNAL void ctkXnatSession::sessionOpened ( )

Signals that the session was just opened.

◆ sessionRenewed()

Q_SIGNAL void ctkXnatSession::sessionRenewed ( const QDateTime &  expirationDate)

Signals that the session was re-newed.

Parameters
expirationDateThe new session expiration date.

◆ setDefaultDownloadDir()

void ctkXnatSession::setDefaultDownloadDir ( const QString &  path)

Sets the default location where files will be saved after being downloaded.

Sets the default directory into which file downloads will be saved. By default this value is empty and files will be stored into the current working directory. If the path does not exists a warning will be printed and the path will be set to the current working directory.

Parameters
paththe path to the download location

◆ setHttpNetworkProxy()

void ctkXnatSession::setHttpNetworkProxy ( const QNetworkProxy &  proxy)

Sets a network proxy that will be used to connect with XNAT.

Tells the qRestAPI to use a network proxy for the connection to XNAT

Parameters
proxythe network proxy that will be set

◆ timedOut()

Q_SIGNAL void ctkXnatSession::timedOut ( )

Signals that the session has timed out.

◆ upload()

void ctkXnatSession::upload ( ctkXnatFile xnatFile,
const UrlParameters parameters = UrlParameters(),
const HttpRawHeaders rawHeaders = HttpRawHeaders() 
)

Uploads a file to the server. fileName is the name of the file. The resource and \parameters are used to compose the URL. rawHeaders can be used to set the raw headers of the request to send. These headers will be set additionally to those defined by the defaultRawHeaders property.

◆ url()

QUrl ctkXnatSession::url ( ) const

Get XNAT server url.

The url is the one specified by the login profile.

Returns
The XNAT server url.

◆ userName()

QString ctkXnatSession::userName ( ) const

Get the user name for this XNAT session.

The user name is the one specified by the login profile.

Returns
The XNAT session user name.

◆ version()

QString ctkXnatSession::version ( ) const

Get the XNAT server version.

Returns
The XNAT version running on the remote server. Returns a null string if the session is not open.

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkXnatSessionPrivate> ctkXnatSession::d_ptr
protected

Definition at line 300 of file ctkXnatSession.h.


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