target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testDetailsRepository() { DetailsRepository detailsRepository = context.detailsRepository(); Assert.assertNotNull(detailsRepository); }
public DetailsRepository detailsRepository() { if (detailsRepository == null) { detailsRepository = new DetailsRepository(); } return detailsRepository; }
Context { public DetailsRepository detailsRepository() { if (detailsRepository == null) { detailsRepository = new DetailsRepository(); } return detailsRepository; } }
Context { public DetailsRepository detailsRepository() { if (detailsRepository == null) { detailsRepository = new DetailsRepository(); } return detailsRepository; } protected Context(); }
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(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
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(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testFormDataRepository() { context.assignbindtypes(); FormDataRepository formDataRepository = context.formDataRepository(); Assert.assertNotNull(formDataRepository); }
public FormDataRepository formDataRepository() { if (formDataRepository == null) { formDataRepository = new FormDataRepository(); } return formDataRepository; }
Context { public FormDataRepository formDataRepository() { if (formDataRepository == null) { formDataRepository = new FormDataRepository(); } return formDataRepository; } }
Context { public FormDataRepository formDataRepository() { if (formDataRepository == null) { formDataRepository = new FormDataRepository(); } return formDataRepository; } protected Context(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testAlertService() { AlertService alertService = context.alertService(); Assert.assertNotNull(alertService); }
public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; }
Context { public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; } }
Context { public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; } protected Context(); }
Context { public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public AlertService alertService() { if (alertService == null) { if (commonFtsObject() != null) { alertService = new AlertService(alertRepository(), commonFtsObject(), allCommonsRepositoryMap()); } else { alertService = new AlertService(alertRepository()); } } return alertService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testServiceProvidedService() { ServiceProvidedService serviceProvidedService = context.serviceProvidedService(); Assert.assertNotNull(serviceProvidedService); }
public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; }
Context { public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; } }
Context { public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; } protected Context(); }
Context { public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public ServiceProvidedService serviceProvidedService() { if (serviceProvidedService == null) { serviceProvidedService = new ServiceProvidedService(allServicesProvided()); } return serviceProvidedService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testEligibleCoupleService() { EligibleCoupleService eligibleCoupleService = context.eligibleCoupleService(); Assert.assertNotNull(eligibleCoupleService); }
public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; }
Context { public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; } }
Context { public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; } protected Context(); }
Context { public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public EligibleCoupleService eligibleCoupleService() { if (eligibleCoupleService == null) { eligibleCoupleService = new EligibleCoupleService(allEligibleCouples(), allTimelineEvents(), allBeneficiaries()); } return eligibleCoupleService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testShouldMigrateReturnsTrueForDBEncryptionVersionZero() { boolean shouldMigrate = CredentialsHelper.shouldMigrate(); Assert.assertTrue(shouldMigrate); }
public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion()); }
CredentialsHelper { public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion()); } }
CredentialsHelper { public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion()); } CredentialsHelper(Context context); }
CredentialsHelper { public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion()); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public static boolean shouldMigrate() { return CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() == 0 || (CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion() > 0 && BuildConfig.DB_ENCRYPTION_VERSION > CoreLibrary.getInstance().context().allSharedPreferences().getDBEncryptionVersion()); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void getClientForm() { ClientFormDTO clientFormDTO = new ClientFormDTO(); clientFormDTO.setId(1); clientFormDTO.setJson("[\"test json\"]"); ClientFormMetadataDTO clientFormMetadataDTO = new ClientFormMetadataDTO(); Date now = Calendar.getInstance().getTime(); clientFormMetadataDTO.setCreatedAt(now); clientFormMetadataDTO.setId(1L); clientFormMetadataDTO.setIdentifier("referral/anc_form"); clientFormMetadataDTO.setJurisdiction("test jurisdiction"); clientFormMetadataDTO.setLabel("ANC Referral form"); clientFormMetadataDTO.setModule("ANC"); clientFormMetadataDTO.setVersion("0.0.1"); ClientFormResponse clientFormResponse = new ClientFormResponse(clientFormDTO, clientFormMetadataDTO); Assert.assertEquals("referral/anc_form", clientFormResponse.getClientFormMetadata().getIdentifier()); Assert.assertEquals("test jurisdiction", clientFormResponse.getClientFormMetadata().getJurisdiction()); Assert.assertEquals("ANC Referral form", clientFormResponse.getClientFormMetadata().getLabel()); Assert.assertEquals("ANC", clientFormResponse.getClientFormMetadata().getModule()); Assert.assertEquals("0.0.1", clientFormResponse.getClientFormMetadata().getVersion()); Assert.assertEquals(now, clientFormResponse.getClientFormMetadata().getCreatedAt()); Assert.assertEquals(1, clientFormResponse.getClientForm().getId()); Assert.assertEquals("[\"test json\"]", clientFormResponse.getClientForm().getJson()); }
public ClientFormDTO getClientForm() { return clientForm; }
ClientFormResponse { public ClientFormDTO getClientForm() { return clientForm; } }
ClientFormResponse { public ClientFormDTO getClientForm() { return clientForm; } ClientFormResponse(ClientFormDTO clientForm, ClientFormMetadataDTO clientFormMetadata); }
ClientFormResponse { public ClientFormDTO getClientForm() { return clientForm; } ClientFormResponse(ClientFormDTO clientForm, ClientFormMetadataDTO clientFormMetadata); ClientFormDTO getClientForm(); void setClientForm(ClientFormDTO clientForm); ClientFormMetadataDTO getClientFormMetadata(); void setClientFormMetadata(ClientFormMetadataDTO clientFormMetadata); }
ClientFormResponse { public ClientFormDTO getClientForm() { return clientForm; } ClientFormResponse(ClientFormDTO clientForm, ClientFormMetadataDTO clientFormMetadata); ClientFormDTO getClientForm(); void setClientForm(ClientFormDTO clientForm); ClientFormMetadataDTO getClientFormMetadata(); void setClientFormMetadata(ClientFormMetadataDTO clientFormMetadata); }
@Test public void testmotherService() { MotherService motherService = context.motherService(); Assert.assertNotNull(motherService); }
public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; }
Context { public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; } }
Context { public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; } protected Context(); }
Context { public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public MotherService motherService() { if (motherService == null) { motherService = new MotherService(allBeneficiaries(), allEligibleCouples(), allTimelineEvents(), serviceProvidedService()); } return motherService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testChildService() { ChildService childService = context.childService(); Assert.assertNotNull(childService); }
public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; }
Context { public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; } }
Context { public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; } protected Context(); }
Context { public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public ChildService childService() { if (childService == null) { childService = new ChildService(allBeneficiaries(), motherRepository(), childRepository(), allTimelineEvents(), serviceProvidedService(), allAlerts()); } return childService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testPendingFormSubmissionService() { context.assignbindtypes(); PendingFormSubmissionService pendingFormSubmissionService = context.pendingFormSubmissionService(); Assert.assertNotNull(pendingFormSubmissionService); }
public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; }
Context { public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; } }
Context { public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; } protected Context(); }
Context { public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public PendingFormSubmissionService pendingFormSubmissionService() { if (pendingFormSubmissionService == null) { pendingFormSubmissionService = new PendingFormSubmissionService(formDataRepository()); } return pendingFormSubmissionService; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testLocationRepository() { LocationRepository locationRepository = context.getLocationRepository(); Assert.assertNotNull(locationRepository); }
public LocationRepository getLocationRepository() { if (locationRepository == null) { locationRepository = new LocationRepository(); } return locationRepository; }
Context { public LocationRepository getLocationRepository() { if (locationRepository == null) { locationRepository = new LocationRepository(); } return locationRepository; } }
Context { public LocationRepository getLocationRepository() { if (locationRepository == null) { locationRepository = new LocationRepository(); } return locationRepository; } protected Context(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testGetLocationTagRepository() { LocationTagRepository locationTagRepository = context.getLocationTagRepository(); Assert.assertNotNull(locationTagRepository); }
public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; }
Context { public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; } }
Context { public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; } protected Context(); }
Context { public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public LocationTagRepository getLocationTagRepository() { if (locationTagRepository == null) { locationTagRepository = new LocationTagRepository(); } return locationTagRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testGetStructureRepository() { StructureRepository structureRepository = context.getStructureRepository(); Assert.assertNotNull(structureRepository); }
public StructureRepository getStructureRepository() { if (structureRepository == null) { structureRepository = new StructureRepository(); } return structureRepository; }
Context { public StructureRepository getStructureRepository() { if (structureRepository == null) { structureRepository = new StructureRepository(); } return structureRepository; } }
Context { public StructureRepository getStructureRepository() { if (structureRepository == null) { structureRepository = new StructureRepository(); } return structureRepository; } protected Context(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testGetPlanDefinitionRepository() { PlanDefinitionRepository planDefinitionRepository = context.getPlanDefinitionRepository(); Assert.assertNotNull(planDefinitionRepository); }
public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; }
Context { public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; } }
Context { public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; } protected Context(); }
Context { public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public PlanDefinitionRepository getPlanDefinitionRepository() { if (planDefinitionRepository == null) { planDefinitionRepository = new PlanDefinitionRepository(); } return planDefinitionRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testGetManifestRepository() { ManifestRepository manifestRepository = context.getManifestRepository(); Assert.assertNotNull(manifestRepository); }
public ManifestRepository getManifestRepository() { if (manifestRepository == null) { manifestRepository = new ManifestRepository(); } return manifestRepository; }
Context { public ManifestRepository getManifestRepository() { if (manifestRepository == null) { manifestRepository = new ManifestRepository(); } return manifestRepository; } }
Context { public ManifestRepository getManifestRepository() { if (manifestRepository == null) { manifestRepository = new ManifestRepository(); } return manifestRepository; } protected Context(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
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 applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void testGetClientFormRepository() { ClientFormRepository clientFormRepository = context.getClientFormRepository(); Assert.assertNotNull(clientFormRepository); }
public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; }
Context { public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; } }
Context { public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; } protected Context(); }
Context { public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); }
Context { public ClientFormRepository getClientFormRepository() { if (clientFormRepository == null) { clientFormRepository = new ClientFormRepository(); } return clientFormRepository; } protected Context(); static Context getInstance(); static Context setInstance(Context mContext); android.content.Context applicationContext(); BeneficiaryService beneficiaryService(); Context updateApplicationContext(android.content.Context applicationContext); ActionService actionService(); FormSubmissionService formSubmissionService(); AllFormVersionSyncService allFormVersionSyncService(); FormSubmissionRouter formSubmissionRouter(); ZiggyService ziggyService(); ZiggyFileLoader ziggyFileLoader(); FormSubmissionSyncService formSubmissionSyncService(); HTTPAgent httpAgent(); ArrayList<DrishtiRepository> sharedRepositories(); DrishtiRepository[] sharedRepositoriesArray(); AllEligibleCouples allEligibleCouples(); AllAlerts allAlerts(); AllSettings allSettings(); AllSharedPreferences allSharedPreferences(); AllBeneficiaries allBeneficiaries(); AllTimelineEvents allTimelineEvents(); AllReports allReports(); AllServicesProvided allServicesProvided(); DetailsRepository detailsRepository(); FormDataRepository formDataRepository(); ImageRepository imageRepository(); UserService userService(); AlertService alertService(); ServiceProvidedService serviceProvidedService(); EligibleCoupleService eligibleCoupleService(); MotherService motherService(); ChildService childService(); Session session(); ANMService anmService(); Cache<String> listCache(); Cache<SmartRegisterClients> smartRegisterClientsCache(); Cache<HomeContext> homeContextCache(); Boolean IsUserLoggedOut(); DristhiConfiguration configuration(); PendingFormSubmissionService pendingFormSubmissionService(); ANMController anmController(); ANMLocationController anmLocationController(); Cache<ECClients> ecClientsCache(); Cache<FPClients> fpClientsCache(); Cache<ANCClients> ancClientsCache(); Cache<PNCClients> pncClientsCache(); Cache<Villages> villagesCache(); Cache<Typeface> typefaceCache(); String getStringResource(int id); int getColorResource(int id); Drawable getDrawable(int id); Drawable getDrawableResource(int id); Cache<CommonPersonObjectClients> personObjectClientsCache(); AllCommonsRepository allCommonsRepositoryobjects(String tablename); long countofcommonrepositroy(String tablename); CommonRepository commonrepository(String tablename); void assignbindtypes(); void getEcBindtypes(); String ReadFromfile(String fileName, android.content.Context context); HTTPAgent getHttpAgent(); Context updateCommonFtsObject(CommonFtsObject commonFtsObject); CommonFtsObject commonFtsObject(); Context updateCustomHumanReadableConceptResponse(Map<String, String> customHumanReadableConceptResponse); Map<String, String> customHumanReadableConceptResponse(); Map<String, AllCommonsRepository> allCommonsRepositoryMap(); void setDetailsRepository(DetailsRepository _detailsRepository); EventClientRepository getEventClientRepository(); UniqueIdRepository getUniqueIdRepository(); CampaignRepository getCampaignRepository(); TaskRepository getTaskRepository(); EventClientRepository getForeignEventClientRepository(); boolean hasForeignEvents(); LocationRepository getLocationRepository(); LocationTagRepository getLocationTagRepository(); StructureRepository getStructureRepository(); PlanDefinitionRepository getPlanDefinitionRepository(); AppProperties getAppProperties(); ManifestRepository getManifestRepository(); ClientFormRepository getClientFormRepository(); ClientRelationshipRepository getClientRelationshipRepository(); static ArrayList<CommonRepositoryInformationHolder> bindtypes; }
@Test public void ShouldShowcount() throws Exception { when(personRepository.count()).thenReturn((long) 8); assertEquals(personRepository.count(), (long) 8); }
public long count() { return personRepository.count(); }
AllCommonsRepository { public long count() { return personRepository.count(); } }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testGetCredentialsInvokesGetDecryptedPassphraseValueWithCorrectValuesForDBAuth() { credentialsHelper.getCredentials(TEST_USERNAME, CredentialsHelper.CREDENTIALS_TYPE.DB_AUTH); ArgumentCaptor<String> usernameArgCaptor = ArgumentCaptor.forClass(String.class); Mockito.verify(userService, Mockito.times(1)).getDecryptedPassphraseValue(usernameArgCaptor.capture()); Assert.assertEquals(TEST_USERNAME, usernameArgCaptor.getValue()); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void testAll() { allCommonsRepository.all(); verify(personRepository).allcommon(); }
public List<CommonPersonObject> all() { return personRepository.allcommon(); }
AllCommonsRepository { public List<CommonPersonObject> all() { return personRepository.allcommon(); } }
AllCommonsRepository { public List<CommonPersonObject> all() { return personRepository.allcommon(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> all() { return personRepository.allcommon(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> all() { return personRepository.allcommon(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testFindByCaseId() { allCommonsRepository.findByCaseID("case 1"); verify(personRepository).findByCaseID("case 1"); }
public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); }
AllCommonsRepository { public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); } }
AllCommonsRepository { public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public CommonPersonObject findByCaseID(String caseId) { return personRepository.findByCaseID(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testFindHHByGOBHHID() { allCommonsRepository.findHHByGOBHHID("gobhhid 1"); verify(personRepository).findHHByGOBHHID("gobhhid 1"); }
public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); }
AllCommonsRepository { public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); } }
AllCommonsRepository { public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public CommonPersonObject findHHByGOBHHID(String gobhhid) { return personRepository.findHHByGOBHHID(gobhhid); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testCount() { allCommonsRepository.count(); verify(personRepository).count(); }
public long count() { return personRepository.count(); }
AllCommonsRepository { public long count() { return personRepository.count(); } }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public long count() { return personRepository.count(); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testFindByCaseIds() { List<String> expectedCaseIds = new ArrayList<>(); expectedCaseIds.add("case 1"); expectedCaseIds.add("case 2"); allCommonsRepository.findByCaseIDs(expectedCaseIds); verify(personRepository).findByCaseIDs(new String[] {expectedCaseIds.get(0), expectedCaseIds.get(1)}); }
public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); }
AllCommonsRepository { public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } }
AllCommonsRepository { public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> findByCaseIDs(List<String> caseIds) { return personRepository.findByCaseIDs(caseIds.toArray(new String[caseIds.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testFindByRelationIds() { List<String> expectedRelationIds = new ArrayList<>(); expectedRelationIds.add("relation id 1"); expectedRelationIds.add("relation id 2"); allCommonsRepository.findByRelationalIDs(expectedRelationIds); verify(personRepository).findByRelationalIDs(new String[] {expectedRelationIds.get(0), expectedRelationIds.get(1)}); }
public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); }
AllCommonsRepository { public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); } }
AllCommonsRepository { public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID) { return personRepository .findByRelationalIDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testFindByRelationIds2() { List<String> expectedRelationIds = new ArrayList<>(); expectedRelationIds.add("relation id 1"); expectedRelationIds.add("relation id 2"); allCommonsRepository.findByRelational_IDs(expectedRelationIds); verify(personRepository).findByRelational_IDs(new String[] {expectedRelationIds.get(0), expectedRelationIds.get(1)}); }
public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); }
AllCommonsRepository { public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); } }
AllCommonsRepository { public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID) { return personRepository .findByRelational_IDs(RelationalID.toArray(new String[RelationalID.size()])); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testClose() { String entityId = "Entity 1"; allCommonsRepository.close(entityId); verify(alertRepository).deleteAllAlertsForEntity(entityId); verify(timelineEventRepository).deleteAllTimelineEventsForEntity(entityId); verify(personRepository).close(entityId); }
public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); }
AllCommonsRepository { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); } }
AllCommonsRepository { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public void close(String entityId) { alertRepository.deleteAllAlertsForEntity(entityId); timelineEventRepository.deleteAllTimelineEventsForEntity(entityId); personRepository.close(entityId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testMergeDetails() { String entityId = "Entity 1"; Map<String, String> details = new HashMap<>(); details.put("case id", "Case 1"); allCommonsRepository.mergeDetails(entityId, details); verify(personRepository).mergeDetails(entityId, details); }
public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); }
AllCommonsRepository { public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); } }
AllCommonsRepository { public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public void mergeDetails(String entityId, Map<String, String> details) { personRepository.mergeDetails(entityId, details); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdate() { String tableName = "sprayed_structures"; String caseId = "Case 1"; ContentValues contentValues = new ContentValues(); contentValues.put("status", "Ready"); allCommonsRepository.update(tableName, contentValues, caseId); verify(personRepository).updateColumn(tableName,contentValues,caseId); }
public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); }
AllCommonsRepository { public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); } }
AllCommonsRepository { public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public void update(String tableName, ContentValues contentValues, String caseId) { personRepository.updateColumn(tableName, contentValues, caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testGetCredentialsInvokesGetDecryptedPassphraseValueWithCorrectValuesForLocalAuth() { credentialsHelper.getCredentials(TEST_USERNAME, CredentialsHelper.CREDENTIALS_TYPE.LOCAL_AUTH); ArgumentCaptor<String> usernameArgCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<String> keyArgCaptor = ArgumentCaptor.forClass(String.class); Mockito.verify(userService, Mockito.times(1)).getDecryptedAccountValue(usernameArgCaptor.capture(), keyArgCaptor.capture()); Assert.assertEquals(TEST_USERNAME, usernameArgCaptor.getValue()); Assert.assertEquals(AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD, keyArgCaptor.getValue()); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
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(username, AccountHelper.INTENT_KEY.ACCOUNT_LOCAL_PASSWORD); } return null; } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void testCustomQuery() { String tableName = "sprayed_structures"; String sql = "SELECT count(*) FROM sprayed_structures WHERE status = ?"; String[] selectionArgs = {"Complete"}; allCommonsRepository.customQuery(sql, selectionArgs, tableName); verify(personRepository).customQuery(sql, selectionArgs, tableName); }
public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); }
AllCommonsRepository { public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); } }
AllCommonsRepository { public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName) { return personRepository.customQuery(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testCustomQueryForCompleteRow() { String tableName = "sprayed_structures"; String sql = "SELECT count(*) FROM sprayed_structures WHERE status = ?"; String[] selectionArgs = {"Complete"}; allCommonsRepository.customQueryForCompleteRow(sql, selectionArgs, tableName); verify(personRepository).customQueryForCompleteRow(sql, selectionArgs, tableName); }
public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); }
AllCommonsRepository { public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); } }
AllCommonsRepository { public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName) { return personRepository.customQueryForCompleteRow(sql, selections, tableName); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithListToRemove() { String caseId = "Case id 1"; String field = "status"; String value = "synced"; String[] listToremove = {"created", "deleted"}; allCommonsRepository.updateSearch(caseId,field,value,listToremove); verify(personRepository).populateSearchValues(caseId,field,value,listToremove); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithListToRemoveMissingCaseId() { allCommonsRepository.updateSearch(null,"status","synced",new String[]{"created", "deleted"}); verifyZeroInteractions(personRepository); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testDeleteSearchRecord() { String caseId = "Case id 1"; allCommonsRepository.deleteSearchRecord(caseId); verify(personRepository).deleteSearchRecord(caseId); }
public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); }
AllCommonsRepository { public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); } }
AllCommonsRepository { public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public boolean deleteSearchRecord(String caseId) { if (StringUtils.isBlank(caseId)) { return false; } return personRepository.deleteSearchRecord(caseId); } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithNoCaseId() { allCommonsRepository.updateSearch(""); verifyZeroInteractions(personRepository); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithCaseId() { String caseId = "Case id 1"; ContentValues contentValues = new ContentValues(); contentValues.put("status", "Ready"); when(personRepository.populateSearchValues(caseId)).thenReturn(contentValues); allCommonsRepository.updateSearch(caseId); verify(personRepository).searchBatchInserts(mapArgumentCaptor.capture()); HashMap actualsearchMap = mapArgumentCaptor.getValue(); assertNotNull(actualsearchMap); ContentValues actualContentValues = (ContentValues) actualsearchMap.get(caseId); assertNotNull(actualContentValues); assertEquals(1, actualContentValues.size()); assertEquals("Ready", actualContentValues.getAsString("status")); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithNoCaseIdList() { allCommonsRepository.updateSearch(new ArrayList<>()); verifyZeroInteractions(personRepository); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void testUpdateSearchWithCaseIdList() { String caseId1 = "Case id 1"; String caseId2 = "Case id 2"; List<String> caseIdList = new ArrayList<>(); caseIdList.add(caseId1); caseIdList.add(caseId2); ContentValues contentValues1 = new ContentValues(); contentValues1.put("status", "Ready"); doReturn(contentValues1).when(personRepository).populateSearchValues(caseId1); ContentValues contentValues2 = new ContentValues(); contentValues2.put("status", "Complete"); doReturn(contentValues2).when(personRepository).populateSearchValues(caseId2); allCommonsRepository.updateSearch(caseIdList); verify(personRepository).searchBatchInserts(mapArgumentCaptor.capture()); HashMap actualsearchMap = mapArgumentCaptor.getValue(); assertNotNull(actualsearchMap); assertEquals(2, actualsearchMap.size()); ContentValues actualContentValues1 = (ContentValues) actualsearchMap.get(caseId1); assertNotNull(actualContentValues1); assertEquals(1, actualContentValues1.size()); assertEquals("Ready", actualContentValues1.getAsString("status")); ContentValues actualContentValues2 = (ContentValues) actualsearchMap.get(caseId2); assertNotNull(actualContentValues2); assertEquals(1, actualContentValues2.size()); assertEquals("Complete", actualContentValues2.getAsString("status")); }
public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
AllCommonsRepository { public List<String> updateSearch(List<String> caseIds) { List<String> remainingIds = new ArrayList<>(); if (caseIds == null || caseIds.isEmpty()) { return remainingIds; } Map<String, ContentValues> searchMap = new HashMap<String, ContentValues>(); for (String caseId : caseIds) { ContentValues contentValues = personRepository.populateSearchValues(caseId); if (contentValues != null) { searchMap.put(caseId, contentValues); } else { remainingIds.add(caseId); } } if (!searchMap.isEmpty()) { personRepository.searchBatchInserts(searchMap); } return remainingIds; } AllCommonsRepository(CommonRepository personRepository, AlertRepository alertRepository, TimelineEventRepository timelineEventRepository); List<CommonPersonObject> all(); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findHHByGOBHHID(String gobhhid); long count(); List<CommonPersonObject> findByCaseIDs(List<String> caseIds); List<CommonPersonObject> findByRelationalIDs(List<String> RelationalID); List<CommonPersonObject> findByRelational_IDs(List<String> RelationalID); void close(String entityId); void mergeDetails(String entityId, Map<String, String> details); void update(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); List<String> updateSearch(List<String> caseIds); boolean updateSearch(String caseId); boolean updateSearch(String caseId, String field, String value, String[] listToRemove); boolean deleteSearchRecord(String caseId); }
@Test public void addCallsDatabaseInsert1times() throws Exception { String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); commonRepository.add(new CommonPersonObject("", "", new HashMap<String, String>(), "")); Mockito.verify(sqliteDatabase, Mockito.times(1)).insert(Mockito.anyString(), Mockito.isNull(String.class), Mockito.any(ContentValues.class)); }
public void add(CommonPersonObject common) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(TABLE_NAME, null, createValuesFor(common)); }
CommonRepository extends DrishtiRepository { public void add(CommonPersonObject common) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.insert(TABLE_NAME, null, createValuesFor(common)); } }
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 commonFtsObject, String tablename, String[] columns); }
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 commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
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 commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void testSaveCredentialsUpdatesSharedPreferencesWithEncryptedPassphrase() { Mockito.doReturn(syncConfiguration).when(coreLibrary).getSyncConfiguration(); Mockito.doReturn(SyncFilter.TEAM_ID).when(syncConfiguration).getEncryptionParam(); credentialsHelper.saveCredentials(CredentialsHelper.CREDENTIALS_TYPE.DB_AUTH, TEST_ENCRYPTED_PWD); ArgumentCaptor<String> encryptionValueArgCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<String> encryptionParamArgCaptor = ArgumentCaptor.forClass(String.class); Mockito.verify(allSharedPreferences, Mockito.times(1)).savePassphrase(encryptionValueArgCaptor.capture(), encryptionParamArgCaptor.capture()); Assert.assertEquals(TEST_ENCRYPTED_PWD, encryptionValueArgCaptor.getValue()); Assert.assertEquals(SyncFilter.TEAM_ID.name(), encryptionParamArgCaptor.getValue()); }
public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void findByCaseIDCallsDatabaseQuery1times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); Assert.assertNotNull(commonRepository.findByCaseID("")); Mockito.verify(sqliteDatabase, Mockito.times(1)).query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class)); }
public CommonPersonObject findByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByCaseID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void findByBaseEntityIdCallsDatabaseQuery1times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); Assert.assertNotNull(commonRepository.findByBaseEntityId("")); Mockito.verify(sqliteDatabase, Mockito.times(1)).query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class)); }
public CommonPersonObject findByBaseEntityId(String baseEntityId) { Cursor cursor = null; try { cursor = masterRepository.getReadableDatabase().query(TABLE_NAME, common_TABLE_COLUMNS, BASE_ENTITY_ID_COLUMN + " = ? " + "COLLATE NOCASE ", new String[]{baseEntityId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return null; }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByBaseEntityId(String baseEntityId) { Cursor cursor = null; try { cursor = masterRepository.getReadableDatabase().query(TABLE_NAME, common_TABLE_COLUMNS, BASE_ENTITY_ID_COLUMN + " = ? " + "COLLATE NOCASE ", new String[]{baseEntityId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return null; } }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByBaseEntityId(String baseEntityId) { Cursor cursor = null; try { cursor = masterRepository.getReadableDatabase().query(TABLE_NAME, common_TABLE_COLUMNS, BASE_ENTITY_ID_COLUMN + " = ? " + "COLLATE NOCASE ", new String[]{baseEntityId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return null; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByBaseEntityId(String baseEntityId) { Cursor cursor = null; try { cursor = masterRepository.getReadableDatabase().query(TABLE_NAME, common_TABLE_COLUMNS, BASE_ENTITY_ID_COLUMN + " = ? " + "COLLATE NOCASE ", new String[]{baseEntityId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return null; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findByBaseEntityId(String baseEntityId) { Cursor cursor = null; try { cursor = masterRepository.getReadableDatabase().query(TABLE_NAME, common_TABLE_COLUMNS, BASE_ENTITY_ID_COLUMN + " = ? " + "COLLATE NOCASE ", new String[]{baseEntityId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return null; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void findByGOBHHIDCallsDatabaseQuery1times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); Assert.assertNotNull(commonRepository.findHHByGOBHHID("")); Mockito.verify(sqliteDatabase, Mockito.times(1)).query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class)); }
public CommonPersonObject findHHByGOBHHID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, "FWGOBHHID" + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } }
CommonRepository extends DrishtiRepository { public CommonPersonObject findHHByGOBHHID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, "FWGOBHHID" + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } }
CommonRepository extends DrishtiRepository { public CommonPersonObject findHHByGOBHHID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, "FWGOBHHID" + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findHHByGOBHHID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, "FWGOBHHID" + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public CommonPersonObject findHHByGOBHHID(String caseId) { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, "FWGOBHHID" + " = ?", new String[]{caseId}, null, null, null, null); List<CommonPersonObject> commons = readAllcommon(cursor); if (commons.isEmpty()) { return null; } return commons.get(0); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void allcommonCallsDatabaseQuery1times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); Assert.assertNotNull(commonRepository.allcommon()); Mockito.verify(sqliteDatabase, Mockito.times(1)).query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class)); }
public List<CommonPersonObject> allcommon() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, null, null, null, null, null, null); return readAllcommon(cursor); } finally { if (cursor != null) { cursor.close(); } } }
CommonRepository extends DrishtiRepository { public List<CommonPersonObject> allcommon() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, null, null, null, null, null, null); return readAllcommon(cursor); } finally { if (cursor != null) { cursor.close(); } } } }
CommonRepository extends DrishtiRepository { public List<CommonPersonObject> allcommon() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, null, null, null, null, null, null); return readAllcommon(cursor); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public List<CommonPersonObject> allcommon() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, null, null, null, null, null, null); return readAllcommon(cursor); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public List<CommonPersonObject> allcommon() { SQLiteDatabase database = masterRepository.getReadableDatabase(); Cursor cursor = null; try { cursor = database .query(TABLE_NAME, common_TABLE_COLUMNS, null, null, null, null, null, null); return readAllcommon(cursor); } finally { if (cursor != null) { cursor.close(); } } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void readAllcommonforCursorAdapterReturnsNotNUll() throws Exception { String[] columns = new String[]{"_id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); matrixCursor.addRow(new Object[]{"caseID2", "relationalID2", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); matrixCursor.moveToFirst(); Assert.assertNotNull(commonRepository.readAllcommonforCursorAdapter(matrixCursor)); }
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(i); String value = cursor.getString(cursor.getColumnIndex(columnName)); columns.put(columnName, value); } CommonPersonObject common = getCommonPersonObjectFromCursor(cursor); common.setColumnmaps(columns); return common; }
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(i); String value = cursor.getString(cursor.getColumnIndex(columnName)); columns.put(columnName, value); } CommonPersonObject common = getCommonPersonObjectFromCursor(cursor); common.setColumnmaps(columns); return common; } }
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(i); String value = cursor.getString(cursor.getColumnIndex(columnName)); columns.put(columnName, value); } CommonPersonObject common = getCommonPersonObjectFromCursor(cursor); common.setColumnmaps(columns); return common; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
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(i); String value = cursor.getString(cursor.getColumnIndex(columnName)); columns.put(columnName, value); } CommonPersonObject common = getCommonPersonObjectFromCursor(cursor); common.setColumnmaps(columns); return common; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
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(i); String value = cursor.getString(cursor.getColumnIndex(columnName)); columns.put(columnName, value); } CommonPersonObject common = getCommonPersonObjectFromCursor(cursor); common.setColumnmaps(columns); return common; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void readAllcommonforFieldReturnsNotNUll() throws Exception { String[] columns = new String[]{"_id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{0, 0, 0, 0}); matrixCursor.addRow(new Object[]{1, 1, 1, 1}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); matrixCursor.moveToFirst(); Assert.assertNotNull(commonRepository.readAllcommonForField(matrixCursor, "")); }
public List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName) { List<CommonPersonObject> commons = new ArrayList<CommonPersonObject>(); try { cursor.moveToFirst(); while (!cursor.isAfterLast()) { int columncount = cursor.getColumnCount(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { columns.put(cursor.getColumnName(i), String.valueOf(cursor.getInt(i))); } CommonPersonObject common = new CommonPersonObject("1", "0", null, tableName); common.setClosed((short) 0); common.setColumnmaps(columns); commons.add(common); cursor.moveToNext(); } } catch (Exception e) { Timber.e(e); } finally { cursor.close(); } return commons; }
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(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { columns.put(cursor.getColumnName(i), String.valueOf(cursor.getInt(i))); } CommonPersonObject common = new CommonPersonObject("1", "0", null, tableName); common.setClosed((short) 0); common.setColumnmaps(columns); commons.add(common); cursor.moveToNext(); } } catch (Exception e) { Timber.e(e); } finally { cursor.close(); } return commons; } }
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(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { columns.put(cursor.getColumnName(i), String.valueOf(cursor.getInt(i))); } CommonPersonObject common = new CommonPersonObject("1", "0", null, tableName); common.setClosed((short) 0); common.setColumnmaps(columns); commons.add(common); cursor.moveToNext(); } } catch (Exception e) { Timber.e(e); } finally { cursor.close(); } return commons; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
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(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { columns.put(cursor.getColumnName(i), String.valueOf(cursor.getInt(i))); } CommonPersonObject common = new CommonPersonObject("1", "0", null, tableName); common.setClosed((short) 0); common.setColumnmaps(columns); commons.add(common); cursor.moveToNext(); } } catch (Exception e) { Timber.e(e); } finally { cursor.close(); } return commons; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
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(); HashMap<String, String> columns = new HashMap<String, String>(); for (int i = 0; i < columncount; i++) { columns.put(cursor.getColumnName(i), String.valueOf(cursor.getInt(i))); } CommonPersonObject common = new CommonPersonObject("1", "0", null, tableName); common.setClosed((short) 0); common.setColumnmaps(columns); commons.add(common); cursor.moveToNext(); } } catch (Exception e) { Timber.e(e); } finally { cursor.close(); } return commons; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void updateDetailsCallsDatabaseUpdate1Times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); matrixCursor.addRow(new Object[]{"caseID2", "relationalID2", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); commonRepository.updateDetails("caseID", new HashMap<String, String>()); Mockito.verify(sqliteDatabase, Mockito.times(1)).update(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(ContentValues.class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class)); }
public void updateDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(details)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); }
CommonRepository extends DrishtiRepository { public void updateDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(details)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } }
CommonRepository extends DrishtiRepository { public void updateDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(details)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public void updateDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(details)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public void updateDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(details)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void mergeDetailsCallsDatabaseUpdate1Times() throws Exception { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor matrixCursor = new MatrixCursor(columns); matrixCursor.addRow(new Object[]{"caseID", "relationalID", new HashMap<String, String>(), 0}); matrixCursor.addRow(new Object[]{"caseID2", "relationalID2", new HashMap<String, String>(), 0}); String tablename = ""; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); Mockito.when(sqliteDatabase.query(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class), org.mockito.ArgumentMatchers.isNull(String.class))).thenReturn(matrixCursor); commonRepository.mergeDetails("caseID", new HashMap<String, String>()); Mockito.verify(sqliteDatabase, Mockito.times(1)).update(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(ContentValues.class), org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.any(String[].class)); }
public void mergeDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } Map<String, String> mergedDetails = new HashMap<String, String>(common.getDetails()); mergedDetails.putAll(details); ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(mergedDetails)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); }
CommonRepository extends DrishtiRepository { public void mergeDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } Map<String, String> mergedDetails = new HashMap<String, String>(common.getDetails()); mergedDetails.putAll(details); ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(mergedDetails)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } }
CommonRepository extends DrishtiRepository { public void mergeDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } Map<String, String> mergedDetails = new HashMap<String, String>(common.getDetails()); mergedDetails.putAll(details); ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(mergedDetails)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public void mergeDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } Map<String, String> mergedDetails = new HashMap<String, String>(common.getDetails()); mergedDetails.putAll(details); ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(mergedDetails)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public void mergeDetails(String caseId, Map<String, String> details) { SQLiteDatabase database = masterRepository.getWritableDatabase(); CommonPersonObject common = findByCaseID(caseId); if (common == null) { return; } Map<String, String> mergedDetails = new HashMap<String, String>(common.getDetails()); mergedDetails.putAll(details); ContentValues valuesToUpdate = new ContentValues(); valuesToUpdate.put(DETAILS_COLUMN, new Gson().toJson(mergedDetails)); database.update(TABLE_NAME, valuesToUpdate, ID_COLUMN + " = ?", new String[]{caseId}); } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void assertOnCreateCallsDatabaseExec() { String tablename = ""; String[] tableColumns = new String[]{CommonRepository.Relational_Underscore_ID, CommonRepository.BASE_ENTITY_ID_COLUMN, ADDITIONALCOLUMN, CUSTOMRELATIONALID}; commonFtsObject = Mockito.mock(CommonFtsObject.class); Mockito.when(commonFtsObject.getCustomRelationalId(Mockito.anyString())).thenReturn(CUSTOMRELATIONALID); CommonRepository commonRepository = new CommonRepository(commonFtsObject, tablename, tableColumns); Assert.assertNotNull(commonRepository); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); repository = Mockito.mock(Repository.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.onCreate(sqliteDatabase); Mockito.verify(sqliteDatabase, Mockito.times(6)).execSQL(Mockito.anyString()); }
@Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); if (StringUtils.isNotBlank(common_ID_INDEX_SQL)) { database.execSQL(common_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_ID_INDEX_SQL)) { database.execSQL(common_Relational_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_Underscore_ID_INDEX_SQL)) { database.execSQL(common_Relational_Underscore_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Base_Entity_ID_INDEX_SQL)) { database.execSQL(common_Base_Entity_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Custom_Relational_ID_INDEX_SQL)) { database.execSQL(common_Custom_Relational_ID_INDEX_SQL); } }
CommonRepository extends DrishtiRepository { @Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); if (StringUtils.isNotBlank(common_ID_INDEX_SQL)) { database.execSQL(common_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_ID_INDEX_SQL)) { database.execSQL(common_Relational_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_Underscore_ID_INDEX_SQL)) { database.execSQL(common_Relational_Underscore_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Base_Entity_ID_INDEX_SQL)) { database.execSQL(common_Base_Entity_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Custom_Relational_ID_INDEX_SQL)) { database.execSQL(common_Custom_Relational_ID_INDEX_SQL); } } }
CommonRepository extends DrishtiRepository { @Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); if (StringUtils.isNotBlank(common_ID_INDEX_SQL)) { database.execSQL(common_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_ID_INDEX_SQL)) { database.execSQL(common_Relational_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_Underscore_ID_INDEX_SQL)) { database.execSQL(common_Relational_Underscore_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Base_Entity_ID_INDEX_SQL)) { database.execSQL(common_Base_Entity_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Custom_Relational_ID_INDEX_SQL)) { database.execSQL(common_Custom_Relational_ID_INDEX_SQL); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { @Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); if (StringUtils.isNotBlank(common_ID_INDEX_SQL)) { database.execSQL(common_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_ID_INDEX_SQL)) { database.execSQL(common_Relational_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_Underscore_ID_INDEX_SQL)) { database.execSQL(common_Relational_Underscore_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Base_Entity_ID_INDEX_SQL)) { database.execSQL(common_Base_Entity_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Custom_Relational_ID_INDEX_SQL)) { database.execSQL(common_Custom_Relational_ID_INDEX_SQL); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { @Override public void onCreate(SQLiteDatabase database) { database.execSQL(common_SQL); if (StringUtils.isNotBlank(common_ID_INDEX_SQL)) { database.execSQL(common_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_ID_INDEX_SQL)) { database.execSQL(common_Relational_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Relational_Underscore_ID_INDEX_SQL)) { database.execSQL(common_Relational_Underscore_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Base_Entity_ID_INDEX_SQL)) { database.execSQL(common_Base_Entity_ID_INDEX_SQL); } if (StringUtils.isNotBlank(common_Custom_Relational_ID_INDEX_SQL)) { database.execSQL(common_Custom_Relational_ID_INDEX_SQL); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void assertCloseCaseCallsDatabaseExec() { String tablename = "table"; String baseEntityId = "1"; String[] tableColumns = new String[]{CommonRepository.Relational_Underscore_ID, CommonRepository.BASE_ENTITY_ID_COLUMN, ADDITIONALCOLUMN, CUSTOMRELATIONALID}; commonFtsObject = Mockito.mock(CommonFtsObject.class); CommonRepository commonRepository = new CommonRepository(commonFtsObject, tablename, tableColumns); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); repository = Mockito.mock(Repository.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.closeCase(baseEntityId, tablename); commonRepository.updateMasterRepository(repository); commonRepository.closeCase(baseEntityId, tablename); Mockito.verify(sqliteDatabase,Mockito.times(1)).update(Mockito.anyString(), Mockito.any(ContentValues.class), Mockito.anyString(),Mockito.any(String[].class)); }
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 String[]{baseEntityId}); } catch (Exception e) { Timber.e(e); } }
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 String[]{baseEntityId}); } catch (Exception e) { Timber.e(e); } } }
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 String[]{baseEntityId}); } catch (Exception e) { Timber.e(e); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
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 String[]{baseEntityId}); } catch (Exception e) { Timber.e(e); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
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 String[]{baseEntityId}); } catch (Exception e) { Timber.e(e); } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void testSaveCredentialsUpdatesSharedPreferencesWithNewDBEncryptionVersion() { Mockito.doReturn(SyncFilter.LOCATION_ID).when(syncConfiguration).getEncryptionParam(); credentialsHelper.saveCredentials(CredentialsHelper.CREDENTIALS_TYPE.DB_AUTH, TEST_ENCRYPTED_PWD); ArgumentCaptor<Integer> encryptionValueArgCaptor = ArgumentCaptor.forClass(Integer.class); Mockito.verify(allSharedPreferences, Mockito.times(1)).setDBEncryptionVersion(encryptionValueArgCaptor.capture()); Assert.assertEquals((Integer) BuildConfig.DB_ENCRYPTION_VERSION, encryptionValueArgCaptor.getValue()); }
public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public void saveCredentials(String type, String encryptedPassphrase) { if (CREDENTIALS_TYPE.DB_AUTH.equals(type)) { allSharedPreferences.savePassphrase(encryptedPassphrase, CoreLibrary.getInstance().getSyncConfiguration().getEncryptionParam().name()); allSharedPreferences.setDBEncryptionVersion(BuildConfig.DB_ENCRYPTION_VERSION); } } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void assertDeleteCaseCallsDatabaseExec() { String tablename = "table"; String baseEntityId = "1"; String[] tableColumns = new String[]{CommonRepository.Relational_Underscore_ID, CommonRepository.BASE_ENTITY_ID_COLUMN, ADDITIONALCOLUMN, CUSTOMRELATIONALID}; commonFtsObject = Mockito.mock(CommonFtsObject.class); CommonRepository commonRepository = new CommonRepository(commonFtsObject, tablename, tableColumns); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); repository = Mockito.mock(Repository.class); Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); Assert.assertEquals(commonRepository.deleteCase(baseEntityId, tablename), false); Mockito.when(sqliteDatabase.delete(Mockito.anyString(), Mockito.anyString(), Mockito.any(String[].class))).thenReturn(1); commonRepository.updateMasterRepository(repository); Assert.assertEquals(commonRepository.deleteCase(baseEntityId, tablename), true); }
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 (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; }
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 (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; } }
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 (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
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 (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
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 (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void assertRawQueryReturnsMap() { String[] columns = new String[]{"id", "relationalid", "details", "is_closed"}; MatrixCursor cursor = new MatrixCursor(columns); cursor.addRow(new Object[]{"caseID", "relationalID", "dd1", "0"}); cursor.addRow(new Object[]{"caseID2", "relationalID2", "dd2", "0"}); String tablename = "table"; String[] tableColumns = new String[]{CommonRepository.Relational_Underscore_ID, CommonRepository.BASE_ENTITY_ID_COLUMN, ADDITIONALCOLUMN, CUSTOMRELATIONALID}; commonFtsObject = Mockito.mock(CommonFtsObject.class); Mockito.when(commonFtsObject.getCustomRelationalId(Mockito.anyString())).thenReturn(CUSTOMRELATIONALID); CommonRepository commonRepository = new CommonRepository(commonFtsObject, tablename, tableColumns); Assert.assertNotNull(commonRepository); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); repository = Mockito.mock(Repository.class); String baseEntityId = "1"; String query = "SELECT * FROM " + tablename + " WHERE base_entity_id = ?"; Mockito.when(repository.getReadableDatabase()).thenReturn(sqliteDatabase); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); Mockito.when(sqliteDatabase.rawQuery(query, null)).thenReturn(cursor); commonRepository.updateMasterRepository(repository); Assert.assertNotNull(commonRepository.rawQuery(query, new String[]{baseEntityId})); }
public ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs) { ArrayList<HashMap<String, String>> maplist = new ArrayList<HashMap<String, String>>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQuery(sql, selectionArgs); if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { do { HashMap<String, String> map = new HashMap<String, String>(); for (int i = 0; i < cursor.getColumnCount(); i++) { map.put(cursor.getColumnName(i), cursor.getString(i)); } maplist.add(map); } while (cursor.moveToNext()); } } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return maplist; }
CommonRepository extends DrishtiRepository { public ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs) { ArrayList<HashMap<String, String>> maplist = new ArrayList<HashMap<String, String>>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQuery(sql, selectionArgs); if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { do { HashMap<String, String> map = new HashMap<String, String>(); for (int i = 0; i < cursor.getColumnCount(); i++) { map.put(cursor.getColumnName(i), cursor.getString(i)); } maplist.add(map); } while (cursor.moveToNext()); } } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return maplist; } }
CommonRepository extends DrishtiRepository { public ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs) { ArrayList<HashMap<String, String>> maplist = new ArrayList<HashMap<String, String>>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQuery(sql, selectionArgs); if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { do { HashMap<String, String> map = new HashMap<String, String>(); for (int i = 0; i < cursor.getColumnCount(); i++) { map.put(cursor.getColumnName(i), cursor.getString(i)); } maplist.add(map); } while (cursor.moveToNext()); } } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return maplist; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs) { ArrayList<HashMap<String, String>> maplist = new ArrayList<HashMap<String, String>>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQuery(sql, selectionArgs); if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { do { HashMap<String, String> map = new HashMap<String, String>(); for (int i = 0; i < cursor.getColumnCount(); i++) { map.put(cursor.getColumnName(i), cursor.getString(i)); } maplist.add(map); } while (cursor.moveToNext()); } } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return maplist; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs) { ArrayList<HashMap<String, String>> maplist = new ArrayList<HashMap<String, String>>(); Cursor cursor = null; try { SQLiteDatabase database = masterRepository.getReadableDatabase(); cursor = database.rawQuery(sql, selectionArgs); if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) { do { HashMap<String, String> map = new HashMap<String, String>(); for (int i = 0; i < cursor.getColumnCount(); i++) { map.put(cursor.getColumnName(i), cursor.getString(i)); } maplist.add(map); } while (cursor.moveToNext()); } } catch (Exception e) { Timber.e(e); } finally { if (cursor != null) { cursor.close(); } } return maplist; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void deleteSearchRecordShouldReturnTrueAndCommitTransaction() { String tablename = "ec_client"; String[] tableColumns = new String[]{}; commonRepository = new CommonRepository(tablename, tableColumns); repository = Mockito.mock(Repository.class); sqliteDatabase = Mockito.mock(SQLiteDatabase.class); Mockito.when(repository.getWritableDatabase()).thenReturn(sqliteDatabase); commonRepository.updateMasterRepository(repository); ArgumentCaptor<String[]> caseIdCaptor = ArgumentCaptor.forClass(String[].class); Mockito.doReturn(2).when(sqliteDatabase).delete(Mockito.eq("ec_client_search"), Mockito.eq("object_id = ?"), caseIdCaptor.capture()); String caseId = "my-case-id"; Assert.assertTrue(commonRepository.deleteSearchRecord(caseId)); Assert.assertEquals(caseId, caseIdCaptor.getValue()[0]); Mockito.verify(sqliteDatabase).beginTransaction(); Mockito.verify(sqliteDatabase).setTransactionSuccessful(); Mockito.verify(sqliteDatabase).endTransaction(); }
public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void deleteSearchRecordShouldReturnFalseAndEndTransactionWhenExceptionOccurs() { ArgumentCaptor<String[]> caseIdCaptor = ArgumentCaptor.forClass(String[].class); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { throw new Exception("An error occurred"); } }).when(sqliteDatabase).delete(Mockito.eq("ec_client_search"), Mockito.eq("object_id = ?"), caseIdCaptor.capture()); String caseId = "my-case-id"; Assert.assertFalse(commonRepository.deleteSearchRecord(caseId)); Assert.assertEquals(caseId, caseIdCaptor.getValue()[0]); Mockito.verify(sqliteDatabase).beginTransaction(); Mockito.verify(sqliteDatabase, Mockito.times(0)).setTransactionSuccessful(); Mockito.verify(sqliteDatabase).endTransaction(); }
public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public boolean deleteSearchRecord(String caseId) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { int afftectedRows = database .delete(ftsSearchTable, CommonFtsObject.idColumn + " = " + "?", new String[]{caseId}); database.setTransactionSuccessful(); database.endTransaction(); if (afftectedRows > 0) { return true; } } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); } return false; } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void searchBatchInsertsShouldReturnFalse() { HashMap<String, ContentValues> searchMap = new HashMap<>(); ContentValues contentValues = new ContentValues(); searchMap.put("sample-case-id", contentValues); Mockito.doThrow(new SQLException("Some exception")).when(sqliteDatabase).insert(Mockito.eq(tablename + "_search"), Mockito.nullable(String.class), Mockito.eq(contentValues)); Assert.assertFalse(commonRepository.searchBatchInserts(searchMap)); Mockito.verify(sqliteDatabase).endTransaction(); Mockito.verify(sqliteDatabase, Mockito.times(0)).setTransactionSuccessful(); }
public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void searchBatchInsertsShouldReturnTrueAndCallSqliteDbInsert() { HashMap<String, ContentValues> searchMap = new HashMap<>(); ContentValues contentValues = new ContentValues(); searchMap.put("sample-case-id", contentValues); Assert.assertTrue(commonRepository.searchBatchInserts(searchMap)); Mockito.verify(sqliteDatabase).insert(Mockito.eq(tablename + "_search"), Mockito.nullable(String.class), Mockito.eq(contentValues)); Mockito.verify(sqliteDatabase).endTransaction(); Mockito.verify(sqliteDatabase).setTransactionSuccessful(); }
public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); }
CommonRepository extends DrishtiRepository { public boolean searchBatchInserts(Map<String, ContentValues> searchMap) { SQLiteDatabase database = masterRepository.getWritableDatabase(); database.beginTransaction(); String ftsSearchTable = CommonFtsObject.searchTableName(TABLE_NAME); try { for (String caseId : searchMap.keySet()) { ContentValues searchValues = searchMap.get(caseId); ArrayList<HashMap<String, String>> mapList = rawQuery( "SELECT " + CommonFtsObject.idColumn + " FROM " + ftsSearchTable + " WHERE " + CommonFtsObject.idColumn + " = ?", new String[]{caseId}); if (!mapList.isEmpty()) { int updated = database.update(ftsSearchTable, searchValues, CommonFtsObject.idColumn + " = " + "" + "?", new String[]{caseId}); Timber.i("Fts Row Updated: %s", String.valueOf(updated)); } else { long rowId = database.insert(ftsSearchTable, null, searchValues); Timber.i("Details Row Inserted : %s", String.valueOf(rowId)); } } database.setTransactionSuccessful(); database.endTransaction(); return true; } catch (Exception e) { Timber.e(e, "Update Search Error"); database.endTransaction(); return false; } } CommonRepository(String tablename, String[] columns); CommonRepository(CommonFtsObject commonFtsObject, String tablename, String[] columns); @Override void onCreate(SQLiteDatabase database); void add(CommonPersonObject common); void updateDetails(String caseId, Map<String, String> details); void mergeDetails(String caseId, Map<String, String> details); List<CommonPersonObject> allcommon(); List<CommonPersonObject> findByCaseIDs(String... caseIds); List<CommonPersonObject> findByRelationalIDs(String... caseIds); List<CommonPersonObject> findByRelational_IDs(String... caseIds); CommonPersonObject findByCaseID(String caseId); CommonPersonObject findByBaseEntityId(String baseEntityId); CommonPersonObject findHHByGOBHHID(String caseId); long count(); void close(String caseId); void updateColumn(String tableName, ContentValues contentValues, String caseId); List<CommonPersonObject> customQuery(String sql, String[] selections, String tableName); List<CommonPersonObject> readAllcommonForField(Cursor cursor, String tableName); List<CommonPersonObject> customQueryForCompleteRow(String sql, String[] selections, String tableName); Cursor rawCustomQueryForAdapter(String query); CommonPersonObject readAllcommonforCursorAdapter(Cursor cursor); CommonPersonObject getCommonPersonObjectFromCursor(Cursor cursor); Long executeInsertStatement(ContentValues values, String tableName); Map<String, String> sqliteRowToMap(Cursor cursor); Cursor queryTable(String query); void closeCase(String baseEntityId, String tableName); boolean deleteCase(String baseEntityId, String tableName); ArrayList<HashMap<String, String>> rawQuery(String sql, String[] selectionArgs); ContentValues populateSearchValues(String caseId); boolean populateSearchValues(String caseId, String field, String value, String[] listToRemove); boolean searchBatchInserts(Map<String, ContentValues> searchMap); boolean deleteSearchRecord(String caseId); List<String> findSearchIds(String query); int countSearchIds(String query); boolean isFts(); static final String ID_COLUMN; static final String Relational_ID; static final String Relational_Underscore_ID; static final String DETAILS_COLUMN; static final String IS_CLOSED_COLUMN; static final String BASE_ENTITY_ID_COLUMN; public String TABLE_NAME; public String[] common_TABLE_COLUMNS; final int initialColumnCount; public String[] additionalcolumns; }
@Test public void testSearchTableNameShouldReturnCorrectSearchTableName() { assertEquals("table1_search", commonFtsObject.searchTableName("table1")); }
public static String searchTableName(String table) { return table + "_search"; }
CommonFtsObject { public static String searchTableName(String table) { return table + "_search"; } }
CommonFtsObject { public static String searchTableName(String table) { return table + "_search"; } CommonFtsObject(String[] tables); }
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 updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); }
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 updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); static final String idColumn; static final String relationalIdColumn; static final String phraseColumn; static final String isClosedColumn; static final String isClosedColumnName; }
@Test public void testContainsTableShouldReturnCorrectStatus() { assertTrue(commonFtsObject.containsTable("table1")); assertFalse(commonFtsObject.containsTable("table100")); }
public boolean containsTable(String table) { if (tables == null || StringUtils.isBlank(table)) { return false; } List<String> tableList = Arrays.asList(tables); return tableList.contains(table); }
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 { 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); }
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 updateSearchFields(String table, String[] searchFields); void updateSortFields(String table, String[] sortFields); void updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); }
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 updateSearchFields(String table, String[] searchFields); void updateSortFields(String table, String[] sortFields); void updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); static final String idColumn; static final String relationalIdColumn; static final String phraseColumn; static final String isClosedColumn; static final String isClosedColumnName; }
@Test public void testGetTablesShouldGetAllTables() { assertEquals(tables, commonFtsObject.getTables()); }
public String[] getTables() { if (tables == null) { tables = ArrayUtils.EMPTY_STRING_ARRAY; } return tables; }
CommonFtsObject { public String[] getTables() { if (tables == null) { tables = ArrayUtils.EMPTY_STRING_ARRAY; } return tables; } }
CommonFtsObject { public String[] getTables() { if (tables == null) { tables = ArrayUtils.EMPTY_STRING_ARRAY; } return tables; } CommonFtsObject(String[] tables); }
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, String[] sortFields); void updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); }
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, String[] sortFields); void updateMainConditions(String table, String[] mainConditions); void updateCustomRelationalId(String table, String customRelationalId); void updateAlertScheduleMap(Map<String, Pair<String, Boolean>> alertsScheduleMap); void updateAlertFilterVisitCodes(String[] alertFilterVisitCodes); String[] getTables(); String[] getSearchFields(String table); String[] getSortFields(String table); String[] getMainConditions(String table); String getCustomRelationalId(String table); String getAlertBindType(String schedule); Boolean alertUpdateVisitCode(String schedule); String getAlertScheduleName(String vaccineName); String[] getAlertFilterVisitCodes(); boolean containsTable(String table); static final String idColumn; static final String relationalIdColumn; static final String phraseColumn; static final String isClosedColumn; static final String isClosedColumnName; }
@Test public void testFilterByColumn() { Map<String, String> column1 = EasyMap.create("name", "Woman A").map(); CommonPersonObjectClient expectedClient = new CommonPersonObjectClient("entity id 1", emptyMap, "Woman A"); expectedClient.setColumnmaps(column1); boolean filter = commonObjectFilterOption.filter(expectedClient); assertTrue(filter); }
@Override public boolean filter(SmartRegisterClient client) { switch (byColumnAndByDetails) { case byColumn: return ((CommonPersonObjectClient) client).getColumnmaps().get(fieldname). contains(criteria); case byDetails: return (((CommonPersonObjectClient) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); final String fieldname; }
@Test public void generateLocalAuthCredentials() throws Exception { Assert.assertNotNull(credentialsHelper); PowerMockito.mockStatic(SecurityHelper.class); PowerMockito.when(SecurityHelper.getPasswordHash(TEST_DUMMY_PASSWORD)).thenReturn(null); credentialsHelper.generateLocalAuthCredentials(TEST_DUMMY_PASSWORD); PowerMockito.verifyStatic(SecurityHelper.class); SecurityHelper.getPasswordHash(TEST_DUMMY_PASSWORD); }
public PasswordHash generateLocalAuthCredentials(char[] password) throws InvalidKeySpecException, NoSuchAlgorithmException { if (password == null) return null; return SecurityHelper.getPasswordHash(password); }
CredentialsHelper { public PasswordHash generateLocalAuthCredentials(char[] password) throws InvalidKeySpecException, NoSuchAlgorithmException { if (password == null) return null; return SecurityHelper.getPasswordHash(password); } }
CredentialsHelper { public PasswordHash generateLocalAuthCredentials(char[] password) throws InvalidKeySpecException, NoSuchAlgorithmException { if (password == null) return null; return SecurityHelper.getPasswordHash(password); } CredentialsHelper(Context context); }
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[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
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[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void testFilterOptionName() { assertEquals(filterOptionName, commonObjectFilterOption.name()); }
@Override public String name() { return filterOptionName; }
CommonObjectFilterOption implements FilterOption { @Override public String name() { return filterOptionName; } }
CommonObjectFilterOption implements FilterOption { @Override public String name() { return filterOptionName; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); }
CommonObjectFilterOption implements FilterOption { @Override public String name() { return filterOptionName; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); }
CommonObjectFilterOption implements FilterOption { @Override public String name() { return filterOptionName; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); final String fieldname; }
@Test public void testFilterByDetails() { commonObjectFilterOption = new CommonObjectFilterOption(criteria, fieldname, byDetails, filterOptionName); Map<String, String> detail = EasyMap.create("name", "Woman A").map(); CommonPersonObjectClient expectedClient = new CommonPersonObjectClient("entity id 1", detail, "Woman A"); expectedClient.setColumnmaps(emptyMap); boolean filter = commonObjectFilterOption.filter(expectedClient); assertTrue(filter); }
@Override public boolean filter(SmartRegisterClient client) { switch (byColumnAndByDetails) { case byColumn: return ((CommonPersonObjectClient) client).getColumnmaps().get(fieldname). contains(criteria); case byDetails: return (((CommonPersonObjectClient) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); }
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) client).getDetails().get(fieldname) != null ? ((CommonPersonObjectClient) client).getDetails().get(fieldname) : ""). toLowerCase().contains(criteria.toLowerCase()); } return false; } CommonObjectFilterOption(String criteriaArg, String fieldnameArg, ByColumnAndByDetails byColumnAndByDetailsArg, String filteroptionnameArg); @Override String name(); @Override boolean filter(SmartRegisterClient client); final String fieldname; }
@Test public void shouldSortECsByName() throws Exception { Map<String, String> personDetails1 = EasyMap.create("name", "Woman A").map(); Map<String, String> personDetails2 = EasyMap.create("name", "Woman B").map(); Map<String, String> personDetails3 = EasyMap.create("name", "Woman C").map(); CommonPersonObject cpo2 = new CommonPersonObject("entity id 2", "relational id 2", personDetails2, "bindtype"); cpo2.setColumnmaps(emptyDetails); CommonPersonObject cpo3 = new CommonPersonObject("entity id 3", "relational id 3", personDetails3, "bindtype"); cpo3.setColumnmaps(emptyDetails); CommonPersonObject cpo1 = new CommonPersonObject("entity id 1", "relational id 1", personDetails1, "bindtype"); cpo1.setColumnmaps(emptyDetails); Mockito.when(allCommonsRepository.all()).thenReturn(Arrays.asList(cpo2, cpo3, cpo1)); CommonPersonObjectClient expectedClient1 = new CommonPersonObjectClient("entity id 1", personDetails1, "Woman A"); expectedClient1.setColumnmaps(emptyDetails); CommonPersonObjectClient expectedClient2 = new CommonPersonObjectClient("entity id 2", personDetails2, "Woman B"); expectedClient2.setColumnmaps(emptyDetails); CommonPersonObjectClient expectedClient3 = new CommonPersonObjectClient("entity id 3", personDetails3, "Woman C"); expectedClient3.setColumnmaps(emptyDetails); String clients = controller.get(); Gson gson = new Gson(); String objectlist = gson.toJson(Arrays.asList(expectedClient1, expectedClient2, expectedClient3)); Assert.assertEquals(objectlist, clients); }
public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); final String nameString; public String filterkey; public String filtervalue; public String null_check_key; public boolean filtercase; }
@Test public void shouldMapCommonObjectToCommonObjectClient() throws Exception { Map<String, String> details = EasyMap.create("name", "Woman A").map(); CommonPersonObject commonpersonobject = new CommonPersonObject("entity id 1", "relational id 1", details, "bindtype"); commonpersonobject.setColumnmaps(emptyDetails); Mockito.when(allCommonsRepository.all()).thenReturn(Arrays.asList(commonpersonobject)); CommonPersonObjectClient expectedCommonObjectClient = new CommonPersonObjectClient( "entity id 1", details, "Woman A"); expectedCommonObjectClient.setColumnmaps(emptyDetails); String clients = controller.get(); Gson gson = new Gson(); String objectlist = gson.toJson(Arrays.asList(expectedCommonObjectClient)); Assert.assertEquals(objectlist, clients); }
public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); final String nameString; public String filterkey; public String filtervalue; public String null_check_key; public boolean filtercase; }
@Test public void shouldfilterNullsAccordingToFilterKey() throws Exception { Map<String, String> personDetails1 = EasyMap.create("name", "Woman A").map(); Map<String, String> personDetails2 = EasyMap.create("name", "Woman B").map(); Map<String, String> personDetails3 = emptyDetails; CommonPersonObject cpo2 = new CommonPersonObject("entity id 2", "relational id 2", personDetails2, "bindtype"); cpo2.setColumnmaps(emptyDetails); CommonPersonObject cpo3 = new CommonPersonObject("entity id 3", "relational id 3", personDetails3, "bindtype"); cpo3.setColumnmaps(emptyDetails); CommonPersonObject cpo1 = new CommonPersonObject("entity id 1", "relational id 1", personDetails1, "bindtype"); cpo1.setColumnmaps(emptyDetails); Mockito.when(allCommonsRepository.all()).thenReturn(Arrays.asList(cpo2, cpo3, cpo1)); CommonPersonObjectClient expectedClient1 = new CommonPersonObjectClient("entity id 1", personDetails1, "Woman A"); expectedClient1.setColumnmaps(emptyDetails); CommonPersonObjectClient expectedClient2 = new CommonPersonObjectClient("entity id 2", personDetails2, "Woman B"); expectedClient2.setColumnmaps(emptyDetails); CommonPersonObjectClient expectedClient3 = new CommonPersonObjectClient("entity id 3", personDetails3, "Woman C"); expectedClient3.setColumnmaps(emptyDetails); String clients = controller.get(); Gson gson = new Gson(); String objectlist = gson.toJson(Arrays.asList(expectedClient1, expectedClient2)); Assert.assertEquals(objectlist, clients); }
public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); }
CommonPersonObjectController { public String get() { return cache.get(person_CLIENTS_LIST, new CacheableData<String>() { @Override public String fetch() { List<CommonPersonObject> p = allpersonobjects.all(); updateDetails(p); CommonPersonObjectClients pClients = new CommonPersonObjectClients(); if (filtermap != null) { for (CommonPersonObject personinlist : p) { boolean filter = false; Log.v("is filtermap ", "" + filtermap.size()); for (int k = 0; k < filtermap.size(); k++) { filter = filtermap.get(k).filtermapLogic(personinlist); } if (!isnull(personinlist) && filter) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else if (filterkey == null) { for (CommonPersonObject personinlist : p) { Log.v("is filtermap ", "wrong place"); if (!isnull(personinlist)) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } else { switch (byColumnAndByDetails) { case byColumn: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get(filterkey) != null) { if (personinlist.getColumnmaps().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byDetails: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getDetails().get(filterkey) != null) { if (personinlist.getDetails().get(filterkey) .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } } break; case byrelationalid: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getRelationalId().equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; case byrelational_id: for (CommonPersonObject personinlist : p) { if (!isnull(personinlist)) { if (personinlist.getColumnmaps().get("relational_id") .equalsIgnoreCase(filtervalue) == filtercase) { CommonPersonObjectClient pClient = new CommonPersonObjectClient( personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get(nameString)); pClient.setColumnmaps(personinlist.getColumnmaps()); pClients.add(pClient); } } } break; } } if (sortOption == null) { sortByName(pClients); } else { sortOption.sort(pClients); } return new Gson().toJson(pClients); } }); } CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, String filterkey, String filtervalue, boolean filterCase, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck, SortOption sortOption); CommonPersonObjectController(AllCommonsRepository allpersons, AllBeneficiaries allBeneficiaries, Cache<String> cache, Cache<CommonPersonObjectClients> personClientsCache, String nameString, String bindtype, ArrayList<ControllerFilterMap> filtermap, ByColumnAndByDetails byColumnAndByDetails, String null_check_key, ByColumnAndByDetails byColumnAndByDetailsNullcheck); String get(); CommonPersonObjectClients getClients(); boolean isnull(CommonPersonObject personinlist); final String nameString; public String filterkey; public String filtervalue; public String null_check_key; public boolean filtercase; }
@Test public void testGetOauthAccountByType() { Account account = AccountHelper.getOauthAccountByNameAndType(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE); Assert.assertNotNull(account); Assert.assertEquals(CORE_ACCOUNT_NAME, account.name); }
public static Account getOauthAccountByNameAndType(String accountName, String accountType) { Account[] accounts = accountManager.getAccountsByType(accountType); return accounts.length > 0 ? selectAccount(accounts, accountName) : null; }
AccountHelper { public static Account getOauthAccountByNameAndType(String accountName, String accountType) { Account[] accounts = accountManager.getAccountsByType(accountType); return accounts.length > 0 ? selectAccount(accounts, accountName) : null; } }
AccountHelper { public static Account getOauthAccountByNameAndType(String accountName, String accountType) { Account[] accounts = accountManager.getAccountsByType(accountType); return accounts.length > 0 ? selectAccount(accounts, accountName) : null; } }
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 accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
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 accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testGetAccountManagerValue() { Whitebox.setInternalState(AccountHelper.class, "accountManager", accountManager); Mockito.doReturn(TEST_VALUE).when(accountManager).getUserData(ArgumentMatchers.any(Account.class), ArgumentMatchers.eq(TEST_KEY)); String value = AccountHelper.getAccountManagerValue(TEST_KEY, CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE); Assert.assertNotNull(value); Assert.assertEquals(TEST_VALUE, value); }
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; }
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; } }
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; } }
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 getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
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 getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testGetOAuthToken() throws AuthenticatorException, OperationCanceledException, IOException { Mockito.doReturn(TEST_TOKEN_VALUE).when(accountManager).blockingGetAuthToken(new Account(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE), AUTH_TOKEN_TYPE, true); String myToken = AccountHelper.getOAuthToken(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE, AUTH_TOKEN_TYPE); Assert.assertNotNull(myToken); Assert.assertEquals(TEST_TOKEN_VALUE, myToken); }
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, "EXCEPTION: %s", ex.toString()); return null; } }
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, "EXCEPTION: %s", ex.toString()); return null; } } }
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, "EXCEPTION: %s", ex.toString()); return null; } } }
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, "EXCEPTION: %s", ex.toString()); return null; } } static Account getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
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, "EXCEPTION: %s", ex.toString()); return null; } } static Account getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testInvalidateAuthToken() { AccountHelper.invalidateAuthToken(CORE_ACCOUNT_TYPE, TEST_TOKEN_VALUE); Mockito.verify(accountManager).invalidateAuthToken(CORE_ACCOUNT_TYPE, TEST_TOKEN_VALUE); }
public static void invalidateAuthToken(String accountType, String authToken) { if (authToken != null) accountManager.invalidateAuthToken(accountType, authToken); }
AccountHelper { public static void invalidateAuthToken(String accountType, String authToken) { if (authToken != null) accountManager.invalidateAuthToken(accountType, authToken); } }
AccountHelper { public static void invalidateAuthToken(String accountType, String authToken) { if (authToken != null) accountManager.invalidateAuthToken(accountType, authToken); } }
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[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
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[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testGetCachedOAuthToken() { Account account = new Account(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE); Mockito.doReturn(TEST_TOKEN_VALUE).when(accountManager).peekAuthToken(account, AUTH_TOKEN_TYPE); String cachedAuthToken = AccountHelper.getCachedOAuthToken(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE, AUTH_TOKEN_TYPE); Mockito.verify(accountManager).peekAuthToken(account, AUTH_TOKEN_TYPE); Assert.assertEquals(TEST_TOKEN_VALUE, cachedAuthToken); }
public static String getCachedOAuthToken(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return account != null ? accountManager.peekAuthToken(account, authTokenType) : null; }
AccountHelper { public static String getCachedOAuthToken(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return account != null ? accountManager.peekAuthToken(account, authTokenType) : null; } }
AccountHelper { public static String getCachedOAuthToken(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return account != null ? accountManager.peekAuthToken(account, authTokenType) : null; } }
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 getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
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 getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testGenerateDBCredentialsReturnsCorrectBytesForSyncByProvider() { Mockito.doReturn(SyncFilter.PROVIDER).when(syncConfiguration).getEncryptionParam(); byte[] bytes = credentialsHelper.generateDBCredentials(TEST_DUMMY_PASSWORD, userInfo); Assert.assertTrue(Arrays.equals(SecurityHelper.toBytes(TEST_DUMMY_PASSWORD), bytes)); }
public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void testReAuthenticateUserAfterSessionExpired() { Account account = new Account(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE); Mockito.doReturn(Mockito.mock(AccountManagerFuture.class)).when(accountManager).updateCredentials(account, AUTH_TOKEN_TYPE, null, null, null, null); AccountManagerFuture<Bundle> reAuthenticationFuture = AccountHelper.reAuthenticateUserAfterSessionExpired(CORE_ACCOUNT_NAME, CORE_ACCOUNT_TYPE, AUTH_TOKEN_TYPE); Assert.assertNotNull(reAuthenticationFuture); Mockito.verify(accountManager).updateCredentials(account, AUTH_TOKEN_TYPE, null, null, null, null); }
public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, null, null, null); }
AccountHelper { public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, null, null, null); } }
AccountHelper { public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, null, null, null); } }
AccountHelper { public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, null, null, null); } static Account getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); }
AccountHelper { public static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType) { Account account = getOauthAccountByNameAndType(accountName, accountType); return accountManager.updateCredentials(account, authTokenType, null, null, null, null); } static Account getOauthAccountByNameAndType(String accountName, String accountType); static Account selectAccount(Account[] accounts, String accountName); static String getAccountManagerValue(String key, String accountName, String accountType); static String getOAuthToken(String accountName, String accountType, String authTokenType); static void invalidateAuthToken(String accountType, String authToken); static String getCachedOAuthToken(String accountName, String accountType, String authTokenType); static AccountManagerFuture<Bundle> reAuthenticateUserAfterSessionExpired(String accountName, String accountType, String authTokenType); final static int MAX_AUTH_RETRIES; }
@Test public void testOnCreateViewHolder() { LinearLayout vg = new LinearLayout(context); when(listItemProvider.createViewHolder(any())).thenReturn(mockViewHolder); RecyclerView.ViewHolder actualViewHolder = adapter.onCreateViewHolder(vg, RecyclerViewCursorAdapter.Type.ITEM.ordinal()); assertNotNull(actualViewHolder); verify(listItemProvider).createViewHolder(any()); }
@NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == RecyclerViewCursorAdapter.Type.FOOTER.ordinal()) { return listItemProvider.createFooterHolder(parent); } else { return listItemProvider.createViewHolder(parent); } }
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 listItemProvider.createViewHolder(parent); } } }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); public int totalcount; public int currentlimit; public int currentoffset; }
@Test public void testOnCreateFooterHolder() { LinearLayout vg = new LinearLayout(context); when(listItemProvider.createFooterHolder(any())).thenReturn(mockViewHolder); RecyclerView.ViewHolder actualViewHolder = adapter.onCreateViewHolder(vg, RecyclerViewCursorAdapter.Type.FOOTER.ordinal()); assertNotNull(actualViewHolder); verify(listItemProvider).createFooterHolder(any()); }
@NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == RecyclerViewCursorAdapter.Type.FOOTER.ordinal()) { return listItemProvider.createFooterHolder(parent); } else { return listItemProvider.createViewHolder(parent); } }
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 listItemProvider.createViewHolder(parent); } } }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); }
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 listItemProvider.createViewHolder(parent); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); public int totalcount; public int currentlimit; public int currentoffset; }
@Test public void testOnBindViewHolder() { String name = "John"; Map<String, String> details = new HashMap<>(); details.put("FWHOHFNAME", name); Map<String, String> columnmaps = new HashMap<>(); String idColumn = "baseEntityId"; columnmaps.put("id", idColumn); String caseId = "case 1"; String relationId = "identifier 123"; String type = "bindtype"; CommonPersonObject personInList = new CommonPersonObject(caseId, relationId, details,type); personInList.setColumnmaps(columnmaps); when(commonRepository.readAllcommonforCursorAdapter(mCursor)).thenReturn(personInList); adapter.onBindViewHolder(mockViewHolder, mCursor); verify(listItemProvider).getView(cursorArgumentCaptor.capture(), personObjectClientArgumentCaptor.capture(), viewHolderArgumentCaptor.capture()); assertEquals(mockViewHolder, viewHolderArgumentCaptor.getValue()); assertEquals(mCursor, cursorArgumentCaptor.getValue()); assertEquals(name, personObjectClientArgumentCaptor.getValue().getName()); assertEquals(caseId, personObjectClientArgumentCaptor.getValue().getCaseId()); assertEquals(idColumn, personObjectClientArgumentCaptor.getValue().getColumnmaps().get("id")); }
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNextPage(), hasPreviousPage()); } else { CommonPersonObject personinlist = commonRepository.readAllcommonforCursorAdapter(cursor); CommonPersonObjectClient pClient = new CommonPersonObjectClient(personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get("FWHOHFNAME")); pClient.setColumnmaps(personinlist.getColumnmaps()); listItemProvider.getView(cursor, pClient, viewHolder); } }
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNextPage(), hasPreviousPage()); } else { CommonPersonObject personinlist = commonRepository.readAllcommonforCursorAdapter(cursor); CommonPersonObjectClient pClient = new CommonPersonObjectClient(personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get("FWHOHFNAME")); pClient.setColumnmaps(personinlist.getColumnmaps()); listItemProvider.getView(cursor, pClient, viewHolder); } } }
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNextPage(), hasPreviousPage()); } else { CommonPersonObject personinlist = commonRepository.readAllcommonforCursorAdapter(cursor); CommonPersonObjectClient pClient = new CommonPersonObjectClient(personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get("FWHOHFNAME")); pClient.setColumnmaps(personinlist.getColumnmaps()); listItemProvider.getView(cursor, pClient, viewHolder); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); }
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNextPage(), hasPreviousPage()); } else { CommonPersonObject personinlist = commonRepository.readAllcommonforCursorAdapter(cursor); CommonPersonObjectClient pClient = new CommonPersonObjectClient(personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get("FWHOHFNAME")); pClient.setColumnmaps(personinlist.getColumnmaps()); listItemProvider.getView(cursor, pClient, viewHolder); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); }
RecyclerViewPaginatedAdapter extends RecyclerViewCursorAdapter { @Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor) { if (listItemProvider.isFooterViewHolder(viewHolder)) { listItemProvider.getFooterView(viewHolder, getCurrentPageCount(), getTotalPageCount(), hasNextPage(), hasPreviousPage()); } else { CommonPersonObject personinlist = commonRepository.readAllcommonforCursorAdapter(cursor); CommonPersonObjectClient pClient = new CommonPersonObjectClient(personinlist.getCaseId(), personinlist.getDetails(), personinlist.getDetails().get("FWHOHFNAME")); pClient.setColumnmaps(personinlist.getColumnmaps()); listItemProvider.getView(cursor, pClient, viewHolder); } } RecyclerViewPaginatedAdapter(Cursor cursor, RecyclerViewProvider<RecyclerView.ViewHolder> listItemProvider, CommonRepository commonRepository); @NonNull @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override void onBindViewHolder(RecyclerView.ViewHolder viewHolder, Cursor cursor); boolean hasNextPage(); boolean hasPreviousPage(); void nextPageOffset(); void previousPageOffset(); void setTotalcount(int totalcount); int getTotalcount(); void setCurrentoffset(int currentoffset); int getCurrentoffset(); void setCurrentlimit(int currentlimit); int getCurrentlimit(); public int totalcount; public int currentlimit; public int currentoffset; }
@Test public void shouldNotDownloadIfThereIsNoPendingForms() throws Exception { Mockito.when(formsVersionRepository.getAllFormWithSyncStatus(SyncStatus.PENDING)).thenReturn( Collections.<FormDefinitionVersion>emptyList()); DownloadStatus status = service.downloadAllPendingFormFromServer(); Assert.assertEquals(status, DownloadStatus.nothingDownloaded); Mockito.verify(formsVersionRepository).getAllFormWithSyncStatus(SyncStatus.PENDING); Mockito.verifyNoMoreInteractions(formsVersionRepository); Mockito.verifyZeroInteractions(httpAgent); }
public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
@Test public void shouldDownloadIfThereIsAPendingForms() throws Exception { Mockito.when(formsVersionRepository.getAllFormWithSyncStatus(SyncStatus.PENDING)).thenReturn( this.expectedFormDefinitionVersion); Mockito.when(httpAgent.downloadFromUrl("http: "ec_dir.zip")).thenReturn(DownloadStatus.downloaded); DownloadStatus status = service.downloadAllPendingFormFromServer(); Assert.assertEquals(status, DownloadStatus.downloaded); Mockito.verify(formsVersionRepository).getAllFormWithSyncStatus(SyncStatus.PENDING); Mockito.verify(httpAgent).downloadFromUrl( "http: "ec_dir.zip"); }
public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
AllFormVersionSyncService { public DownloadStatus downloadAllPendingFormFromServer() { DownloadStatus status = DownloadStatus.nothingDownloaded; List<FormDefinitionVersion> pendingFormList = formsVersionRepository. getAllFormWithSyncStatus(SyncStatus.PENDING); if (pendingFormList.isEmpty()) { return status; } else { for (FormDefinitionVersion l : pendingFormList) { String downloadLink = configuration.dristhiBaseURL() + AllConstants.FORM_DOWNLOAD_URL + l .getFormDirName(); status = httpAgent.downloadFromUrl(downloadLink, l.getFormDirName() + ".zip"); if (status == DownloadStatus.downloaded) { formsVersionRepository.updateSyncStatus(l.getFormDirName(), SyncStatus.SYNCED); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
@Test public void shouldUpdateVersionIfThereIsNewerVersion() throws Exception { String jsonObject = "{\"formVersions\" : [{\"formName\": \"EC_ENGKAN\", \"formDirName\": " + "\"ec_dir\", \"formDataDefinitionVersion\": \"3\"}] }"; Mockito.when(httpAgent.fetch("http: new Response<String>( success, jsonObject)); List<FormDefinitionVersion> repoForm = Arrays.asList(new FormDefinitionVersion("form_ec", "ec_dir", "1")); Mockito.when(formsVersionRepository.formExists("ec_dir")).thenReturn(true); Mockito.when(formsVersionRepository.getAllFormWithSyncStatus(SyncStatus.PENDING)).thenReturn( repoForm); Mockito.when(formsVersionRepository.getFormByFormDirName("ec_dir")).thenReturn( new FormDefinitionVersion( "EC_ENGAN", "ec_dir", "1")); Mockito.when(formsVersionRepository.getVersion("ec_dir")).thenReturn("1"); FetchStatus fetchStatus = service.pullFormDefinitionFromServer(); Assert.assertEquals(fetched, fetchStatus); Mockito.verify(httpAgent).fetch("http: Mockito.verify(formsVersionRepository).updateFormName("ec_dir", "EC_ENGKAN"); Mockito.verify(formsVersionRepository).formExists("ec_dir"); Mockito.verify(formsVersionRepository).updateServerVersion("ec_dir", "3"); Mockito.verify(formsVersionRepository).updateSyncStatus("ec_dir", SyncStatus.PENDING); }
public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
@Test public void shouldNotUpdateIfLocalFormIsTheLatestVersion() throws Exception { String jsonObject = "{\"formVersions\" : [{\"formName\": \"EC_ENGKAN\", \"formDirName\":" + " \"ec_dir\", \"formDataDefinitionVersion\": \"2\"}] }"; Mockito.when(httpAgent.fetch("http: new Response<String>( success, jsonObject)); List<FormDefinitionVersion> repoForm = Arrays.asList(new FormDefinitionVersion("form_ec", "ec_dir", "3")); Mockito.when(formsVersionRepository.formExists("ec_dir")).thenReturn(true); Mockito.when(formsVersionRepository.getAllFormWithSyncStatus(SyncStatus.PENDING)).thenReturn( repoForm); Mockito.when(formsVersionRepository.getFormByFormDirName("ec_dir")).thenReturn( new FormDefinitionVersion( "EC_ENGAN", "ec_dir", "3")); Mockito.when(formsVersionRepository.getVersion("ec_dir")).thenReturn("3"); FetchStatus fetchStatus = service.pullFormDefinitionFromServer(); Assert.assertEquals(nothingFetched, fetchStatus); }
public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
AllFormVersionSyncService { public FetchStatus pullFormDefinitionFromServer() { FetchStatus status = FetchStatus.nothingFetched; String baseUrl = configuration.dristhiBaseURL(); String uri = baseUrl + AllConstants.ALL_FORM_VERSION_URL; Response<String> response = httpAgent.fetch(uri); if (response.isFailure()) { logError("Form definition pull error"); status = FetchStatus.fetchedFailed; return status; } String formVersions; try { JSONObject jsonObject = new JSONObject(response.payload()); formVersions = jsonObject.get("formVersions").toString(); } catch (JSONException e) { return status; } List<FormDefinitionVersion> forms = new Gson() .fromJson(formVersions, new TypeToken<List<FormDefinitionVersion>>() { }.getType()); if (forms.size() > 0) { for (FormDefinitionVersion form : forms) { try { if (!formsVersionRepository.formExists(form.getFormDirName())) { form.setSyncStatus(SyncStatus.PENDING); formsVersionRepository.addFormVersionFromObject(form); } else { FormDefinitionVersion formDefinitionVersion = formsVersionRepository .getFormByFormDirName(form.getFormDirName()); if (!formDefinitionVersion.getFormName().equals(form.getFormName())) { formsVersionRepository .updateFormName(form.getFormDirName(), form.getFormName()); } int repoVersion = Integer.parseInt(formDefinitionVersion.getVersion()); int pulledVersion = Integer.parseInt(form.getVersion()); if (pulledVersion > repoVersion) { formsVersionRepository .updateServerVersion(form.getFormDirName(), form.getVersion()); formsVersionRepository .updateSyncStatus(form.getFormDirName(), SyncStatus.PENDING); status = FetchStatus.fetched; } } } catch (Exception e) { Timber.e(e); } } } return status; } AllFormVersionSyncService(HTTPAgent httpAgentArg, DristhiConfiguration configurationArg, FormsVersionRepository formsVersionRepositoryArg); FetchStatus pullFormDefinitionFromServer(); DownloadStatus downloadAllPendingFormFromServer(); void unzipAllDownloadedFormFile(); void verifyFormsInFolder(); }
@Test public void shouldCreateTimelineEventWhenECIsRegistered() throws Exception { FormSubmission submission = Mockito.mock(FormSubmission.class); Mockito.when(submission.entityId()).thenReturn("entity id 1"); Mockito.when(submission.getFieldValue("submissionDate")).thenReturn("2012-01-01"); service.register(submission); Mockito.verify(allTimelineEvents).add(TimelineEvent.forECRegistered("entity id 1", "2012-01-01")); }
public void register(FormSubmission submission) { if (isNotBlank(submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE))) { allTimelineEvents.add(TimelineEvent.forECRegistered(submission.entityId(), submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE))); } }
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_DATE))); } } }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
@Test public void shouldCloseEC() throws Exception { FormSubmission submission = Mockito.mock(FormSubmission.class); Mockito.when(submission.entityId()).thenReturn("entity id 1"); service.closeEligibleCouple(submission); Mockito.verify(allEligibleCouples).close("entity id 1"); Mockito.verify(allBeneficiaries).closeAllMothersForEC("entity id 1"); }
public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); }
EligibleCoupleService { public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); } }
EligibleCoupleService { public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); }
EligibleCoupleService { public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
EligibleCoupleService { public void closeEligibleCouple(FormSubmission submission) { allEligibleCouples.close(submission.entityId()); allBeneficiaries.closeAllMothersForEC(submission.entityId()); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
@Test public void testGenerateDBCredentialsReturnsCorrectBytesForSyncByTeam() { Mockito.doReturn(SyncFilter.TEAM_ID).when(syncConfiguration).getEncryptionParam(); Mockito.doReturn(TEST_TEAM_ID).when(userService).getUserDefaultTeamId(userInfo); byte[] bytes = credentialsHelper.generateDBCredentials(TEST_DUMMY_PASSWORD, userInfo); Assert.assertTrue(Arrays.equals(SecurityHelper.toBytes(TEST_TEAM_ID.toCharArray()), bytes)); }
public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void shouldNotCreateTimelineEventWhenECIsRegisteredWithoutSubmissionDate() throws Exception { FormSubmission submission = Mockito.mock(FormSubmission.class); Mockito.when(submission.entityId()).thenReturn("entity id 1"); Mockito.when(submission.getFieldValue("submissionDate")).thenReturn(null); service.register(submission); Mockito.verifyZeroInteractions(allTimelineEvents); }
public void register(FormSubmission submission) { if (isNotBlank(submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE))) { allTimelineEvents.add(TimelineEvent.forECRegistered(submission.entityId(), submission.getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE))); } }
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_DATE))); } } }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
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_DATE))); } } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
@Test public void shouldCreateTimelineEventAndUpdateEntityWhenFPChangeIsReported() throws Exception { FormSubmission submission = Mockito.mock(FormSubmission.class); Mockito.when(submission.entityId()).thenReturn("entity id 1"); Mockito.when(submission.getFieldValue("currentMethod")).thenReturn("condom"); Mockito.when(submission.getFieldValue("newMethod")).thenReturn("ocp"); Mockito.when(submission.getFieldValue("familyPlanningMethodChangeDate")).thenReturn("2012-01-01"); service.fpChange(submission); Mockito.verify(allTimelineEvents).add(TimelineEvent.forChangeOfFPMethod("entity id 1", "condom", "ocp", "2012-01-01")); Mockito.verify(allEligibleCouples).mergeDetails("entity id 1", EasyMap.mapOf("currentMethod", "ocp")); }
public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
@Test public void shouldUseFormSubmissionDateAsChangeDateWhenFPMethodIsChangedAndChangeDateIsBlank() throws Exception { FormSubmission submission = Mockito.mock(FormSubmission.class); Mockito.when(submission.entityId()).thenReturn("entity id 1"); Mockito.when(submission.getFieldValue("currentMethod")).thenReturn("condom"); Mockito.when(submission.getFieldValue("newMethod")).thenReturn("none"); Mockito.when(submission.getFieldValue("submissionDate")).thenReturn("2012-02-01"); service.fpChange(submission); Mockito.verify(allTimelineEvents).add(TimelineEvent.forChangeOfFPMethod("entity id 1", "condom", "none", "2012-02-01")); Mockito.verify(allEligibleCouples).mergeDetails("entity id 1", EasyMap.mapOf("currentMethod", "none")); }
public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
EligibleCoupleService { public void fpChange(FormSubmission submission) { String fpMethodChangeDate = submission.getFieldValue( AllConstants.ECRegistrationFields.FAMILY_PLANNING_METHOD_CHANGE_DATE); if (isBlank(fpMethodChangeDate)) { fpMethodChangeDate = submission .getFieldValue(AllConstants.CommonFormFields.SUBMISSION_DATE); } allTimelineEvents.add(forChangeOfFPMethod(submission.entityId(), submission.getFieldValue(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD), submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME), fpMethodChangeDate)); allEligibleCouples.mergeDetails(submission.entityId(), mapOf(AllConstants.ECRegistrationFields.CURRENT_FP_METHOD, submission.getFieldValue(NEW_FP_METHOD_FIELD_NAME))); } EligibleCoupleService(AllEligibleCouples allEligibleCouples, AllTimelineEvents allTimelineEvents, AllBeneficiaries allBeneficiaries); void register(FormSubmission submission); void fpComplications(FormSubmission submission); void fpChange(FormSubmission submission); void renewFPProduct(FormSubmission submission); void closeEligibleCouple(FormSubmission submission); }
@Test public void convertManifestDTOToManifest() throws JSONException { String manifestDTOJson = "{\"json\":\"{\\\"forms_version\\\":\\\"0.0.1\\\",\\\"identifiers\\\":[\\\"anc/member_registration.json\\\",\\\"anc/pregnancy_outcome.json\\\"]}\",\"appId\":\"org.smartregister.chw\",\"appVersion\":\"0.0.1\",\"id\":1}"; ManifestDTO manifestDTO = new Gson().fromJson(manifestDTOJson, ManifestDTO.class); Manifest manifest; manifest = documentConfigurationService.convertManifestDTOToManifest(manifestDTO); Assert.assertEquals(manifest.getAppVersion(), manifestDTO.getAppVersion()); Assert.assertEquals(manifest.getCreatedAt(), manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); Assert.assertEquals(manifest.getFormVersion(), json.getString(MANIFEST_FORMS_VERSION)); Assert.assertEquals(manifest.getIdentifiers(), new Gson().fromJson(json.getString(IDENTIFIERS), new TypeToken<List<String>>() { }.getType())); }
protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); if (json.has(MANIFEST_FORMS_VERSION)) { manifest.setFormVersion(json.getString(MANIFEST_FORMS_VERSION)); } if (json.has(IDENTIFIERS)) { List<String> identifiers = new Gson().fromJson(json.getJSONArray(IDENTIFIERS).toString(), new TypeToken<List<String>>() { }.getType()); manifest.setIdentifiers(identifiers); } return manifest; }
DocumentConfigurationService { protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); if (json.has(MANIFEST_FORMS_VERSION)) { manifest.setFormVersion(json.getString(MANIFEST_FORMS_VERSION)); } if (json.has(IDENTIFIERS)) { List<String> identifiers = new Gson().fromJson(json.getJSONArray(IDENTIFIERS).toString(), new TypeToken<List<String>>() { }.getType()); manifest.setIdentifiers(identifiers); } return manifest; } }
DocumentConfigurationService { protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); if (json.has(MANIFEST_FORMS_VERSION)) { manifest.setFormVersion(json.getString(MANIFEST_FORMS_VERSION)); } if (json.has(IDENTIFIERS)) { List<String> identifiers = new Gson().fromJson(json.getJSONArray(IDENTIFIERS).toString(), new TypeToken<List<String>>() { }.getType()); manifest.setIdentifiers(identifiers); } return manifest; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); }
DocumentConfigurationService { protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); if (json.has(MANIFEST_FORMS_VERSION)) { manifest.setFormVersion(json.getString(MANIFEST_FORMS_VERSION)); } if (json.has(IDENTIFIERS)) { List<String> identifiers = new Gson().fromJson(json.getJSONArray(IDENTIFIERS).toString(), new TypeToken<List<String>>() { }.getType()); manifest.setIdentifiers(identifiers); } return manifest; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); }
DocumentConfigurationService { protected Manifest convertManifestDTOToManifest(ManifestDTO manifestDTO) throws JSONException { Manifest manifest = new Manifest(); manifest.setVersion(manifestDTO.getIdentifier()); manifest.setAppVersion(manifestDTO.getAppVersion()); manifest.setCreatedAt(manifestDTO.getCreatedAt()); JSONObject json = new JSONObject(manifestDTO.getJson()); if (json.has(MANIFEST_FORMS_VERSION)) { manifest.setFormVersion(json.getString(MANIFEST_FORMS_VERSION)); } if (json.has(IDENTIFIERS)) { List<String> identifiers = new Gson().fromJson(json.getJSONArray(IDENTIFIERS).toString(), new TypeToken<List<String>>() { }.getType()); manifest.setIdentifiers(identifiers); } return manifest; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); static final String MANIFEST_FORMS_VERSION; static final String FORM_VERSION; static final String CURRENT_FORM_VERSION; static final String IDENTIFIERS; }
@Test public void convertClientFormResponseToClientForm() throws JSONException { String clientFormResponseJson = "{\"clientForm\":{\"id\":3,\"json\":\"\\\"{\\\\n \\\\\\\"form\\\\\\\": \\\\\\\"ANC Referral\\\\\\\",\\\\n \\\\\\\"count\\\\\\\": \\\\\\\"1\\\\\\\",\\\\n \\\\\\\"encounter_type\\\\\\\": \\\\\\\"ANC Referral\\\\\\\",\\\\n \\\\\\\"entity_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"relational_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"rules_file\\\\\\\": \\\\\\\"rule/general_neat_referral_form_rules.yml\\\\\\\",\\\\n \\\\\\\"metadata\\\\\\\": {\\\\n \\\\\\\"start\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"start\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"end\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"end\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"today\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"encounter\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"encounter_date\\\\\\\"\\\\n },\\\\n \\\\\\\"deviceid\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"deviceid\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"subscriberid\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"subscriberid\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"simserial\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"simserial\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"phonenumber\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"phonenumber\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"encounter_location\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"look_up\\\\\\\": {\\\\n \\\\\\\"entity_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n \\\\\\\"steps\\\\\\\": [\\\\n {\\\\n \\\\\\\"title\\\\\\\": \\\\\\\"ANC referral form\\\\\\\",\\\\n \\\\\\\"fields\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"chw_referral_service\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"invisible\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Choose referral service\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"09978\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify referral service\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"problem\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"multi_choice_checkbox\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pick condition/problem associated with the client.\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163182AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Vaginal_bleeding\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Vaginal bleeding\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"147232AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Discoloured_or_watery_liquid_vaginal_discharge_with_a_bad_smell\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Discoloured or watery, liquid vaginal discharge with a bad smell\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"123396AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"High_blood_pressure\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"High blood pressure\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Severe_abdominal_pain\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Severe abdominal pain\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"165271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Severe_anaemia\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Severe anaemia\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"162044AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Convulsions\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Convulsions\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"No_movement_unusual_movement_for_a_child_in_the_womb\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"No movement / unusual movement for a child in the womb\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Pregnancy_pains_before_9_months\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pregnancy pains before 9 months\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"153316AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Early_age_pregnancy_below_18_years\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Early age pregnancy (below 18 years)\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163119AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"A_severe_headache_dizziness\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"A severe headache / dizziness\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"139081AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Swelling_of_the_face_andor_hands\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Swelling of the face and/or hands\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"460AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Fever\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Fever\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"140238AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Shivering_trembling\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Shivering/trembling\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"158359AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Nausea_and_Vomiting\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Nausea and vomiting\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"133473AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Water_sack_broke_before_contractions\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Water sack broke before contractions\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"129211AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Cord_prolapse\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Cord prolapse\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"128419AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"HIV_care_and_support_services\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"HIV care and support services\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"159811AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Family_planning_services\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Family planning services\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"PMTCT_for_mothers\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"PMTCT for mothers\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160538AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Fistula\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Fistula\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160854AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Difficultly_breathing\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Difficultly breathing\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"142373AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Breast_engorgement\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Breast engorgement\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"118620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Blurred_vision\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Blurred vision\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"147104AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Perineum_tear\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Perineum tear\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"136938AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Pregnancy_confirmation\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pregnancy confirmation\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"152305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Other_symptoms\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Other symptoms\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n }\\\\n ],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify reason for ANC referral\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"problem_other\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"text_input_edit_text\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"163182AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Other symptoms\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"name\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify other symptoms\\\\\\\",\\\\n \\\\\\\"subjects\\\\\\\": \\\\\\\"problem:map\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"service_before_referral\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"164378AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"multi_choice_checkbox\\\\\\\",\\\\n \\\\\\\"is_problem\\\\\\\": false,\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pre-referral management given.\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"ORS\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"ORS\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"351AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Panadol\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Panadol\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"70116AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Other_treatment\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Other treatment\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"None\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"None\\\\\\\",\\\\n \\\\\\\"is_exclusive\\\\\\\": true,\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"164369AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n }\\\\n ],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"Pre-referral management field is required\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"service_before_referral_other\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"text_input_edit_text\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"164378AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Other Treatment\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"name\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify other treatment given\\\\\\\",\\\\n \\\\\\\"subjects\\\\\\\": \\\\\\\"service_before_referral:map\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"chw_referral_hf\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"spinner\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"chw_referral_hf\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Choose referral facility\\\\\\\",\\\\n \\\\\\\"searchable\\\\\\\": \\\\\\\"Choose referral facility\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify referral facility\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_appointment_date\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"datetime_picker\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Please select the appointment date\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"date_picker\\\\\\\",\\\\n \\\\\\\"display_format\\\\\\\": \\\\\\\"dd/MM/yyyy\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_appointment_date\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify the appointment date\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_date\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163181AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_time\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_time\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_type\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_type\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_status\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_status\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n ]\\\\n}\\\"\",\"createdAt\":\"Apr 22, 2020, 7:00:40 PM\"},\"clientFormMetadata\":{\"id\":3,\"identifier\":\"referrals/anc_referral_form\",\"version\":\"0.0.2\",\"label\":\"ANC Referral form\",\"module\":\"ANC\",\"createdAt\":\"Apr 22, 2020, 7:00:40 PM\"}}"; Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(clientFormResponseJson, ClientFormResponse.class); ClientForm clientForm = documentConfigurationService.convertClientFormResponseToClientForm(clientFormResponse); Assert.assertEquals(clientForm.getIdentifier(), clientFormResponse.getClientFormMetadata().getIdentifier()); Assert.assertEquals(clientForm.getCreatedAt(), clientFormResponse.getClientFormMetadata().getCreatedAt()); JSONObject formJson = null; formJson = new JSONObject(clientForm.getJson()); Assert.assertNotNull(formJson); Assert.assertEquals(clientForm.getVersion(), clientFormResponse.getClientFormMetadata().getVersion()); }
protected ClientForm convertClientFormResponseToClientForm(ClientFormResponse clientFormResponse) { ClientForm clientForm = new ClientForm(); clientForm.setId(clientFormResponse.getClientForm().getId()); clientForm.setCreatedAt(clientFormResponse.getClientFormMetadata().getCreatedAt()); clientForm.setIdentifier(clientFormResponse.getClientFormMetadata().getIdentifier()); String jsonString = StringEscapeUtils.unescapeJson(clientFormResponse.getClientForm().getJson()); jsonString = jsonString.substring(1, jsonString.length() - 1); clientForm.setJson(jsonString); clientForm.setVersion(clientFormResponse.getClientFormMetadata().getVersion()); clientForm.setLabel(clientFormResponse.getClientFormMetadata().getLabel()); clientForm.setJurisdiction(clientFormResponse.getClientFormMetadata().getJurisdiction()); clientForm.setModule(clientFormResponse.getClientFormMetadata().getModule()); return clientForm; }
DocumentConfigurationService { protected ClientForm convertClientFormResponseToClientForm(ClientFormResponse clientFormResponse) { ClientForm clientForm = new ClientForm(); clientForm.setId(clientFormResponse.getClientForm().getId()); clientForm.setCreatedAt(clientFormResponse.getClientFormMetadata().getCreatedAt()); clientForm.setIdentifier(clientFormResponse.getClientFormMetadata().getIdentifier()); String jsonString = StringEscapeUtils.unescapeJson(clientFormResponse.getClientForm().getJson()); jsonString = jsonString.substring(1, jsonString.length() - 1); clientForm.setJson(jsonString); clientForm.setVersion(clientFormResponse.getClientFormMetadata().getVersion()); clientForm.setLabel(clientFormResponse.getClientFormMetadata().getLabel()); clientForm.setJurisdiction(clientFormResponse.getClientFormMetadata().getJurisdiction()); clientForm.setModule(clientFormResponse.getClientFormMetadata().getModule()); return clientForm; } }
DocumentConfigurationService { protected ClientForm convertClientFormResponseToClientForm(ClientFormResponse clientFormResponse) { ClientForm clientForm = new ClientForm(); clientForm.setId(clientFormResponse.getClientForm().getId()); clientForm.setCreatedAt(clientFormResponse.getClientFormMetadata().getCreatedAt()); clientForm.setIdentifier(clientFormResponse.getClientFormMetadata().getIdentifier()); String jsonString = StringEscapeUtils.unescapeJson(clientFormResponse.getClientForm().getJson()); jsonString = jsonString.substring(1, jsonString.length() - 1); clientForm.setJson(jsonString); clientForm.setVersion(clientFormResponse.getClientFormMetadata().getVersion()); clientForm.setLabel(clientFormResponse.getClientFormMetadata().getLabel()); clientForm.setJurisdiction(clientFormResponse.getClientFormMetadata().getJurisdiction()); clientForm.setModule(clientFormResponse.getClientFormMetadata().getModule()); return clientForm; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); }
DocumentConfigurationService { protected ClientForm convertClientFormResponseToClientForm(ClientFormResponse clientFormResponse) { ClientForm clientForm = new ClientForm(); clientForm.setId(clientFormResponse.getClientForm().getId()); clientForm.setCreatedAt(clientFormResponse.getClientFormMetadata().getCreatedAt()); clientForm.setIdentifier(clientFormResponse.getClientFormMetadata().getIdentifier()); String jsonString = StringEscapeUtils.unescapeJson(clientFormResponse.getClientForm().getJson()); jsonString = jsonString.substring(1, jsonString.length() - 1); clientForm.setJson(jsonString); clientForm.setVersion(clientFormResponse.getClientFormMetadata().getVersion()); clientForm.setLabel(clientFormResponse.getClientFormMetadata().getLabel()); clientForm.setJurisdiction(clientFormResponse.getClientFormMetadata().getJurisdiction()); clientForm.setModule(clientFormResponse.getClientFormMetadata().getModule()); return clientForm; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); }
DocumentConfigurationService { protected ClientForm convertClientFormResponseToClientForm(ClientFormResponse clientFormResponse) { ClientForm clientForm = new ClientForm(); clientForm.setId(clientFormResponse.getClientForm().getId()); clientForm.setCreatedAt(clientFormResponse.getClientFormMetadata().getCreatedAt()); clientForm.setIdentifier(clientFormResponse.getClientFormMetadata().getIdentifier()); String jsonString = StringEscapeUtils.unescapeJson(clientFormResponse.getClientForm().getJson()); jsonString = jsonString.substring(1, jsonString.length() - 1); clientForm.setJson(jsonString); clientForm.setVersion(clientFormResponse.getClientFormMetadata().getVersion()); clientForm.setLabel(clientFormResponse.getClientFormMetadata().getLabel()); clientForm.setJurisdiction(clientFormResponse.getClientFormMetadata().getJurisdiction()); clientForm.setModule(clientFormResponse.getClientFormMetadata().getModule()); return clientForm; } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); static final String MANIFEST_FORMS_VERSION; static final String FORM_VERSION; static final String CURRENT_FORM_VERSION; static final String IDENTIFIERS; }
@Test public void fetchClientForm() { String manifestJson = "{\"identifiers\":[\"referrals/anc_referral_form\"],\"formVersion\":\"0.0.8\",\"appVersion\":\"0.2.0\",\"createdAt\":\"2020-04-23T16:28:19.879+03:00\"}"; Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); Manifest activeManifest = gson.fromJson(manifestJson, Manifest.class); String jsonObject = "{\"clientForm\":{\"id\":3,\"json\":\"\\\"{\\\\n \\\\\\\"form\\\\\\\": \\\\\\\"ANC Referral\\\\\\\",\\\\n \\\\\\\"count\\\\\\\": \\\\\\\"1\\\\\\\",\\\\n \\\\\\\"encounter_type\\\\\\\": \\\\\\\"ANC Referral\\\\\\\",\\\\n \\\\\\\"entity_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"relational_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"rules_file\\\\\\\": \\\\\\\"rule/general_neat_referral_form_rules.yml\\\\\\\",\\\\n \\\\\\\"metadata\\\\\\\": {\\\\n \\\\\\\"start\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"start\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"end\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"end\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"today\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"encounter\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"encounter_date\\\\\\\"\\\\n },\\\\n \\\\\\\"deviceid\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"deviceid\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"subscriberid\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"subscriberid\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"simserial\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"simserial\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"phonenumber\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_data_type\\\\\\\": \\\\\\\"phonenumber\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"encounter_location\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"look_up\\\\\\\": {\\\\n \\\\\\\"entity_id\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n \\\\\\\"steps\\\\\\\": [\\\\n {\\\\n \\\\\\\"title\\\\\\\": \\\\\\\"ANC referral form\\\\\\\",\\\\n \\\\\\\"fields\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"chw_referral_service\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"invisible\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Choose referral service\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"09978\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify referral service\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"problem\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"multi_choice_checkbox\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pick condition/problem associated with the client.\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163182AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Vaginal_bleeding\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Vaginal bleeding\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"147232AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Discoloured_or_watery_liquid_vaginal_discharge_with_a_bad_smell\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Discoloured or watery, liquid vaginal discharge with a bad smell\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"123396AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"High_blood_pressure\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"High blood pressure\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Severe_abdominal_pain\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Severe abdominal pain\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"165271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Severe_anaemia\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Severe anaemia\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"162044AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Convulsions\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Convulsions\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"No_movement_unusual_movement_for_a_child_in_the_womb\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"No movement / unusual movement for a child in the womb\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"113377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Pregnancy_pains_before_9_months\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pregnancy pains before 9 months\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"153316AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Early_age_pregnancy_below_18_years\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Early age pregnancy (below 18 years)\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163119AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"A_severe_headache_dizziness\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"A severe headache / dizziness\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"139081AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Swelling_of_the_face_andor_hands\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Swelling of the face and/or hands\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"460AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Fever\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Fever\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"140238AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Shivering_trembling\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Shivering/trembling\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"158359AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Nausea_and_Vomiting\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Nausea and vomiting\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"133473AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Water_sack_broke_before_contractions\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Water sack broke before contractions\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"129211AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Cord_prolapse\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Cord prolapse\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"128419AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"HIV_care_and_support_services\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"HIV care and support services\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"159811AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Family_planning_services\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Family planning services\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5271AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"PMTCT_for_mothers\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"PMTCT for mothers\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160538AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Fistula\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Fistula\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160854AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Difficultly_breathing\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Difficultly breathing\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"142373AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Breast_engorgement\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Breast engorgement\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"118620AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Blurred_vision\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Blurred vision\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"147104AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Perineum_tear\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Perineum tear\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"136938AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Pregnancy_confirmation\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pregnancy confirmation\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"152305AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Other_symptoms\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Other symptoms\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n }\\\\n ],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify reason for ANC referral\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"problem_other\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"text_input_edit_text\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"163182AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Other symptoms\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"name\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify other symptoms\\\\\\\",\\\\n \\\\\\\"subjects\\\\\\\": \\\\\\\"problem:map\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"service_before_referral\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"164378AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"multi_choice_checkbox\\\\\\\",\\\\n \\\\\\\"is_problem\\\\\\\": false,\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Pre-referral management given.\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"ORS\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"ORS\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"351AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Panadol\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Panadol\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"70116AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"Other_treatment\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Other treatment\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"None\\\\\\\",\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"None\\\\\\\",\\\\n \\\\\\\"is_exclusive\\\\\\\": true,\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"164369AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n }\\\\n }\\\\n ],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"Pre-referral management field is required\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"service_before_referral_other\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"text_input_edit_text\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"164378AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Other Treatment\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"name\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify other treatment given\\\\\\\",\\\\n \\\\\\\"subjects\\\\\\\": \\\\\\\"service_before_referral:map\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"chw_referral_hf\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"spinner\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"chw_referral_hf\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"text\\\\\\\": \\\\\\\"Choose referral facility\\\\\\\",\\\\n \\\\\\\"searchable\\\\\\\": \\\\\\\"Choose referral facility\\\\\\\"\\\\n },\\\\n \\\\\\\"options\\\\\\\": [],\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"yes:Please specify referral facility\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_appointment_date\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"datetime_picker\\\\\\\",\\\\n \\\\\\\"properties\\\\\\\": {\\\\n \\\\\\\"hint\\\\\\\": \\\\\\\"Please select the appointment date\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"date_picker\\\\\\\",\\\\n \\\\\\\"display_format\\\\\\\": \\\\\\\"dd/MM/yyyy\\\\\\\"\\\\n },\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_appointment_date\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\"\\\\n },\\\\n \\\\\\\"required_status\\\\\\\": \\\\\\\"true:Please specify the appointment date\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_date\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"163181AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_time\\\\\\\",\\\\n \\\\\\\"meta_data\\\\\\\": {\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_time\\\\\\\"\\\\n },\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_type\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_type\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"name\\\\\\\": \\\\\\\"referral_status\\\\\\\",\\\\n \\\\\\\"openmrs_entity_parent\\\\\\\": \\\\\\\"\\\\\\\",\\\\n \\\\\\\"openmrs_entity\\\\\\\": \\\\\\\"concept\\\\\\\",\\\\n \\\\\\\"openmrs_entity_id\\\\\\\": \\\\\\\"referral_status\\\\\\\",\\\\n \\\\\\\"type\\\\\\\": \\\\\\\"hidden\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n ]\\\\n}\\\"\",\"createdAt\":\"Apr 22, 2020, 7:00:40 PM\"},\"clientFormMetadata\":{\"id\":3,\"identifier\":\"referrals/anc_referral_form\",\"version\":\"0.0.2\",\"label\":\"ANC Referral form\",\"module\":\"ANC\",\"createdAt\":\"Apr 22, 2020, 7:00:40 PM\"}}"; Mockito.when(httpAgent.fetch("http: new Response<String>( success, jsonObject)); Mockito.doNothing().when(clientFormRepository).addOrUpdate(Mockito.any(ClientForm.class)); documentConfigurationService.syncClientForms(activeManifest); Mockito.verify(clientFormRepository).addOrUpdate(Mockito.any(ClientForm.class)); }
protected void fetchClientForm(String identifier, String formVersion, ClientForm latestClientForm) throws NoHttpResponseException { if (httpAgent == null) { throw new IllegalArgumentException(CLIENT_FORM_SYNC_URL + " http agent is null"); } String baseUrl = getBaseUrl(); Response resp = httpAgent.fetch( MessageFormat.format("{0}{1}{2}", baseUrl, CLIENT_FORM_SYNC_URL, "?" + FORM_IDENTIFIER + "=" + identifier + "&" + FORM_VERSION + "=" + formVersion + (latestClientForm == null ? "" : "&" + CURRENT_FORM_VERSION + "=" + latestClientForm.getVersion()))); if (resp.isFailure()) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(resp.payload().toString(), ClientFormResponse.class); if (clientFormResponse == null) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } if (latestClientForm == null || !clientFormResponse.getClientFormMetadata().getVersion().equals(latestClientForm.getVersion())) { if (latestClientForm != null) { latestClientForm.setActive(false); latestClientForm.setNew(false); clientFormRepository.addOrUpdate(latestClientForm); } ClientForm clientForm = convertClientFormResponseToClientForm(clientFormResponse); saveReceivedClientForm(clientForm); } }
DocumentConfigurationService { protected void fetchClientForm(String identifier, String formVersion, ClientForm latestClientForm) throws NoHttpResponseException { if (httpAgent == null) { throw new IllegalArgumentException(CLIENT_FORM_SYNC_URL + " http agent is null"); } String baseUrl = getBaseUrl(); Response resp = httpAgent.fetch( MessageFormat.format("{0}{1}{2}", baseUrl, CLIENT_FORM_SYNC_URL, "?" + FORM_IDENTIFIER + "=" + identifier + "&" + FORM_VERSION + "=" + formVersion + (latestClientForm == null ? "" : "&" + CURRENT_FORM_VERSION + "=" + latestClientForm.getVersion()))); if (resp.isFailure()) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(resp.payload().toString(), ClientFormResponse.class); if (clientFormResponse == null) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } if (latestClientForm == null || !clientFormResponse.getClientFormMetadata().getVersion().equals(latestClientForm.getVersion())) { if (latestClientForm != null) { latestClientForm.setActive(false); latestClientForm.setNew(false); clientFormRepository.addOrUpdate(latestClientForm); } ClientForm clientForm = convertClientFormResponseToClientForm(clientFormResponse); saveReceivedClientForm(clientForm); } } }
DocumentConfigurationService { protected void fetchClientForm(String identifier, String formVersion, ClientForm latestClientForm) throws NoHttpResponseException { if (httpAgent == null) { throw new IllegalArgumentException(CLIENT_FORM_SYNC_URL + " http agent is null"); } String baseUrl = getBaseUrl(); Response resp = httpAgent.fetch( MessageFormat.format("{0}{1}{2}", baseUrl, CLIENT_FORM_SYNC_URL, "?" + FORM_IDENTIFIER + "=" + identifier + "&" + FORM_VERSION + "=" + formVersion + (latestClientForm == null ? "" : "&" + CURRENT_FORM_VERSION + "=" + latestClientForm.getVersion()))); if (resp.isFailure()) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(resp.payload().toString(), ClientFormResponse.class); if (clientFormResponse == null) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } if (latestClientForm == null || !clientFormResponse.getClientFormMetadata().getVersion().equals(latestClientForm.getVersion())) { if (latestClientForm != null) { latestClientForm.setActive(false); latestClientForm.setNew(false); clientFormRepository.addOrUpdate(latestClientForm); } ClientForm clientForm = convertClientFormResponseToClientForm(clientFormResponse); saveReceivedClientForm(clientForm); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); }
DocumentConfigurationService { protected void fetchClientForm(String identifier, String formVersion, ClientForm latestClientForm) throws NoHttpResponseException { if (httpAgent == null) { throw new IllegalArgumentException(CLIENT_FORM_SYNC_URL + " http agent is null"); } String baseUrl = getBaseUrl(); Response resp = httpAgent.fetch( MessageFormat.format("{0}{1}{2}", baseUrl, CLIENT_FORM_SYNC_URL, "?" + FORM_IDENTIFIER + "=" + identifier + "&" + FORM_VERSION + "=" + formVersion + (latestClientForm == null ? "" : "&" + CURRENT_FORM_VERSION + "=" + latestClientForm.getVersion()))); if (resp.isFailure()) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(resp.payload().toString(), ClientFormResponse.class); if (clientFormResponse == null) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } if (latestClientForm == null || !clientFormResponse.getClientFormMetadata().getVersion().equals(latestClientForm.getVersion())) { if (latestClientForm != null) { latestClientForm.setActive(false); latestClientForm.setNew(false); clientFormRepository.addOrUpdate(latestClientForm); } ClientForm clientForm = convertClientFormResponseToClientForm(clientFormResponse); saveReceivedClientForm(clientForm); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); }
DocumentConfigurationService { protected void fetchClientForm(String identifier, String formVersion, ClientForm latestClientForm) throws NoHttpResponseException { if (httpAgent == null) { throw new IllegalArgumentException(CLIENT_FORM_SYNC_URL + " http agent is null"); } String baseUrl = getBaseUrl(); Response resp = httpAgent.fetch( MessageFormat.format("{0}{1}{2}", baseUrl, CLIENT_FORM_SYNC_URL, "?" + FORM_IDENTIFIER + "=" + identifier + "&" + FORM_VERSION + "=" + formVersion + (latestClientForm == null ? "" : "&" + CURRENT_FORM_VERSION + "=" + latestClientForm.getVersion()))); if (resp.isFailure()) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } Gson gson = new GsonBuilder().setDateFormat("MMM dd, yyyy, hh:mm:ss aaa").create(); ClientFormResponse clientFormResponse = gson.fromJson(resp.payload().toString(), ClientFormResponse.class); if (clientFormResponse == null) { throw new NoHttpResponseException(CLIENT_FORM_SYNC_URL + " not returned data"); } if (latestClientForm == null || !clientFormResponse.getClientFormMetadata().getVersion().equals(latestClientForm.getVersion())) { if (latestClientForm != null) { latestClientForm.setActive(false); latestClientForm.setNew(false); clientFormRepository.addOrUpdate(latestClientForm); } ClientForm clientForm = convertClientFormResponseToClientForm(clientFormResponse); saveReceivedClientForm(clientForm); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); static final String MANIFEST_FORMS_VERSION; static final String FORM_VERSION; static final String CURRENT_FORM_VERSION; static final String IDENTIFIERS; }
@Test public void saveManifestVersionShouldSaveVersionInSharedPreferences() { Assert.assertNull(CoreLibrary.getInstance().context().allSharedPreferences().fetchManifestVersion()); String manifestVersion = "0.0.89"; documentConfigurationService.saveManifestVersion(manifestVersion); Assert.assertEquals(manifestVersion, CoreLibrary.getInstance().context().allSharedPreferences().fetchManifestVersion()); }
@VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Saving manifest version failed")); } }
DocumentConfigurationService { @VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Saving manifest version failed")); } } }
DocumentConfigurationService { @VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Saving manifest version failed")); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); }
DocumentConfigurationService { @VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Saving manifest version failed")); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); }
DocumentConfigurationService { @VisibleForTesting protected void saveManifestVersion(@NonNull String manifestVersion) { boolean manifestVersionSaved = CoreLibrary.getInstance() .context() .allSharedPreferences() .saveManifestVersion(manifestVersion); if (!manifestVersionSaved) { Timber.e(new Exception("Saving manifest version failed")); } } DocumentConfigurationService(HTTPAgent httpAgentArg, ManifestRepository manifestRepositoryArg, ClientFormRepository clientFormRepositoryArg, DristhiConfiguration configurationArg); void fetchManifest(); static final String MANIFEST_FORMS_VERSION; static final String FORM_VERSION; static final String CURRENT_FORM_VERSION; static final String IDENTIFIERS; }
@Test public void testGenerateDBCredentialsReturnsCorrectBytesForSyncByLocation() { Mockito.doReturn(SyncFilter.LOCATION_ID).when(syncConfiguration).getEncryptionParam(); Mockito.doReturn(TEST_LOCATION_ID).when(userService).getUserLocationId(userInfo); byte[] bytes = credentialsHelper.generateDBCredentials(TEST_DUMMY_PASSWORD, userInfo); Assert.assertTrue(Arrays.equals(SecurityHelper.toBytes(TEST_LOCATION_ID.toCharArray()), bytes)); }
public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
CredentialsHelper { public byte[] generateDBCredentials(char[] password, LoginResponseData userInfo) { char[] encryptionParamValue = null; SyncConfiguration syncConfiguration = CoreLibrary.getInstance().getSyncConfiguration(); if (syncConfiguration.getEncryptionParam() != null) { SyncFilter syncFilter = syncConfiguration.getEncryptionParam(); if (SyncFilter.TEAM.equals(syncFilter) || SyncFilter.TEAM_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserDefaultTeamId(userInfo).toCharArray(); } else if (SyncFilter.LOCATION.equals(syncFilter) || SyncFilter.LOCATION_ID.equals(syncFilter)) { encryptionParamValue = context.userService().getUserLocationId(userInfo).toCharArray(); } else if (SyncFilter.PROVIDER.equals(syncFilter)) { encryptionParamValue = password; } } if (encryptionParamValue == null || encryptionParamValue.length < 1) { return null; } return SecurityHelper.toBytes(encryptionParamValue); } CredentialsHelper(Context context); static boolean shouldMigrate(); byte[] getCredentials(String username, String type); void saveCredentials(String type, String encryptedPassphrase); PasswordHash generateLocalAuthCredentials(char[] password); byte[] generateDBCredentials(char[] password, LoginResponseData userInfo); }
@Test public void shouldNotifyFormSubmittedListenersWhenFormIsHandled() throws Exception { FormSubmission formSubmission = create().withFormName("ec_registration").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); FORM_SUBMITTED.addListener(formSubmittedListener); router.route("instance id 1"); InOrder inOrder = inOrder(formDataRepository, ecRegistrationHandler, formSubmittedListener); inOrder.verify(formDataRepository).fetchFromSubmission("instance id 1"); inOrder.verify(ecRegistrationHandler).handle(formSubmission); inOrder.verify(formSubmittedListener).onEvent("instance id 1"); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void shouldNotifyFormSubmittedListenersWhenThereIsNoHandlerForForm() throws Exception { FormSubmission formSubmission = create().withFormName("form-without-handler").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); FORM_SUBMITTED.addListener(formSubmittedListener); router.route("instance id 1"); InOrder inOrder = inOrder(formDataRepository, formSubmittedListener); inOrder.verify(formDataRepository).fetchFromSubmission("instance id 1"); inOrder.verify(formSubmittedListener).onEvent("instance id 1"); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void testGetPropertyBooleanReturnsCorrectValue() { AppProperties properties = new AppProperties(); Boolean value = properties.getPropertyBoolean(PROP_KEY); Assert.assertNotNull(value); Assert.assertFalse(value); properties.setProperty(PROP_KEY, TEST_VAL_TRUE); value = properties.getPropertyBoolean(PROP_KEY); Assert.assertNotNull(value); Assert.assertTrue(value); }
public Boolean getPropertyBoolean(String key) { return Boolean.valueOf(getProperty(key)); }
AppProperties extends Properties { public Boolean getPropertyBoolean(String key) { return Boolean.valueOf(getProperty(key)); } }
AppProperties extends Properties { public Boolean getPropertyBoolean(String key) { return Boolean.valueOf(getProperty(key)); } }
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); }
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); }
@Test public void shouldDelegateECRegistrationFormSubmissionHandlingToECRegistrationHandler() throws Exception { FormSubmission formSubmission = create().withFormName("ec_registration").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); FORM_SUBMITTED.addListener(formSubmittedListener); router.route("instance id 1"); verify(formDataRepository).fetchFromSubmission("instance id 1"); verify(ecRegistrationHandler).handle(formSubmission); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void shouldDelegateFPComplicationsFormSubmissionHandlingToFPComplicationsHandler() throws Exception { FormSubmission formSubmission = create().withFormName("fp_complications").withInstanceId("instance id 2").withVersion("123").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); router.route("instance id 1"); verify(formDataRepository).fetchFromSubmission("instance id 1"); verify(fpComplicationsHandler).handle(formSubmission); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void shouldDelegateRenewFPProductFormSubmissionHandlingToRenewFPProductHandler() throws Exception { FormSubmission formSubmission = create().withFormName("renew_fp_product").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); router.route("instance id 1"); verify(formDataRepository).fetchFromSubmission("instance id 1"); verify(renewFPProductHandler).handle(formSubmission); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void shouldDelegateECCloseFormSubmissionHandlingToECCloseHandler() throws Exception { FormSubmission formSubmission = create().withFormName("ec_close").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); router.route("instance id 1"); verify(formDataRepository).fetchFromSubmission("instance id 1"); verify(ecCloseHandler).handle(formSubmission); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
@Test public void shouldDelegateANCRegistrationFormSubmissionHandlingToANCRegistrationHandler() throws Exception { FormSubmission formSubmission = create().withFormName("anc_registration").withInstanceId("instance id 1").withVersion("122").build(); when(formDataRepository.fetchFromSubmission("instance id 1")).thenReturn(formSubmission); router.route("instance id 1"); verify(formDataRepository).fetchFromSubmission("instance id 1"); verify(ancRegistrationHandler).handle(formSubmission); }
public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }
FormSubmissionRouter { public void route(String instanceId) throws Exception { FormSubmission submission = formDataRepository.fetchFromSubmission(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logWarn("Could not find a handler due to unknown form submission: " + submission); } else { try { handler.handle(submission); } catch (Exception e) { Log.logError(format("Handling {0} form submission with instance Id: {1} for " + "entity: {2} failed with exception : {3}", submission.formName(), submission.instanceId(), submission.entityId(), ExceptionUtils.getStackTrace(e))); throw e; } } FORM_SUBMITTED.notifyListeners(instanceId); } FormSubmissionRouter(FormDataRepository formDataRepository, ECRegistrationHandler ecRegistrationHandler, FPComplicationsHandler fpComplicationsHandler, FPChangeHandler fpChangeHandler, RenewFPProductHandler renewFPProductHandler, ECCloseHandler ecCloseHandler, ANCRegistrationHandler ancRegistrationHandler, ANCRegistrationOAHandler ancRegistrationOAHandler, ANCVisitHandler ancVisitHandler, ANCCloseHandler ancCloseHandler, TTHandler ttHandler, IFAHandler ifaHandler, HBTestHandler hbTestHandler, DeliveryOutcomeHandler deliveryOutcomeHandler, PNCRegistrationOAHandler pncRegistrationOAHandler, PNCCloseHandler pncCloseHandler, PNCVisitHandler pncVisitHandler, ChildImmunizationsHandler childImmunizationsHandler, ChildRegistrationECHandler childRegistrationECHandler, ChildRegistrationOAHandler childRegistrationOAHandler, ChildCloseHandler childCloseHandler, ChildIllnessHandler childIllnessHandler, VitaminAHandler vitaminAHandler, DeliveryPlanHandler deliveryPlanHandler, ECEditHandler ecEditHandler, ANCInvestigationsHandler ancInvestigationsHandler); void route(String instanceId); Map<String, FormSubmissionHandler> getHandlerMap(); void handleSubmission(FormSubmission submission, String formName); }