Class QInstance

java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.QInstance

public class QInstance extends Object
Container for all meta-data in a running instance of a QQQ application.
  • Field Details

  • Constructor Details

    • QInstance

      public QInstance()
  • Method Details

    • getBackendForTable

      public QBackendMetaData getBackendForTable(String tableName)
      Get the backend for a given table name
    • getProcessesForTable

      public List<QProcessMetaData> getProcessesForTable(String tableName)
      Get the list of processes associated with a given table name
    • getTablePath

      public String getTablePath(String tableName) throws QException
      Get the full path to a table - note - this will be regardless of whether or not the active session/user has access to the table. You may want to also call PermissionsHelper.getPermissionCheckResult to confirm if user has permission.
      Throws:
      QException
    • getProcessPath

      public String getProcessPath(String processName) throws QException
      Get the full path to a process - note - this will be regardless of whether or not the active session/user has access to the process. You may want to also call PermissionsHelper.getPermissionCheckResult to confirm if user has permission.
      Throws:
      QException
    • addBackend

      public void addBackend(QBackendMetaData backend)
    • getBackend

      public QBackendMetaData getBackend(String name)
    • getBackends

      public Map<String,QBackendMetaData> getBackends()
      Getter for backends
    • setBackends

      public void setBackends(Map<String,QBackendMetaData> backends)
      Setter for backends
    • replaceTables

      public void replaceTables(Map<String,QTableMetaData> replacements, QInstanceValidationKey key)
      Replace existing, validated tables atomically; keep startup validation state.
    • addTable

      public void addTable(QTableMetaData table)
    • getTable

      public QTableMetaData getTable(String name)
    • getTables

      public Map<String,QTableMetaData> getTables()
      Getter for tables
    • setTables

      public void setTables(Map<String,QTableMetaData> tables)
      Setter for tables
    • addJoin

      public void addJoin(QJoinMetaData join)
    • getJoin

      public QJoinMetaData getJoin(String name)
    • getJoins

      public Map<String,QJoinMetaData> getJoins()
      Getter for joins
    • setJoins

      public void setJoins(Map<String,QJoinMetaData> joins)
      Setter for joins
    • addPossibleValueSource

      public void addPossibleValueSource(QPossibleValueSource possibleValueSource)
    • getPossibleValueSource

      public QPossibleValueSource getPossibleValueSource(String name)
    • getPossibleValueSources

      public Map<String,QPossibleValueSource> getPossibleValueSources()
      Getter for possibleValueSources
    • setPossibleValueSources

      public void setPossibleValueSources(Map<String,QPossibleValueSource> possibleValueSources)
      Setter for possibleValueSources
    • getProcessStep

      public QStepMetaData getProcessStep(String processName, String functionName)
    • addProcess

      public void addProcess(QProcessMetaData process)
    • getProcess

      public QProcessMetaData getProcess(String name)
    • getProcesses

      public Map<String,QProcessMetaData> getProcesses()
      Getter for processes
    • setProcesses

      public void setProcesses(Map<String,QProcessMetaData> processes)
      Setter for processes
    • addApp

      public void addApp(QAppMetaData app)
    • getApp

      public QAppMetaData getApp(String name)
    • getApps

      public Map<String,QAppMetaData> getApps()
      Getter for apps
    • setApps

      public void setApps(Map<String,QAppMetaData> apps)
      Setter for apps
    • addReport

      public void addReport(QReportMetaData report)
    • getReport

      public QReportMetaData getReport(String name)
    • getReports

      public Map<String,QReportMetaData> getReports()
      Getter for reports
    • setReports

      public void setReports(Map<String,QReportMetaData> reports)
      Setter for reports
    • getSupplementalCustomizer

      public QCodeReference getSupplementalCustomizer(SupplementalCustomizerType type)
      Getter for a supplemental customizer based on type
      See Also:
    • getSupplementalCustomizers

      public Map<SupplementalCustomizerType,QCodeReference> getSupplementalCustomizers()
      Getter for supplementalCustomizers
      See Also:
    • setSupplementalCustomizers

      public void setSupplementalCustomizers(Map<SupplementalCustomizerType,QCodeReference> supplementalCustomizers)
      Setter for supplementalCustomizers
      See Also:
    • addSupplementalCustomizer

      public QInstance addSupplementalCustomizer(SupplementalCustomizerType type, QCodeReference customizer)
      Fluent adder to supplementalCustomizers
      See Also:
    • withSupplementalCustomizers

      public QInstance withSupplementalCustomizers(Map<SupplementalCustomizerType,QCodeReference> supplementalCustomizers)
      Fluent setter for supplementalCustomizers
      Parameters:
      supplementalCustomizers - Map of supplemental customizer types to QCodeReference instances, allowing customizers to be applied to various QQQ components, e.g. RunAdHocScriptCustomizers
      Returns:
      this
    • addSecurityKeyType

      public void addSecurityKeyType(QSecurityKeyType securityKeyType)
    • getSecurityKeyType

      public QSecurityKeyType getSecurityKeyType(String name)
    • getSecurityKeyTypes

      public Map<String,QSecurityKeyType> getSecurityKeyTypes()
      Getter for securityKeyTypes
    • setSecurityKeyTypes

      public void setSecurityKeyTypes(Map<String,QSecurityKeyType> securityKeyTypes)
      Setter for securityKeyTypes
    • addAutomationProvider

      public void addAutomationProvider(QAutomationProviderMetaData automationProvider)
    • getAutomationProvider

      public QAutomationProviderMetaData getAutomationProvider(String name)
    • getAutomationProviders

      public Map<String,QAutomationProviderMetaData> getAutomationProviders()
      Getter for automationProviders
    • setAutomationProviders

      public void setAutomationProviders(Map<String,QAutomationProviderMetaData> automationProviders)
      Setter for automationProviders
    • addMessagingProvider

      public void addMessagingProvider(QMessagingProviderMetaData messagingProvider)
    • getMessagingProvider

      public QMessagingProviderMetaData getMessagingProvider(String name)
    • getMessagingProviders

      public Map<String,QMessagingProviderMetaData> getMessagingProviders()
      Getter for messagingProviders
    • setMessagingProviders

      public void setMessagingProviders(Map<String,QMessagingProviderMetaData> messagingProviders)
      Setter for messagingProviders
    • getHasBeenValidated

      public boolean getHasBeenValidated()
      Getter for hasBeenValidated
    • setHasBeenValidated

      public void setHasBeenValidated(QInstanceValidationKey key)
      If pass a QInstanceValidationKey (which can only be instantiated by the validator), then the validationState will be set to COMPLETE. Else, if passed a null, the validationState will be reset to PENDING. e.g., to re-trigger validation (can be useful in tests).
    • setValidationIsRunning

      public void setValidationIsRunning(QInstanceValidationKey key)
      If pass a QInstanceValidationKey (which can only be instantiated by the validator), then the validationState set to RUNNING.
    • getValidationIsRunning

      public boolean getValidationIsRunning()
      check if the instance is currently running validation.
    • getBranding

      public QBrandingMetaData getBranding()
      Getter for branding
    • setBranding

      public void setBranding(QBrandingMetaData branding)
      Setter for branding
    • getAuthentication

      public QAuthenticationMetaData getAuthentication()
      Getter for authentication
    • withInstanceDefaultAuthentication

      public QInstance withInstanceDefaultAuthentication(QAuthenticationMetaData authMetaData)
      Fluent setter for instance default authentication.

      This is a convenience method that registers the authentication provider under the instance default scope. Equivalent to calling: registerAuthenticationProvider(AuthScope.instanceDefault(), authMetaData)

      Parameters:
      authMetaData - The authentication metadata to register as instance default
      Returns:
      This QInstance for method chaining
    • registerAuthenticationProvider

      public void registerAuthenticationProvider(AuthScope scope, QAuthenticationMetaData authMetaData)
      Register an authentication provider for a specific scope.

      Scopes allow different authentication providers to be registered for different parts of the application (instance default, specific APIs, or route providers). The resolver will check scopes in order of specificity when resolving authentication for a request.

      Parameters:
      scope - The scope to register the provider for (must not be null)
      authMetaData - The authentication metadata to register (must not be null)
    • findAuthenticationProvider

      public Optional<QAuthenticationMetaData> findAuthenticationProvider(AuthScope scope)
      Find an authentication provider for a specific scope.
      Parameters:
      scope - The scope to look up (must not be null)
      Returns:
      Optional containing the authentication metadata if found, empty otherwise
    • getScopedAuthenticationProviders

      public Map<AuthScope,QAuthenticationMetaData> getScopedAuthenticationProviders()
      Get all registered scoped authentication providers.
      Returns:
      Unmodifiable map of all scoped authentication providers
    • getWidgets

      public Map<String,QWidgetMetaDataInterface> getWidgets()
      Getter for widgets
    • setWidgets

      public void setWidgets(Map<String,QWidgetMetaDataInterface> widgets)
      Setter for widgets
    • addWidget

      public void addWidget(QWidgetMetaDataInterface widget)
    • getWidget

      public QWidgetMetaDataInterface getWidget(String name)
    • addQueueProvider

      public void addQueueProvider(QQueueProviderMetaData queueProvider)
    • getQueueProvider

      public QQueueProviderMetaData getQueueProvider(String name)
    • getQueueProviders

      public Map<String,QQueueProviderMetaData> getQueueProviders()
      Getter for queueProviders
    • setQueueProviders

      public void setQueueProviders(Map<String,QQueueProviderMetaData> queueProviders)
      Setter for queueProviders
    • addQueue

      public void addQueue(QQueueMetaData queue)
    • getQueue

      public QQueueMetaData getQueue(String name)
    • getQueues

      public Map<String,QQueueMetaData> getQueues()
      Getter for queues
    • setQueues

      public void setQueues(Map<String,QQueueMetaData> queues)
      Setter for queues
    • getEnvironmentValues

      public Map<String,String> getEnvironmentValues()
      Getter for environmentValues
    • setEnvironmentValues

      public void setEnvironmentValues(Map<String,String> environmentValues)
      Setter for environmentValues
    • getHomeAppName

      public String getHomeAppName()
      Getter for homeAppName - the app whose dashboard a frontend shows as the instance's home page (e.g., at /app/); null for the frontend's own default.
    • setHomeAppName

      public void setHomeAppName(String homeAppName)
      Setter for homeAppName
    • withHomeAppName

      public QInstance withHomeAppName(String homeAppName)
      Fluent setter for homeAppName
    • getDefaultPermissionRules

      public QPermissionRules getDefaultPermissionRules()
      Getter for defaultPermissionRules
    • setDefaultPermissionRules

      public void setDefaultPermissionRules(QPermissionRules defaultPermissionRules)
      Setter for defaultPermissionRules
    • withDefaultPermissionRules

      public QInstance withDefaultPermissionRules(QPermissionRules defaultPermissionRules)
      Fluent setter for defaultPermissionRules
    • setDefaultTimeZoneId

      public void setDefaultTimeZoneId(String defaultTimeZoneId)
      Setter for defaultTimeZoneId
    • withDefaultTimeZoneId

      public QInstance withDefaultTimeZoneId(String defaultTimeZoneId)
      Fluent setter for defaultTimeZoneId
    • getDefaultTimeZoneId

      public String getDefaultTimeZoneId()
      Getter for defaultTimeZoneId
    • getAllowedSecurityKeyNames

      public Set<String> getAllowedSecurityKeyNames()
    • getDefaultAuditRules

      public QAuditRules getDefaultAuditRules()
      Getter for defaultAuditRules
    • setDefaultAuditRules

      public void setDefaultAuditRules(QAuditRules defaultAuditRules)
      Setter for defaultAuditRules
    • withDefaultAuditRules

      public QInstance withDefaultAuditRules(QAuditRules defaultAuditRules)
      Fluent setter for defaultAuditRules
    • getSupplementalMetaData

      public Map<String,QSupplementalInstanceMetaData> getSupplementalMetaData()
      Getter for supplementalMetaData
    • getSupplementalMetaData

      public QSupplementalInstanceMetaData getSupplementalMetaData(String type)
      Getter for supplementalMetaData
    • setSupplementalMetaData

      public void setSupplementalMetaData(Map<String,QSupplementalInstanceMetaData> supplementalMetaData)
      Setter for supplementalMetaData
    • withSupplementalMetaData

      public QInstance withSupplementalMetaData(Map<String,QSupplementalInstanceMetaData> supplementalMetaData)
      Fluent setter for supplementalMetaData
    • withSupplementalMetaData

      public QInstance withSupplementalMetaData(QSupplementalInstanceMetaData supplementalMetaData)
      Fluent setter for supplementalMetaData
    • getJoinGraph

      public JoinGraph getJoinGraph()
    • setJoinGraph

      public void setJoinGraph(QInstanceValidationKey key, JoinGraph joinGraph) throws IllegalArgumentException
      Only the validation (and enrichment) code should set the instance's joinGraph so, we take a package-only-constructable validation key as a param along with the joinGraph - and we throw IllegalArgumentException if a non-null key is given.
      Throws:
      IllegalArgumentException
    • getDeploymentMode

      public String getDeploymentMode()
      Getter for deploymentMode
    • setDeploymentMode

      public void setDeploymentMode(String deploymentMode)
      Setter for deploymentMode
    • withDeploymentMode

      public QInstance withDeploymentMode(String deploymentMode)
      Fluent setter for deploymentMode
    • add

      public void add(TopLevelMetaDataInterface metaData)
    • addScheduler

      public void addScheduler(QSchedulerMetaData scheduler)
    • getScheduler

      public QSchedulerMetaData getScheduler(String name)
    • getSchedulers

      public Map<String,QSchedulerMetaData> getSchedulers()
      Getter for schedulers
    • setSchedulers

      public void setSchedulers(Map<String,QSchedulerMetaData> schedulers)
      Setter for schedulers
    • addSchedulableType

      public void addSchedulableType(SchedulableType schedulableType)
    • getSchedulableType

      public SchedulableType getSchedulableType(String name)
    • getSchedulableTypes

      public Map<String,SchedulableType> getSchedulableTypes()
      Getter for schedulableTypes
    • setSchedulableTypes

      public void setSchedulableTypes(Map<String,SchedulableType> schedulableTypes)
      Setter for schedulableTypes
    • getHelpContent

      public Map<String,List<QHelpContent>> getHelpContent()
      Getter for helpContent
    • setHelpContent

      public void setHelpContent(Map<String,List<QHelpContent>> helpContent)
      Setter for helpContent
    • withHelpContent

      public QInstance withHelpContent(Map<String,List<QHelpContent>> helpContent)
      Fluent setter for helpContent
    • withHelpContent

      public QInstance withHelpContent(String slot, QHelpContent helpContent)
      Fluent setter for adding 1 helpContent (for a slot)
    • removeHelpContent

      public void removeHelpContent(String slot, Set<HelpRole> roles)
      remove a helpContent for a slot based on its set of roles
    • addQBit

      public void addQBit(QBitMetaData qBitMetaData)
    • getQBits

      public Map<String,QBitMetaData> getQBits()
      Getter for qBits
    • setQBits

      public void setQBits(Map<String,QBitMetaData> qBits)
      Setter for qBits
    • withQBits

      public QInstance withQBits(Map<String,QBitMetaData> qBits)
      Fluent setter for qBits
    • getMetaDataActionCustomizer

      public QCodeReference getMetaDataActionCustomizer()
      Getter for metaDataActionCustomizer
    • setMetaDataActionCustomizer

      public void setMetaDataActionCustomizer(QCodeReference metaDataActionCustomizer)
      Setter for metaDataActionCustomizer
    • withMetaDataActionCustomizer

      public QInstance withMetaDataActionCustomizer(QCodeReference metaDataActionCustomizer)
      Fluent setter for metaDataActionCustomizer
    • getTableCustomizers

      public ListingHash<String,QCodeReference> getTableCustomizers()
      Getter for tableCustomizers
    • setTableCustomizers

      public void setTableCustomizers(ListingHash<String,QCodeReference> tableCustomizers)
      Setter for tableCustomizers
    • withTableCustomizers

      public QInstance withTableCustomizers(ListingHash<String,QCodeReference> tableCustomizers)
      Fluent setter for tableCustomizers
    • withTableCustomizer

      public QInstance withTableCustomizer(String role, QCodeReference customizer)
    • withTableCustomizer

      public QInstance withTableCustomizer(TableCustomizers tableCustomizer, QCodeReference customizer)
    • getTableCustomizers

      public List<QCodeReference> getTableCustomizers(TableCustomizers tableCustomizer)
      Getter for tableCustomizers
    • getRecordChangeListeners

      public List<QCodeReference> getRecordChangeListeners()
      Getter for recordChangeListeners
    • setRecordChangeListeners

      public void setRecordChangeListeners(List<QCodeReference> recordChangeListeners)
      Setter for recordChangeListeners
    • withRecordChangeListener

      public QInstance withRecordChangeListener(QCodeReference recordChangeListener)
      Add a RecordChangeListenerInterface, which InsertAction, UpdateAction and DeleteAction call with the records they write successfully.
    • addAuditHandler

      public void addAuditHandler(QAuditHandlerMetaData handler)
      Add an audit handler to the instance.
    • getAuditHandlers

      public Map<String,QAuditHandlerMetaData> getAuditHandlers()
      Getter for auditHandlers
    • setAuditHandlers

      public void setAuditHandlers(Map<String,QAuditHandlerMetaData> auditHandlers)
      Setter for auditHandlers
    • withAuditHandlers

      public QInstance withAuditHandlers(Map<String,QAuditHandlerMetaData> auditHandlers)
      Fluent setter for auditHandlers
    • withAuditHandler

      public QInstance withAuditHandler(QAuditHandlerMetaData handler)
      Fluent setter to add a single audit handler
    • getAuditHandlersForTable

      public List<QAuditHandlerMetaData> getAuditHandlersForTable(String tableName, AuditHandlerType handlerType)
      Get audit handlers for a specific table and handler type. Returns global handlers (no tableNames set) plus handlers for this table.
    • getProcessLifecycleListeners

      public List<QCodeReference> getProcessLifecycleListeners()
      Getter for processLifecycleListeners - code references to ProcessLifecycleListenerInterface implementations.
    • setProcessLifecycleListeners

      public void setProcessLifecycleListeners(List<QCodeReference> processLifecycleListeners)
      Setter for processLifecycleListeners
    • withProcessLifecycleListeners

      public QInstance withProcessLifecycleListeners(List<QCodeReference> processLifecycleListeners)
      Fluent setter for processLifecycleListeners
    • withProcessLifecycleListener

      public QInstance withProcessLifecycleListener(QCodeReference processLifecycleListener)
      Fluent method to add one process lifecycle listener (a code reference to a ProcessLifecycleListenerInterface implementation).
    • getRuntimeServices

      public List<QCodeReference> getRuntimeServices()
      Getter for runtimeServices - code references to QRuntimeServiceInterface implementations, which an application launcher starts (in this order) after the server, and stops (in reverse order) at shutdown.
    • setRuntimeServices

      public void setRuntimeServices(List<QCodeReference> runtimeServices)
      Setter for runtimeServices
    • withRuntimeService

      public QInstance withRuntimeService(QCodeReference runtimeService)
      Fluent method to add one runtime service (a code reference to a QRuntimeServiceInterface implementation).
    • getRecordSearchProvider

      public QCodeReference getRecordSearchProvider()
      Getter for recordSearchProvider - a code reference to a RecordSearchProviderInterface implementation, which RecordSearchAction asks to search the tables it claims (null - the default - searches every table with the default search over its search fields).
    • setRecordSearchProvider

      public void setRecordSearchProvider(QCodeReference recordSearchProvider)
      Setter for recordSearchProvider
    • withRecordSearchProvider

      public QInstance withRecordSearchProvider(QCodeReference recordSearchProvider)
      Fluent setter for recordSearchProvider - a code reference to a RecordSearchProviderInterface implementation.
    • getFailOnMetaDataProducerError

      public Boolean getFailOnMetaDataProducerError()
      Getter for failOnMetaDataProducerError - if true, MetaDataProducerHelper throws when it can't use or run a meta-data producer, instead of logging a warning.
    • setFailOnMetaDataProducerError

      public void setFailOnMetaDataProducerError(Boolean failOnMetaDataProducerError)
      Setter for failOnMetaDataProducerError
    • withFailOnMetaDataProducerError

      public QInstance withFailOnMetaDataProducerError(Boolean failOnMetaDataProducerError)
      Fluent setter for failOnMetaDataProducerError - set to true before running MetaDataProducerHelper, so a failing producer stops startup instead of being logged as a warning and skipped.
    • getEnforcePermissionsInCoreActions

      public Boolean getEnforcePermissionsInCoreActions()
      Getter for enforcePermissionsInCoreActions (may be null, meaning "not configured" - see CorePermissionEnforcer.isInstanceEnforcementEnabled for the effective value).
    • setEnforcePermissionsInCoreActions

      public void setEnforcePermissionsInCoreActions(Boolean enforcePermissionsInCoreActions)
      Setter for enforcePermissionsInCoreActions
    • withEnforcePermissionsInCoreActions

      public QInstance withEnforcePermissionsInCoreActions(Boolean enforcePermissionsInCoreActions)
      Fluent setter for enforcePermissionsInCoreActions - set to true so that core actions enforce table/process/widget/report permissions and field security locks themselves, for every entry point (not only the middlewares).