Files
FairEmail/app/src/main/java/eu/faircode/email/DaoCertificate.java

57 lines
1.8 KiB
Java
Raw Normal View History

2019-12-03 13:59:27 +01: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/>.
2020-01-05 18:32:53 +01:00
Copyright 2018-2020 by Marcel Bokhorst (M66B)
2019-12-03 13:59:27 +01: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 10:14:09 +01:00
@Query("SELECT * FROM certificate")
List<EntityCertificate> getCertificates();
2019-12-03 13:59:27 +01:00
@Query("SELECT * FROM certificate" +
2020-01-30 14:19:15 +01:00
" ORDER BY intermediate, email, subject")
2019-12-06 08:17:19 +01:00
LiveData<List<EntityCertificate>> liveCertificates();
2019-12-04 11:54:02 +01:00
2019-12-03 13:59:27 +01:00
@Query("SELECT * FROM certificate" +
2019-12-04 10:45:53 +01:00
" WHERE fingerprint = :fingerprint" +
2019-12-06 08:17:19 +01:00
" AND email = :email COLLATE NOCASE")
2019-12-04 10:45:53 +01:00
EntityCertificate getCertificate(String fingerprint, String email);
2019-12-03 15:55:52 +01:00
@Query("SELECT * FROM certificate" +
2019-12-06 08:17:19 +01:00
" WHERE email = :email COLLATE NOCASE")
2019-12-03 15:55:52 +01:00
List<EntityCertificate> getCertificateByEmail(String email);
2019-12-03 13:59:27 +01:00
2020-01-30 14:19:15 +01:00
@Query("SELECT * FROM certificate" +
" WHERE intermediate")
List<EntityCertificate> getIntermediateCertificate();
2019-12-03 13:59:27 +01:00
@Insert
long insertCertificate(EntityCertificate certificate);
2019-12-04 13:10:33 +01:00
@Query("DELETE FROM certificate WHERE id = :id")
void deleteCertificate(long id);
2019-12-03 13:59:27 +01:00
}