Search in sources :

Example 21 with ExtWrapTagged

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

the class SubmissionProfile method writeExternal.

public void writeExternal(DataOutputStream out) throws IOException {
    ExtUtil.write(out, new ExtWrapTagged(ref));
    ExtUtil.writeString(out, ExtUtil.emptyIfNull(method));
    ExtUtil.writeString(out, ExtUtil.emptyIfNull(action));
    ExtUtil.writeString(out, ExtUtil.emptyIfNull(mediaType));
    ExtUtil.write(out, new ExtWrapMap(attributeMap));
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ExtWrapMap(org.javarosa.core.util.externalizable.ExtWrapMap)

Example 22 with ExtWrapTagged

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

the class SetValueAction method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    target = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
    explicitValue = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    if (explicitValue == null) {
        value = (XPathExpression) ExtUtil.read(in, new ExtWrapTagged(), pf);
    }
}
Also used : ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged)

Example 23 with ExtWrapTagged

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

the class TreeElement method readExternal.

/* ==== SERIALIZATION ==== */
/*
     * TODO:
     *
     * this new serialization scheme is kind of lame. ideally, we shouldn't have
     * to sub-class TreeElement at all; we should have an API that can
     * seamlessly represent complex data model objects (like weight history or
     * immunizations) as if they were explicity XML subtrees underneath the
     * parent TreeElement
     *
     * failing that, we should wrap this scheme in an ExternalizableWrapper
     */
@Override
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    name = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    multiplicity = ExtUtil.readInt(in);
    flags = ExtUtil.readInt(in);
    value = (IAnswerData) ExtUtil.read(in, new ExtWrapNullable(new ExtWrapTagged()), pf);
    // child
    if (!ExtUtil.readBool(in)) {
        // 1.
        // todo is this needed?
        children.clear();
    } else {
        // 2.
        int numChildren = (int) ExtUtil.readNumeric(in);
        children.clear();
        // 3.
        List<TreeElement> newChildren = new ArrayList<>(numChildren);
        for (int i = 0; i < numChildren; ++i) {
            boolean normal = ExtUtil.readBool(in);
            TreeElement child;
            if (normal) {
                // 3.1
                child = new TreeElement();
                child.readExternal(in, pf);
            } else {
                // 3.2
                child = (TreeElement) ExtUtil.read(in, new ExtWrapTagged(), pf);
            }
            child.setParent(this);
            newChildren.add(child);
        }
        children.addAll(newChildren);
    }
    // end Jan 22, 2009
    dataType = ExtUtil.readInt(in);
    instanceName = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    constraint = (Constraint) ExtUtil.read(in, new ExtWrapNullable(Constraint.class), pf);
    preloadHandler = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    preloadParams = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    namespace = ExtUtil.nullIfEmpty(ExtUtil.readString(in));
    bindAttributes = ExtUtil.readAttributes(in, this);
    attributes = ExtUtil.readAttributes(in, this);
}
Also used : Constraint(org.javarosa.core.model.condition.Constraint) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ArrayList(java.util.ArrayList) Constraint(org.javarosa.core.model.condition.Constraint) ExtWrapNullable(org.javarosa.core.util.externalizable.ExtWrapNullable)

Example 24 with ExtWrapTagged

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

the class DataBinding method writeExternal.

/* (non-Javadoc)
     * @see org.javarosa.core.services.storage.utilities.Externalizable#writeExternal(java.io.DataOutputStream)
     */
public void writeExternal(DataOutputStream out) throws IOException {
    ExtUtil.write(out, new ExtWrapNullable(getId()));
    ExtUtil.writeNumeric(out, getDataType());
    ExtUtil.write(out, new ExtWrapNullable(getPreload()));
    ExtUtil.write(out, new ExtWrapNullable(getPreloadParams()));
    ExtUtil.write(out, new ExtWrapTagged(ref));
// don't bother writing 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)

Example 25 with ExtWrapTagged

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

the class Triggerable method readExternal.

public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
    expr = (IConditionExpr) ExtUtil.read(in, new ExtWrapTagged(), pf);
    contextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
    originalContextRef = (TreeReference) ExtUtil.read(in, TreeReference.class, pf);
    List<TreeReference> tlist = (List<TreeReference>) ExtUtil.read(in, new ExtWrapList(TreeReference.class), pf);
    targets = new ArrayList<TreeReference>(tlist);
}
Also used : TreeReference(org.javarosa.core.model.instance.TreeReference) ExtWrapTagged(org.javarosa.core.util.externalizable.ExtWrapTagged) ArrayList(java.util.ArrayList) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList) List(java.util.List) ExtWrapList(org.javarosa.core.util.externalizable.ExtWrapList)

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