Exemplo n.º 1
1
  public <P extends AbstractOfxProvider> BillingInfo getBillingInfo(Reader reader, P provider) {
    BillingInfo info = new BillingInfo();

    info.setCurrency("PLN");
    BufferedReader br = new BufferedReader(reader);
    try {
      if (br.ready()) {
        // skip header line
        String s = br.readLine();
        getSplit(s);
      }

      String line = "";
      while (br.ready() && line != null) {
        line = br.readLine();
        if (line != null && line.replace("\u0000", "").length() > 0) {
          createLine(line, info);
        }
      }
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    return info;
  }
Exemplo n.º 2
0
 private void createLine(String line, BillingInfo info) throws IOException {
   List<BillingPosition> positions = info.getPositions();
   String[] split = getSplit(line);
   BillingPosition position = new BillingPosition();
   position.setDatePosted(split[1]);
   String name = split[2];
   if (name.length() != 0) {
     name = split[8] + " " + name;
   } else {
     name = split[8] + " " + split[3];
   }
   position.setName(name);
   String description = split[4];
   if (description.length() == 0) {
     description = split[8];
   }
   position.setDescription(description);
   position.setTransactionAmount(split[5]);
   position.setTransactionType(getTransactionType(split[8]));
   setId(position);
   positions.add(position);
 }