Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1213

Provide support for @Mixin domain objects, as a specialized type of contributor (though not a domain service)

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.0
    • Fix Version/s: 1.10.0
    • Component/s: Core
    • Labels:
      None

      Description

      For example, rather than a contributed action:

      @DomainService(
              nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY
      )
      public class CommunicationChannel_updateNotes {
          @Action(
                  semantics = SemanticsOf.IDEMPOTENT
          )
          public <T extends CommunicationChannel<T>> CommunicationChannel<T> updateNotes(
                  CommunicationChannel<T> communicationChannel,
                  @Parameter(optionality = Optionality.OPTIONAL)
                  @ParameterLayout(named = "Notes", multiLine = 10)
                  final String Notes) {
              communicationChannel.setNotes(Notes);
              return communicationChannel;
          }
          public <T extends CommunicationChannel<T>> String default1UpdateNotes(
                  CommunicationChannel<T> communicationChannel
                  ) {
              return communicationChannel.getNotes();
          }
      }
      

      which requires passing in the contributee to every method, and ensuring that all methods are named correctly, we can instead say:

      @DomainObject(
              nature = Nature.MIXIN
      )
      public class CommunicationChannel_updateNotes {
          private final CommunicationChannel communicationChannel;
          public CommunicationChannel_updateNotes(CommunicationChannel communicationChannel) {
              this.communicationChannel = communicationChannel;
          }
         @Action(
                  domainEvent = UpdateNotesEvent.class,
                  semantics = SemanticsOf.IDEMPOTENT
          )
          public <T extends CommunicationChannel<T>> CommunicationChannel<T> __(
                  @Parameter(optionality = Optionality.OPTIONAL)
                  @ParameterLayout(named = "Notes", multiLine = 10)
                  final String Notes) {
              communicationChannel.setNotes(Notes);
              return communicationChannel;
          }
          public <T extends CommunicationChannel<T>> String default0__() {
              return communicationChannel.getNotes();
          }
      }
      

      where the name of the action is "_" meaning instead infer the action name from the name of the mixin class, and where the mixin has a constructor of the object being mixed in.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: