Giter Site home page Giter Site logo

repositorybuilder's People

Contributors

a4b5tq avatar nikolayshaliavski avatar

Stargazers

 avatar Ivan Tonov avatar Andriana avatar Илиян Илиев avatar Vasil Gramov avatar  avatar Ivaylo Ivanov avatar Ivaylo Bosev avatar  avatar  avatar

Watchers

Ivaylo Ivanov avatar  avatar Ognyan Ignatov avatar  avatar

repositorybuilder's Issues

Migrate to separate CLI extension and build possible relation filtrations

Imagine the following entities

class Author {
   private int id;
   private String name;
   private List<Book> books;
}
class Book {
   private int id;
   private String name;
   @Unique private String ISBN;
   private List<Author> authors;
   private Cover cover;
}
class Cover {
   private int id;
   private String imagePath;
   private String title;
}

I would like in my AuthorRepository to have all possible permutations of filtration fields and ordering, both for all relational (navigational) properties in the object graph (Filter author by its books, or by its books' cover). Beware from possible graph cycles.

  • findByName(name);
  • findOneByName(name);
  • findByNameOrderByIdAsc(name);
  • findByNameOrderByIdDesc(name);
  • findByNameOrderByNameAsc(name);
  • findByNameOrderByBooksIdAsc(name);
  • findByNameOrderByBooksIdDesc(name);
  • findByNameOrderByBooksISBNAsc(name);
  • findByNameOrderByBooksISBNDesc(name);
  • findByNameOrderByBooksNameAsc(name);
  • findByNameOrderByBooksNameDesc(name);
  • findByNameOrderByBooksCoverIdAsc(name);
  • findByNameOrderByBooksCoverIdDesc(name);
  • findByNameOrderByBooksCoverImagePathAsc(name);
  • findByNameOrderByBooksCoverImagePathDesc(name);
  • findByNameOrderByBooksCoverTitleAsc(name);
  • findByNameOrderByBooksCoverTitleDesc(name);
  • findAllOrderByIdAsc();
  • findAllOrderByIdDesc();
  • findAllOrderByNameAsc();
  • findAllOrderByBooksIdAsc();
  • findAllOrderByBooksIdDesc();
  • findAllOrderByBooksISBNAsc();
  • findAllOrderByBooksISBNDesc();
  • findAllOrderByBooksNameAsc();
  • findAllOrderByBooksNameDesc();
  • findAllOrderByBooksCoverIdAsc();
  • findAllOrderByBooksCoverIdDesc();
  • findAllOrderByBooksCoverImagePathAsc();
  • findAllOrderByBooksCoverImagePathDesc();
  • findAllOrderByBooksCoverTitleAsc();
  • findAllOrderByBooksCoverTitleDesc();
  • ... and so forth for all fields
  • findOneByISBN(bookISBN);
  • Do not generate findAllByISBN since ISBN is @unique.

As the repository class might grow extremely fast, you can leave the user a chance to create only several methods by some pattern. For example:

  • Create only methods with filtration for primitive fields
  • Create only methods with ordering only for primitive fields
  • Create methods only to certain level of nesting (e.g 1 -> Authors->Books, without Cover)

This could be easily done if you change the configuration as input arguments to your CLI extension. Right now the plugin is bundled to the project and scans entities with annotations, but this highly couples the project to the plugin, but the plugin is used only for one-time startup.

Create a CLI interface that accepts the repository folder where they need to be created and the flags for filtration e.g.

repository-builder.sh /src/main/java/myapp/repository --fields=all
repository-builder.sh /src/main/java/myapp/repository --fields=primitive
repository-builder.sh /src/main/java/myapp/repository --fields=depth(N)

  • where N is the nesting level

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.