samedi 30 mai 2020

Design pattern - Filter list of objects through various steps and finally select one object

I have list of objects in database now they are filtered at various steps depends of conditions and then finally select one object from the list and return. Here are Steps

  1. Get a list of objects based on input request from database
  2. Filter some objects based on business rules
  3. Call external HTTP services for each object and set properties of object based on response
  4. Filter the list based on properties set in step 3 and business rules
  5. Call external another HTTP services for each list from step 4 and set properties of object based on response
  6. Get one object base on populated list in step 5 and business rules

Now based on input we don't require some steps like if input value is "1" do step 1,5,6 like if input value is "2" do step 1,2,3,4,5,6 like if input value is "3" do step 1,2,5,6 etc

Which patter should i use here

Aucun commentaire:

Enregistrer un commentaire