use of com.zimbra.cs.mailbox.ContactAutoComplete.ContactEntry in project zm-mailbox by Zimbra.
the class ContactRankings method remove.
public static void remove(String accountId, String email) throws ServiceException {
if (!LC.contact_ranking_enabled.booleanValue())
return;
ContactRankings rankings = new ContactRankings(accountId);
ContactEntry entry = rankings.mEntries.get(email.toLowerCase());
if (entry != null)
rankings.remove(entry);
rankings.writeToDatabase();
}
use of com.zimbra.cs.mailbox.ContactAutoComplete.ContactEntry in project zm-mailbox by Zimbra.
the class ContactRankings method readFromDatabase.
private synchronized void readFromDatabase() throws ServiceException {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(mAccountId);
Metadata config = mbox.getConfig(null, CONFIG_KEY_CONTACT_RANKINGS);
if (config == null) {
config = new Metadata();
mbox.setConfig(null, CONFIG_KEY_CONTACT_RANKINGS, config);
}
for (Map.Entry<Object, Object> entry : config.map.entrySet()) {
if (entry.getValue() instanceof Map) {
Map<?, ?> m = (Map<?, ?>) entry.getValue();
ContactEntry contact = new ContactEntry();
contact.mEmail = ((String) entry.getKey()).toLowerCase();
Long num = (Long) m.get(KEY_RANKING);
contact.mRanking = num.intValue();
num = (Long) m.get(KEY_LAST_ACCESSED);
contact.mLastAccessed = num.longValue();
contact.setName((String) m.get(KEY_NAME));
contact.mFolderId = ContactAutoComplete.FOLDER_ID_UNKNOWN;
add(contact);
}
}
dump("reading");
}
Aggregations