use of com.j256.ormlite.stmt.QueryBuilder in project krypton-android by kryptco.
the class Approval method isGitTagApprovedNow.
public static synchronized boolean isGitTagApprovedNow(Dao<Approval, Long> db, UUID pairingUUID, Long temporaryApprovalSeconds) throws SQLException {
deleteExpiredApprovals(db, temporaryApprovalSeconds);
QueryBuilder query = db.queryBuilder();
return query.where().eq("pairing_uuid", pairingUUID).and().eq("type", ApprovalType.GIT_TAG_SIGNATURES).countOf() > 0;
}
use of com.j256.ormlite.stmt.QueryBuilder in project krypton-android by kryptco.
the class Approval method isSSHAnyHostApprovedNow.
public static synchronized boolean isSSHAnyHostApprovedNow(Dao<Approval, Long> db, UUID pairingUUID, Long temporaryApprovalSeconds) throws SQLException {
deleteExpiredApprovals(db, temporaryApprovalSeconds);
QueryBuilder query = db.queryBuilder();
return query.where().eq("pairing_uuid", pairingUUID).and().eq("type", ApprovalType.SSH_ANY_HOST).countOf() > 0;
}
use of com.j256.ormlite.stmt.QueryBuilder in project ETSMobile-Android2 by ApplETS.
the class BottinFragment method updateUI.
@SuppressWarnings({ "rawtypes", "unchecked" })
void updateUI() {
AppCompatActivity activity = (AppCompatActivity) getActivity();
try {
DatabaseHelper dbHelper = new DatabaseHelper(activity);
// Création du queryBuilder, permettant de lister les employés par leur nom de service
QueryBuilder<FicheEmploye, String> queryBuilder = (QueryBuilder<FicheEmploye, String>) dbHelper.getDao(FicheEmploye.class).queryBuilder();
queryBuilder.orderBy("Service", true);
PreparedQuery<FicheEmploye> preparedQuery = queryBuilder.prepare();
List<FicheEmploye> listEmployes = dbHelper.getDao(FicheEmploye.class).query(preparedQuery);
// Si le contenu n'est pas vide, l'ajouter au listDataHeader et listDataChild
if (listEmployes.size() > 0) {
String nomService = "";
String previousNomService = "";
listDataHeader.clear();
ArrayList<FicheEmploye> listEmployesOfService = new ArrayList<>();
// Pour le premier élément dans la liste
FicheEmploye employe = listEmployes.get(0);
nomService = employe.Service;
listDataHeader.add(nomService);
listEmployesOfService.add(employe);
previousNomService = nomService;
// Pour les prochains éléments dans la liste
for (int i = 1; i < listEmployes.size(); i++) {
employe = listEmployes.get(i);
nomService = employe.Service;
if (!listDataHeader.contains(nomService)) {
listDataHeader.add(nomService);
Collections.sort(listEmployesOfService, new Comparator<FicheEmploye>() {
@Override
public int compare(FicheEmploye f1, FicheEmploye f2) {
return f1.Nom.compareTo(f2.Nom);
}
});
listDataChild.put(previousNomService, listEmployesOfService);
listEmployesOfService = new ArrayList<>();
previousNomService = nomService;
}
listEmployesOfService.add(employe);
}
// Pour les derniers éléments dans la liste
listDataChild.put(previousNomService, listEmployesOfService);
if (activity != null) {
activity.runOnUiThread(new Runnable() {
public void run() {
listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
expListView.setAdapter(listAdapter);
listAdapter.notifyDataSetChanged();
}
});
}
// Rétablissement du filtre de recherche
CharSequence searchText = searchView.getQuery();
if (searchText.length() != 0)
onQueryTextChange(searchText.toString());
// Si le contenu est vide, télécharger le bottin
} else {
// Le contenu est vide.
afficherRafraichissementEtRechargerBottin();
}
} catch (Exception e) {
Log.e("BD FicheEmploye", "" + e.getMessage());
}
}
use of com.j256.ormlite.stmt.QueryBuilder in project krypton-android by kryptco.
the class Approval method isGitCommitApprovedNow.
public static synchronized boolean isGitCommitApprovedNow(Dao<Approval, Long> db, UUID pairingUUID, Long temporaryApprovalSeconds) throws SQLException {
deleteExpiredApprovals(db, temporaryApprovalSeconds);
QueryBuilder query = db.queryBuilder();
return query.where().eq("pairing_uuid", pairingUUID).and().eq("type", ApprovalType.GIT_COMMIT_SIGNATURES).countOf() > 0;
}
use of com.j256.ormlite.stmt.QueryBuilder in project krypton-android by kryptco.
the class Approval method isReadTeamDataApproved.
public static synchronized boolean isReadTeamDataApproved(Dao<Approval, Long> db, UUID pairingUUID, Long temporaryApprovalSeconds) throws SQLException {
deleteExpiredApprovals(db, temporaryApprovalSeconds);
QueryBuilder query = db.queryBuilder();
return query.where().eq("pairing_uuid", pairingUUID).and().eq("type", ApprovalType.READ_TEAM_DATA).countOf() > 0;
}
Aggregations