/** * @param singleVoteE is an single vote entity * @return the url of the single vote resource */ public static String genUrl(AggregatedVoteE aggregatedVote) { String url = CVSrvContext.getInstance().getValuationServerUrlBase() + CVSrvContext.VOTE_BASE_URL_PREFIX + CVSrvContext.AGGREGATED_VOTE_URL_PREFIX + String.valueOf(aggregatedVote.getAggregatorEvaluation().getId()) + "/" + String.valueOf(aggregatedVote.getId()); return url; }
/** * @param voteEList * @return */ public static Votes aggregatedVoteEntitiesToVotes(List<AggregatedVoteE> voteEList) { if (voteEList == null) { log.error("Mapping request FOR null object"); return null; } Votes votes = new Votes(); for (AggregatedVoteE aggregatedVoteE : voteEList) { Votes.VoteEntry voteEntry = new Votes.VoteEntry(); voteEntry.setVoteId(String.valueOf(aggregatedVoteE.getId())); voteEntry.setVoteUrl(genUrl(aggregatedVoteE)); votes.getVoteEntry().add(voteEntry); } return votes; }