Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests PR] Give Directly #1426

Closed
wants to merge 8 commits into from
2 changes: 0 additions & 2 deletions src/main/java/org/commcare/util/LogTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,5 @@ public class LogTypes {
* Logs related to Firebase Cloud Messaging
*/
public static final String TYPE_FCM = "fcm";

public static final String TYPE_MEDIA_EVENT = "media-event";

}
38 changes: 35 additions & 3 deletions src/main/java/org/javarosa/core/model/FormIndex.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package org.javarosa.core.model;

import org.javarosa.core.model.instance.TreeReference;

import org.javarosa.core.util.externalizable.DeserializationException;
import org.javarosa.core.util.externalizable.ExtUtil;
import org.javarosa.core.util.externalizable.ExtWrapNullable;
import org.javarosa.core.util.externalizable.Externalizable;
import org.javarosa.core.util.externalizable.PrototypeFactory;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Vector;

/**
Expand All @@ -22,15 +30,15 @@
*
* @author Clayton Sims
*/
public class FormIndex {
public class FormIndex implements Externalizable {

private boolean beginningOfForm = false;
private boolean endOfForm = false;

/**
* The index of the questiondef in the current context
*/
private final int localIndex;
private int localIndex;

/**
* The multiplicity of the current instance of a repeated question or group
Expand All @@ -44,6 +52,10 @@ public class FormIndex {

private TreeReference reference;

// needed for serialization
public FormIndex(){
}

public static FormIndex createBeginningOfFormIndex() {
FormIndex begin = new FormIndex(-1, null);
begin.beginningOfForm = true;
Expand Down Expand Up @@ -453,4 +465,24 @@ public void assignRefs(FormDef f) {
i++;
}
}

@Override
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException {
beginningOfForm = ExtUtil.readBool(in);
endOfForm = ExtUtil.readBool(in);
localIndex = ExtUtil.readInt(in);
instanceIndex = ExtUtil.readInt(in);
reference = (TreeReference)ExtUtil.read(in, new ExtWrapNullable(TreeReference.class), pf);
nextLevel = (FormIndex)ExtUtil.read(in, new ExtWrapNullable(FormIndex.class), pf);
}

@Override
public void writeExternal(DataOutputStream out) throws IOException {
ExtUtil.writeBool(out, beginningOfForm);
ExtUtil.writeBool(out, endOfForm);
ExtUtil.writeNumeric(out, localIndex);
ExtUtil.writeNumeric(out, instanceIndex);
ExtUtil.write(out, new ExtWrapNullable(reference));
ExtUtil.write(out, new ExtWrapNullable(nextLevel));
}
}
Loading