method2testcases
stringlengths
118
3.08k
### Question: SettingsRepository extends DrishtiRepository { public static void onUpgrade(SQLiteDatabase database) { database.execSQL(ADD_SETTINGS_VERSION); database.execSQL(ADD_SETTINGS_TYPE); database.execSQL(ADD_SETTINGS_SYNC_STATUS); } static void onUpgrade(SQLiteDatabase database); void updateSetting(String key, ...
### Question: SettingsRepository extends DrishtiRepository { public byte[] queryBLOB(String key) { byte[] value = null; Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.query(SETTINGS_TABLE_NAME, new String[]{SETTINGS_VALUE_COLUMN}, SETTINGS_KEY_COLUMN + " ...
### Question: SettingsRepository extends DrishtiRepository { public void updateSetting(String key, String value) { ContentValues values = new ContentValues(); values.put(SETTINGS_KEY_COLUMN, key); values.put(SETTINGS_VALUE_COLUMN, value); replace(values); } static void onUpgrade(SQLiteDatabase database); void updateSe...
### Question: SettingsRepository extends DrishtiRepository { protected Setting queryCore(Cursor cursor) { Setting value = new Setting(); value.setKey(cursor.getString(cursor.getColumnIndex(SETTINGS_KEY_COLUMN))); value.setValue(cursor.getString(cursor.getColumnIndex(SETTINGS_VALUE_COLUMN))); value.setType(cursor.getStr...
### Question: ChildRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(CHILD_SQL); } void add(Child child); void update(Child child); List<Child> all(); Child find(String caseId); List<Child> findChildrenByCaseIds(String... caseIds); void updateDetails(S...
### Question: ChildRepository extends DrishtiRepository { public void add(Child child) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(CHILD_TABLE_NAME, null, createValuesFor(child)); } void add(Child child); void update(Child child); List<Child> all(); Child find(String caseId); Li...
### Question: ChildRepository extends DrishtiRepository { public void update(Child child) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(CHILD_TABLE_NAME, createValuesFor(child), ID_COLUMN + " = ?", new String[]{child.caseId()}); } void add(Child child); void update(Child child); L...
### Question: ChildRepository extends DrishtiRepository { public List<Child> all() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database .query(CHILD_TABLE_NAME, CHILD_TABLE_COLUMNS, IS_CLOSED_COLUMN + " = ?", new String[]{NOT_CLOSED}, null, null, null, null); return readAll(curso...
### Question: ChildRepository extends DrishtiRepository { public List<Child> findChildrenByCaseIds(String... caseIds) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery( String.format("SELECT * FROM %s WHERE %s IN (%s)", CHILD_TABLE_NAME, ID_COLUMN, insertPlaceholdersF...
### Question: ChildRepository extends DrishtiRepository { public void delete(String childId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.delete(CHILD_TABLE_NAME, ID_COLUMN + "= ?", new String[]{childId}); } void add(Child child); void update(Child child); List<Child> all(); Child find(...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findClientById(String id) { Client client = fetchClientByBaseEntityId(id); return Collections.singletonList(ClientConverter.convertClientToPatientResource(client)); } @Override List<Patient> findClientById(S...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findFamilyByJurisdiction(String jurisdiction) { return fetchClients(String.format("select %s from %s where %s =? and %s =?", client_column.json, clientTable.name(), client_column.locationId, client_column.cli...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findFamilyByResidence(String structureId) { return fetchClients(String.format("select %s from %s where %s =? and %s =?", client_column.json, clientTable.name(), client_column.residence, client_column.clientTy...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findFamilyMemberyByJurisdiction(String jurisdiction) { return fetchClients(String.format("select %s from %s where %s =? and (%s is null or %s !=? )", client_column.json, clientTable.name(), client_column.loca...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findFamilyMemberByResidence(String structureId) { return fetchClients(String.format("select %s from %s where %s =? and (%s is null or %s !=? )", client_column.json, clientTable.name(), client_column.residence...
### Question: ClientDaoImpl extends EventClientRepository implements ClientDao { @Override public List<Patient> findClientByRelationship(String relationship, String id) { return CoreLibrary.getInstance().context().getClientRelationshipRepository().findClientByRelationship(relationship, id) .stream() .map(ClientConverte...
### Question: EventDaoImpl extends EventClientRepository implements EventDao { @Override public List<QuestionnaireResponse> findEventsByEntityIdAndPlan(String resourceId, String planIdentifier) { return fetchEvents(String.format("select %s from %s where %s =? and (%s is null or %s =? )", event_column.json, eventTable.n...
### Question: FormDataRepository extends DrishtiRepository { @JavascriptInterface public String queryUniqueResult(String sql, String[] selectionArgs) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery(sql, selectionArgs); cursor.moveToFirst(); Map<String, String> resul...
### Question: FormDataRepository extends DrishtiRepository { @JavascriptInterface public String queryList(String sql, String[] selectionArgs) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.rawQuery(sql, selectionArgs); List<Map<String, String>> results = new ArrayList<Map<S...
### Question: FormDataRepository extends DrishtiRepository { public FormSubmission fetchFromSubmission(String instanceId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_SUBMISSION_TABLE_NAME, FORM_SUBMISSION_TABLE_COLUMNS, INSTANCE_ID_COLUMN + " = ?", new String[...
### Question: FormDataRepository extends DrishtiRepository { public List<FormSubmission> getPendingFormSubmissions() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_SUBMISSION_TABLE_NAME, FORM_SUBMISSION_TABLE_COLUMNS, SYNC_STATUS_COLUMN + " = ?", new String[]{PEN...
### Question: FormDataRepository extends DrishtiRepository { public boolean submissionExists(String instanceId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_SUBMISSION_TABLE_NAME, new String[]{INSTANCE_ID_COLUMN}, INSTANCE_ID_COLUMN + " = ?", new String[]{insta...
### Question: FormDataRepository extends DrishtiRepository { @JavascriptInterface public String saveEntity(String entityType, String fields) { SQLiteDatabase database = masterRepository.getWritableDatabase(); Map<String, String> updatedFieldsMap = new Gson() .fromJson(fields, new TypeToken<Map<String, String>>() { }.ge...
### Question: FormDataRepository extends DrishtiRepository { public Map<String, String> getMapFromSQLQuery(String sql, String[] selectionArgs) { Map<String, String> map = new HashMap<String, String>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQue...
### Question: FormDataRepository extends DrishtiRepository { public void updateServerVersion(String instanceId, String serverVersion) { SQLiteDatabase database = masterRepository.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(SERVER_VERSION_COLUMN, serverVersion); database.update(FORM_SUB...
### Question: FormDataRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(FORM_SUBMISSION_SQL); } FormDataRepository(); void addTableColumnMap(String key, String[] val); @JavascriptInterface String queryUniqueResult(String sql, String[] selectionArgs); @J...
### Question: P2PReceiverTransferDao extends BaseP2PTransferDao implements ReceiverTransferDao { @Override public TreeSet<DataType> getDataTypes() { return (TreeSet<DataType>) dataTypes.clone(); } @Override TreeSet<DataType> getDataTypes(); @VisibleForTesting P2PClassifier<JSONObject> getP2PClassifier(); @Override lon...
### Question: P2PReceiverTransferDao extends BaseP2PTransferDao implements ReceiverTransferDao { @VisibleForTesting public P2PClassifier<JSONObject> getP2PClassifier() { return DrishtiApplication.getInstance().getP2PClassifier(); } @Override TreeSet<DataType> getDataTypes(); @VisibleForTesting P2PClassifier<JSONObject...
### Question: AllEligibleCouples { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); eligibleCoupleRepository.close(entityId); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepositor...
### Question: AllEligibleCouples { public EligibleCouple findByCaseID(String caseId) { return eligibleCoupleRepository.findByCaseID(caseId); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<Eligibl...
### Question: AllEligibleCouples { public List<EligibleCouple> findByCaseIDs(List<String> caseIds) { return eligibleCoupleRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEv...
### Question: AllEligibleCouples { public void updatePhotoPath(String caseId, String imagePath) { eligibleCoupleRepository.updatePhotoPath(caseId, imagePath); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventReposit...
### Question: AllEligibleCouples { public void mergeDetails(String entityId, Map<String, String> details) { eligibleCoupleRepository.mergeDetails(entityId, details); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEvent...
### Question: AllEligibleCouples { public long count() { return eligibleCoupleRepository.count(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCaseID...
### Question: AllEligibleCouples { public long fpCount() { return eligibleCoupleRepository.fpCount(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCouple findByCa...
### Question: AllEligibleCouples { public List<String> villages() { return eligibleCoupleRepository.villages(); } AllEligibleCouples(EligibleCoupleRepository eligibleCoupleRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<EligibleCouple> all(); EligibleCoupl...
### Question: MotherRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(MOTHER_SQL); database.execSQL(MOTHER_TYPE_INDEX_SQL); database.execSQL(MOTHER_REFERENCE_DATE_INDEX_SQL); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allA...
### Question: MotherRepository extends DrishtiRepository { public void add(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(MOTHER_TABLE_NAME, null, createValuesFor(mother, TYPE_ANC)); } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); ...
### Question: MotherRepository extends DrishtiRepository { public void update(Mother mother) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.update(MOTHER_TABLE_NAME, createValuesFor(mother, TYPE_ANC), ID_COLUMN + " = ?", new String[]{mother.caseId()}); } void add(Mother mother); void swit...
### Question: MotherRepository extends DrishtiRepository { public void closeAllCasesForEC(String ecCaseId) { List<Mother> mothers = findAllCasesForEC(ecCaseId); for (Mother mother : mothers) { close(mother.caseId()); } } void add(Mother mother); void switchToPNC(String caseId); List<Mother> allANCs(); Mother findById(...
### Question: LocationRepository extends BaseRepository { public List<Location> getAllLocations() { Cursor cursor = null; List<Location> locations = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName(), null); while (cursor.moveToNext()) { locations.add(readCursor(c...
### Question: LocationRepository extends BaseRepository { public List<Location> getLocationsByParentId(String parentId) { return getLocationsByParentId(parentId, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> l...
### Question: LocationRepository extends BaseRepository { public Location getLocationById(String id) { return getLocationById(id, getLocationTableName()); } static void createTable(SQLiteDatabase database); void addOrUpdate(Location location); void deleteLocations(@NonNull Set<String> locationIdentifiers); List<Locati...
### Question: LocationRepository extends BaseRepository { public Location getLocationByName(String name) { Cursor cursor = null; try { cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getLocationTableName() + " WHERE " + NAME + " =?", new String[]{name}); if (cursor.moveToFirst()) { return readCursor(cursor);...
### Question: LocationRepository extends BaseRepository { public List<Location> getLocationsByTagName(String tagName) { LocationTagRepository locationTagRepository = new LocationTagRepository(); List<LocationTag> locationTags = locationTagRepository.getLocationTagsByTagName(tagName); List<String> locationIds = location...
### Question: ManifestRepository extends BaseRepository { public List<Manifest> getAllManifests() { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " ORDER BY " + CREATED_AT + " DESC ", null)) { while (cursor.moveToNext()) { m...
### Question: ManifestRepository extends BaseRepository { public List<Manifest> getManifestByAppVersion(String appVersion) { List<Manifest> manifests = new ArrayList<>(); try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + APP_VERSION + " =?", new String[]{appVers...
### Question: ManifestRepository extends BaseRepository { public Manifest getActiveManifest() { try (Cursor cursor = getReadableDatabase().rawQuery("SELECT * FROM " + getManifestTableName() + " WHERE " + ACTIVE + " =?", new String[]{"1"})) { if (cursor.moveToFirst()) { return readCursor(cursor); } } catch (Exception e)...
### Question: Hia2ReportRepository extends BaseRepository { public List<JSONObject> getUnSyncedReports(int limit) { List<JSONObject> reports = new ArrayList<JSONObject>(); String query = "select " + report_column.json + "," + report_column.syncStatus + " from " + Table.hia2_report.name() + " where " + report_column.syn...
### Question: Hia2ReportRepository extends BaseRepository { public List<String> getUnValidatedReportFormSubmissionIds(int limit) { List<String> ids = new ArrayList<String>(); final String validateFilter = " where " + report_column.syncStatus + " = ? " + " AND ( " + report_column.validationStatus + " is NULL or " + repo...
### Question: Hia2ReportRepository extends BaseRepository { public void markReportsAsSynced(List<JSONObject> syncedReports) { try { if (syncedReports != null && !syncedReports.isEmpty()) { for (JSONObject report : syncedReports) { String formSubmissionId = report.getString(report_column.formSubmissionId .name()); markR...
### Question: DetailsRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(SQL); } void add(String baseEntityId, String key, String value, Long timestamp); Map<String, String> getAllDetailsForClient(String baseEntityId); Map<String, String> updateDetails(C...
### Question: DetailsRepository extends DrishtiRepository { public Map<String, String> getAllDetailsForClient(String baseEntityId) { Cursor cursor = null; Map<String, String> clientDetails = new HashMap<String, String>(); try { SQLiteDatabase db = masterRepository.getReadableDatabase(); String query = "SELECT * FROM " ...
### Question: DetailsRepository extends DrishtiRepository { public Map<String, String> updateDetails(CommonPersonObjectClient commonPersonObjectClient) { Map<String, String> details = getAllDetailsForClient(commonPersonObjectClient.entityId()); details.putAll(commonPersonObjectClient.getColumnmaps()); if (commonPersonO...
### Question: DetailsRepository extends DrishtiRepository { public boolean deleteDetails(String baseEntityId) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(TABLE_NAME, BASE_ENTITY_ID_COLUMN + " = ?", new String[]{baseEntityId}); if (afftectedRows > 0) { return true; ...
### Question: AllBeneficiaries { public Mother findMotherWithOpenStatus(String caseId) { return motherRepository.findOpenCaseByCaseID(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ...
### Question: AllBeneficiaries { public Mother findMother(String caseId) { List<Mother> mothers = motherRepository.findByCaseIds(caseId); if (mothers.isEmpty()) { return null; } return mothers.get(0); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, Aler...
### Question: AllBeneficiaries { public List<Child> findAllChildrenByCaseIDs(List<String> caseIds) { return childRepository.findChildrenByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertReposito...
### Question: AllBeneficiaries { public List<Child> allChildrenWithMotherAndEC() { return childRepository.allChildrenWithMotherAndEC(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ...
### Question: AllBeneficiaries { public List<Child> findAllChildrenByECId(String ecId) { return childRepository.findAllChildrenByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ...
### Question: AllBeneficiaries { public Mother findMotherWithOpenStatusByECId(String ecId) { return motherRepository.findMotherWithOpenStatusByECId(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepo...
### Question: AllBeneficiaries { public boolean isPregnant(String ecId) { return motherRepository.isPregnant(ecId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ...
### Question: AllBeneficiaries { public void switchMotherToPNC(String entityId) { motherRepository.switchToPNC(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ...
### Question: AllBeneficiaries { public List<Mother> findAllMothersByCaseIDs(List<String> caseIds) { return motherRepository.findByCaseIds(caseIds.toArray(new String[caseIds.size()])); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository aler...
### Question: AllBeneficiaries { public List<Child> findAllChildrenByMotherId(String entityId) { return childRepository.findByMotherCaseId(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepositor...
### Question: AllBeneficiaries { public Child findChild(String caseId) { return childRepository.find(caseId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository ti...
### Question: AllBeneficiaries { public long ancCount() { return motherRepository.ancCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepos...
### Question: AllBeneficiaries { public long pncCount() { return motherRepository.pncCount(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepos...
### Question: AllBeneficiaries { public long childCount() { return childRepository.count(); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventReposit...
### Question: AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allANCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_ANC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventReposit...
### Question: AllBeneficiaries { public List<Pair<Mother, EligibleCouple>> allPNCsWithEC() { return motherRepository.allMothersOfATypeWithEC(TYPE_PNC); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventReposit...
### Question: AllBeneficiaries { public void closeMother(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); motherRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, ...
### Question: AllBeneficiaries { public void closeChild(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); childRepository.close(entityId); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, ...
### Question: AllBeneficiaries { public void updateChild(Child child) { childRepository.update(child); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository timelineE...
### Question: AllBeneficiaries { public void updateMother(Mother mother) { motherRepository.update(mother); } AllBeneficiaries(MotherRepository motherRepository, ChildRepository childRepository, AlertRepository alertRepository, TimelineEventRepository time...
### Question: StructureRepository extends LocationRepository { public boolean batchInsertStructures(JSONArray array) { if (array == null || array.length() == 0) { return false; } try { getWritableDatabase().beginTransaction(); for (int i = 0; i < array.length(); i++) { JSONObject jsonObject = array.getJSONObject(i); Lo...
### Question: StructureRepository extends LocationRepository { public List<Location> getAllUnsynchedCreatedStructures() { Cursor cursor = null; List<Location> structures = new ArrayList<>(); try { cursor = getReadableDatabase().rawQuery(String.format("SELECT * FROM %s WHERE %s =?", STRUCTURE_TABLE, SYNC_STATUS), new St...
### Question: StructureRepository extends LocationRepository { public void markStructuresAsSynced(String structureId) { try { ContentValues values = new ContentValues(); values.put(ID, structureId); values.put(SYNC_STATUS, BaseRepository.TYPE_Synced); getWritableDatabase().update(STRUCTURE_TABLE, values, ID + " = ?", n...
### Question: StructureRepository extends LocationRepository { @Override public List<Location> getAllLocations() { throw new UnsupportedOperationException("getAllLocations not supported for Structures"); } static void createTable(SQLiteDatabase database); @Override void deleteLocations(@NonNull Set<String> locationIde...
### Question: StructureRepository extends LocationRepository { public static void createTable(SQLiteDatabase database) { database.execSQL(CREATE_LOCATION_TABLE); database.execSQL(CREATE_LOCATION_PARENT_INDEX); } static void createTable(SQLiteDatabase database); @Override void deleteLocations(@NonNull Set<String> locat...
### Question: FormsVersionRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(FORM_VERSION_SQL); } FormDefinitionVersion fetchVersionByFormName(String formName); FormDefinitionVersion fetchVersionByFormDirName(String formDirName); String getVersion(Strin...
### Question: FormsVersionRepository extends DrishtiRepository { public FormDefinitionVersion fetchVersionByFormName(String formName) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, FORM_NAME_COLUMN + " " + "" + "= ?...
### Question: FormsVersionRepository extends DrishtiRepository { public FormDefinitionVersion fetchVersionByFormDirName(String formDirName) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, FORM_DIR_NAME_COLUMN + " = ?...
### Question: FormsVersionRepository extends DrishtiRepository { public String getVersion(String formDirName) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, FORM_DIR_NAME_COLUMN + " = ?", new String[]{formDirName}, ...
### Question: FormsVersionRepository extends DrishtiRepository { public List<FormDefinitionVersion> getAllFormWithSyncStatus(SyncStatus status) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, SYNC_STATUS_COLUMN + " =...
### Question: FormsVersionRepository extends DrishtiRepository { public List<Map<String, String>> getAllFormWithSyncStatusAsMap(SyncStatus status) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, SYNC_STATUS_COLUMN + ...
### Question: FormsVersionRepository extends DrishtiRepository { public FormDefinitionVersion getFormByFormDirName(String formDirName) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, FORM_VERSION_TABLE_COLUMNS, FORM_DIR_NAME_COLUMN + " = ?", ne...
### Question: FormsVersionRepository extends DrishtiRepository { public void addFormVersion(Map<String, String> dataJSON) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(FORM_VERSION_TABLE_NAME, null, createValuesFormVersions(dataJSON)); } FormDefinitionVersion fetchVersionByFormNam...
### Question: FormsVersionRepository extends DrishtiRepository { public void addFormVersionFromObject(FormDefinitionVersion formDefinitionVersion) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(FORM_VERSION_TABLE_NAME, null, createValuesFromObject(formDefinitionVersion)); } FormDef...
### Question: FormsVersionRepository extends DrishtiRepository { public boolean formExists(String formDirName) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(FORM_VERSION_TABLE_NAME, new String[]{FORM_DIR_NAME_COLUMN}, FORM_DIR_NAME_COLUMN + " = ?", new String[]{formD...
### Question: FormsVersionRepository extends DrishtiRepository { public void deleteAll() { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.delete(FORM_VERSION_TABLE_NAME, null, null); } FormDefinitionVersion fetchVersionByFormName(String formName); FormDefinitionVersion fetchVersionByFormDir...
### Question: GenericInteractor implements CallableInteractor { @Override public <T> void execute(Callable<T> callable, CallableInteractorCallBack<T> callBack) { execute(callable, callBack, AppExecutors.Request.DISK_THREAD); } GenericInteractor(); @VisibleForTesting GenericInteractor(AppExecutors appExecutors); @Overr...
### Question: FormsVersionRepository extends DrishtiRepository { public void updateServerVersion(String formDirName, String serverVersion) { SQLiteDatabase database = masterRepository.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(VERSION_COLUMN, serverVersion); database.update(FORM_VERSI...
### Question: FormsVersionRepository extends DrishtiRepository { public void updateFormName(String formDirName, String formName) { SQLiteDatabase database = masterRepository.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(FORM_NAME_COLUMN, formName); database.update(FORM_VERSION_TABLE_NAME...
### Question: FormsVersionRepository extends DrishtiRepository { public void updateSyncStatus(String formDirName, SyncStatus status) { SQLiteDatabase database = masterRepository.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(SYNC_STATUS_COLUMN, status.value()); database.update(FORM_VERSIO...
### Question: TimelineEventRepository extends DrishtiRepository { @Override protected void onCreate(SQLiteDatabase database) { database.execSQL(TIMELINEEVENT_SQL); database.execSQL(TIMELINEVENT_CASEID_INDEX_SQL); } void add(TimelineEvent timelineEvent); List<TimelineEvent> allFor(String caseId); void deleteAllTimeline...
### Question: TimelineEventRepository extends DrishtiRepository { public void add(TimelineEvent timelineEvent) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(TIMELINEEVENT_TABLE_NAME, null, createValuesFor(timelineEvent)); } void add(TimelineEvent timelineEvent); List<TimelineEvent...
### Question: TimelineEventRepository extends DrishtiRepository { public List<TimelineEvent> allFor(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = database.query(TIMELINEEVENT_TABLE_NAME, TIMELINEEVENT_TABLE_COLUMNS, CASEID_COLUMN + "= ?", new String[]{caseId}, null, ...
### Question: TimelineEventRepository extends DrishtiRepository { public void deleteAllTimelineEventsForEntity(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.delete(TIMELINEEVENT_TABLE_NAME, CASEID_COLUMN + " = ?", new String[]{caseId}); } void add(TimelineEvent timelineEve...
### Question: ClientRepository extends SQLiteOpenHelper { @Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); } ClientRepository(Context context, String[] columns); ClientRepository(Context context, String tableName, String[] columns); @Override void onOpen(SQLiteDatabase db); @Over...