BrightSide Workbench Full Report + Source Code
org.turro.vcard.db.VCardFiles Class Reference

Static Public Member Functions

static File getImportFolder ()
 
static File[] getFiles ()
 
static File[] getCSVs ()
 
static File[] getCSVRels ()
 
static VCardList loadVCards () throws IOException
 
static CSVList loadCSVs () throws IOException
 
static CSVList loadCSVRels () throws IOException
 
static File saveVCards (VCardList list) throws IOException
 

Static Public Attributes

static final String VCARD_IMPORT_FOLDER = "/WEB-INF/vCard/in"
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 40 of file VCardFiles.java.

Member Function Documentation

◆ getCSVRels()

static File [] org.turro.vcard.db.VCardFiles.getCSVRels ( )
static

Definition at line 74 of file VCardFiles.java.

74  {
75  File root = new File(ElephantContext.getRealPath(VCARD_IMPORT_FOLDER));
76  if(!root.exists()) root.mkdir();
77  return root.listFiles(new FilenameFilter() {
78  @Override
79  public boolean accept(File dir, String name) {
80  return name.endsWith(".csvrel");
81  }
82  });
83  }
static final String VCARD_IMPORT_FOLDER
Definition: VCardFiles.java:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCSVs()

static File [] org.turro.vcard.db.VCardFiles.getCSVs ( )
static

Definition at line 63 of file VCardFiles.java.

63  {
64  File root = new File(ElephantContext.getRealPath(VCARD_IMPORT_FOLDER));
65  if(!root.exists()) root.mkdir();
66  return root.listFiles(new FilenameFilter() {
67  @Override
68  public boolean accept(File dir, String name) {
69  return name.endsWith(".csv");
70  }
71  });
72  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFiles()

static File [] org.turro.vcard.db.VCardFiles.getFiles ( )
static

Definition at line 52 of file VCardFiles.java.

52  {
53  File root = new File(ElephantContext.getRealPath(VCARD_IMPORT_FOLDER));
54  if(!root.exists()) root.mkdir();
55  return root.listFiles(new FilenameFilter() {
56  @Override
57  public boolean accept(File dir, String name) {
58  return name.endsWith(".vcf");
59  }
60  });
61  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getImportFolder()

static File org.turro.vcard.db.VCardFiles.getImportFolder ( )
static

Definition at line 46 of file VCardFiles.java.

46  {
47  File root = new File(ElephantContext.getRealPath(VCARD_IMPORT_FOLDER));
48  if(!root.exists()) root.mkdir();
49  return root;
50  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCSVRels()

static CSVList org.turro.vcard.db.VCardFiles.loadCSVRels ( ) throws IOException
static

Definition at line 114 of file VCardFiles.java.

114  {
115  File files[] = getCSVRels();
116  CSVList cl = new CSVList();
117  for(File f : files) {
118  BufferedReader in = new BufferedReader(
119  new InputStreamReader(new FileInputStream(f)));
120  cl = new CSVParser(in).getCSVs();
121  in.close();
122  // Can't read more than a single CVS at time, fields may differ
123  break;
124  }
125  return cl;
126  }
Here is the call graph for this function:

◆ loadCSVs()

static CSVList org.turro.vcard.db.VCardFiles.loadCSVs ( ) throws IOException
static

Definition at line 100 of file VCardFiles.java.

100  {
101  File files[] = getCSVs();
102  CSVList cl = new CSVList();
103  for(File f : files) {
104  BufferedReader in = new BufferedReader(
105  new InputStreamReader(new FileInputStream(f)));
106  cl = new CSVParser(in).getCSVs();
107  in.close();
108  // Can't read more than a single CVS at time, fields may differ
109  break;
110  }
111  return cl;
112  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadVCards()

static VCardList org.turro.vcard.db.VCardFiles.loadVCards ( ) throws IOException
static

Definition at line 85 of file VCardFiles.java.

85  {
86  File files[] = getFiles();
87  VCardList vl = new VCardList();
88  for(File f : files) {
89  BufferedReader in = new BufferedReader(
90  new InputStreamReader(new FileInputStream(f)));
91  List<VCard> l = new VCardParser(in).getVCards();
92  if(l != null) {
93  vl.addAll(l);
94  }
95  in.close();
96  }
97  return vl;
98  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveVCards()

static File org.turro.vcard.db.VCardFiles.saveVCards ( VCardList  list) throws IOException
static

Definition at line 128 of file VCardFiles.java.

128  {
129  File root = new File(ElephantContext.getRealPath(VCARD_EXPORT_FOLDER));
130  if(!root.exists()) root.mkdirs();
131  File output = new File(ElephantContext.getRealPath(VCARD_EXPORT_FOLDER +
132  "/" + Application.getUser().getId() + ".vcf"));
133  boolean append = false;
134  for(VCard vCard : list) {
135  Writer out = new OutputStreamWriter(new FileOutputStream(output, append));
136  out.write(vCard.getVCard());
137  out.close();
138  append = true;
139  }
140  return output;
141  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ VCARD_IMPORT_FOLDER

final String org.turro.vcard.db.VCardFiles.VCARD_IMPORT_FOLDER = "/WEB-INF/vCard/in"
static

Definition at line 43 of file VCardFiles.java.


The documentation for this class was generated from the following file: