FreeRDP
Loading...
Searching...
No Matches
BookmarkDao.java
1/*
2 Bookmark data access object
3
4 Copyright 2026 Ibrahim Sevinc <ibrahim.sevinc.mail@gmail.com>
5
6 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 If a copy of the MPL was not distributed with this file, You can obtain one at
8 http://mozilla.org/MPL/2.0/.
9*/
10
11package com.freerdp.freerdpcore.data;
12
13import androidx.lifecycle.LiveData;
14import androidx.room.Dao;
15import androidx.room.Delete;
16import androidx.room.Insert;
17import androidx.room.OnConflictStrategy;
18import androidx.room.Query;
19import androidx.room.Update;
20
21import java.util.List;
22
23@Dao
24public interface BookmarkDao {
25 @Query("SELECT * FROM bookmarks ORDER BY label COLLATE NOCASE ASC")
26 LiveData<List<BookmarkEntity>> getAllLiveData();
27
28 @Query("SELECT * FROM bookmarks ORDER BY label COLLATE NOCASE ASC")
29 List<BookmarkEntity> getAll();
30
31 @Query("SELECT * FROM bookmarks WHERE id = :id") BookmarkEntity getById(long id);
32
33 @Query("SELECT * FROM bookmarks WHERE label LIKE :query OR hostname LIKE :query "
34 + "ORDER BY label COLLATE NOCASE ASC")
35 List<BookmarkEntity>
36 search(String query);
37
38 @Query("SELECT * FROM bookmarks WHERE label LIKE :query OR hostname LIKE :query "
39 + "ORDER BY label COLLATE NOCASE ASC")
40 LiveData<List<BookmarkEntity>>
41 searchLive(String query);
42
43 @Insert(onConflict = OnConflictStrategy.ABORT) long insert(BookmarkEntity entity);
44
45 @Update void update(BookmarkEntity entity);
46
47 @Delete void delete(BookmarkEntity entity);
48
49 @Query("DELETE FROM bookmarks WHERE id = :id") void deleteById(long id);
50}