Package de.bytestore.hostinger.handler
Class CardService
java.lang.Object
de.bytestore.hostinger.handler.CardService
The cardService class is responsible for managing dynamic cards and their settings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCard(DynamicCard cardIO) Adds a dynamic card to the list of cards.Retrieves theDynamicCardobject based on the provided ID from the list of cards.getCardsByLocation(String containerId) Retrieves a list of DynamicCard objects based on the provided container ID.getSetting(String cardIO, String keyIO) Retrieves the value of a setting for a given card and key.getSetting(String cardIO, String keyIO, String defaultIO) Retrieves the value of a setting for a given card and key.getSettingObject(String cardIO, String keyIO) Retrieves theCardConfigobject for a given card and key.Retrieves the source based on the provided input.booleanisLocation(String containerId) Checks if a location is registered.voidload()voidonApplicationStarted(org.springframework.boot.context.event.ApplicationStartedEvent event) voidregisterLocation(String containerIO) Adds a location to the list of registered locations.voidremoveCardSettings(UUID idIO) Removes all card settings associated with a specified card.voidvoidsetSetting(String cardIO, String keyIO, String valueIO) Sets the value of a setting for a given card and key.
-
Constructor Details
-
CardService
public CardService()
-
-
Method Details
-
scanBeans
public void scanBeans() -
onApplicationStarted
@EventListener public void onApplicationStarted(org.springframework.boot.context.event.ApplicationStartedEvent event) -
load
public void load() -
getCard
Retrieves theDynamicCardobject based on the provided ID from the list of cards.- Parameters:
providerIO- The ID of the card to retrieve.- Returns:
- The
DynamicCardobject that matches the specified ID, or null if the card is not found.
-
addCard
Adds a dynamic card to the list of cards.- Parameters:
cardIO- The dynamic card to be added.
-
setSetting
Sets the value of a setting for a given card and key. If the setting does not exist, it creates a new one.- Parameters:
cardIO- The card associated with the setting.keyIO- The key of the setting.valueIO- The value to set for the setting.
-
getSetting
Retrieves the value of a setting for a given card and key. If the setting is not found, returns the default value.- Parameters:
cardIO- The card associated with the setting.keyIO- The key of the setting.- Returns:
- The value of the setting, or the default value if the setting is not found.
-
getSetting
Retrieves the value of a setting for a given card and key. If the setting is not found, returns the default value.- Parameters:
cardIO- The card associated with the setting.keyIO- The key of the setting.defaultIO- The default value to return if the setting is not found.- Returns:
- The value of the setting, or the default value if the setting is not found.
-
getSettingObject
Retrieves theCardConfigobject for a given card and key.- Parameters:
cardIO- The card associated with the setting.keyIO- The key of the setting.- Returns:
- The
CardConfigobject that matches the specified card and key, or null if the setting is not found.
-
getSources
-
registerLocation
Adds a location to the list of registered locations.- Parameters:
containerIO- The ID of the location to register.
-
isLocation
Checks if a location is registered.- Parameters:
containerId- The ID of the location to check.- Returns:
trueif the location is registered,falseotherwise.
-
getCardsByLocation
Retrieves a list of DynamicCard objects based on the provided container ID.- Parameters:
containerId- The ID of the container to retrieve the cards from.- Returns:
- A list of DynamicCard objects that belong to the specified container ID.
-
getSource
Retrieves the source based on the provided input.- Parameters:
sourceIO- The input representing the source.- Returns:
- The source object based on the provided input, or "Not implemented" if the source is not supported.
-
removeCardSettings
Removes all card settings associated with a specified card.- Parameters:
idIO- The ID of the card for which to remove the settings.
-