Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Review Repository/PaginatedRepository use. #34

Open
pedrovgs opened this issue Dec 21, 2015 · 0 comments
Open

Review Repository/PaginatedRepository use. #34

pedrovgs opened this issue Dec 21, 2015 · 0 comments

Comments

@pedrovgs
Copy link
Contributor

To use a PaginatedRepository implementation we have to extend from PaginatedRepository and write code like this:

  @Inject public CharactersRepository(CharacterDataSourceFactory characterDataSourceFactory,
      @Named(ApplicationModule.CHARACTERS_PAGE_IN_MEMORY_CACHE)
      PaginatedCacheDataSource<String, Character> inMemoryPaginatedCache,
      @Named(ApplicationModule.CHARACTERS_IN_MEMORY_CACHE)
      CacheDataSource<String, Character> inMemoryCache) {
    addCacheDataSources(inMemoryCache);
    addPaginatedCacheDataSources(inMemoryPaginatedCache);

    CharacterDataSource characterDataSource = characterDataSourceFactory.createDataSource();
    addReadableDataSources(characterDataSource);
    addPaginatedReadableDataSources(characterDataSource);
  }

We should review this implementation to do not need to add the data source to the cache data sources list and the paginated list. We should just configure the same data source once because a paginated data source should be used as a normal data source.

The usage of the repository should be something like:

  @Inject public CharactersRepository(CharacterDataSourceFactory characterDataSourceFactory,
      @Named(ApplicationModule.CHARACTERS_PAGE_IN_MEMORY_CACHE)
      PaginatedCacheDataSource<String, Character> inMemoryPaginatedCache) {
    addPaginatedCacheDataSources(inMemoryPaginatedCache);

    CharacterDataSource characterDataSource = characterDataSourceFactory.createDataSource();
    addPaginatedReadableDataSources(characterDataSource);
  }
@pedrovgs pedrovgs added this to the 1.0.0 milestone Dec 21, 2015
@pedrovgs pedrovgs mentioned this issue Dec 21, 2015
@pedrovgs pedrovgs modified the milestones: 2.0.0, 1.0.0 Feb 18, 2016
@Serchinastico Serchinastico removed this from the 3.0.0 milestone Mar 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants