Class CardService

java.lang.Object
de.bytestore.hostinger.handler.CardService

@Component @Service public class CardService extends Object
The cardService class is responsible for managing dynamic cards and their settings.
  • 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

      public DynamicCard getCard(String providerIO)
      Retrieves the DynamicCard object based on the provided ID from the list of cards.
      Parameters:
      providerIO - The ID of the card to retrieve.
      Returns:
      The DynamicCard object that matches the specified ID, or null if the card is not found.
    • addCard

      public void addCard(DynamicCard cardIO)
      Adds a dynamic card to the list of cards.
      Parameters:
      cardIO - The dynamic card to be added.
    • setSetting

      public void setSetting(String cardIO, String keyIO, String valueIO)
      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

      public String getSetting(String cardIO, String keyIO)
      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

      public String getSetting(String cardIO, String keyIO, String defaultIO)
      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

      public CardConfig getSettingObject(String cardIO, String keyIO)
      Retrieves the CardConfig object for a given card and key.
      Parameters:
      cardIO - The card associated with the setting.
      keyIO - The key of the setting.
      Returns:
      The CardConfig object that matches the specified card and key, or null if the setting is not found.
    • getSources

      public ArrayList<String> getSources()
    • registerLocation

      public void registerLocation(String containerIO)
      Adds a location to the list of registered locations.
      Parameters:
      containerIO - The ID of the location to register.
    • isLocation

      public boolean isLocation(String containerId)
      Checks if a location is registered.
      Parameters:
      containerId - The ID of the location to check.
      Returns:
      true if the location is registered, false otherwise.
    • getCardsByLocation

      public List<DynamicCard> getCardsByLocation(String containerId)
      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

      public String getSource(String sourceIO)
      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

      public void removeCardSettings(UUID idIO)
      Removes all card settings associated with a specified card.
      Parameters:
      idIO - The ID of the card for which to remove the settings.