@Override public Observable<List<MessageEntity>> fetchPending() { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource .fetchPending() .map((messageList -> mMessageDataMapper.map(messageList))); }
@Override public Observable<List<MessageEntity>> fetchByType(MessageEntity.Type type) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource .fetchMessageByType(mMessageDataMapper.map(type)) .map((messageList -> mMessageDataMapper.map(messageList))); }
@Override public Observable<List<MessageEntity>> fetchByStatus(MessageEntity.Status status) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource .fetchMessageByStatus(mMessageDataMapper.map(status)) .map((messageList -> mMessageDataMapper.map(messageList))); }
@Override public Observable<Integer> deleteByUuid(String uuid) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource.deleteByUuid(uuid); }
@Override public Observable<Integer> deleteAll() { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource.deleteAll(); }
@Override public Observable<Long> deleteEntity(Long id) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource.deleteEntity(id); }
@Override public Observable<Long> updateEntity(MessageEntity messageEntity) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource.put(mMessageDataMapper.map(messageEntity)); }
@Override public Observable<MessageEntity> getEntity(Long id) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataSource.getMessage(id).map(message -> mMessageDataMapper.map(message)); }
@Override public List<MessageEntity> syncFetchPending() { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataMapper.map(mMessageDataSource.syncFetchPending()); }
@Override public MessageEntity syncFetchByUuid(String uuid) { mMessageDataSource = mMessageDataSourceFactory.createMessageDatabaseSource(); return mMessageDataMapper.map(mMessageDataSource.fetchMessageByUuid(uuid)); }