Added queries pertaining to batch jobs and derived classes.

This commit is contained in:
peter-villadsen 2021-10-29 12:46:26 -07:00
Родитель b0156dbdde
Коммит fa1a221fa3
5 изменённых файлов: 95 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,7 @@
<ExtendsRunbaseBatch>
{
for $c in /Class
where $c[lower-case(@Extends) = 'runbasebatch']
return <Result Artifact='{$c/@Name}'/>
}
</ExtendsRunbaseBatch>

Просмотреть файл

@ -0,0 +1,17 @@
declare namespace functx = "http://www.functx.com";
declare function functx:is-value-in-sequence
( $value as xs:anyAtomicType? ,
$seq as xs:anyAtomicType* ) as xs:boolean {
$value = $seq
};
<ExtendsRunbaseBatchDoesNotImplementBatchRetryable>
{
for $c in /Class
let $implements := (for $i in $c/Implements return lower-case($i/text()))
where $c[lower-case(@Extends) = 'runbasebatch']
where not(functx:is-value-in-sequence('batchretryable', $implements))
return <Result Artifact='{$c/@Name}'/>
}
</ExtendsRunbaseBatchDoesNotImplementBatchRetryable>

Просмотреть файл

@ -0,0 +1,20 @@
declare namespace functx = "http://www.functx.com";
declare function functx:is-value-in-sequence
( $value as xs:anyAtomicType? ,
$seq as xs:anyAtomicType* ) as xs:boolean {
$value = $seq
};
<ImplementBatchRetryableWithFalse>
{
for $c in /Class
let $implements := (for $i in $c/Implements return lower-case($i/text()))
where functx:is-value-in-sequence('batchretryable', $implements)
let $retryable := $c/Method[lower-case(@Name) = 'isretryable']
where not($retryable//ReturnStatement/BooleanLiteralExpression[@Value="true"])
return <Result Artifact='{$c/@Artifact}'
StartLine='{$retryable/@StartLine}' EndLine='{$retryable/@EndLine}'
StartCol='{$retryable/@StartCol}' EndCol='{$retryable/@EndCol}' />
}
</ImplementBatchRetryableWithFalse>

Просмотреть файл

@ -0,0 +1,20 @@
declare namespace functx = "http://www.functx.com";
declare function functx:is-value-in-sequence
( $value as xs:anyAtomicType? ,
$seq as xs:anyAtomicType* ) as xs:boolean {
$value = $seq
};
<ImplementBatchRetryableWithFalse>
{
for $c in /Class
let $implements := (for $i in $c/Implements return lower-case($i/text()))
where functx:is-value-in-sequence('batchretryable', $implements)
let $retryable := $c/Method[lower-case(@Name) = 'isretryable']
where ($retryable//ReturnStatement/BooleanLiteralExpression[@Value="true"])
return <Result Artifact='{$c/@Artifact}'
StartLine='{$retryable/@StartLine}' EndLine='{$retryable/@EndLine}'
StartCol='{$retryable/@StartCol}' EndCol='{$retryable/@EndCol}' />
}
</ImplementBatchRetryableWithFalse>

Просмотреть файл

@ -0,0 +1,31 @@
declare function local:GetDerived($classes, $base as xs:string*)
{
for $c in $base
return (for $d in $classes/Class[lower-case(@Extends) = $c] return $d/@Name)
};
let $classes := <Classes>{
for $c in /Class[@Extends != ""]
return <Class Name='{lower-case($c/@Name)}' Extends='{lower-case($c/@Extends)}'/>
}</Classes>
let $seed := ('runbasebatch')
let $r1 := local:GetDerived($classes, $seed)
let $r2 := local:GetDerived($classes, $r1)
let $r3 := local:GetDerived($classes, $r2)
let $r4 := local:GetDerived($classes, $r3)
let $r5 := local:GetDerived($classes, $r4)
let $r6 := local:GetDerived($classes, $r5)
return <Results>
{
for $c in ($r1, $r2, $r3, $r4, $r5)
let $cn := $classes/Class[@Name=$c]
return <Result Name='{$c}' Extends='{$cn/@Extends}'/>
}
</Results>
(:
return ($r1, "111111111111", $r2, "2222222222", $r3, "3333333333333", $r4, "444444444444", $r5, "5555555555", $r6)
:)