/** getXml. */ @Get public void getXml() { ExperimentService ss = BeanFactory.getExperimentServiceBean(); Experiment experiment = (Experiment) testIfNull(ss.findBySWAccession(Integer.parseInt(getId()))); Hibernate3DtoCopier copier = new Hibernate3DtoCopier(); JaxbObject<Experiment> jaxbTool = new JaxbObject<Experiment>(); Experiment dto = copier.hibernate2dto(Experiment.class, experiment); if (fields.contains("attributes")) { Set<ExperimentAttribute> eas = experiment.getExperimentAttributes(); if (eas != null && !eas.isEmpty()) { Set<ExperimentAttribute> newEas = new TreeSet<ExperimentAttribute>(); for (ExperimentAttribute ea : eas) { newEas.add(copier.hibernate2dto(ExperimentAttribute.class, ea)); } dto.setExperimentAttributes(newEas); } } Document line = XmlTools.marshalToDocument(jaxbTool, dto); getResponse().setEntity(XmlTools.getRepresentation(line)); }