BrightSide Workbench Full Report + Source Code
org.turro.financials.product.ProductImport Class Reference

Public Member Functions

void importFromCSV ()
 
File[] getCSVs ()
 

Static Public Member Functions

static void uploadFile ()
 

Static Public Attributes

static final String PRODUCT_IMPORT_FOLDER = "/WEB-INF/product/in"
 

Detailed Description

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

Definition at line 58 of file ProductImport.java.

Member Function Documentation

◆ getCSVs()

File [] org.turro.financials.product.ProductImport.getCSVs ( )

Definition at line 90 of file ProductImport.java.

90  {
91  File root = new File(ElephantContext.getRealPath(PRODUCT_IMPORT_FOLDER));
92  if(!root.exists()) root.mkdir();
93  return root.listFiles(new FilenameFilter() {
94  @Override
95  public boolean accept(File dir, String name) {
96  return name.endsWith(".csv");
97  }
98  });
99  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ importFromCSV()

void org.turro.financials.product.ProductImport.importFromCSV ( )

Definition at line 77 of file ProductImport.java.

77  {
78  for(File file : getCSVs()) {
79  try(BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file)))) {
80  processFile(new CSVParser(in).getCSVs());
81  } catch (FileNotFoundException ex) {
82  Logger.getLogger(ProductImport.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
83  } catch (IOException ex) {
84  Logger.getLogger(ProductImport.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
85  }
86  file.delete();
87  }
88  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uploadFile()

static void org.turro.financials.product.ProductImport.uploadFile ( )
static

Definition at line 64 of file ProductImport.java.

64  {
65  FileWrapper fw = new FileWrapper(new File(ElephantContext.getRealPath(PRODUCT_IMPORT_FOLDER)));
66  fw.upload(new Command() {
67  @Override
68  public Object execute(Context context) {
69  Clients.showBusy(I_.get("Import CVS"));
70  new ProductImport().importFromCSV();
71  Clients.clearBusy();
72  return null;
73  }
74  });
75  }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ PRODUCT_IMPORT_FOLDER

final String org.turro.financials.product.ProductImport.PRODUCT_IMPORT_FOLDER = "/WEB-INF/product/in"
static

Definition at line 61 of file ProductImport.java.


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