Search in sources :

Example 6 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class XPathQName method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    ExtUtil.write(out, new ExtWrapNullable(namespace));
    ExtUtil.writeString(out, name);
}
Also used : ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 7 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class FormDef method readExternal.

/**
 * Reads the form definition object from the supplied stream.
 * <p/>
 * Requires that the instance has been set to a prototype of the instance
 * that should be used for deserialization.
 *
 * @param dis - the stream to read from.
 * @throws IOException
 * @throws InstantiationException
 * @throws IllegalAccessException
 */
@Override
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
    setID(ExtUtil.readInt(dis));
    setName(ExtUtil.nullIfEmpty(ExtUtil.readString(dis)));
    setTitle((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
    setChildren((List<IFormElement>) ExtUtil.read(dis, new ExtWrapListPoly(), pf));
    setInstance((FormInstance) ExtUtil.read(dis, FormInstance.class, pf));
    setLocalizer((Localizer) ExtUtil.read(dis, new ExtWrapNullable(Localizer.class), pf));
    List<Condition> vcond = (List<Condition>) ExtUtil.read(dis, new ExtWrapList(Condition.class), pf);
    for (Condition condition : vcond) {
        addTriggerable(condition);
    }
    List<Recalculate> vcalc = (List<Recalculate>) ExtUtil.read(dis, new ExtWrapList(Recalculate.class), pf);
    for (Recalculate recalculate : vcalc) {
        addTriggerable(recalculate);
    }
    finalizeTriggerables();
    outputFragments = (List<IConditionExpr>) ExtUtil.read(dis, new ExtWrapListPoly(), pf);
    submissionProfiles = (HashMap<String, SubmissionProfile>) ExtUtil.read(dis, new ExtWrapMap(String.class, SubmissionProfile.class));
    formInstances = (HashMap<String, DataInstance>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapTagged()), pf);
    eventListeners = (HashMap<String, List<Action>>) ExtUtil.read(dis, new ExtWrapMap(String.class, new ExtWrapListPoly()), pf);
    extensions = (List<XFormExtension>) ExtUtil.read(dis, new ExtWrapListPoly(), pf);
    resetEvaluationContext();
}
Also used : Condition(org.javarosa.core.model.condition.Condition) IConditionExpr(org.javarosa.core.model.condition.IConditionExpr) DataInstance(org.javarosa.core.model.instance.DataInstance) Recalculate(org.javarosa.core.model.condition.Recalculate) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap) Localizer(org.javarosa.core.services.locale.Localizer) ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) List(java.util.List) ArrayList(java.util.ArrayList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 8 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class ItemsetBinding method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    nodesetExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
    contextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
    labelExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
    valueExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
    copyExpr = (IConditionExpr) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
    labelIsItext = ExtUtil.readBool(in);
    copyMode = ExtUtil.readBool(in);
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 9 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class QuestionDef method writeExternal.

@Override
public void writeExternal(DataOutputStream dos) throws IOException {
    ExtUtil.writeNumeric(dos, getID());
    ExtUtil.write(dos, new ExtWrapNullable(binding == null ? null : new ExtWrapTagged(binding)));
    ExtUtil.write(dos, new ExtWrapNullable(getAppearanceAttr()));
    ExtUtil.write(dos, new ExtWrapNullable(getTextID()));
    ExtUtil.write(dos, new ExtWrapNullable(getLabelInnerText()));
    ExtUtil.write(dos, new ExtWrapNullable(getHelpText()));
    ExtUtil.write(dos, new ExtWrapNullable(getHelpTextID()));
    ExtUtil.write(dos, new ExtWrapNullable(getHelpInnerText()));
    ExtUtil.writeNumeric(dos, getControlType());
    ExtUtil.writeAttributes(dos, additionalAttributes);
    ExtUtil.write(dos, new ExtWrapList(ExtUtil.emptyIfNull(choices)));
    ExtUtil.write(dos, new ExtWrapNullable(dynamicChoices));
    ExtUtil.write(dos, new ExtWrapList(ExtUtil.emptyIfNull(osmTags)));
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 10 with ExtWrapNullable

use of org.javarosa.core.util.externalizable.ExtWrapNullable in project javarosa by opendatakit.

the class DataBinding method readExternal.

/* (non-Javadoc)
     * @see org.javarosa.core.services.storage.utilities.Externalizable#readExternal(java.io.DataInputStream)
     */
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    setId((String) ExtUtil.read(in, new ExtWrapNullable(String.class), pf));
    setDataType(ExtUtil.readInt(in));
    setPreload((String) ExtUtil.read(in, new ExtWrapNullable(String.class), pf));
    setPreloadParams((String) ExtUtil.read(in, new ExtWrapNullable(String.class), pf));
    ref = (IDataReference) ExtUtil.read(in, new ExtWrapTagged());
// don't bother reading relevancy/required/readonly/constraint/calculate/additionalAttrs right now; they're only used during parse anyway
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Aggregations

ExtWrapNullable (org.javarosa.core.util.externalizable.ExtWrapNullable)27 ExtWrapTagged (org.javarosa.core.util.externalizable.ExtWrapTagged)13 ExtWrapListPoly (org.javarosa.core.util.externalizable.ExtWrapListPoly)9 ExtWrapList (org.javarosa.core.util.externalizable.ExtWrapList)7 ExtWrapMap (org.javarosa.core.util.externalizable.ExtWrapMap)7 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Date (java.util.Date)3 Condition (org.javarosa.core.model.condition.Condition)2 Recalculate (org.javarosa.core.model.condition.Recalculate)2 DeserializationException (org.javarosa.core.util.externalizable.DeserializationException)2 HashMap (java.util.HashMap)1 Constraint (org.javarosa.core.model.condition.Constraint)1 IConditionExpr (org.javarosa.core.model.condition.IConditionExpr)1 DataInstance (org.javarosa.core.model.instance.DataInstance)1 TreeElement (org.javarosa.core.model.instance.TreeElement)1 OSMTag (org.javarosa.core.model.osm.OSMTag)1 Localizer (org.javarosa.core.services.locale.Localizer)1 OrderedMap (org.javarosa.core.util.OrderedMap)1 ExtWrapBase (org.javarosa.core.util.externalizable.ExtWrapBase)1