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

72 lines
2.3 KiB
Java
Raw Normal View History

2018-08-02 13:33:06 +00:00
package eu.faircode.email;
/*
2018-08-14 05:53:24 +00:00
This file is part of FairEmail.
2018-08-02 13:33:06 +00:00
2018-08-14 05:53:24 +00:00
FairEmail is free software: you can redistribute it and/or modify
2018-08-02 13:33:06 +00:00
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.
NetGuard 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 NetGuard. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018 by Marcel Bokhorst (M66B)
*/
import java.util.List;
2018-08-08 06:55:47 +00:00
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
2018-08-02 13:33:06 +00:00
@Dao
public interface DaoIdentity {
2018-08-08 10:22:12 +00:00
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
" JOIN account ON account.id = identity.account")
LiveData<List<TupleIdentityEx>> liveIdentities();
2018-08-02 13:33:06 +00:00
@Query("SELECT identity.* FROM identity" +
" JOIN account ON account.id = identity.account" +
" WHERE account.synchronize = :synchronize" +
" AND identity.synchronize = :synchronize")
2018-08-02 13:33:06 +00:00
LiveData<List<EntityIdentity>> liveIdentities(boolean synchronize);
2018-08-14 17:41:21 +00:00
@Query("SELECT * FROM identity")
List<EntityIdentity> getIdentities();
2018-08-02 13:33:06 +00:00
@Query("SELECT * FROM identity WHERE id = :id")
EntityIdentity getIdentity(long id);
@Query("SELECT * FROM identity WHERE id = :id")
LiveData<EntityIdentity> liveIdentity(long id);
2018-08-12 08:16:41 +00:00
@Insert
2018-08-02 13:33:06 +00:00
long insertIdentity(EntityIdentity identity);
@Update
void updateIdentity(EntityIdentity identity);
2018-08-15 11:26:59 +00:00
@Query("UPDATE identity SET state = :state WHERE id = :id")
int setIdentityState(long id, String state);
2018-08-27 16:19:56 +00:00
@Query("UPDATE identity SET password = :password WHERE id = :id")
int setIdentityPassword(long id, String password);
2018-08-15 11:26:59 +00:00
@Query("UPDATE identity SET error = :error WHERE id = :id")
int setIdentityError(long id, String error);
2018-08-02 13:33:06 +00:00
@Query("UPDATE identity SET `primary` = 0")
void resetPrimary();
2018-08-07 19:35:21 +00:00
@Query("DELETE FROM identity WHERE id = :id")
void deleteIdentity(long id);
2018-08-02 13:33:06 +00:00
}