Ejemplo n.º 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)));
 }
Ejemplo n.º 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)));
 }
Ejemplo n.º 3
0
 @Override
 public Observable<List<MessageEntity>> fetchPending() {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource
       .fetchPending()
       .map((messageList -> mMessageDataMapper.map(messageList)));
 }
Ejemplo n.º 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));
       });
 }
Ejemplo n.º 5
0
 @Override
 public Observable<Long> updateEntity(MessageEntity messageEntity) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource.put(mMessageDataMapper.map(messageEntity));
 }
Ejemplo n.º 6
0
 @Override
 public Observable<MessageEntity> getEntity(Long id) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataSource.getMessage(id).map(message -> mMessageDataMapper.map(message));
 }
Ejemplo n.º 7
0
 @Override
 public List<MessageEntity> syncFetchPending() {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataMapper.map(mMessageDataSource.syncFetchPending());
 }
Ejemplo n.º 8
0
 @Override
 public MessageEntity syncFetchByUuid(String uuid) {
   mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource();
   return mMessageDataMapper.map(mMessageDataSource.fetchMessageByUuid(uuid));
 }