Search in sources :

Example 16 with ExtWrapTagged

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

the class GroupDef method writeExternal.

/**
 * Write the group definition object to the supplied stream.
 */
public void writeExternal(DataOutputStream dos) throws IOException {
    ExtUtil.writeNumeric(dos, getID());
    ExtUtil.write(dos, new ExtWrapNullable(getAppearanceAttr()));
    ExtUtil.write(dos, new ExtWrapTagged(getBind()));
    ExtUtil.write(dos, new ExtWrapNullable(getTextID()));
    ExtUtil.write(dos, new ExtWrapNullable(getLabelInnerText()));
    ExtUtil.writeBool(dos, getRepeat());
    ExtUtil.write(dos, new ExtWrapListPoly(getChildren()));
    ExtUtil.writeBool(dos, noAddRemove);
    ExtUtil.write(dos, new ExtWrapNullable(count != null ? new ExtWrapTagged(count) : null));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(chooseCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(addCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(delCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(doneCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(addEmptyCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(doneEmptyCaption));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(entryHeader));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(delHeader));
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(mainHeader));
    ExtUtil.writeAttributes(dos, additionalAttributes);
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 17 with ExtWrapTagged

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

the class GroupDef method readExternal.

/**
 * Reads a group definition object from the supplied stream.
 */
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
    try {
        setID(ExtUtil.readInt(dis));
        setAppearanceAttr((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setBind((IDataReference) ExtUtil.read(dis, new ExtWrapTagged(), pf));
        setTextID((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setLabelInnerText((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setRepeat(ExtUtil.readBool(dis));
        setChildren((List<IFormElement>) ExtUtil.read(dis, new ExtWrapListPoly(), pf));
        noAddRemove = ExtUtil.readBool(dis);
        count = (IDataReference) ExtUtil.read(dis, new ExtWrapNullable(new ExtWrapTagged()), pf);
        chooseCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        addCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        delCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        doneCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        addEmptyCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        doneEmptyCaption = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        entryHeader = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        delHeader = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        mainHeader = ExtUtil.nullIfEmpty(ExtUtil.readString(dis));
        additionalAttributes = ExtUtil.readAttributes(dis, null);
    } catch (OutOfMemoryError e) {
        throw new DeserializationException("serialization format change caused misalignment and out-of-memory error");
    }
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) DeserializationException(org.javarosa.core.util.externalizable.DeserializationException) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 18 with ExtWrapTagged

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

the class ItemsetBinding method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    ExtUtil.write(out, new ExtWrapTagged(nodesetExpr));
    ExtUtil.write(out, contextRef);
    ExtUtil.write(out, new ExtWrapTagged(labelExpr));
    ExtUtil.write(out, new ExtWrapNullable(valueExpr == null ? null : new ExtWrapTagged(valueExpr)));
    ExtUtil.write(out, new ExtWrapNullable(copyExpr == null ? null : new ExtWrapTagged(copyExpr)));
    ExtUtil.writeBool(out, labelIsItext);
    ExtUtil.writeBool(out, copyMode);
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 19 with ExtWrapTagged

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

the class QuestionDef method readExternal.

@Override
public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException {
    try {
        setID(ExtUtil.readInt(dis));
        binding = (IDataReference) ExtUtil.read(dis, new ExtWrapNullable(new ExtWrapTagged()), pf);
        setAppearanceAttr((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setTextID((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setLabelInnerText((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setHelpText((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setHelpTextID((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setHelpInnerText((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf));
        setControlType(ExtUtil.readInt(dis));
        additionalAttributes = ExtUtil.readAttributes(dis, null);
        choices = (List<SelectChoice>) ExtUtil.nullIfEmpty((List<SelectChoice>) ExtUtil.read(dis, new ExtWrapList(SelectChoice.class), pf));
        for (int i = 0; i < getNumChoices(); i++) {
            choices.get(i).setIndex(i);
        }
        setDynamicChoices((ItemsetBinding) ExtUtil.read(dis, new ExtWrapNullable(ItemsetBinding.class)));
        osmTags = (List<OSMTag>) ExtUtil.nullIfEmpty((List<OSMTag>) ExtUtil.read(dis, new ExtWrapList(OSMTag.class), pf));
    } catch (OutOfMemoryError e) {
        throw new DeserializationException("serialization format change caused misalignment and out-of-memory error");
    }
}
Also used : OSMTag(org.javarosa.core.model.osm.OSMTag) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) DeserializationException(org.javarosa.core.util.externalizable.DeserializationException) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 20 with ExtWrapTagged

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

the class SubmissionProfile method readExternal.

@SuppressWarnings("unchecked")
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    ref = (IDataReference) ExtUtil.read(in, new ExtWrapTagged(IDataReference.class));
    method = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    action = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    mediaType = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    attributeMap = (HashMap<String, String>) ExtUtil.read(in, new ExtWrapMap(String.class, String.class));
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap)

Aggregations

ExtWrapTagged (org.javarosa.core.util.externalizable.ExtWrapTagged)29 ExtWrapNullable (org.javarosa.core.util.externalizable.ExtWrapNullable)13 ExtWrapList (org.javarosa.core.util.externalizable.ExtWrapList)7 ExtWrapListPoly (org.javarosa.core.util.externalizable.ExtWrapListPoly)7 ArrayList (java.util.ArrayList)6 ExtWrapMap (org.javarosa.core.util.externalizable.ExtWrapMap)5 List (java.util.List)4 Condition (org.javarosa.core.model.condition.Condition)2 Recalculate (org.javarosa.core.model.condition.Recalculate)2 TreeReference (org.javarosa.core.model.instance.TreeReference)2 DeserializationException (org.javarosa.core.util.externalizable.DeserializationException)2 Date (java.util.Date)1 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 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