// prevent deletion
setCustomerId(null);
// Step 2. Add Subscriber
String subscriberId = addAdministrator(customerId);
JsonEntity administrator = getSubscriberById(subscriberId);
System.out.println(administrator.toJsonString());
String loginName = administrator.getAsString("Subscriber/Person/EmailAddress");
setPassword(loginName, "onet1me!", "passw0rd");
System.out.println(loginName);
// Step 3. Create "IBM SmartCloud Connections" Subscription
String engageSubscriptionId = createSubscription(customerId, 3, "D0NWLLL", 5);
System.out.println(engageSubscriptionId);
System.out.println("D0NWLLL : " + getSubscriptionById(engageSubscriptionId).toJsonString());
// Step 4. Create Extra Storage Subscription
String storageSubscriptionId = createSubscription(customerId, 3, "D100PLL", 100);
System.out.println(storageSubscriptionId);
System.out.println("D100PLL : " + getSubscriptionById(storageSubscriptionId).toJsonString());
// Step 5. Activate the subscriber
activateSubscriber(subscriberId);
// Step 8. Entitle subscriber
entitleSubscriber(subscriberId, engageSubscriptionId, true);
entitleSubscriber(subscriberId, storageSubscriptionId, true);
// Optional: Check seats
JsonEntity jsonEntity = getSubscriberManagementService().getSubscriberById(subscriberId);
JsonJavaObject rootObject = jsonEntity.getJsonObject();
JsonJavaObject subscriberObject = rootObject.getAsObject("Subscriber");
List<Object> seatSet = subscriberObject.getAsList("SeatSet");
for (Object seat : seatSet) {
System.out.println(seat);
}
// Step 8. Retrieve a seat
JsonJavaObject seatJson = findSeat(subscriberId, storageSubscriptionId);
String seatId = String.valueOf(seatJson.getAsObject("Seat").getAsLong("Id"));
// Step 9. Revoke subscriber subscription
getSubscriberManagementService().revokeSubscriber(subscriberId, seatId, true);
// Optional: Check seats
jsonEntity = getSubscriberManagementService().getSubscriberById(subscriberId);
rootObject = jsonEntity.getJsonObject();
subscriberObject = rootObject.getAsObject("Subscriber");
seatSet = subscriberObject.getAsList("SeatSet");
for (Object seat : seatSet) {
System.out.println(seat);
}