Class FieldsSettingsService

java.lang.Object
sk.iway.iwcm.system.datatable.settings.fields.rest.FieldsSettingsService

@Service public class FieldsSettingsService extends Object
Caches field settings by class and domain and discovers annotated entities for autocomplete. Shares class discovery with custom fields; autocomplete metadata comes from annotations and domain-scoped tab settings.
  • Constructor Details

  • Method Details

    • getFieldsSettings

      public FieldsSettingsEntity[] getFieldsSettings(String className, int domainId)
      Loads settings for a class and domain, caching the result for one hour.
      Parameters:
      className - fully qualified entity class name
      domainId - domain owning the settings
      Returns:
      the cached settings array, empty when no overrides exist
    • getCacheKey

      public String getCacheKey(String className, int domainId)
      Builds a fixed-length cache key from the class name and domain ID.
      Parameters:
      className - fully qualified entity class name
      domainId - domain owning the settings
      Returns:
      the settings prefix followed by the SHA-256 hash of the class/domain pair
    • clearCache

      public void clearCache(String cacheKey)
      Removes cached settings locally and requests invalidation on the other cluster nodes.
      Parameters:
      cacheKey - key returned by getCacheKey(String, int)
    • getClassOptions

      public List<String> getClassOptions(String term)
      Returns sorted entity class names containing the search term and at least one datatable column.
      Parameters:
      term - search text, or % or * to return all eligible class names
      Returns:
      case-insensitively sorted matching class names, or an empty list for an empty term
    • getCustomFieldClassOptions

      public List<String> getCustomFieldClassOptions(String term)
      Returns custom-field class suggestions while retaining literal substring matching.
      Parameters:
      term - substring to match; * and % do not expand to all classes
      Returns:
      case-insensitively sorted matching class names, or an empty list for blank input
    • getFieldOptions

      public List<LabelValue> getFieldOptions(String term, String className, Prop prop)
      Returns localized column titles with field paths as labels and raw field paths as values, excluding ID columns.
      Parameters:
      term - search text, or % or * to return all field names
      className - fully qualified selected class name
      prop - translations for the current request
      Returns:
      options matching the title or field name, or an empty list for empty input or an unknown class
    • getTabOptions

      public List<LabelValue> getTabOptions(String term, String className, Prop prop)
      Returns localized tab titles from the selected class's annotations and current-domain settings with raw IDs as values.
      Parameters:
      term - search text, or % or * to return all tab IDs
      className - fully qualified selected class name
      prop - translations for the current request
      Returns:
      options matching the title or tab ID, or an empty list for empty input or no matching tabs
    • hasTab

      public boolean hasTab(String className, String tabId, int domainId)
      Checks a tab ID against the entity's editor metadata and settings in the supplied domain.
      Parameters:
      className - fully qualified selected class name
      tabId - raw tab ID to validate
      domainId - domain owning the settings
      Returns:
      whether the tab exists for this entity and domain
    • hasTab

      public boolean hasTab(String className, String tabId, int domainId, Long excludedSettingsId)
      Checks a tab ID while excluding a persisted setting that is being changed. Declared or inferred tabs remain available even if their saved override is excluded.
      Parameters:
      className - fully qualified selected class name
      tabId - raw tab ID to validate
      domainId - domain owning the settings
      excludedSettingsId - persisted tab setting being edited, or null to include all settings
      Returns:
      whether the tab still exists without the excluded setting