2019-12-03 12:59:27 +00:00
|
|
|
package eu.faircode.email;
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file is part of FairEmail.
|
|
|
|
|
|
|
|
FairEmail is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
FairEmail is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2024-01-01 07:50:49 +00:00
|
|
|
Copyright 2018-2024 by Marcel Bokhorst (M66B)
|
2019-12-03 12:59:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
import androidx.lifecycle.LiveData;
|
|
|
|
import androidx.room.Dao;
|
|
|
|
import androidx.room.Insert;
|
|
|
|
import androidx.room.Query;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface DaoCertificate {
|
2019-12-06 09:14:09 +00:00
|
|
|
@Query("SELECT * FROM certificate")
|
|
|
|
List<EntityCertificate> getCertificates();
|
|
|
|
|
2019-12-03 12:59:27 +00:00
|
|
|
@Query("SELECT * FROM certificate" +
|
2020-01-30 13:19:15 +00:00
|
|
|
" ORDER BY intermediate, email, subject")
|
2019-12-06 07:17:19 +00:00
|
|
|
LiveData<List<EntityCertificate>> liveCertificates();
|
2019-12-04 10:54:02 +00:00
|
|
|
|
2022-02-05 18:42:18 +00:00
|
|
|
@Query("SELECT * FROM certificate" +
|
|
|
|
" WHERE id = :id")
|
|
|
|
EntityCertificate getCertificate(long id);
|
|
|
|
|
2019-12-03 12:59:27 +00:00
|
|
|
@Query("SELECT * FROM certificate" +
|
2019-12-04 09:45:53 +00:00
|
|
|
" WHERE fingerprint = :fingerprint" +
|
2019-12-06 07:17:19 +00:00
|
|
|
" AND email = :email COLLATE NOCASE")
|
2019-12-04 09:45:53 +00:00
|
|
|
EntityCertificate getCertificate(String fingerprint, String email);
|
2019-12-03 14:55:52 +00:00
|
|
|
|
|
|
|
@Query("SELECT * FROM certificate" +
|
2019-12-06 07:17:19 +00:00
|
|
|
" WHERE email = :email COLLATE NOCASE")
|
2019-12-03 14:55:52 +00:00
|
|
|
List<EntityCertificate> getCertificateByEmail(String email);
|
2019-12-03 12:59:27 +00:00
|
|
|
|
2020-01-30 13:19:15 +00:00
|
|
|
@Query("SELECT * FROM certificate" +
|
|
|
|
" WHERE intermediate")
|
|
|
|
List<EntityCertificate> getIntermediateCertificate();
|
|
|
|
|
2019-12-03 12:59:27 +00:00
|
|
|
@Insert
|
|
|
|
long insertCertificate(EntityCertificate certificate);
|
2019-12-04 12:10:33 +00:00
|
|
|
|
|
|
|
@Query("DELETE FROM certificate WHERE id = :id")
|
|
|
|
void deleteCertificate(long id);
|
2019-12-03 12:59:27 +00:00
|
|
|
}
|