You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Daniel Keir Haywood (Jira)" <ji...@apache.org> on 2021/06/16 14:15:00 UTC

[jira] [Created] (ISIS-2743) For embedded entity types, contribute their actions to the referencing type.

Daniel Keir Haywood created ISIS-2743:
-----------------------------------------

             Summary: For embedded entity types, contribute their actions to the referencing type.
                 Key: ISIS-2743
                 URL: https://issues.apache.org/jira/browse/ISIS-2743
             Project: Isis
          Issue Type: New Feature
    Affects Versions: 2.0.0-M5
            Reporter: Daniel Keir Haywood
             Fix For: 2.0.0


For example, suppose we have an embedded type that itself defines an action:
{code:java}
@javax.persistence.Embeddable                                                             @Value(semanticsProviderClass = ComplexNumberJpaValueSemantics.class)
public class ComplexNumber { 

    private double re;
    private double im;

    @Action
    public ComplexNumber update(double re, double im) {
        return new ComplexNumber(re, im);
    }
}
 {code}
and then we have an entity that uses that type:
{code:java}
@Entity 
public class SomePhysicsConcept {
    ComplexNumber upper;
    ComplexNumber lower;
}{code}
then we should synthesise these mixins on the referencing type:
{code:java}
@ActionLayout(associateWith="upper")
public class SomePhysicsConcept_updateUpper {
    public SomePhysicsConcept act(double re, double im) {
        somePhysicsConcept.upper = somePhysicsConcept.upper.act(re, im);
    }
}
 {code}
and similarly:
{code:java}
@ActionLayout(associateWith="lower")
public class SomePhysicsConcept_updateLower {
    public SomePhysicsConcept act(double re, double im) {
        somePhysicsConcept.lower = somePhysicsConcept.lower.act(re, im);
    }
}{code}
 

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)