BrightSide Workbench Full Report + Source Code
ImportFromVCard.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
package
org.turro.vcard.util;
19
20
import
java.io.File;
21
import
java.io.IOException;
22
import
java.util.ArrayList;
23
import
java.util.List;
24
import
org.turro.contacts.Contact;
25
import
org.turro.vcard.VCard;
26
import
org.turro.vcard.VCardToContact;
27
import
org.turro.vcard.db.VCardFiles;
28
import
org.turro.vcard.db.VCardList;
29
34
public
class
ImportFromVCard
{
35
36
public
ImportFromVCard
() {
37
}
38
39
public
List<Contact>
importVCard
() throws IOException {
40
List<Contact> clist =
new
ArrayList<Contact>();
41
VCardList
list =
VCardFiles
.
loadVCards
();
42
for
(
VCard
v : list) {
43
Contact
c =
new
VCardToContact
(v).
getContact
();
44
if
(c ==
null
)
continue
;
45
clist.add(c);
46
}
47
for
(File f :
VCardFiles
.
getFiles
()) {
48
f.delete();
49
}
50
return
clist;
51
}
52
53
}
org.turro.contacts.Contact
Definition:
Contact.java:52
org.turro.vcard.VCardToContact
Definition:
VCardToContact.java:32
org.turro.vcard.VCardToContact.getContact
Contact getContact()
Definition:
VCardToContact.java:41
org.turro.vcard.VCard
Definition:
VCard.java:31
org.turro.vcard.db.VCardFiles
Definition:
VCardFiles.java:40
org.turro.vcard.db.VCardFiles.getFiles
static File[] getFiles()
Definition:
VCardFiles.java:52
org.turro.vcard.db.VCardFiles.loadVCards
static VCardList loadVCards()
Definition:
VCardFiles.java:85
org.turro.vcard.db.VCardList
Definition:
VCardList.java:27
org.turro.vcard.util.ImportFromVCard
Definition:
ImportFromVCard.java:34
org.turro.vcard.util.ImportFromVCard.ImportFromVCard
ImportFromVCard()
Definition:
ImportFromVCard.java:36
org.turro.vcard.util.ImportFromVCard.importVCard
List< Contact > importVCard()
Definition:
ImportFromVCard.java:39
TurroProjects
Public
BrightSide
contacts-vcard
src
main
java
org
turro
vcard
util
ImportFromVCard.java
Generated on Tue Mar 12 2024 07:01:19 for BrightSide by
1.9.1