//Account Info requests
LOGGER.log(Level.INFO, "\n-------------createAccountInfoRequest-------------");
sampleEntry = service.createAccountInfoRequest(user);
LOGGER.log(Level.INFO, sampleEntry.getAllProperties().toString());
AccountInfo info = new AccountInfo(sampleEntry);
LOGGER.log(Level.INFO, "\n-------------retrieveAccountInfoRequest-------------");
sampleEntry = service.retrieveAccountInfoRequest(user, info.getRequestId());
info = new AccountInfo(sampleEntry);
LOGGER.log(Level.INFO, info.getRequestId() + " : " + info.getStatus());
if (info.getStatus().equalsIgnoreCase("COMPLETED")) {
for ( String url : info.getFileUrls())
LOGGER.log(Level.INFO, "File: " + url);
}
// retrieve all account info requests from the given date.
LOGGER.log(Level.INFO, "\n------retrieveAllAccountInfoRequests with fromDate-----");
Calendar temp = Calendar.getInstance();
temp.add(Calendar.MONTH, -1);
entries = service.retrieveAllAccountInfoRequests(temp.getTime());
for (GenericEntry entry : entries) {
LOGGER.log(Level.INFO, entry.getAllProperties().toString());
}
/*
* retrieve all account info requests without fromDate query. This will
* retrieve all requests made in the last 3 weeks.
*/
LOGGER.log(Level.INFO, "\n-------------retrieveAllAccountInfoRequests-------------");
entries = service.retrieveAllAccountInfoRequests(null);
for (GenericEntry entry : entries) {
LOGGER.log(Level.INFO, entry.getAllProperties().toString());
}
LOGGER.log(Level.INFO, "\n-------------deleteAccountInfoRequest-------------");
try {
service.deleteAccountInfoRequest(user, info.getRequestId());
} catch (AppsForYourDomainException e) {
if (e.getErrorCode() == AppsForYourDomainErrorCode.InvalidValue) {
LOGGER.log(Level.INFO, e.getMessage());
} else {
e.printStackTrace();