Skip to content

Latest commit

 

History

History
126 lines (74 loc) · 6.48 KB

mixees-and-mixins.adoc

File metadata and controls

126 lines (74 loc) · 6.48 KB

Mixees and Mixins

This section defines a number of "mixee" interfaces that define a contract for some framework-defined mixins.

Tip

See the user guide for a discussion of mixins.

java.lang.Object

The framework provides a number of mixins that contributes to java.lang.Object (in other words, to every domain object):

  • Layout

    • Object_downloadLayoutXml

  • Metamodel

    • Object_downloadMetamodelXml

    • Object_rebuildMetamodel

    • Object_logicalTypeName (property)

    • Object_objectIdentifier (property)

  • Wicket viewer:

    • Object_clearHints

  • All viewers:

    • Object_impersonate

    • Object_impersonateWithRoles

    • Object_stopImpersonating

    • Object_openRestApi

Dto

JAXB view models can optionally implement the Dto interface. Two mixins contribute to this interface:

  • Dto_downloadXml

  • Dto_downloadXsd

These allow the view model/DTO to be seriailized, respectively, as XML and as the XSD schema for said XML.

Persistable

All JDO domain entities implement the DataNucleus Persistable role interface as a result of the enhancer process (the fully qualified class name is org.datanucleus.enhancement.Persistable).

Using this, the following mixins (actions and properties) are available for all JDO entities:

  • Persistable_downloadJdoMetadata

  • Persistable_datanucleusVersionLong (property)

    only visible if the entity is annotated with javax.jdo.annotations.Version and the version field introduced by enhancing can be cast to Long.

  • Persistable_datanucleusVersionTimestamp (property)

    only visible if the entity is annotated with javax.jdo.annotations.Version and the version field introduced by enhancing can be cast to java.sql.Timestamp.

As a developer you do not need to write any code to obtain the mixins that contribute to this interface.

These mixin properties/actions are all associated with the "Metadata" fieldset.

Security

Domain objects that are created, updated or otherwise associated with a user can implement the HasUsername mixee interface.

A number of extension modules related to security, such as SecMan module, contribute to this interface.

System

Domain objects that are associated to an Interaction can express this relationship by implementing the HasInteractionId interface.

Mixins that contribute to this mixee interface include:

  • HasInteractionId_command

    from Comman Log module.

The closely related HasTransactionId (a subtype of HasInteractionId) can be implemented by any domain objects associated with a particular transaction within the outer Interaction.

The DomainChangeRecord is intended for domain objects representing commands, audit entries or executions (of action invocations/property edits). Extension modules that provide these capabilities can implement this domain object to allow the user to navigate between these different but related cross-cutting concerns.

Mixins that contribute to this mixee interface include:

  • DomainChangeRecord_openTargetObject

    (provided by the core framework)

Updates

The following interfaces define a contract for the framework to update:

  • OnUpdatedAt

    For domain entities that keep track of when they were last updated.

  • OnUpdatedBy

    For domain entities that keep track of which user last updated them.

  • OnUpdatedByAndAt

    Simply a combination of OnUpdatedAt and OnUpdatedBy

Note that these are not quite the same thing as regular mixee interfaces, in that they do not expose getters to be leveraged by a mixin. Rather, these expose callback such that the framework can populate them at the appropriate juncture.