Search in sources :

Example 1 with SyncContactHistoric

use of com.axelor.apps.base.db.SyncContactHistoric in project axelor-open-suite by axelor.

the class SyncContactService method importAllContact.

public void importAllContact(Long id, List<Person> people) {
    int i = 0;
    SyncContact syncContact = syncContactRepo.find(id);
    if (syncContact == null) {
        return;
    }
    SyncContactHistoric syncContactHistoric = new SyncContactHistoric();
    for (Person googlePerson : people) {
        Partner partner = importContact(googlePerson, syncContact.getUpdateContactField());
        if (partner != null) {
            syncContactHistoric.addPartnerSetItem(partner);
        }
        if (i % 10 == 0) {
            JPA.clear();
        }
        i++;
    }
    updateSyncContact(id, syncContactHistoric);
}
Also used : SyncContactHistoric(com.axelor.apps.base.db.SyncContactHistoric) SyncContact(com.axelor.apps.base.db.SyncContact) Person(com.google.api.services.people.v1.model.Person) Partner(com.axelor.apps.base.db.Partner)

Aggregations

Partner (com.axelor.apps.base.db.Partner)1 SyncContact (com.axelor.apps.base.db.SyncContact)1 SyncContactHistoric (com.axelor.apps.base.db.SyncContactHistoric)1 Person (com.google.api.services.people.v1.model.Person)1