use of org.javarosa.core.services.transport.payload.MultiMessagePayload in project javarosa by opendatakit.
the class XFormSerializingVisitor method createSerializedPayload.
public IDataPayload createSerializedPayload(FormInstance model, IDataReference ref) throws IOException {
init();
rootRef = FormInstance.unpackReference(ref);
if (this.serializer == null) {
this.setAnswerDataSerializer(new XFormAnswerDataSerializer());
}
model.accept(this);
if (theXmlDoc != null) {
// TODO: Did this strip necessary data?
byte[] form = XFormSerializer.getUtfBytes(theXmlDoc);
if (dataPointers.size() == 0) {
return new ByteArrayPayload(form, null, IDataPayload.PAYLOAD_TYPE_XML);
}
MultiMessagePayload payload = new MultiMessagePayload();
payload.addPayload(new ByteArrayPayload(form, "xml_submission_file", IDataPayload.PAYLOAD_TYPE_XML));
for (IDataPointer pointer : dataPointers) {
payload.addPayload(new DataPointerPayload(pointer));
}
return payload;
} else {
return null;
}
}
Aggregations