18 package org.turro.vcard;
20 import java.util.Arrays;
21 import org.turro.contacts.*;
22 import org.turro.csv.CSVEntry;
23 import org.turro.util.PhraseBuilder;
32 private CSVEntry entry;
45 private void generateContact() {
49 if(entry.getList().getHeader().hasPrefix(
"X-GID")) {
52 if(entry.getList().getHeader().hasPrefix(
"FN")) {
53 contact.
setName(entry.getField(
"FN"));
56 if(entry.getList().getHeader().hasPrefix(
"N:")) {
57 PhraseBuilder pb =
new PhraseBuilder();
58 pb.addWord(entry.getField(
"N:First"));
59 pb.addWord(entry.getField(
"N:Middle"));
60 pb.addWord(entry.getField(
"N:Last"));
64 if(entry.getList().getHeader().hasPrefix(
"ADR:WORK:")) {
67 caddress.
setStreet(entry.getField(
"ADR:WORK:Street"));
68 caddress.
setCity(entry.getField(
"ADR:WORK:City"));
69 caddress.
setProvince(entry.getField(
"ADR:WORK:Province"));
70 caddress.
setZipCode(entry.getField(
"ADR:WORK:ZipCode"));
71 caddress.
setState(entry.getField(
"ADR:WORK:State"));
72 caddress.
setDescription(VCardToContact.translateGroup(Arrays.asList(
new String[] {
"WORK"})));
75 if(entry.getList().getHeader().hasPrefix(
"ADR:HOME:")) {
78 caddress.
setStreet(entry.getField(
"ADR:HOME:Street"));
79 caddress.
setCity(entry.getField(
"ADR:HOME:City"));
80 caddress.
setProvince(entry.getField(
"ADR:HOME:Province"));
81 caddress.
setZipCode(entry.getField(
"ADR:HOME:ZipCode"));
82 caddress.
setState(entry.getField(
"ADR:HOME:State"));
83 caddress.
setDescription(VCardToContact.translateGroup(Arrays.asList(
new String[] {
"HOME"})));
86 if(entry.getList().getHeader().hasPrefix(
"EMAIL")) {
89 connector.
setDescription(VCardToContact.getMostUsedConnector(
"Email"));
90 connector.
setValue(entry.getField(
"EMAIL"));
93 if(entry.getList().getHeader().hasPrefix(
"TEL")) {
96 connector.
setDescription(VCardToContact.getMostUsedConnector(
"Telephone"));
97 connector.
setValue(entry.getField(
"TEL"));
100 if(entry.getList().getHeader().hasPrefix(
"CELL")) {
103 connector.
setDescription(VCardToContact.getMostUsedConnector(
"Cell"));
104 connector.
setValue(entry.getField(
"CELL"));
107 if(entry.getList().getHeader().hasPrefix(
"FAX")) {
110 connector.
setDescription(VCardToContact.getMostUsedConnector(
"Fax"));
111 connector.
setValue(entry.getField(
"FAX"));
114 if(entry.getList().getHeader().hasPrefix(
"WEB")) {
117 connector.
setDescription(VCardToContact.getMostUsedConnector(
"Web"));
118 connector.
setValue(entry.getField(
"WEB"));
121 if(entry.getList().getHeader().hasPrefix(
"NOTE")) {
127 if(entry.getList().getHeader().hasPrefix(
"TITLE")) {
128 String v[] = entry.getField(
"TITLE").split(
"\\>");
139 if(entry.getList().getHeader().hasPrefix(
"CON:ID")) {
143 connector.
setValue(entry.getField(
"CON:ID"));
void setFull(String full)