Class CoreModuleExtender

java.lang.Object
org.apache.cayenne.configuration.runtime.CoreModuleExtender

public class CoreModuleExtender extends Object
A builder of extensions for CoreModule.
Since:
5.0
See Also:
  • Constructor Details

    • CoreModuleExtender

      protected CoreModuleExtender(Binder binder)
  • Method Details

    • initAllExtensions

      protected CoreModuleExtender initAllExtensions()
    • setProperty

      public CoreModuleExtender setProperty(String key, Object value)
      Sets Cayenne runtime property. Property names known to Cayenne are defined in the Constants interface.
    • syncContexts

      public CoreModuleExtender syncContexts()
      Configures the stack to synchronize data between ObjectContexts. This is false by default.
    • externalTransactions

      public CoreModuleExtender externalTransactions()
      Sets transaction management to either external. By default, transactions are internally managed by Cayenne.
    • softDeleteIfColumnPresent

      public CoreModuleExtender softDeleteIfColumnPresent(String columnName)
      Enables "soft delete" for entities whose tables contain a BOOLEAN column with the given name. Instead of a SQL DELETE, such entities are deleted by an UPDATE ... SET <columnName> = true, so the row physically stays in the table. Tables that have no column with the given name (or whose column of that name is not BOOLEAN) are unaffected and are deleted with a regular SQL DELETE. A NULL value in the column is treated as "not deleted".

      This setting only affects the delete path. Hiding soft-deleted rows from queries remains the responsibility of the mapping, e.g. a DbEntity qualifier like DELETED = false or DELETED = null.

      Parameters:
      columnName - the name of the BOOLEAN column marking soft-deleted rows
      Since:
      5.0
    • snapshotCacheSize

      public CoreModuleExtender snapshotCacheSize(int size)
      Sets max size of snapshot cache.
      Parameters:
      size - max size of snapshot cache
    • maxIdQualifierSize

      public CoreModuleExtender maxIdQualifierSize(int size)
      Sets the maximum number of object IDs to match in a single query for queries that select objects based on a collection of ObjectIds, such as paginated queries and DISJOINT_BY_ID prefetches. Zero or negative value means no limit.
      Parameters:
      size - max number of IDs per generated query
      Since:
      5.0
    • addProjectLocation

      public CoreModuleExtender addProjectLocation(String location)
      Adds a custom project location.
    • addQueryFilter

      public CoreModuleExtender addQueryFilter(DataChannelQueryFilter queryFilter)
      Adds a custom query filter to the end of the existing filter list
    • addQueryFilter

      public CoreModuleExtender addQueryFilter(Class<? extends DataChannelQueryFilter> queryFilterType)
      Adds a custom query filter to the end of the existing filter list
    • addSyncFilter

      public CoreModuleExtender addSyncFilter(DataChannelSyncFilter syncFilter)
      Adds a custom sync filter.
    • addSyncFilter

      public CoreModuleExtender addSyncFilter(Class<? extends DataChannelSyncFilter> syncFilterType)
      Adds a custom sync filter.
    • addSyncFilter

      public CoreModuleExtender addSyncFilter(DataChannelSyncFilter syncFilter, boolean includeInTransaction)
      Adds a custom sync filter. Depending on the "includeInTransaction" parameter value it is added either before or after the TransactionFilter.
    • addSyncFilter

      public CoreModuleExtender addSyncFilter(Class<? extends DataChannelSyncFilter> syncFilterType, boolean includeInTransaction)
      Adds a custom sync filter. Depending on the "includeInTransaction" parameter value it is added either before or after the TransactionFilter.
    • addListener

      public CoreModuleExtender addListener(Object listener)
      Registers an annotated event listener.
    • addListenerType

      public CoreModuleExtender addListenerType(Class<?> listenerType)
      Registers an annotated event listener of a given type
    • addAdapterDetector

      public CoreModuleExtender addAdapterDetector(DbAdapterDetector adapterDetector)
      Adds a custom DbAdapterDetector
    • addAdapterDetector

      public CoreModuleExtender addAdapterDetector(Class<? extends DbAdapterDetector> adapterDetectorType)
      Adds a custom DbAdapterDetector
    • addDefaultExtendedType

      public CoreModuleExtender addDefaultExtendedType(ExtendedType<?> type)
      Adds a default adapter-agnostic ExtendedType. "Default" types are loaded before adapter-provided or "user" types, so they may be overridden by those.
    • addDefaultExtendedType

      public CoreModuleExtender addDefaultExtendedType(Class<? extends ExtendedType<?>> type)
      Adds a default adapter-agnostic ExtendedType. "Default" types are loaded before adapter-provided or "user" types, so they may be overridden by those.
    • addUserExtendedType

      public CoreModuleExtender addUserExtendedType(ExtendedType<?> type)
      Adds an adapter-agnostic ExtendedType. "User" types are loaded after default and adapter-provided types and can override those.
    • addUserExtendedType

      public CoreModuleExtender addUserExtendedType(Class<? extends ExtendedType<?>> type)
      Adds an adapter-agnostic ExtendedType. "User" types are loaded after default and adapter-provided types and can override those.
    • addExtendedTypeFactory

      public CoreModuleExtender addExtendedTypeFactory(ExtendedTypeFactory factory)
      Adds an ExtendedTypeFactory used for dynamic extended type creation.
    • addExtendedTypeFactory

      public CoreModuleExtender addExtendedTypeFactory(Class<? extends ExtendedTypeFactory> factoryType)
      Adds an ExtendedTypeFactory used for dynamic extended type creation.
    • addValueObjectType

      public CoreModuleExtender addValueObjectType(ValueObjectType<?,?> type)
      Adds a custom ValueObjectType.
    • addValueObjectType

      public CoreModuleExtender addValueObjectType(Class<? extends ValueObjectType<?,?>> type)
      Adds a custom ValueObjectType.
    • addCommitLogListener

      public CoreModuleExtender addCommitLogListener(CommitLogListener listener)
      Registers a commit log listener that receives post-commit change notifications.
      Since:
      5.0
    • addCommitLogListener

      public CoreModuleExtender addCommitLogListener(Class<? extends CommitLogListener> listenerType)
      Registers a commit log listener type that receives post-commit change notifications.
      Since:
      5.0
    • commitLogAnnotationEntitiesOnly

      public CoreModuleExtender commitLogAnnotationEntitiesOnly()
      Restricts commit log auditing to entities annotated with CommitLog. By default all entities are audited.
      Since:
      5.0
    • commitLogEntityFactory

      public CoreModuleExtender commitLogEntityFactory(Class<? extends CommitLogEntityFactory> factoryType)
      Installs a custom factory for commit log entity metadata.
      Since:
      5.0
    • excludeCommitLogFromTransaction

      public CoreModuleExtender excludeCommitLogFromTransaction()
      Configures commit log listeners to be notified outside the database transaction. By default listeners are called within the transaction, allowing them to participate in the same commit. Use this option when listeners may themselves write to the database and you want to avoid nested transactions.
      Since:
      5.0