@Test public void readLinks() throws Exception { XMLStreamReader reader = createReaderForTest(MANAGER_1_EMPLOYEES, true); final List<String> links = new XmlLinkConsumer().readLinks(reader, null); assertEquals(4, links.size()); assertEquals(SERVICE_ROOT + "Employees('1')", links.get(0)); assertEquals(SERVICE_ROOT + "Employees('2')", links.get(1)); assertEquals(SERVICE_ROOT + "Employees('3')", links.get(2)); assertEquals(SERVICE_ROOT + "Employees('6')", links.get(3)); }
public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } } }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet); List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet); }
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet); List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet);  }