Apache Causeway Documentation

repository·main·Indexed 21 days ago

https://github.com/apache/causeway

Developer and contributor guides for Apache Causeway, including instructions for cutting releases, configuring JDK toolchains, managing dependency licenses with Apache RAT, and GnuPG key generation for artifact signing. Also contains implementation details for integrating Owl Carousel 2.

Tokens
215.4K
Snippets
539
Records
966
Agent score
72%

What's inside Apache Causeway

  1. Overview of Apache Causeway components

    main

    Apache Causeway is composed of three main functional areas: Security, Viewers, and Persistence.

    • Security: Manages access control and integrates various security components into the framework.
    • Viewers: Automatically render domain objects into different presentation layers (Web UI, GraphQL, or REST).
    • Persistence: Handles the storage of domain entities using either standard JPA/Eclipselink or custom implementations via the ViewModel interface.
  2. What is Apache Causeway?

    main

    Apache Causeway is a Java framework designed for rapidly developing domain-driven applications. It allows developers to focus on business logic by writing entities, domain services, and repositories, while the framework automatically generates a web application UI and a RESTful API based on the domain model.

    To get started, you can use the following starter applications:

    • Hello World: A basic starter app for learning the fundamentals.
    • SimpleApp: A more robust starter app for building your own applications.
    https://github.com/apache/causeway-app-simpleapp
  3. Release notes for version 2.0.0-M7

    main

    Summary of changes in version 2.0.0-M7:

    Key Highlights

    • Encapsulation: Support for non-public visibility of members via ENCAPSULATION_ENABLED policy.
    • Value Types: Reworked treatment of value types and refactored implementation in the Wicket viewer.
    • Localization: Support for UserLocale (language, number, and time formats) via UserMemento.
    • Type Mapping: Improved handling of @LogicalTypeName for superclasses.
    • Dependencies: Updated to DataNucleus 6.

    Notable New Features

    • Declarative Interaction Context Specification for testing.
    • Per-user Locale support.
    • Direct export of Collection Views in Wicket Viewer.
    • Site-Map Export (AsciiDoc).
    • Application Logo availability via REST.

    Notable Improvements

    • @DomainObject is no longer allowed on Interfaces.
    • Removed LocaleProvider in favor of InteractionContext for i18n.
    • @XmlJavaTypeAdapter on properties is now optional if the referenced type already has it.
    • Support for generic Value-Type Conversion based on ValueSemantics in Wicket Viewer.
  4. New features in Causeway 2.0.0-RC1

    main

    The 2.0.0-RC1 release introduces several key features and architectural changes:

    • PageRenderSubscriber SPI: A new Service Provider Interface that provides callbacks to track the time taken to render a page.
    • Enhanced Permissions: SAFE semantics actions can now be invoked with only VIEWING permission.
    • HTML Documentation Service: A new service based on the domain model.
    • BackgroundService: A new service for handling background tasks.
    • ViewModel Injection: ViewModel implementations now support using Injection Points during construction.
    • CommandPublisher Callbacks: Additional callbacks are available for when a command is created or started, and CommandLogEntry is now persisted at the beginning of the process.
    • AsciiDoc PlantUML Support: Added support for PlantUML within AsciiDoc for Value Types.
    • Customizable Layouts: DomainObjectLayout#tableDecoration has been refactored to allow for customization.
  5. Use MetaModelService to access the framework metamodel

    main

    The MetaModelService provides a formal API to inspect the framework's metamodel. It allows you to look up domain types (via names or classes), retrieve aliases, inspect the domain model, and export the metamodel or object graphs for external tools like PlantUML.

    interface MetaModelService {
      Optional<LogicalType> lookupLogicalTypeByName(String logicalTypeName);
      Can<LogicalType> logicalTypeAndAliasesFor(LogicalType logicalType);
      Can<LogicalType> logicalTypeAndAliasesFor(String logicalTypeName);
      Optional<LogicalType> lookupLogicalTypeByClass(Class<?> domainType);
      void rebuild(Class<?> domainType);
      DomainModel getDomainModel();
      BeanSort sortOf(Class<?> domainType, Mode mode);
      BeanSort sortOf(Bookmark bookmark, Mode mode);
      CommandDtoProcessor commandDtoProcessorFor(String logicalMemberIdentifier);
      MetamodelDto exportMetaModel(Config config);
      ObjectGraph exportObjectGraph(BiPredicate<BeanSort, LogicalType> filter);
    }
  6. Use cases for WrapperFactory

    main

    Beyond simple constraint enforcement, WrapperFactory can be used for:

    • Creating Interactions: Invoking actions with executionPublishing enabled. This generates a serializable representation of the invocation that can be used to route messages to other systems.
    • Integration Testing: Frequently used in integration tests to simulate real-world interaction constraints.
    • Trust Boundaries: Ensuring that business constraints defined by a callee are honored when the caller is in a different module or context.
    • Listener API & Documentation: Combined with InteractionContext, the wrapper/listener pattern can be used to build execution call graphs or autogenerate documentation like sequence diagrams.
  7. New features in Apache Causeway 2.0.0-RC2

    main

    The 2.0.0-RC2 release introduces several key capabilities:

    • NonDurable Entities: Support for NonDurable entities, enabling queries against them.
    • RepositoryService#allMatches: Now supports JDOQL queries that include a result clause.
    • @InteractAs Annotation: Can now be specified at the class level in addition to the test level.
    • Metamodel Customization: Support for plugging in custom Exporters into the Metamodel.
    • Facet Handling: Extended to infer optionality from JAXB @XmlElement annotations.
    • UI Configuration: Added a configuration parameter to hide the 'disable reason text icon tooltip'.
  8. Release notes for version 2.0.0-M2

    main

    This milestone (2.0.0-M2) introduces support for a table tree view in the Wicket viewer and includes all features from Apache Isis 1.17.0.

    Key architectural changes include:

    • Immutability: IsisConfiguration is now immutable once instantiated.
    • Configuration: The relationship between IsisConfiguration and AppManifest has been defined.
    • Dependency Changes: Google Guava has been removed from the core.
    • Long-term Goal: The framework is moving towards supporting either Spring Boot or JEE MicroProfile as the underlying framework for configuration and injection.
  9. Explore Domain Services in Apache Causeway

    main

    Apache Causeway provides a wide range of Domain Services (applib-svc) that handle core application logic, infrastructure, and UI support. These services are categorized into several functional areas:

    • Command & Execution: Services for executing commands and processing DTOs, including CommandExecutorService, CommandDtoProcessorService, and various subscribers like CommandSubscriber.
    • Content & Mapping: Tools for managing content and data transformations, such as ContentMappingService and ContentMappingServiceForCommandDto.
    • User & Security: Services for managing users, sessions, and permissions, including UserService, SessionSubscriber, SudoService, and ImpersonateMenu.
    • UI & Navigation: Components for building user interfaces, such as MenuBarsService, LayoutService, SitemapService, and ApplicationFeatureMenu.
    • Data & Persistence: Support for data handling, including RepositoryService, GridService, QueryResultsCache, and specialized QueryDsl support like QueryDslRepository.
    • Infrastructure: Core utilities like EventBusService, TransactionService, HealthCheckService, MetricsService, and ErrorReportingService.
    • Internationalization (i18n): Services for localization, including LanguageProvider, TranslationService, and LocaleChoiceProvider.

    Refer to the specific service documentation for detailed API signatures and usage patterns.

  10. New features in Apache Isis 2.0.0-M1

    main

    Apache Isis 2.0.0-M1 introduces several new capabilities:

    • Meta-annotation Support: Support for both Apache Isis and DataNucleus meta-annotations (e.g., @PersistenceCapable, @Property, @Collection, and @Action with @XxxLayout).
    • Docker Distribution: Support for distributing Isis as a Docker image using 'skinny wars' (libraries located in Tomcat's lib/ folder).
    • UrlEncodingService: New convenience adapter implementations.
    • 'Where am I' Feature: A new feature to help users understand their current context within the application.
  11. What is a Wrapper and why use WrapperFactory?

    main

    A Wrapper is a runtime-generated proxy that wraps a domain object to enforce the Apache Causeway programming model.

    When you interact with a wrapped object via its get methods, set methods, or actions, the wrapper automatically enforces:

    • Imperative constraints: Logic defined in hideXxx(), disableXxx(), and validateXxx() methods.
    • Declarative constraints: Constraints defined via annotations, such as @Parameter(maxLength=...) or @Property(mustSatisfy=...).

    If an interaction violates these rules, the wrapper throws an InteractionException (or a subclass like HiddenException or InvalidException).

    Key Capabilities:

    • Synchronous Execution: Enforce business rules immediately during method calls.
    • Asynchronous Execution: Execute actions in a separate thread using an ExecutorService via asyncWrap.
    • Mixin Support: Wrap objects with additional functionality using wrapMixin or wrapMixinT (typesafe).