@Override public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", id); map.put("name", name); map.put("path", path); map.put("description", description); map.put("type", getType()); map.put("added", added); map.put("playbackPosition", playbackPosition); map.put("skipIndex", getSkipIndex()); map.put("subtitles", MapObjectUtil.listToDbMap(subtitles)); map.put("resources", MapObjectUtil.mapToDbMap(resources)); map.put("watched", watched); map.put("readyToPlay", readyToPlay); return map; }
@Override public void fromMap(Map<String, Object> map) { id = (String) map.get("id"); name = (String) map.get("name"); path = (String) map.get("path"); description = (String) map.get("description"); added = (Date) map.get("added"); playbackPosition = (Double) map.get("playbackPosition"); if (map.get("skipIndex") != null) { skipIndex = (Boolean) map.get("skipIndex"); } subtitles = MapObjectUtil.dbMapToList(map.get("subtitles"), Subtitle.class); resources = MapObjectUtil.dbMapToMap(map.get("resources"), Resource.class); if (map.get("watched") != null) { watched = (Boolean) map.get("watched"); } if (map.get("readyToPlay") != null) { readyToPlay = (Boolean) map.get("readyToPlay"); } }