Search in sources :

Example 6 with ExtWrapListPoly

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

the class XPathFilterExpr method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    List<XPathExpression> v = Arrays.asList(predicates);
    ExtUtil.write(out, new ExtWrapTagged(x));
    ExtUtil.write(out, new ExtWrapListPoly(v));
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged)

Example 7 with ExtWrapListPoly

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

the class XPathFilterExpr method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    x = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
    List<Object> v = (List<Object>) ExtUtil.read(in, new ExtWrapListPoly(), pf);
    predicates = new XPathExpression[v.size()];
    for (int i = 0; i < predicates.length; i++) predicates[i] = (XPathExpression) v.get(i);
}
Also used : ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with ExtWrapListPoly

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

the class FormDef method writeExternal.

/**
 * Writes the form definition object to the supplied stream.
 *
 * @param dos - the stream to write to.
 * @throws IOException
 */
@Override
public void writeExternal(DataOutputStream dos) throws IOException {
    ExtUtil.writeNumeric(dos, getID());
    ExtUtil.writeString(dos, ExtUtil.emptyIfNull(getName()));
    ExtUtil.write(dos, new ExtWrapNullable(getTitle()));
    ExtUtil.write(dos, new ExtWrapListPoly(getChildren()));
    ExtUtil.write(dos, getMainInstance());
    ExtUtil.write(dos, new ExtWrapNullable(localizer));
    List<Condition> conditions = dagImpl.getConditions();
    List<Recalculate> recalcs = dagImpl.getRecalculates();
    ExtUtil.write(dos, new ExtWrapList(conditions));
    ExtUtil.write(dos, new ExtWrapList(recalcs));
    ExtUtil.write(dos, new ExtWrapListPoly(outputFragments));
    ExtUtil.write(dos, new ExtWrapMap(submissionProfiles));
    // for support of multi-instance forms
    ExtUtil.write(dos, new ExtWrapMap(formInstances, new ExtWrapTagged()));
    ExtUtil.write(dos, new ExtWrapMap(eventListeners, new ExtWrapListPoly()));
    ExtUtil.write(dos, new ExtWrapListPoly(extensions));
}
Also used : Condition(org.javarosa.core.model.condition.Condition) ExtWrapListPoly(org.javarosa.core.util.externalizable.ExtWrapListPoly) Recalculate(org.javarosa.core.model.condition.Recalculate) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 9 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly 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 10 with ExtWrapListPoly

use of org.javarosa.core.util.externalizable.ExtWrapListPoly 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)

Aggregations

ExtWrapListPoly (org.javarosa.core.util.externalizable.ExtWrapListPoly)14 ExtWrapNullable (org.javarosa.core.util.externalizable.ExtWrapNullable)9 ExtWrapTagged (org.javarosa.core.util.externalizable.ExtWrapTagged)7 List (java.util.List)5 ExtWrapList (org.javarosa.core.util.externalizable.ExtWrapList)5 ExtWrapMap (org.javarosa.core.util.externalizable.ExtWrapMap)5 ArrayList (java.util.ArrayList)4 Condition (org.javarosa.core.model.condition.Condition)2 Recalculate (org.javarosa.core.model.condition.Recalculate)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 IConditionExpr (org.javarosa.core.model.condition.IConditionExpr)1 DataInstance (org.javarosa.core.model.instance.DataInstance)1 Localizer (org.javarosa.core.services.locale.Localizer)1 OrderedMap (org.javarosa.core.util.OrderedMap)1 DeserializationException (org.javarosa.core.util.externalizable.DeserializationException)1 ExtWrapBase (org.javarosa.core.util.externalizable.ExtWrapBase)1 ExtWrapMapPoly (org.javarosa.core.util.externalizable.ExtWrapMapPoly)1 PrototypeFactory (org.javarosa.core.util.externalizable.PrototypeFactory)1 XPathExpression (org.javarosa.xpath.expr.XPathExpression)1