コード例 #1
0
 @Override
 public void cachePersonIdsToPrayFor(List<String> personIdsToPrayFor) {
   if (personIdsToPrayFor != null && !personIdsToPrayFor.isEmpty()) {
     LocalCacheDataPOJO newCacheData = new LocalCacheDataPOJO();
     newCacheData.setPersonIdsToPrayFor(personIdsToPrayFor);
     cacheData(newCacheData);
   }
 }
コード例 #2
0
 @Override
 public void cacheVerseImageURL(String verseImageURL) {
   if (verseImageURL != null && !verseImageURL.isEmpty()) {
     LocalCacheDataPOJO newCacheData = new LocalCacheDataPOJO();
     newCacheData.setVerseImageURL(verseImageURL);
     cacheData(newCacheData);
   }
 }
コード例 #3
0
 @Override
 public String getCachedVerseImageURL() {
   LocalCacheDataPOJO cacheData = getCacheData();
   if (cacheData != null
       && cacheData.getVerseImageURL() != null
       && !cacheData.getVerseImageURL().isEmpty()) {
     return cacheData.getVerseImageURL();
   }
   return null;
 }
コード例 #4
0
 @Override
 public List<String> getCachedPersonIdsToPrayFor() {
   LocalCacheDataPOJO cacheData = getCacheData();
   if (cacheData != null
       && cacheData.getPersonIdsToPrayFor() != null
       && !cacheData.getPersonIdsToPrayFor().isEmpty()) {
     return cacheData.getPersonIdsToPrayFor();
   }
   return null;
 }
コード例 #5
0
 @Override
 public void cacheScripture(ScriptureData scriptureData) {
   if (scriptureData != null
       && scriptureData.getText() != null
       && !scriptureData.getText().isEmpty()
       && scriptureData.getCitation() != null
       && !scriptureData.getCitation().isEmpty()
       && scriptureData.getJson() != null
       && !scriptureData.getJson().isEmpty()) {
     LocalCacheDataPOJO newCacheData = new LocalCacheDataPOJO();
     newCacheData.setScriptureText(scriptureData.getText());
     newCacheData.setScriptureCitation(scriptureData.getCitation());
     newCacheData.setScriptureJson(scriptureData.getJson());
     cacheData(newCacheData);
   }
 }
コード例 #6
0
 @Override
 public ScriptureData getCachedScripture() {
   LocalCacheDataPOJO cacheData = getCacheData();
   if (cacheData != null
       && cacheData.getScriptureText() != null
       && !cacheData.getScriptureText().isEmpty()
       && cacheData.getScriptureCitation() != null
       && !cacheData.getScriptureCitation().isEmpty()
       && cacheData.getScriptureJson() != null
       && !cacheData.getScriptureJson().isEmpty()) {
     return new ScriptureData(
         cacheData.getScriptureText(),
         cacheData.getScriptureCitation(),
         cacheData.getScriptureJson());
   }
   return null;
 }
コード例 #7
0
 private void populateCacheData(LocalCacheData realmCacheData, LocalCacheDataPOJO newCacheData) {
   realmCacheData.setCreationDate(generateCreationDate());
   if (newCacheData.getPersonIdsToPrayFor() != null) {
     List<String> personIdsToPrayFor = newCacheData.getPersonIdsToPrayFor();
     RealmList<RealmString> managedPersonIdsToPrayFor = new RealmList<>();
     for (String personIdToPrayFor : personIdsToPrayFor) {
       managedPersonIdsToPrayFor.add(realm.copyToRealm(new RealmString(personIdToPrayFor)));
     }
     realmCacheData.setPersonIdsToPrayFor(managedPersonIdsToPrayFor);
   }
   if (newCacheData.getScriptureCitation() != null)
     realmCacheData.setScriptureCitation(newCacheData.getScriptureCitation());
   if (newCacheData.getScriptureText() != null)
     realmCacheData.setScriptureText(newCacheData.getScriptureText());
   if (newCacheData.getScriptureJson() != null)
     realmCacheData.setScriptureJson(newCacheData.getScriptureJson());
   if (newCacheData.getVerseImageURL() != null)
     realmCacheData.setVerseImageURL(newCacheData.getVerseImageURL());
 }