Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.induct.yle.api.programs.domain.items.TvProgram Maven / Gradle / Ivy
Go to download
Uploads all artifacts belonging to configuration ':archives'
package io.induct.yle.api.programs.domain.items;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import io.induct.domain.Entity;
import io.induct.yle.api.YleId;
import io.induct.yle.api.common.Language;
import io.induct.yle.api.programs.domain.Item;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.joda.time.DateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @since 2015-05-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class TvProgram extends Item {
private final Map descriptions;
private final Video video;
private final String typeMedia;
private final List creators;
private final int episodeNumber;
private final Map promotionTitles;
private final DateTime indexDataModified;
private final Season season;
private final Series series;
private final List alternativeIds;
private final String duration; // TODO: looks like custom format, objectify
private final String productionId;
private final ContentRating contentRating;
private final Map titles;
//private final Map itemTitles;
private final List countryOfOrigin;
private final String typeCreative;
private final Image image;
private final List audio;
private final Map originalTitles;
private final List publicationEvents;
private final String collection;
private final List subject;
private final List subtitling;
@JsonCreator
public TvProgram(@JsonProperty("id") YleId identity,
@JsonProperty("description") Map descriptions,
@JsonProperty("creator") List creators,
@JsonProperty("partOfSeason") Season season,
@JsonProperty("partOfSeries") Series series,
@JsonProperty("video") Video video,
@JsonProperty("typeMedia") String typeMedia,
@JsonProperty("episodeNumber") int episodeNumber,
@JsonProperty("promotionTitle") Map promotionTitles,
@JsonProperty("indexDataModified") DateTime indexDataModified,
@JsonProperty("alternativeId") List alternativeIds,
@JsonProperty("duration") String duration,
@JsonProperty("productionId") String productionId,
@JsonProperty("contentRating") ContentRating contentRating,
@JsonProperty("title") Map title,
//@JsonProperty("itemTitle") Map itemTitles, TODO: content currently unknown
@JsonProperty("countryOfOrigin") List countryOfOrigin,
@JsonProperty("typeCreative") String typeCreative,
@JsonProperty("image") Image image,
@JsonProperty("audio") List audio,
@JsonProperty("originalTitle") Map originalTitles,
@JsonProperty("publicationEvent") List publicationEvents,
@JsonProperty("collection") String collection,
@JsonProperty("subject") List subject,
@JsonProperty("subtitling") List subtitling) {
super(identity);
this.season = season;
this.series = series;
this.alternativeIds = alternativeIds;
this.descriptions = descriptions;
this.creators = creators;
this.video = video;
this.typeMedia = typeMedia;
this.episodeNumber = episodeNumber;
this.promotionTitles = promotionTitles;
this.indexDataModified = indexDataModified;
this.duration = duration;
this.productionId = productionId;
this.contentRating = contentRating;
this.titles = title;
//this.itemTitles = itemTitles;
this.countryOfOrigin = countryOfOrigin;
this.typeCreative = typeCreative;
this.image = image;
this.audio = audio;
this.originalTitles = originalTitles;
this.publicationEvents = publicationEvents;
this.collection = collection;
this.subject = subject;
this.subtitling = subtitling;
}
public String getTitle(Language language) {
return titles.get(language);
}
public String getDescription(Language language) {
return descriptions.get(language);
}
/**
* @since 2015-08-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class Season extends Entity {
private final Map description;
private final int number;
private final List creators;
private final YleId series;
private final DateTime indexDataModified;
private final Map title;
private final List countryOfOrigin;
private final List subjects;
@JsonCreator
public Season(@JsonProperty("description") Map description,
@JsonProperty("seasonNumber") int number,
@JsonProperty("creator") List creators,
@JsonProperty("partOfSeries") Map series,
@JsonProperty("indexDataModified") DateTime indexDataModified,
@JsonProperty("title") Map title,
@JsonProperty("countryOfOrigin") List countryOfOrigin,
@JsonProperty("id") YleId id,
@JsonProperty("subject") List subjects) {
super(id, YleId.UNIDENTIFIED);
this.description = description;
this.number = number;
this.creators = creators;
this.series = series.get("id"); // TODO: hack to get around this serialization issue
this.indexDataModified = indexDataModified;
this.title = title;
this.countryOfOrigin = countryOfOrigin;
this.subjects = subjects;
}
}
/**
* @since 2015-08-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class Series extends Entity {
private final Map descriptions;
private final List creators;
private final DateTime indexDataModified;
private final Map titles;
private final Image coverImage;
private final List seasons;
private final List countryOfOrigin;
private final List subjects;
@JsonCreator
public Series(
@JsonProperty("id") YleId id,
@JsonProperty("description") Map descriptions,
@JsonProperty("creator") List creators,
@JsonProperty("indexDataModified") DateTime indexDataModified,
@JsonProperty("title") Map titles,
@JsonProperty("coverImage") Image coverImage,
@JsonProperty("season") List seasons,
@JsonProperty("countryOfOrigin") List countryOfOrigin,
@JsonProperty("subject") List subjects) {
super(id, YleId.UNIDENTIFIED);
this.descriptions = descriptions;
this.creators = creators;
this.indexDataModified = indexDataModified;
this.titles = titles;
this.coverImage = coverImage;
this.seasons = seasons;
this.countryOfOrigin = countryOfOrigin;
this.subjects = subjects;
}
}
/**
* @since 2015-08-04
*/
@Data
public static class Creator {
private final String name;
private final String type;
@JsonCreator
public Creator(@JsonProperty("name") String name,
@JsonProperty("type") String type) {
this.name = name;
this.type = type;
}
}
/**
* @since 2015-08-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class Subject extends Entity {
private final Map titles;
private final Optional> broader;
private final String inScheme;
private final String type;
private final Optional key;
private final Optional> notations;
@JsonCreator
public Subject(@JsonProperty("id") YleId id,
@JsonProperty("title") Map titles,
@JsonProperty("broader") Optional> broader,
@JsonProperty("inScheme") String inScheme,
@JsonProperty("type") String type,
@JsonProperty("key") Optional key,
@JsonProperty("notation") Optional> notations) {
super(id, YleId.UNIDENTIFIED);
this.titles = titles;
this.broader = broader.isPresent() ? Optional.of(Sets.newHashSet(broader.get().values())) : Optional.absent(); // TODO: this is a bit of a hack around the "broader" concept as I don't fully know what its contents should be
this.inScheme = inScheme;
this.type = type;
this.key = key;
this.notations = notations;
}
@Data
public static class Notation {
private final String value;
private final String valueType;
@JsonCreator
public Notation(@JsonProperty("value") String value,
@JsonProperty("valueType") String valueType) {
this.value = value;
this.valueType = valueType;
}
}
}
/**
* @since 2015-08-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class PublicationEvent extends Entity {
private final Service service;
private final Optional> publishers;
private final DateTime startTime;
private final String temporalStatus;
private final DateTime endTime;
private final String type;
private final String duration;
private final String region;
private final YleId id;
private final Optional media;
@JsonCreator
public PublicationEvent(@JsonProperty("service") Service service,
@JsonProperty("publisher") Optional> publishers,
@JsonProperty("startTime") DateTime startTime,
@JsonProperty("temporalStatus") String temporalStatus,
@JsonProperty("endTime") DateTime endTime,
@JsonProperty("type") String type,
@JsonProperty("duration") String duration,
@JsonProperty("region") String region,
@JsonProperty("id") YleId id,
@JsonProperty("media") Optional media) {
super(id, YleId.UNIDENTIFIED);
this.service = service;
this.publishers = publishers;
this.startTime = startTime;
this.temporalStatus = temporalStatus;
this.endTime = endTime;
this.type = type;
this.duration = duration;
this.region = region;
this.id = id;
this.media = media;
}
@Data
public static class Service {
private final String id;
@JsonCreator
public Service(@JsonProperty("id") String id) {
this.id = id;
}
}
@Data
public static class Publisher {
private final String id;
@JsonCreator
public Publisher(@JsonProperty("id") String id) {
this.id = id;
}
public String getId() {
return id;
}
}
@Data
@EqualsAndHashCode(callSuper = true)
public static class Media extends Entity {
private final String duration;
private final List contentProtection;
@JsonCreator
public Media(@JsonProperty("id") YleId id,
@JsonProperty("duration") String duration,
@JsonProperty("contentProtection") List contentProtection) {
super(id, YleId.UNIDENTIFIED);
this.duration = duration;
this.contentProtection = contentProtection;
}
@Data
@EqualsAndHashCode(callSuper = true)
public static class ContentProtection extends Entity {
private final String type;
@JsonCreator
public ContentProtection(@JsonProperty("id") YleId id,
@JsonProperty("type") String type) {
super(id, YleId.UNIDENTIFIED);
this.type = type;
}
}
}
}
/**
* @since 2015-08-04
*/
@Data
public static class Subtitling {
private final List languages;
private final String type;
@JsonCreator
public Subtitling(@JsonProperty("language") List languages,
@JsonProperty("type") String type) {
this.languages = languages;
this.type = type;
}
}
/**
* @since 2015-08-04
*/
@Data
public static class ContentRating {
private final Map titles;
private final int ageRestriction;
private final List reasons;
@JsonCreator
public ContentRating(@JsonProperty("title") Map titles,
@JsonProperty("ageRestriction") int ageRestriction,
@JsonProperty("reason") List reasons) {
this.titles = titles;
this.ageRestriction = ageRestriction;
this.reasons = reasons;
}
@Data
public static class Reason {
private final Map titles;
private final String type;
private final String key;
@JsonCreator
public Reason(@JsonProperty("title") Map titles,
@JsonProperty("type") String type,
@JsonProperty("key") String key) {
this.titles = titles;
this.type = type;
this.key = key;
}
}
}
/**
* @since 2015-08-04
*/
@Data
public static class Video {
private final List formats;
private final String type;
@JsonCreator
public Video(@JsonProperty("format") List formats,
@JsonProperty("type") String type) {
this.formats = formats;
this.type = type;
}
@Data
public static class Format {
private final String inScheme;
private final String type;
private final String key;
@JsonCreator
public Format(@JsonProperty("inScheme") String inScheme,
@JsonProperty("type") String type,
@JsonProperty("key") String key) {
this.inScheme = inScheme;
this.type = type;
this.key = key;
}
}
}
/**
* @since 2015-08-04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class Image extends Entity {
private final boolean available;
private final String type;
@JsonCreator
public Image(@JsonProperty("id") YleId id,
@JsonProperty("available") boolean available,
@JsonProperty("type") String type) {
super(id, YleId.UNIDENTIFIED);
this.available = available;
this.type = type;
}
}
}