[ 
https://issues.apache.org/jira/browse/ISIS-845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jeroen van der Wal updated ISIS-845:
------------------------------------
    Description: 
For example:

PartyRelationship {
    fromParty;
    toParty;
}

if rendered from the point of view of the from party, would want to show only 
the toParty.  But adding this annotation causes both properties to be 
suppressed.

This can be seen in the code:

{code}
    static Filter<ObjectAssociation> associationDoesNotReferenceParent(final 
ObjectSpecification parentSpec) {
        if(parentSpec == null) {
            return Filters.any();
        }
        return new Filter<ObjectAssociation>() {
            @Override
            public boolean accept(ObjectAssociation association) {
                final HiddenFacet facet = 
association.getFacet(HiddenFacet.class);
                if(facet == null) {
                    return true;
                }
                if (facet.where() != Where.REFERENCES_PARENT) {
                    return true;
                }
                final ObjectSpecification assocSpec = 
association.getSpecification();
                final boolean associationSpecIsOfParentSpec = 
parentSpec.isOfType(assocSpec);
                final boolean isVisible = !associationSpecIsOfParentSpec;
                return isVisible;
            }
        };
    }
{code}

Instead, the code should take into account the actual instance that is 
referenced, not just the type (ie look at the object that the association 
points back to).

  was:
For example:

PartyRelationship {
    fromParty;
    toParty;
}

if rendered from the point of view of the from party, would want to show only 
the toParty.  But adding this annotation causes both properties to be 
suppressed.

This can be seen in the code:

    static Filter<ObjectAssociation> associationDoesNotReferenceParent(final 
ObjectSpecification parentSpec) {
        if(parentSpec == null) {
            return Filters.any();
        }
        return new Filter<ObjectAssociation>() {
            @Override
            public boolean accept(ObjectAssociation association) {
                final HiddenFacet facet = 
association.getFacet(HiddenFacet.class);
                if(facet == null) {
                    return true;
                }
                if (facet.where() != Where.REFERENCES_PARENT) {
                    return true;
                }
                final ObjectSpecification assocSpec = 
association.getSpecification();
                final boolean associationSpecIsOfParentSpec = 
parentSpec.isOfType(assocSpec);
                final boolean isVisible = !associationSpecIsOfParentSpec;
                return isVisible;
            }
        };
    }

Instead, the code should take into account the actual instance that is 
referenced, not just the type (ie look at the object that the association 
points back to).


> Hidden (Where.REFERENCES_PARENT) should take into account the instance that 
> is the parent, not just its type.
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: ISIS-845
>                 URL: https://issues.apache.org/jira/browse/ISIS-845
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: core-1.6.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>             Fix For: core-1.8.0
>
>
> For example:
> PartyRelationship {
>     fromParty;
>     toParty;
> }
> if rendered from the point of view of the from party, would want to show only 
> the toParty.  But adding this annotation causes both properties to be 
> suppressed.
> This can be seen in the code:
> {code}
>     static Filter<ObjectAssociation> associationDoesNotReferenceParent(final 
> ObjectSpecification parentSpec) {
>         if(parentSpec == null) {
>             return Filters.any();
>         }
>         return new Filter<ObjectAssociation>() {
>             @Override
>             public boolean accept(ObjectAssociation association) {
>                 final HiddenFacet facet = 
> association.getFacet(HiddenFacet.class);
>                 if(facet == null) {
>                     return true;
>                 }
>                 if (facet.where() != Where.REFERENCES_PARENT) {
>                     return true;
>                 }
>                 final ObjectSpecification assocSpec = 
> association.getSpecification();
>                 final boolean associationSpecIsOfParentSpec = 
> parentSpec.isOfType(assocSpec);
>                 final boolean isVisible = !associationSpecIsOfParentSpec;
>                 return isVisible;
>             }
>         };
>     }
> {code}
> Instead, the code should take into account the actual instance that is 
> referenced, not just the type (ie look at the object that the association 
> points back to).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to