public TIPDetailsDto create( Long typeId, String name, String description, String photoUrl, String infoUrl, Geometry geom, Long osmId, boolean reviewed, Long facebookUserId) throws TIPLocationException, InvalidTIPUrlException, InstanceNotFoundException { TIPtype tipType = tipTypeDao.findById(typeId); return create( tipType, name, description, photoUrl, infoUrl, geom, osmId, reviewed, true, facebookUserId); }
@Override public void syncTIPs(List<TIPSyncDto> tipSyncDtos) { List<Long> osmIds = new ArrayList<>(); for (TIPSyncDto tipSyncDto : tipSyncDtos) { try { Long osmId = tipSyncDto.getOsm_id(); osmIds.add(osmId); Long tipTypeId = tipSyncDto.getTip_type_id(); TIPtype tipType = tipTypeDao.findById(tipTypeId); Geometry geom = GeometryUtils.latLong2Geom(tipSyncDto.getLon(), tipSyncDto.getLat()); try { TIP tip = tipDao.findByOSMId(osmId); edit( tip, null, tipType, tipSyncDto.getName(), null, tipSyncDto.getInfo_url(), tip.getAddress(), tipSyncDto.getPhoto_url()); } catch (InstanceNotFoundException e) { createSyncTIPs( tipType, tipSyncDto.getName(), null, tipSyncDto.getPhoto_url(), tipSyncDto.getInfo_url(), geom, osmId, true); } } catch (Exception e) { e.printStackTrace(); } } // FIXME: No sé si es buena idea eliminar automáticamente los TIPs que se han eliminado de // OSM... Igual sería mejor sacar un listado y eliminarlos manualmente (por si tienen reviews, // comentarios...) // Se eliminan los TIPs obtenidos de OSM que ya no existan. tipDao.deleteNonExistingFromOSMIds(osmIds); }
public TIPDetailsDto edit( Long TIPId, Long facebookUserId, Long type, String name, String description, String infoUrl, String address, String photoUrl) throws InstanceNotFoundException, InvalidTIPUrlException { TIP tip = tipDao.findById(TIPId); UserAccount userAccount = null; if (facebookUserId != null) { userAccount = userAccountDao.findByFBUserID(facebookUserId); } TIPtype tipType = tipTypeDao.findById(type); return edit(tip, userAccount, tipType, name, description, infoUrl, address, photoUrl); }