public void processGroupSync(List<Group> groups) { List<FlwGroup> flwGroups = new ArrayList<>(); for (Group group : groups) { String id = group.getId(); logger.info(String.format("Creating/Updating group with id: %s", id)); try { FlwGroup flwGroup = processGroup(group); flwGroups.add(flwGroup); } catch (Exception e) { logger.error(String.format("Error occurred while processing group with id: %s", id), e); } } service.saveOrUpdateAllByExternalPrimaryKey(FlwGroup.class, flwGroups); }
public void processProviderSync(List<Provider> providers) { List<Flw> flws = new ArrayList<>(); Map<String, FlwGroup> flwGroups = new HashMap<>(); for (Provider provider : providers) { try { Flw flw = processProvider(flwGroups, provider); flws.add(flw); } catch (Exception e) { logger.error( String.format("Error occurred while processing provider with id: %s", provider.getId()), e); } } service.saveOrUpdateAllByExternalPrimaryKey(Flw.class, flws); }