Implemented workaround. We create our own ids instead of using CommCare case_id.

parent 1993caeb
...@@ -14,6 +14,8 @@ import com.aluxoft.earrecognition.common.EarIdList; ...@@ -14,6 +14,8 @@ import com.aluxoft.earrecognition.common.EarIdList;
import com.aluxoft.earrecognition.common.NameDistance; import com.aluxoft.earrecognition.common.NameDistance;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.util.UUID;
/** /**
* Shows top 10 matches, allows to register if not match is satisfactory. * Shows top 10 matches, allows to register if not match is satisfactory.
* TODO: Populate list * TODO: Populate list
...@@ -59,7 +61,9 @@ public class SelectFollowupActivity extends Activity { ...@@ -59,7 +61,9 @@ public class SelectFollowupActivity extends Activity {
registerButton.setOnClickListener(new View.OnClickListener() { registerButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
SelectFollowupActivity.this.setResult(Activity.RESULT_OK, new Intent()); Intent intent = new Intent();
intent.putExtra("case_id", UUID.randomUUID().toString());
SelectFollowupActivity.this.setResult(Activity.RESULT_OK, intent);
finish(); finish();
} }
}); });
......
...@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils; ...@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.UUID;
/** /**
* Callout to transfer features to CommCare * Callout to transfer features to CommCare
...@@ -61,6 +62,11 @@ public class IntentTransferingFeatures extends Activity { ...@@ -61,6 +62,11 @@ public class IntentTransferingFeatures extends Activity {
try { try {
_showTransferringMessage(); _showTransferringMessage();
Intent returningIntent = new Intent(getIntent()); Intent returningIntent = new Intent(getIntent());
Bundle responses = new Bundle();
responses.putString("ear_id", UUID.randomUUID().toString());
returningIntent.putExtra("odk_intent_bundle", responses);
returningIntent.putExtra( returningIntent.putExtra(
"odk_intent_data", "odk_intent_data",
FileUtils.readFileToString( FileUtils.readFileToString(
...@@ -147,6 +153,11 @@ public class IntentTransferingFeatures extends Activity { ...@@ -147,6 +153,11 @@ public class IntentTransferingFeatures extends Activity {
String list = data.getStringExtra("list"); String list = data.getStringExtra("list");
EarIdList earIdList = new Gson().fromJson(list, EarIdList.class); EarIdList earIdList = new Gson().fromJson(list, EarIdList.class);
Intent returningIntent = new Intent(getIntent()); Intent returningIntent = new Intent(getIntent());
Bundle responses = new Bundle();
responses.putString("ear_id", UUID.randomUUID().toString());
returningIntent.putExtra("odk_intent_bundle", responses);
returningIntent.putExtra( returningIntent.putExtra(
"odk_intent_data", "odk_intent_data",
earIdList.getCurrentFeature().serializeFeatures() earIdList.getCurrentFeature().serializeFeatures()
......
...@@ -52,7 +52,7 @@ public class EarDataLoaderCommcare extends EarDataLoader { ...@@ -52,7 +52,7 @@ public class EarDataLoaderCommcare extends EarDataLoader {
gender = caseCursor.getString(caseCursor.getColumnIndex("value")); gender = caseCursor.getString(caseCursor.getColumnIndex("value"));
} else */if (datumId.equals("features")) { } else */if (datumId.equals("features")) {
features = caseCursor.getString(caseCursor.getColumnIndex("value")); features = caseCursor.getString(caseCursor.getColumnIndex("value"));
} else if (datumId.equals("case_id_internal")) { // ToDo: Remplazarlo con una mejor forma } else if (datumId.equals("ear_id")) { // ToDo: Remplazarlo con una mejor forma
caseId = caseCursor.getString(caseCursor.getColumnIndex("value")); caseId = caseCursor.getString(caseCursor.getColumnIndex("value"));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment