use of com.vodafone360.people.engine.presence.User in project 360-Engine-for-Android by 360.
the class PresenceList method createFromHashtable.
/**
* //////////////////////////////ServiceMethods/////////////////////////////
*/
/**
* Create PresenceList from Hashtable generated by Hessian-decoder
*
* @param hash Hashtable containing PresenceList parameters
*/
public void createFromHashtable(Hashtable<String, Object> hash) {
LogUtils.logI("HessianDecoder.createFromHashtable() hash[" + hash.toString() + "]");
Enumeration<String> e = hash.keys();
while (e.hasMoreElements()) {
String key = e.nextElement();
LogUtils.logI("HessianDecoder.createFromHashtable() key[" + key + "] value[" + hash.get(key) + "]");
Tags tag = Tags.findTag(key);
if (tag != null) {
setValue(tag, hash.get(key));
}
}
LogUtils.logI("HessianDecoder.createFromHashtable() mUserId[" + mUserId + "] mType[" + mType + "] users[" + users + "]");
if (users != null) {
for (User mUser : users) {
LogUtils.logI("HessianDecoder.createFromHashtable() getPayload[" + mUser.getPayload() + "]");
}
} else {
LogUtils.logW("HessianDecoder.createFromHashtable() users is NULL");
}
}
use of com.vodafone360.people.engine.presence.User in project 360-Engine-for-Android by 360.
the class MainApplication method removeUserData.
/**
* Remove all user data from People client, this includes all account
* information (downloaded contacts, login credentials etc.) and all cached
* settings.
*/
public synchronized void removeUserData() {
EngineManager mEngineManager = EngineManager.getInstance();
if (mEngineManager != null) {
// Resets all the engines, the call will block until every engines
// have been reset.
mEngineManager.resetAllEngines();
}
// Remove NAB Account at this point (does nothing on 1.X)
NativeContactsApi.getInstance().removePeopleAccount();
// the same action as in NetworkSettingsActivity onChecked()
setInternetAvail(InternetAvail.ALWAYS_CONNECT, false);
mDatabaseHelper.removeUserData();
// Before clearing the Application cache, kick the widget update. Pref's
// file contain the widget ID.
WidgetUtils.kickWidgetUpdateNow(this);
mApplicationCache.clearCachedData(this);
}
use of com.vodafone360.people.engine.presence.User in project 360-Engine-for-Android by 360.
the class NowPlusActivitiesTest method test1.
@MediumTest
public void test1() {
Log.i(LOG_TAG, "***** EXECUTING test1 *****");
Log.i(LOG_TAG, "<description here>");
Log.i(LOG_TAG, "Test 1a: Remove user data");
mDatabase.removeUserData();
mDatabase.fetchThumbnailUrlCount();
ServiceStatus status = mTestUtility.waitForEvent(WAIT_EVENT_TIMEOUT_MS, DbTestUtility.CONTACTS_INT_EVENT_MASK);
if (ServiceStatus.SUCCESS != status) {
throw (new RuntimeException("No database change event received after removing user data, error: " + status));
}
Log.i(LOG_TAG, "********************************");
Log.i(LOG_TAG, "test1 has completed successfully");
Log.i(LOG_TAG, "********************************");
Log.i(LOG_TAG, "");
}
use of com.vodafone360.people.engine.presence.User in project 360-Engine-for-Android by 360.
the class ContactGroupsTableTest method testModyficationsContactsToGroups.
public void testModyficationsContactsToGroups() {
Log.i(LOG_TAG, "testModyficationsContactsToGroups start");
createTable();
for (int i = 0; i < testTable.length; i++) {
assertTrue("Failed adding contact to group at step " + i, ContactGroupsTable.addContactToGroup(testTable[i][0], testTable[i][1], mTestDatabase.getWritableDatabase()));
}
ArrayList<Long> list = getUniqueIdListFromTestTable();
ArrayList<Long> groupList = null;
Long ContactId = null;
for (Long l : list) {
groupList = getEntriesWithId(l);
if (groupList.size() > 1) {
ContactId = l;
break;
}
}
if (ContactId == null) {
fail("Test data does not containg user with more than one group.");
}
Random r = new Random();
r.setSeed(System.currentTimeMillis());
groupList.add(r.nextLong());
groupList.add(r.nextLong());
Contact c = new Contact();
c.localContactID = ContactId;
c.groupList = groupList;
ServiceStatus status = ContactGroupsTable.modifyContact(c, mTestDatabase.getWritableDatabase());
if (status != ServiceStatus.SUCCESS) {
fail("Faild on modifyContact");
}
ArrayList<Long> testList = new ArrayList<Long>();
assertTrue("Failed fetchContactGroups after modifyContact", ContactGroupsTable.fetchContactGroups(ContactId, testList, mTestDatabase.getWritableDatabase()));
if (!testList.containsAll(groupList) || !groupList.containsAll(testList)) {
fail("List after modyfyContact are different");
}
Log.i(LOG_TAG, "testModyficationsContactsToGroups PASS");
}
use of com.vodafone360.people.engine.presence.User in project 360-Engine-for-Android by 360.
the class PresenceList method toString.
// /**
// * This method is called by the Engine to update the presence list state
// and refresh user statuses
// * @param changes is a Hashtable<String - UserId, Hashtable -
// presenceStatus in communities>
// */
// @SuppressWarnings("unchecked")
// public void addUsers(List<User> changes) {
// if (changes != null) {
// for (User user: changes) {
// if (users.contains(user))
// users.remove(user);
// if (user.isOnline() != OnlineStatus.OFFLINE.ordinal())
// users.add(user);
// }
// }
// }
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("PresenceList - mUserId[");
sb.append(mUserId);
sb.append("] mType[");
sb.append(mType);
sb.append("] users[");
if (users != null) {
for (User user : users) {
sb.append("[");
sb.append(user.toString());
sb.append("]");
}
}
sb.append("]");
return sb.toString();
}
Aggregations