Search in sources :

Example 6 with XFormAnswerDataSerializer

use of org.javarosa.xform.util.XFormAnswerDataSerializer in project javarosa by opendatakit.

the class SMSSerializingVisitor method serializeInstance.

/*
     * (non-Javadoc)
     * @see org.javarosa.core.model.utils.IInstanceSerializingVisitor#serializeInstance(org.javarosa.core.model.instance.FormInstance, org.javarosa.core.model.IDataReference)
     */
public byte[] serializeInstance(FormInstance model, IDataReference ref) throws IOException {
    init();
    rootRef = FormInstance.unpackReference(ref);
    if (this.serializer == null) {
        this.setAnswerDataSerializer(new XFormAnswerDataSerializer());
    }
    model.accept(this);
    if (theSmsStr != null) {
        // Encode in UTF-16 by default, since it's the default for complex messages
        return theSmsStr.getBytes("UTF-16BE");
    } else {
        return null;
    }
}
Also used : XFormAnswerDataSerializer(org.javarosa.xform.util.XFormAnswerDataSerializer)

Example 7 with XFormAnswerDataSerializer

use of org.javarosa.xform.util.XFormAnswerDataSerializer in project javarosa by opendatakit.

the class FormDef method setValue.

public void setValue(IAnswerData data, TreeReference ref, TreeElement node, boolean midSurvey) {
    IAnswerData oldValue = node.getValue();
    IAnswerDataSerializer answerDataSerializer = new XFormAnswerDataSerializer();
    if (midSurvey && dagImpl.shouldTrustPreviouslyCommittedAnswer() && objectEquals(answerDataSerializer.serializeAnswerData(oldValue), answerDataSerializer.serializeAnswerData(data))) {
        return;
    }
    setAnswer(data, node);
    Collection<QuickTriggerable> qts = triggerTriggerables(ref, midSurvey);
    dagImpl.publishSummary("New value", ref, qts);
// TODO: pre-populate fix-count repeats here?
}
Also used : IAnswerData(org.javarosa.core.model.data.IAnswerData) XFormAnswerDataSerializer(org.javarosa.xform.util.XFormAnswerDataSerializer)

Aggregations

XFormAnswerDataSerializer (org.javarosa.xform.util.XFormAnswerDataSerializer)7 IAnswerData (org.javarosa.core.model.data.IAnswerData)2 ByteArrayPayload (org.javarosa.core.services.transport.payload.ByteArrayPayload)2 IOException (java.io.IOException)1 IDataPointer (org.javarosa.core.data.IDataPointer)1 FormDef (org.javarosa.core.model.FormDef)1 IConditionExpr (org.javarosa.core.model.condition.IConditionExpr)1 DateData (org.javarosa.core.model.data.DateData)1 IntegerData (org.javarosa.core.model.data.IntegerData)1 StringData (org.javarosa.core.model.data.StringData)1 TimeData (org.javarosa.core.model.data.TimeData)1 FormInstance (org.javarosa.core.model.instance.FormInstance)1 TreeReference (org.javarosa.core.model.instance.TreeReference)1 IXFormyFactory (org.javarosa.core.model.util.restorable.IXFormyFactory)1 DataPointerPayload (org.javarosa.core.services.transport.payload.DataPointerPayload)1 IDataPayload (org.javarosa.core.services.transport.payload.IDataPayload)1 MultiMessagePayload (org.javarosa.core.services.transport.payload.MultiMessagePayload)1 XPathConditional (org.javarosa.xpath.XPathConditional)1