You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2015/10/16 19:33:05 UTC
[jira] [Resolved] (ISIS-1213) Provide support for @Mixin domain
objects, as a specialized type of contributor (though not a domain service)
[ https://issues.apache.org/jira/browse/ISIS-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Haywood resolved ISIS-1213.
-------------------------------
Resolution: Fixed
> Provide support for @Mixin domain objects, as a specialized type of contributor (though not a domain service)
> -------------------------------------------------------------------------------------------------------------
>
> Key: ISIS-1213
> URL: https://issues.apache.org/jira/browse/ISIS-1213
> Project: Isis
> Issue Type: New Feature
> Components: Core
> Affects Versions: 1.9.0
> Reporter: Dan Haywood
> Assignee: Dan Haywood
> Priority: Minor
> Fix For: 1.10.0
>
>
> For example, rather than a contributed action:
> {code:java}
> @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();
> }
> }
> {code}
> which requires passing in the contributee to every method, and ensuring that all methods are named correctly, we can instead say:
> {code:java}
> @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();
> }
> }
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)