@Test public void testWriteFeedLinkByCallingAction() throws Exception { startDocument(true); odataUri = new ODataParserImpl() .parseUri("http: metadataWriter = new AtomMetadataWriter(xmlWriter, odataUri, entityDataModel, nsConfigurationProvider); metadataWriter.writeFeedLink(null, null); endDocument(); assertEquals(prettyPrintXml(readContent(EXPECTED_FEED_LINK_PATH)), prettyPrintXml(outputStream.toString())); }
void writeFeedLink(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_LINK); xmlWriter.writeAttribute(REL, SELF); if (entity == null) { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { Option<TargetType> targetTypeOption = ODataUriUtil.resolveTargetType(oDataUri, entityDataModel); if (targetTypeOption.isDefined()) { TargetType targetType = targetTypeOption.get(); String entitySetName = EntityDataModelUtil.getEntitySetByEntityTypeName(entityDataModel, targetType.typeName()).getName(); xmlWriter.writeAttribute(TITLE, entitySetName); xmlWriter.writeAttribute(HREF, entitySetName); } else { throw new ODataEdmException("Failed to resolve entity target type"); } } else { xmlWriter.writeAttribute(TITLE, getEntitySetName(oDataUri).get()); xmlWriter.writeAttribute(HREF, getEntitySetName(oDataUri).get()); } } else { xmlWriter.writeAttribute(TITLE, property.getName()); xmlWriter.writeAttribute(HREF, String.format("%s/%s", getEntityWithKey(entity), property.getName())); } xmlWriter.writeEndElement(); }
AtomMetadataWriter { void writeFeedLink(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_LINK); xmlWriter.writeAttribute(REL, SELF); if (entity == null) { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { Option<TargetType> targetTypeOption = ODataUriUtil.resolveTargetType(oDataUri, entityDataModel); if (targetTypeOption.isDefined()) { TargetType targetType = targetTypeOption.get(); String entitySetName = EntityDataModelUtil.getEntitySetByEntityTypeName(entityDataModel, targetType.typeName()).getName(); xmlWriter.writeAttribute(TITLE, entitySetName); xmlWriter.writeAttribute(HREF, entitySetName); } else { throw new ODataEdmException("Failed to resolve entity target type"); } } else { xmlWriter.writeAttribute(TITLE, getEntitySetName(oDataUri).get()); xmlWriter.writeAttribute(HREF, getEntitySetName(oDataUri).get()); } } else { xmlWriter.writeAttribute(TITLE, property.getName()); xmlWriter.writeAttribute(HREF, String.format("%s/%s", getEntityWithKey(entity), property.getName())); } xmlWriter.writeEndElement(); } }
AtomMetadataWriter { void writeFeedLink(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_LINK); xmlWriter.writeAttribute(REL, SELF); if (entity == null) { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { Option<TargetType> targetTypeOption = ODataUriUtil.resolveTargetType(oDataUri, entityDataModel); if (targetTypeOption.isDefined()) { TargetType targetType = targetTypeOption.get(); String entitySetName = EntityDataModelUtil.getEntitySetByEntityTypeName(entityDataModel, targetType.typeName()).getName(); xmlWriter.writeAttribute(TITLE, entitySetName); xmlWriter.writeAttribute(HREF, entitySetName); } else { throw new ODataEdmException("Failed to resolve entity target type"); } } else { xmlWriter.writeAttribute(TITLE, getEntitySetName(oDataUri).get()); xmlWriter.writeAttribute(HREF, getEntitySetName(oDataUri).get()); } } else { xmlWriter.writeAttribute(TITLE, property.getName()); xmlWriter.writeAttribute(HREF, String.format("%s/%s", getEntityWithKey(entity), property.getName())); } xmlWriter.writeEndElement(); } AtomMetadataWriter(XMLStreamWriter xmlWriter, ODataUri oDataUri,
                              EntityDataModel entityDataModel, AtomNSConfigurationProvider nsConfigurationProvider); }
AtomMetadataWriter { void writeFeedLink(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_LINK); xmlWriter.writeAttribute(REL, SELF); if (entity == null) { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { Option<TargetType> targetTypeOption = ODataUriUtil.resolveTargetType(oDataUri, entityDataModel); if (targetTypeOption.isDefined()) { TargetType targetType = targetTypeOption.get(); String entitySetName = EntityDataModelUtil.getEntitySetByEntityTypeName(entityDataModel, targetType.typeName()).getName(); xmlWriter.writeAttribute(TITLE, entitySetName); xmlWriter.writeAttribute(HREF, entitySetName); } else { throw new ODataEdmException("Failed to resolve entity target type"); } } else { xmlWriter.writeAttribute(TITLE, getEntitySetName(oDataUri).get()); xmlWriter.writeAttribute(HREF, getEntitySetName(oDataUri).get()); } } else { xmlWriter.writeAttribute(TITLE, property.getName()); xmlWriter.writeAttribute(HREF, String.format("%s/%s", getEntityWithKey(entity), property.getName())); } xmlWriter.writeEndElement(); } AtomMetadataWriter(XMLStreamWriter xmlWriter, ODataUri oDataUri,
                              EntityDataModel entityDataModel, AtomNSConfigurationProvider nsConfigurationProvider); void writeEntryEntityLink(Object entity); void writeCount(Object count); }
AtomMetadataWriter { void writeFeedLink(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_LINK); xmlWriter.writeAttribute(REL, SELF); if (entity == null) { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { Option<TargetType> targetTypeOption = ODataUriUtil.resolveTargetType(oDataUri, entityDataModel); if (targetTypeOption.isDefined()) { TargetType targetType = targetTypeOption.get(); String entitySetName = EntityDataModelUtil.getEntitySetByEntityTypeName(entityDataModel, targetType.typeName()).getName(); xmlWriter.writeAttribute(TITLE, entitySetName); xmlWriter.writeAttribute(HREF, entitySetName); } else { throw new ODataEdmException("Failed to resolve entity target type"); } } else { xmlWriter.writeAttribute(TITLE, getEntitySetName(oDataUri).get()); xmlWriter.writeAttribute(HREF, getEntitySetName(oDataUri).get()); } } else { xmlWriter.writeAttribute(TITLE, property.getName()); xmlWriter.writeAttribute(HREF, String.format("%s/%s", getEntityWithKey(entity), property.getName())); } xmlWriter.writeEndElement(); } AtomMetadataWriter(XMLStreamWriter xmlWriter, ODataUri oDataUri,
                              EntityDataModel entityDataModel, AtomNSConfigurationProvider nsConfigurationProvider); void writeEntryEntityLink(Object entity); void writeCount(Object count);  }