/**
  * Retrieve a contact from the list when we already got all its information (except its
  * isFavorite)
  *
  * @param contact the contact we want to retrieve
  * @return
  */
 public IContact getContact(IContact contact) {
   for (IContact iContact : contacts) {
     if (iContact.equals(contact)) {
       return iContact;
     }
   }
   return null;
 }
Пример #2
0
 public String printALL() {
   StringBuffer sb = new StringBuffer();
   for (IContact contact : PHONE_LIST) {
     sb.append(contact.getMobileno());
     sb.append(" ");
     sb.append(contact.getPassword());
     sb.append(System.getProperty("line.separator"));
   }
   return sb.toString();
 }
Пример #3
0
  @Override
  public VCard createDocument(IContact c) {
    VCard vcard = new VCard();
    VCardComposer composer = new VCardComposer();

    ContactStruct contact = new ContactStruct();
    contact.name = c.getNom() + " " + c.getPrenom();
    contact.addPhone(Contacts.Phones.TYPE_MOBILE, c.getMobile(), null, true);
    contact.addOrganization(0, c.getCompagnie(), null, true);

    // create vCard representation
    try {
      vcard.setCard(composer.createVCard(contact, VCardComposer.VERSION_VCARD30_INT));
    } catch (VCardException vce) {
      LOGGER.error("Exception while generating VCard for contact.", vce);
    }
    return vcard;
  }