Interface ModelSearchStrategy

All Known Implementing Classes:
DefaultItemModelSearchStrategy

public interface ModelSearchStrategy
This interface describes strategy for searching model instances by example model. Currently only used in ModelService.getByExample(Object).

Example:
ProductModel exampleProduct = new ProductModel(); exampleProduct.setCode("test"); ModelConverter converter = defaultModelService.getModelConverterByModel(exampleProduct); ProductModel foundProduct = defaultItemModelSearchStrategy.getModelByExample(converter,exampleProduct);
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    Search for an existing model by a given (not saved) example model.
    <T> List<T>
    Search for an existing models by a given (not saved) example model.
  • Method Details

    • getModelByExample

      <T> T getModelByExample(ModelConverter conv, T example)
      Search for an existing model by a given (not saved) example model. Every modified attribute in this example is used as search parameter.
      Type Parameters:
      T - the type of the model and the type of the search result. Can be the same type or a subtype.
      Parameters:
      example - the example model
      conv - the model converter
      Returns:
      the search result as object(model)
      Throws:
      ModelNotFoundException - if nothing was found
      AmbiguousIdentifierException - if by the given searchparams to many models where found
    • getModelsByExample

      <T> List<T> getModelsByExample(ModelConverter conv, T example)
      Search for an existing models by a given (not saved) example model. Every modified attribute in this example is used as search parameter.
      Type Parameters:
      T - the type of the model and the type of the search result. Can be the same type or a subtype.
      Parameters:
      example - the example model
      conv - the model converter
      Returns:
      list containing zero or more models
      Throws:
      ModelNotFoundException - if nothing was found