// Adding relation method.. // This will add a new data to the list relation object.. public void addRelation(RecentItem recentItems) { try { that.getRecentItems().add(recentItems); } catch (Exception e) { DataList<RecentItem> recentItems1 = new DataList(); // Now add this item to list.. recentItems1.add(recentItems); // Now set data.... that.setRecentItems(recentItems1); } }
// Adding relation method.. // This will add a new data to the list relation object.. public void addRelation(Bookmark bookmarks) { try { that.getBookmarks().add(bookmarks); } catch (Exception e) { DataList<Bookmark> bookmarks1 = new DataList(); // Now add this item to list.. bookmarks1.add(bookmarks); // Now set data.... that.setBookmarks(bookmarks1); } }
// Adding related model automatically in case of include statement from server.. Adding 1 for // removing same name error.. public void setRecentItems1(DataList<HashMap<String, Object>> recentItems) { // First create a dummy Repo class object for .. RecentItemRepository recentItemsRepository = new RecentItemRepository(); DataList<RecentItem> result = new DataList<>(); for (HashMap<String, Object> obj : recentItems) { // Also add relation to child type for two way communication.. RecentItem obj1 = recentItemsRepository.createObject(obj); result.add(obj1); } setRecentItems(result); }
// Adding related model automatically in case of include statement from server.. Adding 1 for // removing same name error.. public void setBookmarks1(DataList<HashMap<String, Object>> bookmarks) { // First create a dummy Repo class object for .. BookmarkRepository bookmarksRepository = new BookmarkRepository(); DataList<Bookmark> result = new DataList<>(); for (HashMap<String, Object> obj : bookmarks) { // Also add relation to child type for two way communication.. Bookmark obj1 = bookmarksRepository.createObject(obj); result.add(obj1); } setBookmarks(result); }