private Optional<String> fetchTeamName(SportsTeamData teamData, OptaSportType sportType) { String teamId = teamData.attributes().teamRef(); Optional<Organisation> team = getTeamByUri(utility.createTeamUri(sportType, teamId)); if (!team.isPresent()) { log.error("team {} not present in teams list", teamId); return Optional.absent(); } return Optional.of(team.get().getTitle()); }
@Override public Optional<Organisation> parseOrganisation(SportsTeam team, OptaSportType sport) { Organisation organisation = new Organisation(); organisation.setCanonicalUri(utility.createTeamUri(sport, team.attributes().uId())); organisation.setPublisher(Publisher.OPTA); organisation.setTitle(team.name()); return Optional.of(organisation); }