Skip to content

Commit

Permalink
refactor: update after removal of SequenceType
Browse files Browse the repository at this point in the history
  • Loading branch information
nsenave committed Aug 17, 2023
1 parent 133f70e commit 67b31e0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/fr/insee/lunatic/conversion/XMLSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.slf4j.LoggerFactory;

import fr.insee.lunatic.model.flat.Questionnaire;
import fr.insee.lunatic.model.flat.SequenceType;
import fr.insee.lunatic.model.flat.ComponentType;

public class XMLSerializer {

Expand All @@ -37,19 +37,19 @@ public String serialize(Questionnaire questionnaire) throws JAXBException, Unsup

}

public String serialize(SequenceType sequence) throws JAXBException, UnsupportedEncodingException {
public String serialize(ComponentType component) throws JAXBException, UnsupportedEncodingException {

if (sequence == null) return "";
if (component == null) return "";

logger.debug("Serializing sequence " + sequence.getId());
logger.debug("Serializing component " + component.getId());

JAXBContext context = JAXBContext.newInstance(SequenceType.class);
JAXBContext context = JAXBContext.newInstance(ComponentType.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
marshaller.marshal(sequence, baos);
marshaller.marshal(component, baos);

return baos.toString("UTF-8");
}
Expand Down

0 comments on commit 67b31e0

Please sign in to comment.