use of org.atlasapi.content.v2.model.udt.Description in project atlas-deer by atlasapi.
the class DescriptionSerialization method serialize.
public Description serialize(org.atlasapi.content.Description description) {
if (description == null) {
return null;
}
Description internal = new Description();
internal.setTitle(description.getTitle());
internal.setImage(description.getImage());
internal.setSynopsis(description.getSynopsis());
internal.setThumbnail(description.getThumbnail());
return internal;
}
use of org.atlasapi.content.v2.model.udt.Description in project atlas-deer by atlasapi.
the class ItemSummarySerialization method serialize.
public ItemSummary serialize(org.atlasapi.content.ItemSummary itemSummary) {
ItemSummary internal = new ItemSummary();
internal.setType("item");
internal.setTitle(itemSummary.getTitle());
Optional<String> description = itemSummary.getDescription();
if (description.isPresent()) {
internal.setDescription(description.get());
}
Optional<String> image = itemSummary.getImage();
if (image.isPresent()) {
internal.setImage(image.get());
}
Optional<Integer> releaseYear = itemSummary.getReleaseYear();
if (releaseYear.isPresent()) {
internal.setReleaseYear(releaseYear.get());
}
Optional<ImmutableSet<Certificate>> certificates = itemSummary.getCertificates();
if (certificates.isPresent()) {
internal.setCertificate(certificates.get().stream().map(certificate::serialize).filter(Objects::nonNull).collect(Collectors.toSet()));
}
if (itemSummary instanceof EpisodeSummary) {
internal.setType("episode");
internal.setEpisodeNumber(((EpisodeSummary) itemSummary).getEpisodeNumber().orElse(null));
}
return internal;
}
Aggregations