Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. try{
  2. if(createContact.getId() == null)
  3. {
  4. System.out.println("Inside_create_of_update");
  5. BatchUtils.setBatchOperationType(createContact, BatchOperationType.INSERT);
  6. BatchUtils.setBatchId(createContact,"create");
  7. updateFeed.getEntries().add(createContact);
  8. }
  9. else
  10. {
  11. //If contact already present in google with this email, we just update this
  12. //instead of creating new contact
  13. System.out.println("Inside_update_of_update");
  14. BatchUtils.setBatchOperationType(createContact, BatchOperationType.UPDATE);
  15. BatchUtils.setBatchId(createContact,"update");
  16. updateFeed.getEntries().add(createContact);
  17. }
  18. updateRequestCount++;
  19. }
  20. catch(Exception e)
  21. {
  22. System.out.println("Exception occured while updating contact:"+e);
  23. }
  24. }
  25.  
  26. if (updateRequestCount >= 95 || ((i >= (contacts.size() - 1) && updateRequestCount != 0)))
  27. {
  28. Thread.sleep(2000);
  29. System.out.println("Inside batch update");
  30. responseFeed = contactService.batch(new URL("https://www.google.com/m8/feeds/contacts/default/full/batch?"
  31. + "access_token=" + token), updateFeed);
  32. System.out.println("Response_feed"+responseFeed);
  33. for(int v=0;v<responseFeed.getEntries().size();v++)
  34. {
  35. ContactEntry entry = responseFeed.getEntries().get(v);
  36. String batchId = BatchUtils.getBatchId(responseFeed.getEntries().get(v));
  37. IBatchStatus status = BatchUtils.getStatus(entry);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement