private DomainObjectReprRenderer withMembers(final ObjectAdapter objectAdapter) { final JsonRepresentation appendTo = mode.isUpdatePropertiesLinkArgs() ? representation : JsonRepresentation.newMap(); final List<ObjectAssociation> associations = objectAdapter.getSpecification().getAssociations(Contributed.INCLUDED); addProperties(objectAdapter, appendTo, associations); if(!rendererContext.objectPropertyValuesOnly()) { if (!mode.isArgs() ) { addCollections(objectAdapter, appendTo, associations); } if (mode.isRegular()) { final List<ObjectAction> actions = objectAdapter.getSpecification().getObjectActions(Contributed.INCLUDED); addActions(objectAdapter, actions, appendTo); } } if(!mode.isUpdatePropertiesLinkArgs()) { representation.mapPut("members", appendTo); } return this; }
private void addProperties(final ObjectAdapter objectAdapter, final JsonRepresentation members, final List<ObjectAssociation> associations) { for (final ObjectAssociation assoc : associations) { if (mode.checkVisibility()) { final Consent visibility = assoc.isVisible(objectAdapter, getInteractionInitiatedBy(), rendererContext.getWhere()); if (!visibility.isAllowed()) { continue; } } if (!(assoc instanceof OneToOneAssociation)) { continue; } final OneToOneAssociation property = (OneToOneAssociation) assoc; final LinkFollowSpecs linkFollowerForProp = getLinkFollowSpecs().follow("members[" + property.getId() + "]"); final JsonRepresentation propertyRepresentation = JsonRepresentation.newMap(); final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(getRendererContext(), linkFollowerForProp, property.getId(), propertyRepresentation); renderer.with(new ObjectAndProperty(objectAdapter, property)).usingLinkTo(linkToBuilder); if (mode.isArgs()) { renderer.asArguments(); } if(mode.isEventSerialization()) { renderer.asEventSerialization(); } final JsonRepresentation propertyValueRepresentation = renderer.render(); final JsonRepresentation propertyRepr = rendererContext.objectPropertyValuesOnly() ? propertyValueRepresentation.getRepresentation("value") : propertyValueRepresentation; members.mapPut(assoc.getId(), propertyRepr); } }
if (!mode.isArgs() && !rendererContext.objectPropertyValuesOnly()) {