26 QString QgsRaiseExceptionAlgorithm::name()
const
28 return QStringLiteral(
"raiseexception" );
31 QgsProcessingAlgorithm::Flags QgsRaiseExceptionAlgorithm::flags()
const
36 QString QgsRaiseExceptionAlgorithm::displayName()
const
38 return QObject::tr(
"Raise exception" );
41 QStringList QgsRaiseExceptionAlgorithm::tags()
const
43 return QObject::tr(
"abort,warn,error,cancel" ).split(
',' );
46 QString QgsRaiseExceptionAlgorithm::group()
const
48 return QObject::tr(
"Modeler tools" );
51 QString QgsRaiseExceptionAlgorithm::groupId()
const
53 return QStringLiteral(
"modelertools" );
56 QString QgsRaiseExceptionAlgorithm::shortHelpString()
const
58 return QObject::tr(
"This algorithm raises an exception and cancels a model's execution.\n\n"
59 "The exception message can be customized, and optionally an expression based condition "
60 "can be specified. If an expression condition is used, then the exception will only "
61 "be raised if the expression result is true. A false result indicates that no exception "
62 "will be raised, and the model execution can continue uninterrupted." );
65 QString QgsRaiseExceptionAlgorithm::shortDescription()
const
67 return QObject::tr(
"Raises an exception and cancels a model's execution." );
70 QgsRaiseExceptionAlgorithm *QgsRaiseExceptionAlgorithm::createInstance()
const
72 return new QgsRaiseExceptionAlgorithm();
75 void QgsRaiseExceptionAlgorithm::initAlgorithm(
const QVariantMap & )
83 const QString expression = parameterAsExpression( parameters, QStringLiteral(
"CONDITION" ), context );
84 if ( !expression.isEmpty() )
88 if ( exp.hasParserError() )
90 throw QgsProcessingException( QObject::tr(
"Error parsing condition expression: %1" ).arg( exp.parserErrorString() ) );
92 if ( !exp.evaluate( &expContext ).toBool() )
96 const QString error = parameterAsString( parameters, QStringLiteral(
"MESSAGE" ), context );
105 QString QgsRaiseWarningAlgorithm::name()
const
107 return QStringLiteral(
"raisewarning" );
110 QgsProcessingAlgorithm::Flags QgsRaiseWarningAlgorithm::flags()
const
115 QString QgsRaiseWarningAlgorithm::displayName()
const
117 return QObject::tr(
"Raise warning" );
120 QStringList QgsRaiseWarningAlgorithm::tags()
const
122 return QObject::tr(
"abort,warn,error,cancel" ).split(
',' );
125 QString QgsRaiseWarningAlgorithm::group()
const
127 return QObject::tr(
"Modeler tools" );
130 QString QgsRaiseWarningAlgorithm::groupId()
const
132 return QStringLiteral(
"modelertools" );
135 QString QgsRaiseWarningAlgorithm::shortHelpString()
const
137 return QObject::tr(
"This algorithm raises a warning message in the log.\n\n"
138 "The warning message can be customized, and optionally an expression based condition "
139 "can be specified. If an expression condition is used, then the warning will only "
140 "be logged if the expression result is true. A false result indicates that no warning "
144 QString QgsRaiseWarningAlgorithm::shortDescription()
const
146 return QObject::tr(
"Raises an warning message." );
149 QgsRaiseWarningAlgorithm *QgsRaiseWarningAlgorithm::createInstance()
const
151 return new QgsRaiseWarningAlgorithm();
154 void QgsRaiseWarningAlgorithm::initAlgorithm(
const QVariantMap & )
162 const QString expression = parameterAsExpression( parameters, QStringLiteral(
"CONDITION" ), context );
163 if ( !expression.isEmpty() )
167 if ( exp.hasParserError() )
169 throw QgsProcessingException( QObject::tr(
"Error parsing condition expression: %1" ).arg( exp.parserErrorString() ) );
171 if ( !exp.evaluate( &expContext ).toBool() )
172 return QVariantMap();
175 const QString warning = parameterAsString( parameters, QStringLiteral(
"MESSAGE" ), context );
177 return QVariantMap();
185 QString QgsRaiseMessageAlgorithm::name()
const
187 return QStringLiteral(
"raisemessage" );
190 QgsProcessingAlgorithm::Flags QgsRaiseMessageAlgorithm::flags()
const
195 QString QgsRaiseMessageAlgorithm::displayName()
const
197 return QObject::tr(
"Raise message" );
200 QStringList QgsRaiseMessageAlgorithm::tags()
const
202 return QObject::tr(
"information" ).split(
',' );
205 QString QgsRaiseMessageAlgorithm::group()
const
207 return QObject::tr(
"Modeler tools" );
210 QString QgsRaiseMessageAlgorithm::groupId()
const
212 return QStringLiteral(
"modelertools" );
215 QString QgsRaiseMessageAlgorithm::shortHelpString()
const
217 return QObject::tr(
"This algorithm raises an information message in the log.\n\n"
218 "The message can be customized, and optionally an expression based condition "
219 "can be specified. If an expression condition is used, then the message will only "
220 "be logged if the expression result is true. A false result indicates that no message "
224 QString QgsRaiseMessageAlgorithm::shortDescription()
const
226 return QObject::tr(
"Raises an information message." );
229 QgsRaiseMessageAlgorithm *QgsRaiseMessageAlgorithm::createInstance()
const
231 return new QgsRaiseMessageAlgorithm();
234 void QgsRaiseMessageAlgorithm::initAlgorithm(
const QVariantMap & )
242 const QString expression = parameterAsExpression( parameters, QStringLiteral(
"CONDITION" ), context );
243 if ( !expression.isEmpty() )
247 if ( exp.hasParserError() )
249 throw QgsProcessingException( QObject::tr(
"Error parsing condition expression: %1" ).arg( exp.parserErrorString() ) );
251 if ( !exp.evaluate( &expContext ).toBool() )
252 return QVariantMap();
255 const QString info = parameterAsString( parameters, QStringLiteral(
"MESSAGE" ), context );
257 return QVariantMap();