Beispiel #1
0
 public StreamedContent getSufdDocumentForFunding(Funding funding, Treasury exporter) {
   List<PaymentOrder> paymentOrders = paymentOrderRepository.findByFunding(funding);
   LegalPerson payer =
       paymentOrders
           .stream()
           .map(PaymentOrder::getPayer)
           .filter(p -> p != null)
           .findAny()
           .orElseThrow(() -> new PayerNotFoundException());
   String sufdDocument = exporter.generateSufdDocument(paymentOrders, payer);
   Charset charset = Charset.forName("windows-1251");
   ByteArrayInputStream bis = new ByteArrayInputStream(sufdDocument.getBytes(charset));
   dialog.dispose();
   return new DefaultStreamedContent(
       bis, "text/plain", funding.getSufdFileName(), charset.displayName());
 }
Beispiel #2
0
  public Treasury cloneSelfAndDependecies() {
    Treasury clone = new Treasury(code, name);
    clone.setCharsetName(charsetName);
    clone.setFieldDelimiter(fieldDelimiter);
    clone.setNewlineCharacters(newlineCharacters);
    clone.setDateFormatPattern(dateFormatPattern);
    clone.setNumberFormatPattern(numberFormatPattern);
    clone.setDecimalSeparator(decimalSeparator);
    clone.setGroupingUsed(groupingUsed);
    clone.setMaximumFractionDigits(maximumFractionDigits);
    clone.setMinimumFractionDigits(minimumFractionDigits);

    getSufdDescriptor()
        .entrySet()
        .forEach(
            entry -> {
              clone.addSufdAttribute(
                  entry.getKey(), entry.getValue().getValue(), entry.getValue().getDescription());
            });

    return clone;
  }