Interface IUIBehaviour


public interface IUIBehaviour
IDEMPIERE-7024 OSGi extension point that lets a plugin participate in three UI decisions: - lookup cache partitioning via getLookupCacheKeySuffix(org.compiere.model.Lookup, org.compiere.model.MLookupInfo) - whether a tab is editable (e.g. workflow approval, role-based read-only) - whether a single field is editable (e.g. PII masking for certain roles, license-based feature gating)

Lookup cache

A non-null suffix appended to the cache key creates an isolated cache bucket (e.g. one per history date) using the existing CCache infrastructure — caching stays active, just partitioned. Returning null (the default) is a no-op with zero overhead.

Veto semantics

Boolean methods use veto semantics: return true when not relevant (neutral/allow), false to deny. The aggregator in UIBehaviourProvider returns false as soon as any provider returns false. Implementations must be registered via OSGi Declarative Services as providers of this interface. The core helper UIBehaviourProvider iterates all registered providers and aggregates their answers with AND logic.
  • Method Details

    • getLookupCacheKeySuffix

      default String getLookupCacheKeySuffix(Lookup lookup, MLookupInfo lookupInfo)
      Return a suffix appended to the lookup cache key to create an isolated cache bucket, or null to use the standard key.

      Example: a time-machine provider returns "HST@2026-06-23" so each history date gets its own cache partition while caching stays active. In normal (non-time-travel) mode the provider returns null — zero overhead, identical to vanilla iDempiere.

      Parameters:
      lookup - the lookup being evaluated
      lookupInfo - the lookup info (may be null)
      Returns:
      null to use the standard cache key, or a non-empty string to partition
    • isTabEditable

      boolean isTabEditable(Properties ctx, GridTab tab)
      Additional check on tab editability. The tab is editable only if EVERY registered provider allows it.
      Parameters:
      ctx - current context
      tab - the tab being evaluated
      Returns:
      true to allow edit (or when not relevant), false to deny
    • isFieldEditable

      boolean isFieldEditable(Properties ctx, GridField field, boolean checkContext, boolean isGrid)
      Additional check on field editability. The field is editable only if EVERY registered provider allows it.
      Parameters:
      ctx - current context
      field - the field being evaluated
      checkContext - pass-through flag from GridField.isEditable
      isGrid - pass-through flag from GridField.isEditable
      Returns:
      true to allow edit (or when not relevant), false to deny