Tabnine Logo
Query
Code IndexAdd Tabnine to your IDE (free)

How to use
Query
in
com.microsoft.azure.sdk.iot.provisioning.service

Best Java code snippets using com.microsoft.azure.sdk.iot.provisioning.service.Query (Showing top 7 results out of 315)

origin: Azure/azure-iot-sdk-java

/**
 * Return the next page of result for the query using a new continuationToken.
 *
 * @param continuationToken the {@code String} with the previous continuationToken. It cannot be {@code null} or empty.
 * @return A {@link QueryResult} with the next page of items for the query.
 * @throws NoSuchElementException if the query does no have more pages to return.
 */
public QueryResult next(String continuationToken)
{
  /* SRS_QUERY_21_018: [The next shall throw NoSuchElementException if the provided continuationToken is null or empty.] */
  if(Tools.isNullOrEmpty(continuationToken))
  {
    throw new NoSuchElementException("There is no Continuation Token to get pending elements,");
  }
  /* SRS_QUERY_21_019: [The next shall store the provided continuationToken.] */
  this.continuationToken = continuationToken;
  /* SRS_QUERY_21_020: [The next shall return the next page of results by calling the next().] */
  return next();
}
origin: Azure/azure-iot-sdk-java

/**
 * Create a new enrollmentGroup query.
 *
 * @see ProvisioningServiceClient#createEnrollmentGroupQuery(QuerySpecification)
 * @see ProvisioningServiceClient#createEnrollmentGroupQuery(QuerySpecification, int)
 *
 * @param querySpecification is a {@code String} with the SQL query specification. It cannot be {@code null}.
 * @param pageSize the {@code int} with the maximum number of items per iteration. It can be 0 for default, but not negative.
 * @return A {@link Query} iterator.
 * @throws IllegalArgumentException if the provided parameter is not correct.
 */
Query createQuery(QuerySpecification querySpecification, int pageSize)
{
  /* SRS_ENROLLMENT_GROUP_MANAGER_21_038: [The createQuery shall throw IllegalArgumentException if the provided querySpecification is null.] */
  if(querySpecification == null)
  {
    throw new IllegalArgumentException("querySpecification cannot be null.");
  }
  /* SRS_ENROLLMENT_GROUP_MANAGER_21_039: [The createQuery shall throw IllegalArgumentException if the provided pageSize is negative.] */
  if(pageSize < 0)
  {
    throw new IllegalArgumentException("pageSize cannot be negative.");
  }
  /* SRS_ENROLLMENT_GROUP_MANAGER_21_040: [The createQuery shall create Query iterator with a Http path `enrollmentGroups`.] */
  String targetPath = EnrollmentGroupManager.getEnrollmentGroupsPath();
  /* SRS_ENROLLMENT_GROUP_MANAGER_21_041: [The createQuery shall create and return a new instance of the Query iterator.] */
  return new Query(contractApiHttp, targetPath, querySpecification, pageSize);
}
origin: Azure/azure-iot-sdk-java

Query query = provisioningServiceClient.createIndividualEnrollmentQuery(querySpecification, QUERY_PAGE_SIZE);
while(query.hasNext())
  QueryResult queryResult = query.next();
  System.out.println(queryResult);
origin: Azure/azure-iot-sdk-java

Query query = provisioningServiceClient.createEnrollmentGroupQuery(querySpecification);
while(query.hasNext())
  QueryResult queryResult = query.next();
  System.out.println(queryResult);
origin: Azure/azure-iot-sdk-java

Query query = provisioningServiceClient.createIndividualEnrollmentQuery(querySpecification);
while(query.hasNext())
  QueryResult queryResult = query.next();
  System.out.println(queryResult);
origin: Azure/azure-iot-sdk-java

/**
 * Create a new individualEnrollment query.
 *
 * @see ProvisioningServiceClient#createIndividualEnrollmentQuery(QuerySpecification)
 * @see ProvisioningServiceClient#createIndividualEnrollmentQuery(QuerySpecification, int)
 *
 * @param querySpecification is a {@code String} with the SQL query specification. It cannot be {@code null}.
 * @param pageSize the {@code int} with the maximum number of items per iteration. It can be 0 for default, but not negative.
 * @return A {@link Query} iterator.
 * @throws IllegalArgumentException if the provided parameter is not correct.
 */
Query createQuery(QuerySpecification querySpecification, int pageSize)
{
  /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_038: [The createQuery shall throw IllegalArgumentException if the provided querySpecification is null.] */
  if(querySpecification == null)
  {
    throw new IllegalArgumentException("querySpecification cannot be null.");
  }
  /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_039: [The createQuery shall throw IllegalArgumentException if the provided pageSize is negative.] */
  if(pageSize < 0)
  {
    throw new IllegalArgumentException("pageSize cannot be negative.");
  }
  /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_040: [The createQuery shall create Query iterator with a Http path `enrollments`.] */
  String targetPath = IndividualEnrollmentManager.getEnrollmentsPath();
  /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_041: [The createQuery shall create and return a new instance of the Query iterator.] */
  return new Query(contractApiHttp, targetPath, querySpecification, pageSize);
}
origin: Azure/azure-iot-sdk-java

return new Query(contractApiHttp, targetPath, querySpecification, pageSize);
com.microsoft.azure.sdk.iot.provisioning.serviceQuery

Javadoc

The query iterator.

The Query iterator is the result of the query factory for

Query factories
IndividualEnrollment: ProvisioningServiceClient#createIndividualEnrollmentQuery(QuerySpecification,int)
EnrollmentGroup: ProvisioningServiceClient#createEnrollmentGroupQuery(QuerySpecification,int)
RegistrationStatus: ProvisioningServiceClient#createEnrollmentGroupRegistrationStatusQuery(QuerySpecification,String,int)

On all cases, the QuerySpecification contains a SQL query that must follow the Query Language for the Device Provisioning Service.

Optionally, an Integer with the pageSize, can determine the maximum number of the items in the QueryResult returned by the #next(). It must be any positive integer, and if it contains 0, the Device Provisioning Service will ignore it and use a standard page size.

You can use this Object as a standard Iterator, just using the #hasNext() and #next() in a while loop, up to the point where the #hasNext() return false. But, keep in mind that the QueryResult can contain a empty list, even if the #hasNext() 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 QueryResult#getItems() will return a empty list.

You can also store a query context (QuerySpecification + ContinuationToken) and restart it in the future, from the point where you stopped.

Besides the Items, the queryResult contains the continuationToken, the QueryResult#getContinuationToken()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 #next(String) providing the stored continuationToken to get the next page.

Most used methods

  • next
    Return the next page of result for the query using a new continuationToken.
  • hasNext
    Getter for hasNext. It will return true if the query is not finished in the Device Provisioning Serv
  • <init>
    INTERNAL CONSTRUCTOR Use one of the factories to create a new query.Query factories IndividualEnroll

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now