azure-docs-sdk-java/docs-ref-autogen/com.microsoft.azure.sdk.iot...

110 строки
17 KiB
YAML

### YamlMime:JavaType
uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query"
name: "Query"
nameWithType: "Query"
summary: "The query iterator."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "<xref href=\"java.lang.Object?alt=java.lang.Object&text=Object\" data-throw-if-not-resolved=\"False\" />"
methodsRef:
- "<xref href=\"java.lang.Object.clone()?alt=java.lang.Object.clone&text=clone\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.equals(java.lang.Object)?alt=java.lang.Object.equals&text=equals\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.finalize()?alt=java.lang.Object.finalize&text=finalize\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.getClass()?alt=java.lang.Object.getClass&text=getClass\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.hashCode()?alt=java.lang.Object.hashCode&text=hashCode\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notify()?alt=java.lang.Object.notify&text=notify\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.notifyAll()?alt=java.lang.Object.notifyAll&text=notifyAll\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.toString()?alt=java.lang.Object.toString&text=toString\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait()?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
- "<xref href=\"java.lang.Object.wait(long,int)?alt=java.lang.Object.wait&text=wait\" data-throw-if-not-resolved=\"False\" />"
syntax: "public class **Query**</br> implements <xref href=\"java.util.Iterator?alt=java.util.Iterator&text=Iterator\" data-throw-if-not-resolved=\"False\" />"
constructors:
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.Query(com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp,java.lang.String,com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,int)"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.Query(ContractApiHttp contractApiHttp, String targetPath, QuerySpecification querySpecification, int pageSize)"
name: "Query(ContractApiHttp contractApiHttp, String targetPath, QuerySpecification querySpecification, int pageSize)"
nameWithType: "Query.Query(ContractApiHttp contractApiHttp, String targetPath, QuerySpecification querySpecification, int pageSize)"
summary: "INTERNAL CONSTRUCTOR"
modifiers:
- "protected"
parameters:
- description: "the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ContractApiHttp\"></xref> that send request messages to the Device Provisioning Service. It cannot be <code>null</code>."
name: "contractApiHttp"
type: "<xref href=\"com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp?alt=com.microsoft.azure.sdk.iot.provisioning.service.contract.ContractApiHttp&text=ContractApiHttp\" data-throw-if-not-resolved=\"False\" />"
- description: "the <code>String</code> with the path that will be part of the URL in the rest API. It cannot be <code>null</code>."
name: "targetPath"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
- description: "the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QuerySpecification\"></xref> with the SQL query. It cannot be <code>null</code>."
name: "querySpecification"
type: "<xref href=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification?alt=com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification&text=QuerySpecification\" data-throw-if-not-resolved=\"False\" />"
- description: "the <code>int</code> with the maximum number of items per iteration. It cannot be negative."
name: "pageSize"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "protected Query(ContractApiHttp contractApiHttp, String targetPath, QuerySpecification querySpecification, int pageSize)"
desc: "INTERNAL CONSTRUCTOR\n\nUse one of the factories to create a new query.\n\n | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n | **IndividualEnrollment:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createIndividualEnrollmentQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createIndividualEnrollmentQuery(QuerySpecification, int)\"></xref> |\n | **EnrollmentGroup:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createEnrollmentGroupQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createEnrollmentGroupQuery(QuerySpecification, int)\"></xref> |\n | **RegistrationStatus:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createEnrollmentGroupRegistrationStatusQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,java.lang.String,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createEnrollmentGroupRegistrationStatusQuery(QuerySpecification, String, int)\"></xref> |"
methods:
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.getPageSize()"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.getPageSize()"
name: "getPageSize()"
nameWithType: "Query.getPageSize()"
summary: "Getter for the page<wbr>Size."
syntax: "public int getPageSize()"
desc: "Getter for the pageSize.\n\nPageSize is the maximum number of items in the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> per iteration."
returns:
description: "An <code>int</code> with the current pageSize."
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.hasNext()"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.hasNext()"
name: "hasNext()"
nameWithType: "Query.hasNext()"
summary: "Getter for has<wbr>Next."
syntax: "public boolean hasNext()"
desc: "Getter for hasNext.\n\nIt will return `true` if the query is not finished in the Device Provisioning Service, and another iteration with <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next()\"></xref> may return more items. Call <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next()\"></xref> after receive a `hasNext` `true` will result in a <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> that can or cannot contains elements. And call <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next()\"></xref> after receive a `hasNext` `false` will result in a exception."
returns:
description: "The<code>boolean</code> <code>true</code> if query is not finalize in the Service."
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.next()"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.next()"
name: "next()"
nameWithType: "Query.next()"
summary: "Return the next page of result for the query."
syntax: "public QueryResult next()"
desc: "Return the next page of result for the query."
returns:
description: "A <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> with the next page of items for the query."
type: "<xref href=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult?alt=com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult&text=QueryResult\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.next(java.lang.String)"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.next(String continuationToken)"
name: "next(String continuationToken)"
nameWithType: "Query.next(String continuationToken)"
summary: "Return the next page of result for the query using a new continuation<wbr>Token."
parameters:
- description: "the <code>String</code> with the previous continuationToken. It cannot be <code>null</code> or empty."
name: "continuationToken"
type: "<xref href=\"java.lang.String?alt=java.lang.String&text=String\" data-throw-if-not-resolved=\"False\" />"
syntax: "public QueryResult next(String continuationToken)"
desc: "Return the next page of result for the query using a new continuationToken."
returns:
description: "A <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> with the next page of items for the query."
type: "<xref href=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult?alt=com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult&text=QueryResult\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.microsoft.azure.sdk.iot.provisioning.service.Query.setPageSize(int)"
fullName: "com.microsoft.azure.sdk.iot.provisioning.service.Query.setPageSize(int pageSize)"
name: "setPageSize(int pageSize)"
nameWithType: "Query.setPageSize(int pageSize)"
summary: "Setter for the page<wbr>Size."
parameters:
- description: "an <code>int</code> with the new pageSize. It cannot be negative. The Device Service Client\n will use its own default pageSize if it is <b>0</b>."
name: "pageSize"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void setPageSize(int pageSize)"
desc: "Setter for the pageSize.\n\nPageSize is the maximum number of items in the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> per iteration."
type: "class"
desc: "The query iterator.\n\nThe `Query` iterator is the result of the query factory for\n\n | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n | **IndividualEnrollment:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createIndividualEnrollmentQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createIndividualEnrollmentQuery(QuerySpecification, int)\"></xref> |\n | **EnrollmentGroup:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createEnrollmentGroupQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createEnrollmentGroupQuery(QuerySpecification, int)\"></xref> |\n | **RegistrationStatus:** | <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.ProvisioningServiceClient.createEnrollmentGroupRegistrationStatusQuery(com.microsoft.azure.sdk.iot.provisioning.service.configs.QuerySpecification,java.lang.String,int)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProvisioningServiceClient#createEnrollmentGroupRegistrationStatusQuery(QuerySpecification, String, int)\"></xref> |\n\nOn all cases, the **QuerySpecification** contains a SQL query that must follow the [Query Language][] for the Device Provisioning Service.\n\nOptionally, an `Integer` with the **pageSize**, can determine the maximum number of the items in the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> returned by the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next()\"></xref>. It must be any positive integer, and if it contains 0, the Device Provisioning Service will ignore it and use a standard page size.\n\nYou can use this Object as a standard Iterator, just using the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.hasNext()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#hasNext()\"></xref> and <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next()\"></xref> in a `while` loop, up to the point where the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.hasNext()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#hasNext()\"></xref> return `false`. But, keep in mind that the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult\"></xref> can contain a empty list, even if the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.hasNext()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#hasNext()\"></xref> returned `true`. For example, image that you have 10 IndividualEnrollment in the Device Provisioning Service and you created new query with the `pageSize` equals 5. The first `hasNext()` will return `true`, and the first `next()` will return a `QueryResult` with 5 items. After that you call the `hasNext`, which will returns `true`. Now, before you get the next page, somebody delete all the IndividualEnrollment, What happened, when you call the `next()`, it will return a valid `QueryResult`, but the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult.getItems()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult#getItems()\"></xref> will return a empty list.\n\nYou can also store a query context (QuerySpecification + ContinuationToken) and restart it in the future, from the point where you stopped.\n\nBesides the Items, the queryResult contains the continuationToken, the <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.configs.QueryResult.getContinuationToken()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"QueryResult#getContinuationToken()\"></xref> shall return it. In any point in the future, you may recreate the query using the same query factories that you used for the first time, and call <xref uid=\"com.microsoft.azure.sdk.iot.provisioning.service.Query.next(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#next(String)\"></xref> providing the stored continuationToken to get the next page.\n\n\n[Query Language]: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-query-language"
implements:
- "<xref href=\"java.util.Iterator?alt=java.util.Iterator&text=Iterator\" data-throw-if-not-resolved=\"False\" />"
metadata: {}
package: "com.microsoft.azure.sdk.iot.provisioning.service"
artifact: com.microsoft.azure.sdk.iot.provisioning:provisioning-service-client:1.7.0