public TIPDetailsDto findById(Long TIPId, Long facebookUserId) throws InstanceNotFoundException { UserAccount userAccount = null; if (facebookUserId != null) { userAccount = userAccountDao.findByFBUserID(facebookUserId); } return dtoService.TIP2TIPDetailsDto(tipDao.findById(TIPId), userAccount); }
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); }
private TIPDetailsDto create( TIPtype tipType, String name, String description, String photoUrl, String infoUrl, Geometry geom, Long osmId, boolean reviewed, boolean getAddress, Long facebookUserId) throws TIPLocationException, InvalidTIPUrlException, InstanceNotFoundException { TIP tip = new TIP(); tip.setType(tipType); tip.setName(name); tip.setDescription(description); tip.setGeom(geom); tip.setPhotoUrl(photoUrl); tip.setInfoUrl(infoUrl); tip.setOsmId(osmId); tip.setReviewed(reviewed); tip.setCreationDate(Calendar.getInstance()); tip.setUserAccount(userAccountDao.findByFBUserID(facebookUserId)); if (getAddress) { Coordinate coordinate = tip.getGeom().getCoordinate(); tip.setGoogleMapsUrl(gMapsServiceForUsers.getTIPGoogleMapsUrl(coordinate)); tip.setAddress(getAddress(gMapsServiceForUsers, coordinate)); } City city = cityService.getCityFromLocation(geom); tip.setCity(city); URLvalidator.checkURLs(tip); tipDao.save(tip); return dtoService.TIP2TIPDetailsDto(tip, null); }