Class ContentDiscovery
- java.lang.Object
-
- aero.panasonic.inflight.services.contentdiscovery.v2.ContentDiscovery
-
public class ContentDiscovery extends java.lang.ObjectPackage Starting Point - The Content Discovery module provides dynamic ways to browse the content metadata and increase the flexibility for searching, filtering and organizing the content libraries. The content is airline specific.
Categories can be retrieved by root content type, such as media or games.
Items can be retrieved by the specific content type, such as media.video.movie, media.video.tvepisode and media.audio.music. In addition, Items can be retrieved by descriptor sets, such as genres, languages, actor, director, ratings or a custom value defined by the airline.
This class includes a series of get methods for the various types of data. Data are passed back inContentDiscovery.Listenercallbacks. If the data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)orContentDiscovery.Listener.onStringDataReceived(List, List, Method, Map)is called.
If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
To limit the responses, applications can specify request-specific filter parameters, such as seat class, by Set methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContentDiscovery.ErrorStandard Error class for Content Discovery.static interfaceContentDiscovery.ListenerInterface is used by client to receive a response from the request.static classContentDiscovery.Method
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSDK_VERSION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgetCategories(java.lang.String contentName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all categories available for specified content name.voidgetContentTypes(java.lang.String contentName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all content types that are available for the specified content name.voidgetFieldValues(java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all field values that are available for the specified field name.voidgetItems(java.lang.String contentType, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all items for specified content_type.voidgetItemsbyCategories(java.lang.String contentType, java.util.List<java.lang.Integer> categoryIds, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves list of all items for multiple categories and grouped by category.voidgetItemsDetail(java.util.List<java.lang.String> contentUris, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves detailed information for Items by list of content URIs.voidgetLanguages(java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves information on languages where metadata translations are available.voidgetTags(java.lang.String contentType, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all tag names for fields indexed by content_type.voidgetTagValues(java.lang.String contentType, java.util.List<java.lang.String> tagNames, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all the distinct values for a specific tag by content_type.static voidinitService(Context context, IInFlightCallback inFlightCallback, InFlight inFlight)This API is the starting point for Content Discovery -- Initializes the service object and returns the object with the IInFlightCallback.voidremove()Clean up CDV2 internal object and singletonsvoidsearchByField(java.util.Map<java.lang.String,java.lang.String> requiredFields, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Searches content by field value.voidsearchByText(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Searches content by free text in the Title, Genre, Year, Artist, Actor and Director fields.voidsetLanguage(java.lang.String languageCode)Sets the ISO 639-3 language code.voidsetSeatClass(java.lang.String seatClass)Sets the seat class, such as first or business.
-
-
-
Method Detail
-
initService
public static void initService(Context context, IInFlightCallback inFlightCallback, InFlight inFlight)This API is the starting point for Content Discovery -- Initializes the service object and returns the object with the IInFlightCallback.- Parameters:
context- Provides access to resources and classes to initialize the object.inFlightCallback- Returns the instance or error message.inFlight- Initializes anInFlightinstance.- Example:
mInFlight = new InFlight(); ContentDiscovery.initService(activity, new IInFlightCallback() { @Override public void onInitServiceComplete(Object o, String s) { Log.i(TAG, "onInitServiceComplete()", "Service initialization complete", Log.params("service", s)); ContentDiscovery cd = (ContentDiscovery) o; cd.setSeatClass(MetadataV1.SeatClass.ALL); cd.setLanguage("eng"); } @Override public void onInitServiceFailed(String s, InFlight.Error error) { Log.e(TAG, "onInitServiceFailed()", "Service initialization failed", Log.params("service", s, "error", error)); } }, mInFlight);
-
setSeatClass
public void setSeatClass(java.lang.String seatClass)
Sets the seat class, such as first or business.
If not specified, SeatClass.All will be used.- Parameters:
seatClass- Only accepts strings provided bySeatClass, such as first, business or all.
-
setLanguage
public void setLanguage(java.lang.String languageCode)
Sets the ISO 639-3 language code. For example, the language code for English is eng and for German is deu.
If not specified, the default language on the passenger's device is used.
If the specified language is not available, the default language for the airline is returned.- Parameters:
languageCode- ISO 639-3 language code.
-
getCategories
public void getCategories(java.lang.String contentName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all categories available for specified content name. Content is returned in the order specified from the Ground.- Parameters:
contentName- Required. Identifies the content. Examples: media, games and ebooks.filter- Optional. Request parameters, such as: category_root, parent_id, tree_depth and image_size_selector.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getItems
public void getItems(java.lang.String contentType, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all items for specified content_type.- Parameters:
contentType- Required. Identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media.*, media.video.*, media.audio.*.filter- Optional. Request parameters, such as: offset, page_size, requested_fields, image_size_selector and image_resolution.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getItemsbyCategories
public void getItemsbyCategories(java.lang.String contentType, java.util.List<java.lang.Integer> categoryIds, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves list of all items for multiple categories and grouped by category.- Parameters:
contentType- Required. Identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media,games,ebook,media.video.*, media.video.movie.categoryIds- Required. List of category IDs for which you want to fetch the items.filter- Optional. Request parameters, such as: offset, page_size, requested_fields, image_size_selector and image_resolution.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getItemsDetail
public void getItemsDetail(java.util.List<java.lang.String> contentUris, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves detailed information for Items by list of content URIs.- Parameters:
contentUris- Required. List of content URIs for which detail is required.filter- Optional. Request parameters, such as: requested_fields, image_size_selector, image_resolution and image_type.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getTags
public void getTags(java.lang.String contentType, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all tag names for fields indexed by content_type. Sample tag list includes genre, rating, year or a custom tag defined by the airline.- Parameters:
contentType- Required. Identifies the content. Comma separated list, where each token supports ending with wildcard, for example, media.*, media.video.* , media.audio.*.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onStringDataReceived(List, List, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getTagValues
public void getTagValues(java.lang.String contentType, java.util.List<java.lang.String> tagNames, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all the distinct values for a specific tag by content_type. For example, the distinct values for the tag_name 'genre'.- Parameters:
contentType- Required, identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media.*, media.video.* , media.audio.*.tagNames- Required. Pre-defined or custom field that can be specific to the airline. This value should come from the "get_tags" API. If more than one custom field is given, use an "OR" between the custom fields.filter- Optional. Request parameters, such as: tag_filter_value, image_size_selector and image_resolution.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getContentTypes
public void getContentTypes(java.lang.String contentName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all content types that are available for the specified content name. For example, the content name 'media' can have content types of audio.album or audio.soundtrack.- Parameters:
contentName- Optional. Identifies the content. If not provided, returns content types for ALL components.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getFieldValues
public void getFieldValues(java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves all field values that are available for the specified field name. For example, the filed name 'genre'- Parameters:
fieldName- Required. Identifies the field.filter- Optional. Request parameters, such as: lang.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
getLanguages
public void getLanguages(java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Retrieves information on languages where metadata translations are available.- Parameters:
listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
searchByField
public void searchByField(java.util.Map<java.lang.String,java.lang.String> requiredFields, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Searches content by field value.- Parameters:
requiredFields- Required. Specify one or multiple fields. Service will perform "AND" operation between multiple fields.filter- Optional. Request parameters, such as: content_type, match_type, offset, page_size and requested_fields.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
searchByText
public void searchByText(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> filter, ContentDiscovery.Listener listener)Searches content by free text in the Title, Genre, Year, Artist, Actor and Director fields.- Parameters:
text- Required. Sets the filter text. This is free text that is searched in the Title, Genre, Year, Artist, Actor and Director fields.filter- Optional. Request parameters, such as: content_type, match_type, offset, page_size and requested_fields.listener- Data is passed back in the form of a listener. If data is retrieved successfully,ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map)is called. If an error occurs,ContentDiscovery.Listener.onError(Error, Method, Map)is called.
-
remove
public void remove()
Clean up CDV2 internal object and singletons
-
-