45 void addTransactionResult( QDomDocument &responseDoc, QDomElement &responseElem,
const QString &status,
46 const QString &locator,
const QString &message );
57 response.
setHeader(
"Content-Type",
"text/xml; charset=utf-8" );
58 response.
write( doc.toByteArray() );
72 if ( doc.setContent( parameters.value( QStringLiteral(
"REQUEST_BODY" ) ),
true, &errorMsg ) )
74 QDomElement docElem = doc.documentElement();
83 if ( actionCount == 0 )
94 QDomElement respElem = resp.createElement( QStringLiteral(
"WFS_TransactionResponse" ) );
95 respElem.setAttribute( QStringLiteral(
"xmlns" ),
WFS_NAMESPACE );
96 respElem.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
97 respElem.setAttribute( QStringLiteral(
"xsi:schemaLocation" ),
WFS_NAMESPACE +
" http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" );
98 respElem.setAttribute( QStringLiteral(
"xmlns:ogc" ),
OGC_NAMESPACE );
99 respElem.setAttribute( QStringLiteral(
"version" ), QStringLiteral(
"1.0.0" ) );
100 resp.appendChild( respElem );
103 QStringList errorLocators;
104 QStringList errorMessages;
106 QList<transactionUpdate>::iterator tuIt = aRequest.
updates.begin();
107 for ( ; tuIt != aRequest.
updates.end(); ++tuIt )
113 if ( action.
handle.isEmpty() )
115 errorLocators << QStringLiteral(
"Update:%1" ).arg( action.
typeName );
119 errorLocators << action.
handle;
125 QList<transactionDelete>::iterator tdIt = aRequest.
deletes.begin();
126 for ( ; tdIt != aRequest.
deletes.end(); ++tdIt )
132 if ( action.
handle.isEmpty() )
134 errorLocators << QStringLiteral(
"Delete:%1" ).arg( action.
typeName );
138 errorLocators << action.
handle;
144 QList<transactionInsert>::iterator tiIt = aRequest.
inserts.begin();
145 for ( ; tiIt != aRequest.
inserts.end(); ++tiIt )
151 if ( action.
handle.isEmpty() )
153 errorLocators << QStringLiteral(
"Insert:%1" ).arg( action.
typeName );
157 errorLocators << action.
handle;
166 QString fidStr = *fidIt;
167 QDomElement irElem = doc.createElement( QStringLiteral(
"InsertResult" ) );
168 if ( !action.
handle.isEmpty() )
170 irElem.setAttribute( QStringLiteral(
"handle" ), action.
handle );
172 QDomElement fiElem = doc.createElement( QStringLiteral(
"ogc:FeatureId" ) );
173 fiElem.setAttribute( QStringLiteral(
"fid" ), fidStr );
174 irElem.appendChild( fiElem );
175 respElem.appendChild( irElem );
181 if ( errorCount == 0 )
183 addTransactionResult( resp, respElem, QStringLiteral(
"SUCCESS" ), QString(), QString() );
187 QString locator = errorLocators.join( QStringLiteral(
"; " ) );
188 QString message = errorMessages.join( QStringLiteral(
"; " ) );
189 if ( errorCount != actionCount )
191 addTransactionResult( resp, respElem, QStringLiteral(
"PARTIAL" ), locator, message );
195 addTransactionResult( resp, respElem, QStringLiteral(
"ERROR" ), locator, message );
204 QStringList typeNameList;
206 QList<transactionInsert>::iterator tiIt = aRequest.
inserts.begin();
207 for ( ; tiIt != aRequest.
inserts.end(); ++tiIt )
209 QString name = ( *tiIt ).typeName;
210 if ( !typeNameList.contains( name ) )
211 typeNameList << name;
213 QList<transactionUpdate>::iterator tuIt = aRequest.
updates.begin();
214 for ( ; tuIt != aRequest.
updates.end(); ++tuIt )
216 QString name = ( *tuIt ).typeName;
217 if ( !typeNameList.contains( name ) )
218 typeNameList << name;
220 QList<transactionDelete>::iterator tdIt = aRequest.
deletes.begin();
221 for ( ; tdIt != aRequest.
deletes.end(); ++tdIt )
223 QString name = ( *tdIt ).typeName;
224 if ( !typeNameList.contains( name ) )
225 typeNameList << name;
240 QMap<QString, QgsVectorLayer *> mapLayerMap;
241 for (
int i = 0; i < wfsLayerIds.size(); ++i )
244 if ( layer->
type() != QgsMapLayer::LayerType::VectorLayer )
251 if ( !typeNameList.contains( name ) )
278 if ( !wfstUpdateLayerIds.contains( vlayer->
id() )
279 && !wfstDeleteLayerIds.contains( vlayer->
id() )
280 && !wfstInsertLayerIds.contains( vlayer->
id() ) )
296 mapLayerMap[name] = vlayer;
300 tuIt = aRequest.
updates.begin();
301 for ( ; tuIt != aRequest.
updates.end(); ++tuIt )
306 if ( !mapLayerMap.keys().contains( typeName ) )
309 action.
errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg( typeName );
317 if ( !wfstUpdateLayerIds.contains( vlayer->
id() ) )
320 action.
errorMsg = QStringLiteral(
"No permissions to do WFS updates on layer '%1'" ).arg( typeName );
326 action.
errorMsg = QStringLiteral(
"No permissions to do WFS updates on layer '%1'" ).arg( typeName );
338 action.
errorMsg = QStringLiteral(
"No capabilities to do WFS updates on layer '%1'" ).arg( typeName );
363 QMap<QString, QString> propertyMap = action.
propertyMap;
368 QMap<QString, int>::const_iterator fieldMapIt;
370 bool conversionSuccess;
374 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
377 action.
errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg( typeName );
381 QMap< QString, QString >::const_iterator it = propertyMap.constBegin();
382 for ( ; it != propertyMap.constEnd(); ++it )
384 fieldName = it.key();
385 fieldMapIt = fieldMap.find( fieldName );
386 if ( fieldMapIt == fieldMap.constEnd() )
390 QgsField field = fields.
at( fieldMapIt.value() );
391 QVariant value = it.value();
392 if ( value.isNull() )
397 action.
errorMsg = QStringLiteral(
"NOT NULL constraint error on layer '%1', field '%2'" ).arg( typeName, field.
name() );
404 if ( field.
type() == QVariant::Type::Int )
406 value = it.value().toInt( &conversionSuccess );
407 if ( !conversionSuccess )
410 action.
errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg( typeName );
415 else if ( field.
type() == QVariant::Type::Double )
417 value = it.value().toDouble( &conversionSuccess );
418 if ( !conversionSuccess )
421 action.
errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg( typeName );
426 else if ( field.
type() == QVariant::Type::LongLong )
428 value = it.value().toLongLong( &conversionSuccess );
429 if ( !conversionSuccess )
432 action.
errorMsg = QStringLiteral(
"Property conversion error on layer '%1'" ).arg( typeName );
445 if ( !geometryElem.isNull() )
451 action.
errorMsg = QStringLiteral(
"Geometry from GML error on layer '%1'" ).arg( typeName );
458 action.
errorMsg = QStringLiteral(
"Error in change geometry on layer '%1'" ).arg( typeName );
474 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
477 action.
errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg( typeName );
492 action.
errorMsg = QStringLiteral(
"Error committing updates: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
497 action.
error =
false;
502 tdIt = aRequest.
deletes.begin();
503 for ( ; tdIt != aRequest.
deletes.end(); ++tdIt )
508 if ( !mapLayerMap.keys().contains( typeName ) )
511 action.
errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg( typeName );
519 if ( !wfstDeleteLayerIds.contains( vlayer->
id() ) )
522 action.
errorMsg = QStringLiteral(
"No permissions to do WFS deletes on layer '%1'" ).arg( typeName );
528 action.
errorMsg = QStringLiteral(
"No permissions to do WFS deletes on layer '%1'" ).arg( typeName );
540 action.
errorMsg = QStringLiteral(
"No capabilities to do WFS deletes on layer '%1'" ).arg( typeName );
563 if ( accessControl && !accessControl->
allowToEdit( vlayer, feature ) )
566 action.
errorMsg = QStringLiteral(
"Feature modify permission denied" );
570 fids << feature.
id();
580 action.
errorMsg = QStringLiteral(
"Delete features failed on layer '%1'" ).arg( typeName );
589 action.
errorMsg = QStringLiteral(
"Error committing deletes: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
594 action.
error =
false;
598 tiIt = aRequest.
inserts.begin();
599 for ( ; tiIt != aRequest.
inserts.end(); ++tiIt )
604 if ( !mapLayerMap.keys().contains( typeName ) )
607 action.
errorMsg = QStringLiteral(
"TypeName '%1' unknown" ).arg( typeName );
615 if ( !wfstInsertLayerIds.contains( vlayer->
id() ) )
618 action.
errorMsg = QStringLiteral(
"No permissions to do WFS inserts on layer '%1'" ).arg( typeName );
624 action.
errorMsg = QStringLiteral(
"No permissions to do WFS inserts on layer '%1'" ).arg( typeName );
636 action.
errorMsg = QStringLiteral(
"No capabilities to do WFS inserts on layer '%1'" ).arg( typeName );
652 action.
errorMsg = QStringLiteral(
"%1 '%2'" ).arg( ex.
message() ).arg( typeName );
658 QgsFeatureList::iterator featureIt = featureList.begin();
659 while ( featureIt != featureList.end() )
661 if ( !accessControl->
allowToEdit( vlayer, *featureIt ) )
664 action.
errorMsg = QStringLiteral(
"Feature modify permission denied on layer '%1'" ).arg( typeName );
680 action.
errorMsg = QStringLiteral(
"Insert features failed on layer '%1'" ).arg( typeName );
681 if ( provider ->hasErrors() )
693 action.
errorMsg = QStringLiteral(
"Error committing inserts: %1" ).arg( vlayer->
commitErrors().join( QStringLiteral(
"; " ) ) );
698 action.
error =
false;
701 for (
int j = 0; j < featureList.size(); j++ )
703 action.
insertFeatureIds << typeName +
"." + QString::number( featureList[j].
id() );
708 filterRestorer.reset();
719 QMap<QString, int>::const_iterator fieldMapIt;
721 for (
int i = 0; i < featureNodeList.count(); i++ )
725 QDomElement featureElem = featureNodeList.at( i ).toElement();
726 QDomNode currentAttributeChild = featureElem.firstChild();
727 bool conversionSuccess =
true;
729 while ( !currentAttributeChild.isNull() )
731 QDomElement currentAttributeElement = currentAttributeChild.toElement();
732 QString attrName = currentAttributeElement.localName();
734 if ( attrName != QLatin1String(
"boundedBy" ) )
736 if ( attrName != QLatin1String(
"geometry" ) )
738 fieldMapIt = fieldMap.find( attrName );
739 if ( fieldMapIt == fieldMap.constEnd() )
744 QgsField field = fields.
at( fieldMapIt.value() );
745 QString attrValue = currentAttributeElement.text();
746 int attrType = field.
type();
748 QgsMessageLog::logMessage( QStringLiteral(
"attr: name=%1 idx=%2 value=%3" ).arg( attrName ).arg( fieldMapIt.value() ).arg( attrValue ) );
750 if ( attrType == QVariant::Int )
751 feat.
setAttribute( fieldMapIt.value(), attrValue.toInt( &conversionSuccess ) );
752 else if ( attrType == QVariant::Double )
753 feat.
setAttribute( fieldMapIt.value(), attrValue.toDouble( &conversionSuccess ) );
757 if ( !conversionSuccess )
772 currentAttributeChild = currentAttributeChild.nextSibling();
782 if ( !parameters.contains( QStringLiteral(
"OPERATION" ) ) )
786 if ( parameters.value( QStringLiteral(
"OPERATION" ) ).toUpper() != QStringLiteral(
"DELETE" ) )
792 if ( ( parameters.contains( QStringLiteral(
"FEATUREID" ) )
793 && ( parameters.contains( QStringLiteral(
"FILTER" ) ) || parameters.contains( QStringLiteral(
"BBOX" ) ) ) )
794 || ( parameters.contains( QStringLiteral(
"FILTER" ) )
795 && ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) || parameters.contains( QStringLiteral(
"BBOX" ) ) ) )
796 || ( parameters.contains( QStringLiteral(
"BBOX" ) )
797 && ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) || parameters.contains( QStringLiteral(
"FILTER" ) ) ) )
805 QStringList typeNameList;
807 if ( parameters.contains( QStringLiteral(
"FEATUREID" ) ) )
809 QStringList fidList = parameters.value( QStringLiteral(
"FEATUREID" ) ).split(
',' );
811 QMap<QString, QgsFeatureIds> fidsMap;
813 QStringList::const_iterator fidIt = fidList.constBegin();
814 for ( ; fidIt != fidList.constEnd(); ++fidIt )
817 QString fid = *fidIt;
820 if ( !fid.contains(
'.' ) )
825 QString
typeName = fid.section(
'.', 0, 0 );
826 fid = fid.section(
'.', 1, 1 );
827 if ( !typeNameList.contains( typeName ) )
833 if ( fidsMap.contains( typeName ) )
835 fids = fidsMap.value( typeName );
837 fids.insert( fid.toInt() );
838 fidsMap.insert( typeName, fids );
841 QMap<QString, QgsFeatureIds>::const_iterator fidsMapIt = fidsMap.constBegin();
842 while ( fidsMapIt != fidsMap.constEnd() )
850 request.
deletes.append( action );
855 if ( !parameters.contains( QStringLiteral(
"TYPENAME" ) ) )
860 typeNameList = parameters.value( QStringLiteral(
"TYPENAME" ) ).split(
',' );
863 QStringList::const_iterator typeNameIt = typeNameList.constBegin();
864 for ( ; typeNameIt != typeNameList.constEnd(); ++typeNameIt )
867 typeName = typeName.trimmed();
872 request.
deletes.append( action );
876 if ( parameters.contains( QStringLiteral(
"EXP_FILTER" ) ) )
878 QString expFilterName = parameters.value( QStringLiteral(
"EXP_FILTER" ) );
879 QStringList expFilterList;
880 QRegExp rx(
"\\(([^()]+)\\)" );
881 if ( rx.indexIn( expFilterName, 0 ) == -1 )
883 expFilterList << expFilterName;
888 while ( ( pos = rx.indexIn( expFilterName, pos ) ) != -1 )
890 expFilterList << rx.cap( 1 );
891 pos += rx.matchedLength();
896 if ( request.
deletes.size() == expFilterList.size() )
899 QList<transactionDelete>::iterator dIt = request.
deletes.begin();
900 QStringList::const_iterator expFilterIt = expFilterList.constBegin();
901 for ( ; dIt != request.
deletes.end(); ++dIt )
906 if ( expFilterIt != expFilterList.constEnd() )
908 expFilter = *expFilterIt;
910 std::shared_ptr<QgsExpression> filter(
new QgsExpression( expFilter ) );
913 if ( filter->hasParserError() )
919 if ( filter->needsGeometry() )
934 if ( parameters.contains( QStringLiteral(
"BBOX" ) ) )
937 QString bbox = parameters.value( QStringLiteral(
"BBOX" ) );
938 if ( bbox.isEmpty() )
944 QStringList corners = bbox.split(
',' );
945 if ( corners.size() != 4 )
953 for (
int i = 0; i < 4; i++ )
955 corners[i].replace(
' ',
'+' );
956 d[i] = corners[i].toDouble( &ok );
966 QList<transactionDelete>::iterator dIt = request.
deletes.begin();
967 for ( ; dIt != request.
deletes.end(); ++dIt )
974 else if ( parameters.contains( QStringLiteral(
"FILTER" ) ) )
976 QString filterName = parameters.value( QStringLiteral(
"FILTER" ) );
977 QStringList filterList;
978 QRegExp rx(
"\\(([^()]+)\\)" );
979 if ( rx.indexIn( filterName, 0 ) == -1 )
981 filterList << filterName;
986 while ( ( pos = rx.indexIn( filterName, pos ) ) != -1 )
988 filterList << rx.cap( 1 );
989 pos += rx.matchedLength();
994 if ( request.
deletes.size() != filterList.size() )
1000 QList<transactionDelete>::iterator dIt = request.
deletes.begin();
1001 QStringList::const_iterator filterIt = filterList.constBegin();
1002 for ( ; dIt != request.
deletes.end(); ++dIt )
1007 QDomDocument filter;
1008 if ( filterIt != filterList.constEnd() )
1011 if ( !filter.setContent( *filterIt,
true, &errorMsg ) )
1017 QDomElement filterElem = filter.firstChildElement();
1020 if ( filterIt != filterList.constEnd() )
1035 QDomNodeList docChildNodes = docElem.childNodes();
1037 QDomElement actionElem;
1040 for (
int i = docChildNodes.count(); 0 < i; --i )
1042 actionElem = docChildNodes.at( i - 1 ).toElement();
1043 actionName = actionElem.localName();
1045 if ( actionName == QLatin1String(
"Insert" ) )
1048 request.
inserts.append( action );
1050 else if ( actionName == QLatin1String(
"Update" ) )
1053 request.
updates.append( action );
1055 else if ( actionName == QLatin1String(
"Delete" ) )
1058 request.
deletes.append( action );
1067 QString
typeName = actionElem.attribute( QStringLiteral(
"typeName" ) );
1068 if ( typeName.contains(
':' ) )
1069 typeName = typeName.section(
':', 1, 1 );
1071 QDomElement filterElem = actionElem.firstChild().toElement();
1072 if ( filterElem.tagName() != QLatin1String(
"Filter" ) )
1082 action.
error =
false;
1084 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1086 action.
handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1094 QString
typeName = actionElem.attribute( QStringLiteral(
"typeName" ) );
1095 if ( typeName.contains(
':' ) )
1096 typeName = typeName.section(
':', 1, 1 );
1098 QDomNodeList propertyNodeList = actionElem.elementsByTagName( QStringLiteral(
"Property" ) );
1099 if ( propertyNodeList.isEmpty() )
1104 QMap<QString, QString> propertyMap;
1105 QDomElement propertyElem;
1106 QDomElement nameElem;
1107 QDomElement valueElem;
1108 QDomElement geometryElem;
1110 for (
int l = 0; l < propertyNodeList.count(); ++l )
1112 propertyElem = propertyNodeList.at( l ).toElement();
1113 nameElem = propertyElem.elementsByTagName( QStringLiteral(
"Name" ) ).at( 0 ).toElement();
1114 valueElem = propertyElem.elementsByTagName( QStringLiteral(
"Value" ) ).at( 0 ).toElement();
1115 if ( nameElem.text() != QLatin1String(
"geometry" ) )
1117 propertyMap.insert( nameElem.text(), valueElem.text() );
1121 geometryElem = valueElem;
1125 QDomNodeList filterNodeList = actionElem.elementsByTagName( QStringLiteral(
"Filter" ) );
1127 if ( filterNodeList.size() != 0 )
1129 QDomElement filterElem = filterNodeList.at( 0 ).toElement();
1138 action.
error =
false;
1140 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1142 action.
handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1150 QDomNodeList featureNodeList = actionElem.childNodes();
1151 if ( featureNodeList.size() != 1 )
1157 for (
int i = 0; i < featureNodeList.count(); ++i )
1159 QString tempTypeName = featureNodeList.at( i ).toElement().localName();
1160 if ( tempTypeName.contains(
':' ) )
1161 tempTypeName = tempTypeName.section(
':', 1, 1 );
1163 if ( typeName.isEmpty() )
1165 typeName = tempTypeName;
1167 else if ( tempTypeName != typeName )
1176 action.
error =
false;
1178 if ( actionElem.hasAttribute( QStringLiteral(
"handle" ) ) )
1180 action.
handle = actionElem.attribute( QStringLiteral(
"handle" ) );
1189 void addTransactionResult( QDomDocument &responseDoc, QDomElement &responseElem,
const QString &status,
1190 const QString &locator,
const QString &message )
1192 QDomElement trElem = responseDoc.createElement( QStringLiteral(
"TransactionResult" ) );
1193 QDomElement stElem = responseDoc.createElement( QStringLiteral(
"Status" ) );
1194 QDomElement successElem = responseDoc.createElement( status );
1195 stElem.appendChild( successElem );
1196 trElem.appendChild( stElem );
1197 responseElem.appendChild( trElem );
1199 if ( !locator.isEmpty() )
1201 QDomElement locElem = responseDoc.createElement( QStringLiteral(
"Locator" ) );
1202 locElem.appendChild( responseDoc.createTextNode( locator ) );
1203 trElem.appendChild( locElem );
1206 if ( !message.isEmpty() )
1208 QDomElement mesElem = responseDoc.createElement( QStringLiteral(
"Message" ) );
1209 mesElem.appendChild( responseDoc.createTextNode( message ) );
1210 trElem.appendChild( mesElem );
QgsFeatureRequest featureRequest
Class for parsing and evaluation of expressions (formerly called "search strings").
bool layerInsertPermission(const QgsVectorLayer *layer) const
Returns the layer insert right.
Wrapper for iterator of features from vector data provider or vector layer.
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
A rectangle specified with double values.
Base class for all map layer types.
SERVER_EXPORT QStringList wfstUpdateLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities...
QList< transactionInsert > inserts
QSet< QgsFeatureId > QgsFeatureIds
virtual QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
QMap< QString, int > fieldNameMap() const
Returns a map where the key is the name of the field and the value is its index.
bool addFeatures(QgsFeatureList &flist, QgsFeatureSink::Flags flags=nullptr) override
Adds a list of features to the sink.
QList< QgsFeature > QgsFeatureList
bool commitChanges()
Attempts to commit to the underlying data provider any buffered changes made since the last to call t...
bool startEditing()
Makes the layer editable.
Exception base class for service exceptions.
bool deleteFeatures(const QgsFeatureIds &fids)
Deletes a set of features from the layer (but does not commit it)
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QString message() const
Returns the exception message.
bool layerDeletePermission(const QgsVectorLayer *layer) const
Returns the layer delete right.
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device...
QList< transactionUpdate > updates
QgsMapLayer::LayerType type() const
Returns the type of the layer.
transactionUpdate parseUpdateActionElement(QDomElement &actionElem)
Transform Update element to transactionUpdate.
QString layerTypeName(const QgsMapLayer *layer)
Returns typename from vector layer.
QDomElement geometryElement
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
static void applyAccessControlLayerFilters(const QgsAccessControl *accessControl, QgsMapLayer *mapLayer, QHash< QgsMapLayer *, QString > &originalLayerFilters)
Apply filter from AccessControl.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
transactionRequest parseTransactionRequestBody(QDomElement &docElem)
Transform RequestBody root element to getFeatureRequest.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
bool changeGeometry(QgsFeatureId fid, QgsGeometry &geometry, bool skipDefaultValue=false)
Changes a feature's geometry within the layer's edit buffer (but does not immediately commit the chan...
bool rollBack(bool deleteBuffer=true)
Stops a current editing operation and discards any uncommitted edits.
SERVER_EXPORT QStringList wfstDeleteLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities...
QgsFields fields() const override=0
Returns the fields associated with this data provider.
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
This class wraps a request for features to a vector layer (or directly its vector data provider)...
const QString WFS_NAMESPACE
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
QgsFeatureRequest parseFilterElement(const QString &typeName, QDomElement &filterElem, const QgsProject *project)
Transform a Filter element to a feature request.
Allows modifications of geometries.
Reads and writes project states.
void clearErrors()
Clear recorded errors.
transactionRequest parseTransactionParameters(QgsServerRequest::Parameters parameters)
transactionInsert parseInsertActionElement(QDomElement &actionElem)
Transform Insert element to transactionInsert.
Encapsulate a field in an attribute table or data source.
QList< transactionDelete > deletes
QStringList insertFeatureIds
const QString OGC_NAMESPACE
QStringList commitErrors() const
Returns a list containing any error messages generated when attempting to commit changes to the layer...
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
static QgsGeometry geometryFromGML(const QString &xmlString)
Static method that creates geometry from GML.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QgsFieldConstraints constraints
QgsFeatureRequest featureRequest
QDomNodeList featureNodeList
void writeTransaction(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WFS transaction response.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
RAII class to restore layer filters on destruction.
A helper class that centralizes restrictions given by all the access control filter plugins...
QgsFeatureList featuresFromGML(QDomNodeList featureNodeList, QgsVectorDataProvider *provider)
Transform GML feature nodes to features.
void filterFeatures(const QgsVectorLayer *layer, QgsFeatureRequest &filterFeatures) const override
Filter the features of the layer.
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
SERVER_EXPORT QStringList wfstInsertLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities...
Exception thrown when data access violates access controls.
Allows deletion of features.
bool layerUpdatePermission(const QgsVectorLayer *layer) const
Returns the layer update right.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Query the layer for features specified in request.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
bool changeAttributeValue(QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue=QVariant(), bool skipDefaultValues=false)
Changes an attribute value for a feature (but does not immediately commit the changes).
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be null.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
bool nextFeature(QgsFeature &f)
This is the base class for vector data providers.
Represents a vector layer which manages a vector based data sets.
transactionDelete parseDeleteActionElement(QDomElement &actionElem)
Transform Delete element to transactionDelete.
QMap< QString, QString > propertyMap
void performTransaction(transactionRequest &aRequest, QgsServerInterface *serverIface, const QgsProject *project)
Perform the transaction.
Allows modification of attribute values.
QDomDocument createTransactionDocument(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request)
Create a wfs transaction document.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
QMap< QString, QString > Parameters
bool allowToEdit(const QgsVectorLayer *layer, const QgsFeature &feature) const
Are we authorized to modify the following geometry.