public void addBrandSummary(SimpleModel model, BrandSummary brand) { if (brand != null) { SimpleModel brandModel = new SimpleModel(); brandModel.put("title", brand.getTitle()); brandModel.put("curie", brand.getCurie()); brandModel.put("uri", brand.getUri()); model.put("brand", brandModel); } }
public SimpleModel build(Item item) { SimpleModel model = new SimpleModel(); BrandSummary brand = item.getBrandSummary(); model.put("uri", item.getUri()); model.put("thumbnail", item.getThumbnail()); if (item.getImage() != null) { model.put("image", item.getImage()); } else if (item.getThumbnail() != null) { model.put("image", item.getThumbnail()); } model.put("description", truncator.truncatePossibleNull(item.getDescription())); model.put("curie", item.getCurie()); model.put("externalUrl", item.getUri()); model.put("seriesNumber", item.getSeriesNumber()); model.put("episodeNumber", item.getEpisodeNumber()); addPublisher(model, item); addTitles(model, item, brand); addBrandSummary(model, brand); modelHelper.addGenres(model, item); modelHelper.addChannel(model, item); return model; }
public void addTitles(SimpleModel model, Item item, BrandSummary list) { if (list == null || list.getTitle() == null) { model.put("primaryTitle", item.getTitle()); } else { model.put("primaryTitle", list.getTitle()); model.put("secondaryTitle", item.getTitle()); } model.put("title", item.getTitle()); model.put("titleTruncated", titleTruncator.truncatePossibleNull(item.getTitle())); Matcher seriesAndEpisodeMatcher = seriesAndEpisodeTitlePattern.matcher(item.getTitle()); Matcher episodeMatcher = episodeTitlePattern.matcher(item.getTitle()); model.put( "titleIsEpisodeNumber", seriesAndEpisodeMatcher.matches() || episodeMatcher.matches()); }
public void addPublisher(SimpleModel model, Item item) { SimpleModel publisherModel = new SimpleModel(); publisherModel.put("uri", item.getPublisher().getKey()); publisherModel.put("name", item.getPublisher().getName()); model.put("publisher", publisherModel); }