use of com.opencsv.CSVReader in project pictureapp by EyeSeeTea.
the class RelationsIdCsvDB method getQuestionThresholdIdRelationDBCsv.
static HashMap<Long, Long> getQuestionThresholdIdRelationDBCsv(Context context) throws IOException {
HashMap<Long, Long> questionThresholdFK = new HashMap<>();
List<QuestionThreshold> matches = QuestionThreshold.getAllQuestionThresholds();
List<Long> csvIds = new ArrayList<>();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.QUESTION_THRESHOLDS_CSV)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] idToAdd;
while ((idToAdd = reader.readNext()) != null) {
csvIds.add(Long.parseLong(idToAdd[0]));
}
for (int i = 0; i < matches.size() && i < csvIds.size(); i++) {
questionThresholdFK.put(matches.get(i).getId_question_threshold(), csvIds.get(i));
}
return questionThresholdFK;
}
use of com.opencsv.CSVReader in project pictureapp by EyeSeeTea.
the class RelationsIdCsvDB method getMatchIdRelationDBCsv.
static HashMap<Long, Long> getMatchIdRelationDBCsv(Context context) throws IOException {
HashMap<Long, Long> matchesFK = new HashMap<>();
List<Match> matches = Match.listAll();
List<Long> csvIds = new ArrayList<>();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.MATCHES)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] idToAdd;
while ((idToAdd = reader.readNext()) != null) {
csvIds.add(Long.parseLong(idToAdd[0]));
}
for (int i = 0; i < matches.size() && i < csvIds.size(); i++) {
matchesFK.put(matches.get(i).getId_match(), csvIds.get(i));
}
return matchesFK;
}
use of com.opencsv.CSVReader in project pictureapp by EyeSeeTea.
the class RelationsIdCsvDB method getQuestionOptionIdRelationDBCsv.
static HashMap<Long, Long> getQuestionOptionIdRelationDBCsv(Context context) throws IOException {
HashMap<Long, Long> questionOptionFK = new HashMap<>();
List<QuestionOption> questionOptions = QuestionOption.listAll();
List<Long> csvIds = new ArrayList<>();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.QUESTION_OPTIONS_CSV)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] idToAdd;
while ((idToAdd = reader.readNext()) != null) {
csvIds.add(Long.parseLong(idToAdd[0]));
}
for (int i = 0; i < questionOptions.size() && i < csvIds.size(); i++) {
questionOptionFK.put(questionOptions.get(i).getId_question_option(), csvIds.get(i));
}
return questionOptionFK;
}
use of com.opencsv.CSVReader in project pictureapp by EyeSeeTea.
the class RelationsIdCsvDB method getHeaderFKRelationCsvDB.
static HashMap<Long, Header> getHeaderFKRelationCsvDB(Context context) throws IOException {
HashMap<Long, Header> headerFK = new HashMap<>();
List<Header> headers = Header.getAllHeaders();
List<Long> csvIds = new ArrayList<>();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.HEADERS_CSV)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] idToAdd;
while ((idToAdd = reader.readNext()) != null) {
csvIds.add(Long.parseLong(idToAdd[0]));
}
for (int i = 0; i < headers.size() && i < csvIds.size(); i++) {
headerFK.put(csvIds.get(i), headers.get(i));
}
return headerFK;
}
use of com.opencsv.CSVReader in project pictureapp by EyeSeeTea.
the class RelationsIdCsvDB method getTabsIdRelationsCsvDB.
static HashMap<Long, Tab> getTabsIdRelationsCsvDB(Context context) throws IOException {
HashMap<Long, Tab> tabFK = new HashMap<>();
List<Tab> tabs = Tab.getAllTabs();
List<Long> csvIds = new ArrayList<>();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.TABS_CSV)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] idToAdd;
while ((idToAdd = reader.readNext()) != null) {
csvIds.add(Long.parseLong(idToAdd[0]));
}
for (int i = 0; i < tabs.size() && i < csvIds.size(); i++) {
tabFK.put(csvIds.get(i), tabs.get(i));
}
return tabFK;
}
Aggregations