/** getXml. */ @Get public void getXml() { authenticate(); JaxbObject<Lane> jaxbTool = new JaxbObject<>(); Hibernate3DtoCopier copier = new Hibernate3DtoCopier(); SampleService ss = BeanFactory.getSampleServiceBean(); Sample sample = testIfNull(ss.findBySWAccession(getId())); CollectionPropertyName<Sample>[] createCollectionPropertyNames = CollectionPropertyName.createCollectionPropertyNames( Sample.class, new String[] {"sampleAttributes"}); Sample dto = copier.hibernate2dto( Sample.class, sample, new Class<?>[] {}, createCollectionPropertyNames); if (fields.contains("lanes")) { SortedSet<Lane> lanes = sample.getLanes(); if (lanes != null) { SortedSet<Lane> copiedLanes = new TreeSet<>(); for (Lane lane : lanes) { copiedLanes.add(copier.hibernate2dto(Lane.class, lane)); } dto.setLanes(copiedLanes); } else { Log.info("Could not be found: lanes"); } } if (fields.contains("ius")) { SortedSet<IUS> ius = sample.getIUS(); if (ius != null) { SortedSet<IUS> copiedIUS = new TreeSet<>(); for (IUS i : ius) { copiedIUS.add(copier.hibernate2dto(IUS.class, i)); } dto.setIUS(copiedIUS); } { Log.info("Could not be found : ius"); } } Document line = XmlTools.marshalToDocument(jaxbTool, dto); getResponse().setEntity(XmlTools.getRepresentation(line)); }