@@ -31,9 +31,11 @@ import java.util.*
3131 * @param criteria The query criteria that will be used to obtain the sequence.
3232 * @return Returns true if the sequence contains any elements; otherwise, false.
3333 */
34- fun <T : ContractState > VaultService<T>.any (criteria : QueryCriteria = defaultQueryCriteria): Boolean {
35- return VaultSequence (this , criteria).any()
36- }
34+ fun <T : ContractState > VaultService<T>.any (
35+ criteria : QueryCriteria = defaultQueryCriteria,
36+ paging : PageSpecification = MAXIMUM_PAGE_SPECIFICATION ,
37+ sorting : Sort = DEFAULT_SORTING
38+ ): Boolean = VaultSequence (this , criteria, paging, sorting).any()
3739
3840/* *
3941 * Determines whether the sequence contains any elements.
@@ -43,7 +45,7 @@ fun <T : ContractState> VaultService<T>.any(criteria: QueryCriteria = defaultQue
4345 * @return Returns true if the sequence contains any elements; otherwise, false.
4446 */
4547fun <T : ContractState > VaultService<T>.any (action : QueryDsl <T >.() -> Unit ): Boolean {
46- val queryDsl = QueryDsl <T >()
48+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
4749 action(queryDsl)
4850 return VaultSequence (this , queryDsl).any()
4951}
@@ -55,9 +57,11 @@ fun <T : ContractState> VaultService<T>.any(action: QueryDsl<T>.() -> Unit): Boo
5557 * @param criteria The query criteria that will be used to obtain the sequence.
5658 * @return Returns a count of the number of elements in a sequence.
5759 */
58- fun <T : ContractState > VaultService<T>.count (criteria : QueryCriteria = defaultQueryCriteria): Int {
59- return VaultSequence (this , criteria).count()
60- }
60+ fun <T : ContractState > VaultService<T>.count (
61+ criteria : QueryCriteria = defaultQueryCriteria,
62+ paging : PageSpecification = MAXIMUM_PAGE_SPECIFICATION ,
63+ sorting : Sort = DEFAULT_SORTING
64+ ): Int = VaultSequence (this , criteria, paging, sorting).count()
6165
6266/* *
6367 * Counts the number of elements in a sequence.
@@ -67,7 +71,7 @@ fun <T : ContractState> VaultService<T>.count(criteria: QueryCriteria = defaultQ
6771 * @return Returns a count of the number of elements in a sequence.
6872 */
6973fun <T : ContractState > VaultService<T>.count (action : QueryDsl <T >.() -> Unit ): Int {
70- val queryDsl = QueryDsl <T >()
74+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
7175 action(queryDsl)
7276 return VaultSequence (this , queryDsl).count()
7377}
@@ -95,7 +99,7 @@ fun <T : ContractState> VaultService<T>.filter(
9599 * @return Returns a filtered sequence of elements.
96100 */
97101fun <T : ContractState > VaultService<T>.filter (action : QueryDsl <T >.() -> Unit ): VaultSequence <T > {
98- val queryDsl = QueryDsl <T >()
102+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
99103 action(queryDsl)
100104 return VaultSequence (this , queryDsl)
101105}
@@ -123,7 +127,7 @@ fun <T : ContractState> VaultService<T>.first(
123127 * @return Returns the first element in the sequence.
124128 */
125129fun <T : ContractState > VaultService<T>.first (action : QueryDsl <T >.() -> Unit ): StateAndRef <T > {
126- val queryDsl = QueryDsl <T >()
130+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
127131 action(queryDsl)
128132 return VaultSequence (this , queryDsl).first()
129133}
@@ -151,7 +155,7 @@ fun <T : ContractState> VaultService<T>.firstOrNull(
151155 * @return Returns the first element in the sequence, or null if no element is found.
152156 */
153157fun <T : ContractState > VaultService<T>.firstOrNull (action : QueryDsl <T >.() -> Unit ): StateAndRef <T >? {
154- val queryDsl = QueryDsl <T >()
158+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
155159 action(queryDsl)
156160 return VaultSequence (this , queryDsl).firstOrNull()
157161}
@@ -179,7 +183,7 @@ fun <T : ContractState> VaultService<T>.last(
179183 * @return Returns the last element in the sequence.
180184 */
181185fun <T : ContractState > VaultService<T>.last (action : QueryDsl <T >.() -> Unit ): StateAndRef <T > {
182- val queryDsl = QueryDsl <T >()
186+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
183187 action(queryDsl)
184188 return VaultSequence (this , queryDsl).last()
185189}
@@ -207,7 +211,7 @@ fun <T : ContractState> VaultService<T>.lastOrNull(
207211 * @return Returns the last element in the sequence, or null if no element is found.
208212 */
209213fun <T : ContractState > VaultService<T>.lastOrNull (action : QueryDsl <T >.() -> Unit ): StateAndRef <T >? {
210- val queryDsl = QueryDsl <T >()
214+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
211215 action(queryDsl)
212216 return VaultSequence (this , queryDsl).lastOrNull()
213217}
@@ -235,7 +239,7 @@ fun <T : ContractState> VaultService<T>.single(
235239 * @return Returns the last element in the sequence.
236240 */
237241fun <T : ContractState > VaultService<T>.single (action : QueryDsl <T >.() -> Unit ): StateAndRef <T > {
238- val queryDsl = QueryDsl <T >()
242+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
239243 action(queryDsl)
240244 return VaultSequence (this , queryDsl).single()
241245}
@@ -263,7 +267,7 @@ fun <T : ContractState> VaultService<T>.singleOrNull(
263267 * @return Returns the last element in the sequence, or null if no element is found.
264268 */
265269fun <T : ContractState > VaultService<T>.singleOrNull (action : QueryDsl <T >.() -> Unit ): StateAndRef <T >? {
266- val queryDsl = QueryDsl <T >()
270+ val queryDsl = QueryDsl <T >(defaultQueryCriteria )
267271 action(queryDsl)
268272 return VaultSequence (this , queryDsl).singleOrNull()
269273}
0 commit comments