-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Server] Handle bad layers at QGIS project laoding and throw exception
This commit return exceptions if a layer is not available like other servers (e.g. UMN) and prevents caching of projects with missing datasources (a datasource may become available later on).
- Loading branch information
Showing
8 changed files
with
2,110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsstorebadlayerinfo.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsStoreBadLayerInfo: QgsProjectBadLayerHandler | ||
{ | ||
%Docstring | ||
Stores layer ids of bad layers | ||
|
||
.. versionadded:: 3.4.8 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsstorebadlayerinfo.h" | ||
%End | ||
public: | ||
|
||
QgsStoreBadLayerInfo(); | ||
%Docstring | ||
Default constructor | ||
%End | ||
|
||
void handleBadLayers( const QList<QDomNode> &layers ); | ||
%Docstring | ||
handleBadLayers | ||
|
||
:param layers: layer nodes | ||
%End | ||
|
||
QStringList badLayers() const; | ||
%Docstring | ||
badLayers | ||
|
||
:return: ids of bad layers | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/server/qgsstorebadlayerinfo.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*************************************************************************** | ||
qgsstorebadlayerinfo.cpp | ||
------------------------ | ||
begin : Jan 2019 | ||
copyright : (C) 2019 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsstorebadlayerinfo.h" | ||
#include <QDomElement> | ||
|
||
void QgsStoreBadLayerInfo::handleBadLayers( const QList<QDomNode> &layers ) | ||
{ | ||
mBadLayerIds.clear(); | ||
QList<QDomNode>::const_iterator it = layers.constBegin(); | ||
for ( ; it != layers.constEnd(); ++it ) | ||
{ | ||
if ( !it->isNull() ) | ||
{ | ||
QDomElement idElem = it->firstChildElement( "id" ); | ||
if ( !idElem.isNull() ) | ||
{ | ||
mBadLayerIds.append( idElem.text() ); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSTOREBADLAYERINFO_H | ||
#define QGSSTOREBADLAYERINFO_H | ||
|
||
#include "qgsprojectbadlayerhandler.h" | ||
#include "qgis_server.h" | ||
#include <QStringList> | ||
|
||
/** | ||
* \ingroup server | ||
* Stores layer ids of bad layers | ||
* \since QGIS 3.4.8 | ||
*/ | ||
class SERVER_EXPORT QgsStoreBadLayerInfo: public QgsProjectBadLayerHandler | ||
{ | ||
public: | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
QgsStoreBadLayerInfo() = default; | ||
|
||
/** | ||
* \brief handleBadLayers | ||
* \param layers layer nodes | ||
*/ | ||
void handleBadLayers( const QList<QDomNode> &layers ); | ||
|
||
/** | ||
* \brief badLayers | ||
* \returns ids of bad layers | ||
*/ | ||
QStringList badLayers() const { return mBadLayerIds; } | ||
|
||
private: | ||
QStringList mBadLayerIds; | ||
}; | ||
|
||
#endif // QGSSTOREBADLAYERINFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.