55 VCardComposer composer =
new VCardComposer();
57 ContactStruct contact1 =
new ContactStruct();
58 contact1.name = contact.
getName();
59 contact1.addExtension(
new PropertyNode(
"ID", contact.
getId(),
null,
null,
null,
null,
null));
60 contact1.addExtension(
new PropertyNode(
"GID", contact.
getGlobalIdentifier(),
null,
null,
null,
null,
null));
63 if(!address.isEmpty()) {
64 contact1.addContactmethod(
Contacts.KIND_POSTAL,
Contacts.ContactMethods.TYPE_CUSTOM,
65 getAddressString(address), address.getDescription(),
66 "Fiscal".equals(address.getDescription()));
71 if(!connector.isEmpty()) {
72 if(matchValue(properties,
"Telephone",
"Telephone", connector.getDescription())) {
73 contact1.addPhone(
Contacts.Phones.TYPE_WORK, connector.getValue(),
null,
true);
74 }
else if(matchValue(properties,
"Cell",
"Cell", connector.getDescription())) {
75 contact1.addPhone(
Contacts.Phones.TYPE_MOBILE, connector.getValue(),
null,
false);
76 }
else if(matchValue(properties,
"Fax",
"Fax", connector.getDescription())) {
77 contact1.addPhone(
Contacts.Phones.TYPE_FAX_WORK, connector.getValue(),
null,
false);
78 }
else if(matchValue(properties,
"Email",
"Email", connector.getDescription())) {
79 contact1.addContactmethod(
Contacts.KIND_EMAIL,
Contacts.ContactMethods.TYPE_WORK, connector.getValue(),
null,
true);
80 }
else if(matchValue(properties,
"Source",
"Web", connector.getDescription())) {
81 contact1.addWeb(connector.getValue());
87 if(!relation.isEmpty()) {
88 contact1.addOrganization(
Contacts.KIND_ORGANIZATION, relation.getBusiness().getName(), relation.getFormattedDescription(),
false);
93 if(!comment.isEmpty()) {
94 contact1.notes.add(comment.getComment());
98 StringWriter writer =
new StringWriter();
99 String vcardString = composer.createVCard(contact1, VCardComposer.VERSION_VCARD30_INT);
100 writer.write(vcardString);
103 return writer.toString();