Class IngredientService
java.lang.Object
com.kosdev.kos.ext.dispense.service.ingredient.IngredientService
Service that provides access to available ingredients. This provides a central service
that coordinates the installation and dissemination of ingredients along with relevant
lifecycle events.
Ingredients provided by this service are used during the insertion process to assign
ingredients to holders. This service just acts as a proxy to sources of ingredients
provided by IngredientSource objects.
This service allows multiple ingredient sources to be registered and holders can be tagged with corresponding ingredient source id's to ensure that only ingredients from the tagged source can be inserted. The service has a concept of a default source which can be used in applications that don't require multiple distinct ingredients collections.
- Since:
- 1
- Version:
- 1
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSource(IngredientSource source) Add the ingredient source to the service.Return the default ingredient source.getIngredient(String id) Return an ingredient for the specified ingredient id from the default source.getIngredient(String sourceId, String id) Return an ingredient for the specified ingredient id in the specified source.Return theIngredientSourcewith the specified id.Return the collection of ingredient sources.booleanReturn true if any source existsbooleanReturn true if an ingredient source exists.voidremoveSource(String sourceId) Remove a source by the id of the source.voidsetDefaultSource(IngredientSource source) Add the source and use the source as the default ingredient source.
-
Field Details
-
DEFAULT_INGREDIENT_SOURCE_SEPARATOR
- See Also:
-
-
Method Details
-
setDefaultSource
Add the source and use the source as the default ingredient source.- Parameters:
source- the new default ingredient source or null- Since:
- 1
-
getDefaultSource
Return the default ingredient source.- Since:
- 1
-
addSource
Add the ingredient source to the service. This will replace any existing source with the same id.- Parameters:
source- the ingredient source to add- Since:
- 1
-
removeSource
Remove a source by the id of the source.- Parameters:
sourceId- the source of the id to remove- Since:
- 1
-
getSource
Return theIngredientSourcewith the specified id.- Parameters:
sourceId- id of the source to return- Since:
- 1
-
getSources
Return the collection of ingredient sources.- Since:
- 1
-
hasSource
Return true if an ingredient source exists.- Parameters:
sourceId- the id of the source to check- Since:
- 1
-
hasAnySource
public boolean hasAnySource()Return true if any source exists- Since:
- 1
-
getIngredient
Return an ingredient for the specified ingredient id from the default source.- Parameters:
id- the group id of the ingredient to return- Since:
- 1
-
getIngredient
Return an ingredient for the specified ingredient id in the specified source.- Parameters:
sourceId- the id of the sourceid- the id of the ingredient to return- Since:
- 1
-
getIngredientSourceSeparator
-