}
} else if (parameters.containsKey("Delete")) {
try {
DeleteTopicRequest deleteTopicRequest = new DeleteTopicRequest(arn);
sns.deleteTopic(deleteTopicRequest);
logger.debug("event=delete_topic topic_arn="+arn+" user_id= " + userId);
} catch (Exception ex) {
logger.error("event=delete_topic topic_arn="+arn+" user_id= " + userId, ex);
throw new ServletException(ex);
}
} else if (parameters.containsKey("DeleteAll")) {
try {
ListTopicsRequest listTopicRequest = new ListTopicsRequest();
if (nextToken != null) {
listTopicRequest.setNextToken(nextToken);
}
ListTopicsResult listTopicResult = sns.listTopics(listTopicRequest);
topics = listTopicResult.getTopics();
} catch (Exception ex) {
logger.error("event=list_topics user_id= " + userId, ex);
throw new ServletException(ex);
}
for (int i = 0; topics != null && i < topics.size(); i++) {
Topic t = topics.get(i);
try {
DeleteTopicRequest deleteTopicRequest = new DeleteTopicRequest(t.getTopicArn());
sns.deleteTopic(deleteTopicRequest);
logger.debug("event=delete_topic topic_arn=" + (t != null ? t.getTopicArn() : "null") + " user_id= " + userId);
} catch (Exception ex) {
logger.error("event=delete_topic topic_arn=" + (t != null ? t.getTopicArn() : "null") + " user_id= " + userId, ex);
}