◆ CSVToRelation()
org.turro.vcard.CSVToRelation.CSVToRelation |
( |
CSVEntry |
v | ) |
|
◆ create()
void org.turro.vcard.CSVToRelation.create |
( |
| ) |
|
Definition at line 40 of file CSVToRelation.java.
41 Dao dao =
new ContactsPU();
42 Contact main =
null, related =
null;
43 String header = entry.getList().getHeader().getHeader(
"GID-MAIN");
45 String value = entry.getField(header);
46 main = contactByGID(dao, value);
49 header = entry.getList().getHeader().getPrefixHeader(
"ID-MAIN");
51 String prefixValue =
null;
52 if(header.length() >
"ID-MAIN".length()) {
53 prefixValue = header.substring(
"ID-MAIN".length() + 1);
55 String value = prefixValue ==
null ? entry.getField(header) :
56 entry.getField(header).substring(prefixValue.length());
57 main = contactByConnector(dao,
"ID", value);
60 header = entry.getList().getHeader().getPrefixHeader(
"CONNECTOR-REL");
62 String connector =
null;
63 if(header.length() >
"CONNECTOR-REL".length()) {
64 connector = header.substring(
"CONNECTOR-REL".length() + 1);
66 String value = entry.getField(header);
67 related = contactByConnector(dao, connector, value);
69 if(main !=
null && related !=
null) {
70 header = entry.getList().getHeader().getHeader(
"RELATION");
72 String value = entry.getField(header);
73 BusinessRelation relation =
new BusinessRelation();
74 relation.setBusiness(main);
75 relation.setContact(related);
76 relation.setDescription(value ==
null ?
"Contacto" : value);
77 dao.saveObject(relation);
The documentation for this class was generated from the following file: