Пример #1
0
 @Override
 public Observable<List<MessageEntity>> fetchByType(MessageEntity.Type type) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource
       .fetchMessageByType(mMessageDataMapper.map(type))
       .map((messageList -> mMessageDataMapper.map(messageList)));
 }
Пример #2
0
 @Override
 public Observable<List<MessageEntity>> fetchByStatus(MessageEntity.Status status) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource
       .fetchMessageByStatus(mMessageDataMapper.map(status))
       .map((messageList -> mMessageDataMapper.map(messageList)));
 }
Пример #3
0
 @Override
 public Observable<List<MessageEntity>> fetchPending() {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource
       .fetchPending()
       .map((messageList -> mMessageDataMapper.map(messageList)));
 }
Пример #4
0
 @Override
 public Observable<List<MessageEntity>> importMessage() {
   return Observable.defer(
       () -> {
         ProcessSms processSms = mPostMessage.getProcessSms();
         List<SmsMessage> smsMessages = processSms.importMessages();
         List<Message> messages = new ArrayList<>();
         for (SmsMessage smsMessage : smsMessages) {
           messages.add(mPostMessage.map(smsMessage));
         }
         return Observable.just(mMessageDataMapper.map(messages));
       });
 }
Пример #5
0
 @Override
 public Observable<Long> updateEntity(MessageEntity messageEntity) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource.put(mMessageDataMapper.map(messageEntity));
 }
Пример #6
0
 @Override
 public Observable<MessageEntity> getEntity(Long id) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource.getMessage(id).map(message -> mMessageDataMapper.map(message));
 }
Пример #7
0
 @Override
 public List<MessageEntity> syncFetchPending() {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataMapper.map(mMessageDataSource.syncFetchPending());
 }
Пример #8
0
 @Override
 public MessageEntity syncFetchByUuid(String uuid) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataMapper.map(mMessageDataSource.fetchMessageByUuid(uuid));
 }