Search in sources :

Example 1 with PlaylistData

use of com.zype.android.webapi.model.playlist.PlaylistData in project zype-android by zype.

the class DbHelper method playlistDataToEntity.

public static List<Playlist> playlistDataToEntity(List<PlaylistData> playlists) {
    List<Playlist> result = new ArrayList<>(playlists.size());
    for (PlaylistData item : playlists) {
        Playlist playlistEntity = new Playlist();
        playlistEntity.id = item.getId();
        playlistEntity.active = item.active ? 1 : 0;
        playlistEntity.createdAt = item.getCreatedAt();
        playlistEntity.deletedAt = item.getDeletedAt();
        playlistEntity.images = new Gson().toJson(item.getImages());
        playlistEntity.marketplaceIds = new Gson().toJson(item.marketplaceIds);
        playlistEntity.purchasePrice = item.purchasePrice;
        playlistEntity.purchaseRequired = item.purchaseRequired ? 1 : 0;
        playlistEntity.parentId = item.getParentId();
        playlistEntity.playlistItemCount = item.getPlaylistItemCount();
        playlistEntity.priority = item.getPriority();
        playlistEntity.thumbnails = new Gson().toJson(item.getThumbnails());
        playlistEntity.thumbnailLayout = item.getThumbnailLayout();
        playlistEntity.title = item.getTitle();
        playlistEntity.updatedAt = item.getUpdatedAt();
        result.add(playlistEntity);
    }
    return result;
}
Also used : Playlist(com.zype.android.Db.Entity.Playlist) PlaylistData(com.zype.android.webapi.model.playlist.PlaylistData) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson)

Aggregations

Gson (com.google.gson.Gson)1 Playlist (com.zype.android.Db.Entity.Playlist)1 PlaylistData (com.zype.android.webapi.model.playlist.PlaylistData)1 ArrayList (java.util.ArrayList)1