public void savePrice(Good good) throws IOException { List dataRecord = getDataRecord(good); for (int i = 6; i < provider.getFileHeader().size(); i++) { String store = provider.getFileHeader().get(i); Export export = good.getAliases().get(store); dataRecord.add(export == null ? "" : export.getPrice()); } provider.printRecord(dataRecord); }
public void saveAlias(Good good) throws IOException { List dataRecord = getDataRecord(good); Map<String, String> aliasMap = new HashMap<>(); for (Alias alias : good.getStoredAliases()) { aliasMap.put(alias.getStore(), alias.getAlias()); } for (int i = 6; i < provider.getFileHeader().size(); i++) { dataRecord.add(aliasMap.get(provider.getFileHeader().get(i))); } provider.printRecord(dataRecord); }
private List getDataRecord(Good good) { List dataRecord = new ArrayList(); dataRecord.add(good.getT1()); dataRecord.add(good.getT2()); dataRecord.add(good.getT3()); dataRecord.add(good.getT4()); dataRecord.add(good.getBrand()); dataRecord.add(good.getModel()); return dataRecord; }