@Override protected List<Account> parseItem(String[] strings) { List<Account> result = new ArrayList<>(); List<ColumnDefinition> columnDefinitions = getColumnDefinitions(); if (strings.length == VALUE_COLMN + columnDefinitions.size()) { String areaKey = strings[AREA_KEY]; if (isAreaKeyAcceptable(areaKey)) { String areaLabel = strings[AREA_LABEL]; String accountKey = strings[ACCOUNT_KEY]; String accountName = strings[ACCOUNT_NAME]; if (isAreaKeyValid(areaKey) && Utils.hasText(accountKey)) { int parsedAccountKey = Integer.parseInt(accountKey); for (int x = 0; x < columnDefinitions.size(); x++) { ColumnDefinition cd = columnDefinitions.get(x); String value = strings[VALUE_COLMN + x]; LongValue convertedValue = LongValue.valueOf(value); result.add( new Account( areaKey, areaLabel, cd.getKey(), cd.getLabel(), parsedAccountKey, accountName, convertedValue)); addLabel(parsedAccountKey, accountName); } } } } return result; }
private boolean isAreaKeyValid(String areaKey) { return Utils.hasText(areaKey) && areaKey.length() == 8; }