Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- if(createContact.getId() == null)
- {
- System.out.println("Inside_create_of_update");
- BatchUtils.setBatchOperationType(createContact, BatchOperationType.INSERT);
- BatchUtils.setBatchId(createContact,"create");
- updateFeed.getEntries().add(createContact);
- }
- else
- {
- //If contact already present in google with this email, we just update this
- //instead of creating new contact
- System.out.println("Inside_update_of_update");
- BatchUtils.setBatchOperationType(createContact, BatchOperationType.UPDATE);
- BatchUtils.setBatchId(createContact,"update");
- updateFeed.getEntries().add(createContact);
- }
- updateRequestCount++;
- }
- catch(Exception e)
- {
- System.out.println("Exception occured while updating contact:"+e);
- }
- }
- if (updateRequestCount >= 95 || ((i >= (contacts.size() - 1) && updateRequestCount != 0)))
- {
- Thread.sleep(2000);
- System.out.println("Inside batch update");
- responseFeed = contactService.batch(new URL("https://www.google.com/m8/feeds/contacts/default/full/batch?"
- + "access_token=" + token), updateFeed);
- System.out.println("Response_feed"+responseFeed);
- for(int v=0;v<responseFeed.getEntries().size();v++)
- {
- ContactEntry entry = responseFeed.getEntries().get(v);
- String batchId = BatchUtils.getBatchId(responseFeed.getEntries().get(v));
- IBatchStatus status = BatchUtils.getStatus(entry);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement