BrightSide Workbench Full Report + Source Code
org.turro.importer.AbstractImporterProvider Class Referenceabstract
Inheritance diagram for org.turro.importer.AbstractImporterProvider:
Collaboration diagram for org.turro.importer.AbstractImporterProvider:

Public Member Functions

 AbstractImporterProvider (String name, String service)
 
String getName ()
 
String getService ()
 
boolean inRole ()
 
void setType (ImporterDataType type)
 
void setType (String fileName)
 
void clear ()
 
void setFullImport (boolean fullImport)
 
boolean isFullImport ()
 
void importData (Reader reader)
 
List< String > getHeaders ()
 
List< ImporterRegister > getData ()
 
void processData (WsMember member)
 

Protected Member Functions

List< ImporterRegister > importDataFrom (Reader reader)
 
abstract void process (WsMember member, List< ImporterRegister > data)
 
abstract boolean isInRole ()
 

Detailed Description

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

Definition at line 37 of file AbstractImporterProvider.java.

Constructor & Destructor Documentation

◆ AbstractImporterProvider()

org.turro.importer.AbstractImporterProvider.AbstractImporterProvider ( String  name,
String  service 
)

Definition at line 47 of file AbstractImporterProvider.java.

47  {
48  this.name = name;
49  this.service = service;
50  }

Member Function Documentation

◆ clear()

void org.turro.importer.AbstractImporterProvider.clear ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 82 of file AbstractImporterProvider.java.

82  {
83  data = new ArrayList<>();
84  headers = new ArrayList<>();
85  }

◆ getData()

List<ImporterRegister> org.turro.importer.AbstractImporterProvider.getData ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 108 of file AbstractImporterProvider.java.

108  {
109  return data;
110  }

◆ getHeaders()

List<String> org.turro.importer.AbstractImporterProvider.getHeaders ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 103 of file AbstractImporterProvider.java.

103  {
104  return headers;
105  }

◆ getName()

String org.turro.importer.AbstractImporterProvider.getName ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 53 of file AbstractImporterProvider.java.

53  {
54  return name;
55  }

◆ getService()

String org.turro.importer.AbstractImporterProvider.getService ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 58 of file AbstractImporterProvider.java.

58  {
59  return service;
60  }

◆ importData()

void org.turro.importer.AbstractImporterProvider.importData ( Reader  reader)

Implements org.turro.importer.ImporterProvider.

Definition at line 98 of file AbstractImporterProvider.java.

98  {
99  data.addAll(importDataFrom(reader));
100  }
List< ImporterRegister > importDataFrom(Reader reader)
Here is the call graph for this function:

◆ importDataFrom()

List<ImporterRegister> org.turro.importer.AbstractImporterProvider.importDataFrom ( Reader  reader)
protected

Definition at line 117 of file AbstractImporterProvider.java.

117  {
118  try {
119  if(type.equals(ImporterDataType.CSV) || type.equals(ImporterDataType.TDF)) {
120  CSVs csv = type.equals(ImporterDataType.CSV) ? CSVs.cvs().reader(reader) : CSVs.tdf().reader(reader);
121  List<Map<String, String>> values = csv.parse();
122  headers = csv.getRealHeaders();
123  return values.stream().map(register -> ImporterRegister.from(new HashMap<String, Object>(register))).toList();
124  }
125  } catch (IOException ex) {
126  Logger.getLogger(AbstractImporterProvider.class.getName()).log(Level.SEVERE, null, ex);
127  }
128  return Collections.EMPTY_LIST;
129  }
Here is the caller graph for this function:

◆ inRole()

boolean org.turro.importer.AbstractImporterProvider.inRole ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 63 of file AbstractImporterProvider.java.

63  {
64  return isInRole();
65  }
Here is the call graph for this function:

◆ isFullImport()

boolean org.turro.importer.AbstractImporterProvider.isFullImport ( )

Implements org.turro.importer.ImporterProvider.

Definition at line 93 of file AbstractImporterProvider.java.

93  {
94  return fullImport;
95  }
Here is the caller graph for this function:

◆ isInRole()

abstract boolean org.turro.importer.AbstractImporterProvider.isInRole ( )
abstractprotected

◆ process()

abstract void org.turro.importer.AbstractImporterProvider.process ( WsMember  member,
List< ImporterRegister >  data 
)
abstractprotected

◆ processData()

void org.turro.importer.AbstractImporterProvider.processData ( WsMember  member)

Implements org.turro.importer.ImporterProvider.

Definition at line 113 of file AbstractImporterProvider.java.

113  {
114  process(member, data);
115  }
abstract void process(WsMember member, List< ImporterRegister > data)
Here is the call graph for this function:

◆ setFullImport()

void org.turro.importer.AbstractImporterProvider.setFullImport ( boolean  fullImport)

Implements org.turro.importer.ImporterProvider.

Definition at line 88 of file AbstractImporterProvider.java.

88  {
89  this.fullImport = fullImport;
90  }

◆ setType() [1/2]

void org.turro.importer.AbstractImporterProvider.setType ( ImporterDataType  type)

Implements org.turro.importer.ImporterProvider.

Definition at line 68 of file AbstractImporterProvider.java.

68  {
69  this.type = type;
70  }

◆ setType() [2/2]

void org.turro.importer.AbstractImporterProvider.setType ( String  fileName)

Implements org.turro.importer.ImporterProvider.

Definition at line 73 of file AbstractImporterProvider.java.

73  {
74  if(fileName.toLowerCase().endsWith("csv")) {
75  type = ImporterDataType.CSV;
76  } else if(fileName.toLowerCase().endsWith("tdf")) {
77  type = ImporterDataType.TDF;
78  }
79  }

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