/** * Write a {@code <link>} element for a given entity. * * @param entity The given entity. * @throws XMLStreamException If unable to write to stream * @throws ODataEdmException if unable to check entity types */ public void writeEntryEntityLink(Object entity) throws XMLStreamException, ODataEdmException { EntityType entityType = getAndCheckEntityType(entityDataModel, entity.getClass()); xmlWriter.writeStartElement(ATOM_LINK); if (entityType.isReadOnly()) { xmlWriter.writeAttribute(REL, SELF); } else { xmlWriter.writeAttribute(REL, EDIT); } xmlWriter.writeAttribute(TITLE, entityType.getName()); xmlWriter.writeAttribute(HREF, getEntityWithKey(entity)); xmlWriter.writeEndElement(); }
/** * Write a {@code <link>} element for a given entity. * * @param entity The given entity. * @throws XMLStreamException If unable to write to stream * @throws ODataEdmException if unable to check entity types */ public void writeEntryEntityLink(Object entity) throws XMLStreamException, ODataEdmException { EntityType entityType = getAndCheckEntityType(entityDataModel, entity.getClass()); xmlWriter.writeStartElement(ATOM_LINK); if (entityType.isReadOnly()) { xmlWriter.writeAttribute(REL, SELF); } else { xmlWriter.writeAttribute(REL, EDIT); } xmlWriter.writeAttribute(TITLE, entityType.getName()); xmlWriter.writeAttribute(HREF, getEntityWithKey(entity)); xmlWriter.writeEndElement(); }