* request</li>
* </ul>
*/
private void runSample() {
GenericEntry entry = new GenericEntry();
entry.addProperty("user", destinationUser);
entry.addProperty("key", domain);
entry.addProperty("from", from);
entry.addProperty("to", to);
entry.addProperty("subject", subject);
entry.addProperty("hasTheWord", hasTheWord);
entry.addProperty("doesNotHaveTheWord", doesNotHaveTheWord);
entry.addProperty("hasAttachment", hasAttachment);
entry.addProperty("shouldMarkAsRead", shouldMarkAsRead);
entry.addProperty("shouldArchive", shouldArchive);
entry.addProperty("label", label);
entry.addProperty("forwardTo", forwardTo);
entry.addProperty("neverSpam", neverSpam);
entry.addProperty("shouldStar", shouldStar);
entry.addProperty("shouldTrash", shouldTrash);
LOGGER.log(Level.INFO, "Inserting 1 gmail filter.");
GenericEntry[] entries = new GenericEntry[ITEMS_TO_BATCH];
for (int i = 0; i < ITEMS_TO_BATCH; i ++) {
GenericEntry newEntry = new GenericEntry();
newEntry.addProperty("user", destinationUser);
newEntry.addProperty("key", domain);
newEntry.addProperty("from", from);
newEntry.addProperty("to", to);
newEntry.addProperty("subject", subject);
newEntry.addProperty("hasTheWord", hasTheWord);
newEntry.addProperty("doesNotHaveTheWord", doesNotHaveTheWord);
newEntry.addProperty("hasAttachment", hasAttachment);
newEntry.addProperty("shouldMarkAsRead", shouldMarkAsRead);
newEntry.addProperty("shouldArchive", shouldArchive);
// Apply different label to different filter
newEntry.addProperty("label", String.valueOf(i));
entries[i] = newEntry;
}
try {
LOGGER.log(Level.INFO, "Inserting 1 Gmail filter.");
GenericEntry resultEntry = insertGmailFilter(entry);
LOGGER.log(Level.INFO, "Insert 1 filter succeeded.");
LOGGER.log(Level.INFO, "Batch inserting " + ITEMS_TO_BATCH +
" Gmail filters");
GenericFeed resultFeed = batchInsertGmailFilters(entries);