private void cleanAllContacts() { List<ContactInfo> contactsNotALL = new ArrayList<ContactInfo>(); for (Iterator<ContactInfo> iterator = contacts.iterator(); iterator.hasNext(); ) { ContactInfo type = iterator.next(); if (!type.getChatType().equals(ChatType.ALL)) { contactsNotALL.add(type); } } contacts.removeAll(contactsNotALL); }
public ContactCollection(List<ContactInfo> contacts) { super(); for (ContactInfo contactInfo : contacts) { if (contactInfo.getStatus() == ContactStatus.pending) { pendingContacts.add(contactInfo); } else { this.contacts.add(contactInfo); } } }
@Override public void internationalize(Messages messages) { ContactInfo owner = feed.getOwner(); String gender = Gender.FEMALE == owner.getGender() ? "feed.import.female" : "feed.import.male"; clear(); StringBuilder sb = new StringBuilder(); sb.append(messages.getMessage("feed.changed")); sb.append(messages.getMessage(gender)); sb.append(messages.getMessage("feed.avatar")); this.getHeaderPanel().appendContactInfo(owner); this.getHeaderPanel().appendText(sb.toString()); super.internationalize(messages); }
@Test public void shouldUpdateContactProfile() throws Exception { @SuppressWarnings("deprecation") ContactInfo contactInfo = new ContactInfo(); contactInfo.setEmail("*****@*****.**"); contactInfo.setId(1L); Message<?> message = new AllMessage<ContactInfo>( MessEngineConstants.UPDATE_CONTACT_PROFILE_REQUEST, contactInfo); when(defaultTemplate.postForObject( anyString(), eq(JsonConverter.toJson(contactInfo)), eq(String.class))) .thenReturn(JsonConverter.toJson(contactInfo)); messEngine.send(message); verify(defaultTemplate) .postForObject(anyString(), eq(JsonConverter.toJson(contactInfo)), eq(String.class)); Message<?> response = messEngine.getMessage(MessEngineConstants.UPDATE_CONTACT_PROFILE_RESPONSE); assertNotNull(response); assertEquals(contactInfo, response.getBody()); }
@Override public void notifyContactUpdated(ContactInfo contact) { getFriendInfoPanel().notifyPresence(contact.getChatStatus()); }