method2testcases stringlengths 118 6.63k |
|---|
### Question:
FileUtilities { public void write(String fileName, String data) { File root = Environment.getExternalStorageDirectory(); File outDir = new File(root.getAbsolutePath() + File.separator + "EZ_time_tracker"); if (!outDir.isDirectory()) { outDir.mkdir(); } try { if (!outDir.isDirectory()) { throw new IOExcept... |
### Question:
LocationServiceHelper extends BaseHelper { public void fetchOpenMrsLocationsByTeamIds() throws NoHttpResponseException, JSONException { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(OPENMRS_LOCATION_BY_TEAM_IDS + " http agent is null"); } String baseUrl ... |
### Question:
LocationServiceHelper extends BaseHelper { public List<Location> fetchLocationsStructures() { syncLocationsStructures(true); List<Location> locations = syncLocationsStructures(false); syncCreatedStructureToServer(); syncUpdatedLocationsToServer(); return locations; } LocationServiceHelper(LocationReposito... |
### Question:
LocationServiceHelper extends BaseHelper { public void syncCreatedStructureToServer() { List<Location> locations = structureRepository.getAllUnsynchedCreatedStructures(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormattedBaseUrl(); Response<Strin... |
### Question:
LocationServiceHelper extends BaseHelper { public void syncUpdatedLocationsToServer() { HTTPAgent httpAgent = getHttpAgent(); List<Location> locations = locationRepository.getAllUnsynchedLocation(); if (!locations.isEmpty()) { String jsonPayload = locationGson.toJson(locations); String baseUrl = getFormat... |
### Question:
LocationServiceHelper extends BaseHelper { public void fetchAllLocations() { try { HTTPAgent httpAgent = getHttpAgent(); if (httpAgent == null) { throw new IllegalArgumentException(LOCATION_STRUCTURE_URL + " http agent is null"); } String baseUrl = getFormattedBaseUrl(); JSONObject request = new JSONObjec... |
### Question:
P2PSyncAuthorizationService implements P2PAuthorizationService { @Override public void authorizeConnection(@NonNull final Map<String, Object> peerDeviceMap, @NonNull final AuthorizationCallback authorizationCallback) { getAuthorizationDetails(new OnAuthorizationDetailsProvidedCallback() { @Override public... |
### Question:
FileUtilities { public static String getFileExtension(String fileName) { String extension = ""; if (fileName != null && !fileName.isEmpty()) { int i = fileName.lastIndexOf('.'); if (i > 0) { extension = fileName.substring(i + 1); } } return extension; } FileUtilities(); static Bitmap retrieveStaticImageFr... |
### Question:
OpenSRPClientBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action = intent.getAction(); switch (action) { case Intent.ACTION_TIME_CHANGED: Timber.d("timechanged"); forceFullySignOut(); break; case Intent.ACTION_TIMEZONE_CHANGED... |
### Question:
GZIPCompression implements ICompression { @Override public byte[] compress(String rawString) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gos = new GZIPOutputStream(os); gos.write(rawString.getBytes(CharEncoding.UTF_8)); gos.close(); byte[] compressed = os.toByteArray()... |
### Question:
Context { public UserService userService() { if (userService == null) { userService = new UserService(allSettings(), allSharedPreferences(), httpAgent(), session(), configuration(), saveANMLocationTask(), saveUserInfoTask(), saveANMTeamTask()); } return userService; } protected Context(); static Context ... |
### Question:
Context { public ImageRepository imageRepository() { if (imageRepository == null) { imageRepository = new ImageRepository(); } return imageRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); Beneficia... |
### Question:
DisplayUtils { public static int getDisplayWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } static ScreenDpi getScreenDpi(Context context); static int getDispla... |
### Question:
Context { public AllAlerts allAlerts() { if (allAlerts == null) { allAlerts = new AllAlerts(alertRepository()); } return allAlerts; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficia... |
### Question:
Context { public HTTPAgent httpAgent() { if (httpAgent == null) { httpAgent = new HTTPAgent(applicationContext, allSharedPreferences(), configuration()); } return httpAgent; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicat... |
### Question:
Context { public ANMService anmService() { if (anmService == null) { anmService = new ANMService(allSharedPreferences(), allBeneficiaries(), allEligibleCouples()); } return anmService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Conte... |
### Question:
Context { public DristhiConfiguration configuration() { if (configuration == null) { configuration = new DristhiConfiguration(); } return configuration; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); Benefic... |
### Question:
Context { public ANMController anmController() { if (anmController == null) { anmController = new ANMController(anmService(), listCache(), homeContextCache()); } return anmController; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Contex... |
### Question:
Context { public ANMLocationController anmLocationController() { if (anmLocationController == null) { anmLocationController = new ANMLocationController(allSettings(), listCache()); } return anmLocationController; } protected Context(); static Context getInstance(); static Context setInstance(Context mCon... |
### Question:
Context { public HTTPAgent getHttpAgent() { return httpAgent(); } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Contex... |
### Question:
Context { public EventClientRepository getEventClientRepository() { if (eventClientRepository == null) { eventClientRepository = new EventClientRepository(); } return eventClientRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.... |
### Question:
Context { public UniqueIdRepository getUniqueIdRepository() { if (uniqueIdRepository == null) { uniqueIdRepository = new UniqueIdRepository(); } return uniqueIdRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicatio... |
### Question:
Context { public CampaignRepository getCampaignRepository() { if (campaignRepository == null) { campaignRepository = new CampaignRepository(); } return campaignRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicatio... |
### Question:
DisplayUtils { public static int getDisplayHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } static ScreenDpi getScreenDpi(Context context); static int getDisp... |
### Question:
Context { public TaskRepository getTaskRepository() { if (taskRepository == null) { taskNotesRepository = new TaskNotesRepository(); taskRepository = new TaskRepository(taskNotesRepository); } return taskRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context m... |
### Question:
Context { public BeneficiaryService beneficiaryService() { if (beneficiaryService == null) { beneficiaryService = new BeneficiaryService(allEligibleCouples(), allBeneficiaries()); } return beneficiaryService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext... |
### Question:
Context { protected DrishtiService drishtiService() { if (drishtiService == null) { drishtiService = new DrishtiService(httpAgent(), configuration().dristhiBaseURL()); } return drishtiService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.conte... |
### Question:
Context { public ActionService actionService() { if (actionService == null) { actionService = new ActionService(drishtiService(), allSettings(), allSharedPreferences(), allReports()); } return actionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext)... |
### Question:
Context { public FormSubmissionService formSubmissionService() { if (formSubmissionService == null) { if (commonFtsObject != null) { formSubmissionService = new FormSubmissionService(ziggyService(), formDataRepository(), allSettings(), allCommonsRepositoryMap()); } else { formSubmissionService = new FormS... |
### Question:
Context { public AllFormVersionSyncService allFormVersionSyncService() { if (allFormVersionSyncService == null) { allFormVersionSyncService = new AllFormVersionSyncService(httpAgent(), configuration(), formsVersionRepository()); } return allFormVersionSyncService; } protected Context(); static Context ge... |
### Question:
Context { public FormSubmissionRouter formSubmissionRouter() { if (formSubmissionRouter == null) { formSubmissionRouter = new FormSubmissionRouter(formDataRepository(), ecRegistrationHandler(), fpComplicationsHandler(), fpChangeHandler(), renewFPProductHandler(), ecCloseHandler(), ancRegistrationHandler()... |
### Question:
Context { public ZiggyService ziggyService() { if (ziggyService == null) { ziggyService = new ZiggyService(ziggyFileLoader(), formDataRepository(), formSubmissionRouter()); } return ziggyService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.co... |
### Question:
Context { public ZiggyFileLoader ziggyFileLoader() { if (ziggyFileLoader == null) { ziggyFileLoader = new ZiggyFileLoader("www/ziggy", "www/form", applicationContext().getAssets()); } return ziggyFileLoader; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext)... |
### Question:
Context { public FormSubmissionSyncService formSubmissionSyncService() { if (formSubmissionSyncService == null) { formSubmissionSyncService = new FormSubmissionSyncService(formSubmissionService(), httpAgent(), formDataRepository(), allSettings(), allSharedPreferences(), configuration()); } return formSubm... |
### Question:
DisplayUtils { public static double getScreenSize(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; double wi = (double) width / (double) dm.xdpi; double hi = (double) hei... |
### Question:
Context { public DrishtiRepository[] sharedRepositoriesArray() { ArrayList<DrishtiRepository> drishtiRepositories = sharedRepositories(); DrishtiRepository[] drishtireposotoryarray = drishtiRepositories .toArray(new DrishtiRepository[drishtiRepositories.size()]); return drishtireposotoryarray; } protected... |
### Question:
Context { public AllTimelineEvents allTimelineEvents() { if (allTimelineEvents == null) { allTimelineEvents = new AllTimelineEvents(timelineEventRepository()); } return allTimelineEvents; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Co... |
### Question:
Context { public AllReports allReports() { if (allReports == null) { allReports = new AllReports(reportRepository()); } return allReports; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService be... |
### Question:
Context { public AllServicesProvided allServicesProvided() { if (allServicesProvided == null) { allServicesProvided = new AllServicesProvided(serviceProvidedRepository()); } return allServicesProvided; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); andr... |
### Question:
Context { public DetailsRepository detailsRepository() { if (detailsRepository == null) { detailsRepository = new DetailsRepository(); } return detailsRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(... |
### Question:
Context { public FormDataRepository formDataRepository() { if (formDataRepository == null) { formDataRepository = new FormDataRepository(); } return formDataRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationCo... |
### Question:
Context { public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; } protected C... |
### Question:
Context { public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; } protected Context(); static Context getInstance(); static Context setInstance(Context mCo... |
### Question:
Context { public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; } protected Context(); static Context getInstance(); stat... |
### Question:
CredentialsHelper { public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInst... |
### Question:
ClientFormResponse { public ClientFormDTO getClientForm() { return clientForm; } ClientFormResponse(ClientFormDTO clientForm, ClientFormMetadataDTO clientFormMetadata); ClientFormDTO getClientForm(); void setClientForm(ClientFormDTO clientForm); ClientFormMetadataDTO getClientFormMetadata(); void setClien... |
### Question:
Context { public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; } protected Context(); static Context getInstance(); static Context setInstance... |
### Question:
Context { public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; } protected Context(); static Context getInstance(); st... |
### Question:
Context { public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; } protected Context(); static Context getInstance(); sta... |
### Question:
Context { public LocationRepository getLocationRepository() { if (locationRepository == null) { locationRepository = new LocationRepository(); } return locationRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicatio... |
### Question:
Context { public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.... |
### Question:
Context { public StructureRepository getStructureRepository() { if (structureRepository == null) { structureRepository = new StructureRepository(); } return structureRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context appl... |
### Question:
Context { public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext)... |
### Question:
Context { public ManifestRepository getManifestRepository() { if (manifestRepository == null) { manifestRepository = new ManifestRepository(); } return manifestRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicatio... |
### Question:
Context { public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Contex... |
### Question:
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String case... |
### Question:
CredentialsHelper { public byte[] getCredentials(String username, String type) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { return context.userService().getDecryptedPassphraseValue(username); } else if (CREDENTIALS_TYPE.LOCAL_AUTH.equals(type)) { return context.userService().getDecryptedAccountValue(use... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> all() { return personRepository.allcommon(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject fi... |
### Question:
AllCommonsRepository { public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all... |
### Question:
AllCommonsRepository { public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObj... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository ti... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertReposito... |
### Question:
AllCommonsRepository { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertR... |
### Question:
AllCommonsRepository { public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timelineEventRepository); List<Co... |
### Question:
AllCommonsRepository { public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository timeline... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepos... |
### Question:
AllCommonsRepository { public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRe... |
### Question:
AllCommonsRepository { public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository
alertRepository, TimelineEventRepository ti... |
### Question:
CommonRepository extends DrishtiRepository { public void add(CommonPersonObject common) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(TABLE_NAME, null, createValuesFor(common)); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject ... |
### Question:
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncrypti... |
### Question:
CommonRepository extends DrishtiRepository { public CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor) { int columncount = cursor.getColumnCount(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { String columnName = cursor.getColumnName... |
### Question:
CommonRepository extends DrishtiRepository { public List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName) { List<CommonPersonObject> commons = new ArrayList<CommonPersonObject>(); try { cursor.moveToFirst(); while (!cursor.isAfterLast()) { int columncount = cursor.getColumnCount(... |
### Question:
CommonRepository extends DrishtiRepository { public void closeCase(String baseEntityId, String tableName) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(IS_CLOSED_COLUMN, 1); db.update(tableName, cv, BASE_ENTITY_ID_COLUMN + "=?", new Stri... |
### Question:
CommonRepository extends DrishtiRepository { public boolean deleteCase(String baseEntityId, String tableName) { try { SQLiteDatabase db = masterRepository.getWritableDatabase(); int afftectedRows = db .delete(tableName, BASE_ENTITY_ID_COLUMN + " = ? COLLATE NOCASE" + " ", new String[]{baseEntityId}); if (... |
### Question:
CommonFtsObject { public static String searchTableName(String table) { return table + "_search"; } CommonFtsObject(String[] tables); static String searchTableName(String table); void updateSearchFields(String table, String[] searchFields); void updateSortFields(String table, String[] sortFields); void upd... |
### Question:
CommonFtsObject { public boolean containsTable(String table) { if (tables == null || StringUtils.isBlank(table)) { return false; } List<String> tableList = Arrays.asList(tables); return tableList.contains(table); } CommonFtsObject(String[] tables); static String searchTableName(String table); void updateS... |
### Question:
CommonFtsObject { public String[] getTables() { if (tables == null) { tables = ArrayUtils.EMPTY_STRING_ARRAY; } return tables; } CommonFtsObject(String[] tables); static String searchTableName(String table); void updateSearchFields(String table, String[] searchFields); void updateSortFields(String table, ... |
### Question:
CommonObjectFilterOption implements FilterOption { @Override public boolean filter(SmartRegisterClient client) { switch (byColumnAndByDetails) { case byColumn: return ((CommonPersonObjectClient) client).getColumnmaps().get(fieldname). contains(criteria); case byDetails: return (((CommonPersonObjectClient)... |
### Question:
CredentialsHelper { public PasswordHash generateLocalAuthCredentials(char[] password) throws InvalidKeySpecException, NoSuchAlgorithmException { if (password == null) return null; return SecurityHelper.getPasswordHash(password); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] ... |
### Question:
CommonObjectFilterOption implements FilterOption { @Override public String name() { return filterOptionName; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails
byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean... |
### Question:
AccountHelper { public static Account getOauthAccountByNameAndType(String accountName, String accountType) { Account[] accounts = accountManager.getAccountsByType(accountType); return accounts.length > 0 ? selectAccount(accounts, accountName) : null; } static Account getOauthAccountByNameAndType(String a... |
### Question:
AccountHelper { public static String getAccountManagerValue(String key, String accountName, String accountType) { Account account = AccountHelper.getOauthAccountByNameAndType(accountName, accountType); if (account != null) { return accountManager.getUserData(account, key); } return null; } static Account... |
### Question:
AccountHelper { public static String getOAuthToken(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); try { return accountManager.blockingGetAuthToken(account, authTokenType, true); } catch (Exception ex) { Timber.e(ex,... |
### Question:
AccountHelper { public static void invalidateAuthToken(String accountType, String authToken) { if (authToken != null) accountManager.invalidateAuthToken(accountType, authToken); } static Account getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] a... |
### Question:
AccountHelper { public static String getCachedOAuthToken(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return account != null ? accountManager.peekAuthToken(account, authTokenType) : null; } static Account getOaut... |
### Question:
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = s... |
### Question:
AccountHelper { public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, n... |
### Question:
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == RecyclerViewCursorAdapter.Type.FOOTER.ordinal()) { return listItemProvider.createFooterHolder(parent); } else { return lis... |
### Question:
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNext... |
### Question:
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return statu... |
### Question:
EligibleCoupleService { public void register(FormSubmission submission) { if (isNotBlank(submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE))) { allTimelineEvents.add(TimelineEvent.forECRegistered(submission.entityId(), submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_... |
### Question:
EligibleCoupleService { public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents
allTimelineEvents... |
### Question:
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFi... |
### Question:
DocumentConfigurationService { protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCre... |
### Question:
DocumentConfigurationService { @VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Sa... |
### Question:
AppProperties extends Properties { public Boolean getPropertyBoolean(String key) { return Boolean.valueOf(getProperty(key)); } Boolean getPropertyBoolean(String key); Boolean hasProperty(String key); Boolean isTrue(String key); }### Answer:
@Test public void testGetPropertyBooleanReturnsCorrectValue() {... |
### Question:
AppProperties extends Properties { public Boolean hasProperty(String key) { return getProperty(key) != null; } Boolean getPropertyBoolean(String key); Boolean hasProperty(String key); Boolean isTrue(String key); }### Answer:
@Test public void testHasPropertyReturnsCorrectValue() { AppProperties properti... |
### Question:
FloatUtil { public static Float tryParse(String value, Float defaultValue) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { return defaultValue; } } static Float tryParse(String value, Float defaultValue); static String tryParse(String value, String defaultValue); }### Answer:... |
### Question:
StringUtil { public static String humanize(String value) { return capitalize(replace(getValue(value), "_", " ")); } static String humanize(String value); static String replaceAndHumanize(String value, String oldCharacter, String
newCharacter); static String replaceAndHumanizeWithInitCapText(S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.