@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().put(key, value); return true; } }, "add custom person data");
@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().put(key, version); return true; } }, "add custom person data");
@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().put(key, value); return true; } }, "add custom person data");
@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().put(key, dateTime); return true; } }, "add custom person data");
@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().remove(key); return true; } }, "remove custom person data");
@Override protected boolean execute(Conversation conversation) { conversation.getPerson().getCustomData().put(key, trim(value)); return true; } }, "add custom person data");
case custom_data: String customDataKey = tokens[2].trim(); CustomData customData = person.getCustomData(); if (customData != null) {
if (oldPerson == null || !equal(oldPerson.getCustomData(), newPerson.getCustomData())) { CustomData customData = newPerson.getCustomData(); ret.setCustomData(customData != null ? customData.toJson() : null); changed = true;
@Test public void queriesAgainstPerson() throws JSONException { String json = loadTextAssetAsString(TEST_DATA_DIR + "testQueriesAgainstPerson.json"); InteractionCriteria criteria = new InteractionCriteria(json); Person person = new Person(); person.setEmail("example@example.com"); person.getCustomData().put("foo", "bar"); EventData eventData = new EventData(); FieldManager fieldManager = new FieldManager(targetContext, new VersionHistory(), eventData, person, new Device(), new AppRelease()); // 0 assertTrue(criteria.isMet(fieldManager)); // 1 eventData.storeEventForCurrentAppVersion(Util.currentTimeSeconds(), versionCode, versionName, "switch.code.point"); assertFalse(criteria.isMet(fieldManager)); // 2 eventData.storeEventForCurrentAppVersion(Util.currentTimeSeconds(), versionCode, versionName, "switch.code.point"); assertTrue(criteria.isMet(fieldManager)); // 3 person.getCustomData().put("foo", "bar"); eventData.storeEventForCurrentAppVersion(Util.currentTimeSeconds(), versionCode, versionName, "switch.code.point"); assertTrue(criteria.isMet(fieldManager)); // 4 eventData.storeEventForCurrentAppVersion(Util.currentTimeSeconds(), versionCode, versionName, "switch.code.point"); assertFalse(criteria.isMet(fieldManager)); // 5 eventData.storeEventForCurrentAppVersion(Util.currentTimeSeconds(), versionCode, versionName, "switch.code.point"); assertTrue(criteria.isMet(fieldManager)); }
listenerFired = false; data.getPerson().getCustomData().put("foo", "bar"); assertTrue(listenerFired); listenerFired = false; data.getPerson().getCustomData().remove("foo"); assertTrue(listenerFired); listenerFired = false;