/** * Create a new instance of the IndividualEnrollmentManager using the provided connection * string and https as the transport protocol. * * @param contractApiHttp is the class that cares the Http communication. * @return The {@code IndividualEnrollmentManager} with the new instance of this class. * @throws IllegalArgumentException if the {@link ContractApiHttp} is {@code null}. */ static IndividualEnrollmentManager createFromContractApiHttp(ContractApiHttp contractApiHttp) { /* SRS_INDIVIDUAL_ENROLLMENT_MANAGER_21_004: [The factory shall create a new instance of this.] */ return new IndividualEnrollmentManager(contractApiHttp); }
return individualEnrollmentManager.bulkOperation(bulkOperationMode, individualEnrollments);
return individualEnrollmentManager.createOrUpdate(individualEnrollment);
String enrollmentPath = IndividualEnrollmentManager.getEnrollmentPath(registrationId);
individualEnrollmentManager.delete(registrationId, eTag);
/** * Factory to create a individualEnrollment query. * * <p> This method will create a new individualEnrollment query for Device Provisioning Service and return it * as a {@link Query} iterator. * * <p> The Device Provisioning Service expects a SQL query in the {@link QuerySpecification}, for instance * {@code "SELECT * FROM enrollments"}. * * @param querySpecification the {@link QuerySpecification} with the SQL query. It cannot be {@code null}. * @return The {@link Query} iterator. * @throws IllegalArgumentException if the provided parameter is not correct. */ public Query createIndividualEnrollmentQuery(QuerySpecification querySpecification) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_014: [The createIndividualEnrollmentQuery shall create a new individual enrolment query by calling the createQuery in the individualEnrollmentManager.] */ return individualEnrollmentManager.createQuery(querySpecification, 0); }
/** * 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); }
return individualEnrollmentManager.get(registrationId);
/** * PRIVATE CONSTRUCTOR * * @param connectionString the {@code String} that contains the connection string for the Provisioning service. * @throws IllegalArgumentException if the connectionString is {@code null}, empty, or invalid. */ private ProvisioningServiceClient(String connectionString) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_002: [The constructor shall throw IllegalArgumentException if the provided connectionString is null or empty.] */ if(Tools.isNullOrEmpty(connectionString)) { throw new IllegalArgumentException("connectionString cannot be null or empty"); } /* SRS_PROVISIONING_SERVICE_CLIENT_21_003: [The constructor shall throw IllegalArgumentException if the ProvisioningConnectionString or one of the inner Managers failed to create a new instance.] */ /* SRS_PROVISIONING_SERVICE_CLIENT_21_004: [The constructor shall create a new instance of the ContractApiHttp class using the provided connectionString.] */ ProvisioningConnectionString provisioningConnectionString = ProvisioningConnectionStringBuilder.createConnectionString(connectionString); ContractApiHttp contractApiHttp = ContractApiHttp.createFromConnectionString(provisioningConnectionString); /* SRS_PROVISIONING_SERVICE_CLIENT_21_005: [The constructor shall create a new instance of the IndividualEnrollmentManger.] */ this.individualEnrollmentManager = IndividualEnrollmentManager.createFromContractApiHttp(contractApiHttp); /* SRS_PROVISIONING_SERVICE_CLIENT_21_006: [The constructor shall create a new instance of the EnrollmentGroupManager.] */ this.enrollmentGroupManager = EnrollmentGroupManager.createFromContractApiHttp(contractApiHttp); /* SRS_PROVISIONING_SERVICE_CLIENT_21_007: [The constructor shall create a new instance of the RegistrationStatusManager.] */ this.registrationStatusManager = RegistrationStatusManager.createFromContractApiHttp(contractApiHttp); }
String enrollmentPath = IndividualEnrollmentManager.getEnrollmentPath(individualEnrollment.getRegistrationId());
individualEnrollmentManager.delete(registrationId, null);
/** * Factory to create a individualEnrollment query. * * <p> This method will create a new individualEnrollment query for Device Provisioning Service and return it * as a {@link Query} iterator. * * <p> The Device Provisioning Service expects a SQL query in the {@link QuerySpecification}, for instance * {@code "SELECT * FROM enrollments"}. * * <p> For each iteration, the Query will return a List of objects correspondent to the query result. The maximum * number of items per iteration can be specified by the pageSize. It is optional, you can provide <b>0</b> for * default pageSize or use the API {@link #createIndividualEnrollmentQuery(QuerySpecification)}. * * @param querySpecification the {@link QuerySpecification} with the SQL query. 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 The {@link Query} iterator. * @throws IllegalArgumentException if the provided parameters are not correct. */ public Query createIndividualEnrollmentQuery(QuerySpecification querySpecification, int pageSize) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_015: [The createIndividualEnrollmentQuery shall create a new individual enrolment query by calling the createQuery in the individualEnrollmentManager.] */ return individualEnrollmentManager.createQuery(querySpecification, pageSize); }
String bulkEnrollmentPath = IndividualEnrollmentManager.getEnrollmentsPath();
String enrollmentPath = IndividualEnrollmentManager.getEnrollmentPath(registrationId);
individualEnrollmentManager.delete(individualEnrollment);
String enrollmentPath = IndividualEnrollmentManager.getEnrollmentPath(id);