<commit_before>package name.abuchen.portfolio.datatransfer.pdf;

import name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block;
import name.abuchen.portfolio.datatransfer.pdf.PDFParser.DocumentType;
import name.abuchen.portfolio.datatransfer.pdf.PDFParser.Transaction;
import name.abuchen.portfolio.model.BuySellEntry;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.PortfolioTransaction;

public class SutorPDFExtractor extends AbstractPDFExtractor
{

    public SutorPDFExtractor(Client client)
    {
        super(client);

        addBankIdentifier("Sutor"); //$NON-NLS-1$
        addBankIdentifier("Sutor Bank"); //$NON-NLS-1$

        addBuyTransaction();
    }

    @Override
    public String getPDFAuthor()
    {
        return "Sutor Bank"; //$NON-NLS-1$
    }

    private void addBuyTransaction()
    {
        DocumentType type = new DocumentType("Sutor fairriester 2.0 | Umsätze");
        this.addDocumentTyp(type);

        Block block = new Block(".* Kauf .*");
        type.addBlock(block);
        block.set(new Transaction<BuySellEntry>().subject(() -> {
            BuySellEntry entry = new BuySellEntry();
            entry.setType(PortfolioTransaction.Type.BUY);
            return entry;
        })

                        .section("name").match("^.* Kauf (?<name>[^\\d]*) .*")
                        .assign((t, v) -> t.setSecurity(getOrCreateSecurity(v)))

                        .section("date").match("^(\\d+.\\d+.\\d{4}+) (?<date>\\d+.\\d+.\\d{4}+) .*")
                        .assign((t, v) -> t.setDate(asDate(v.get("date"))))

                        .section("amount")
                        .match("^(\\d+.\\d+.\\d{4}+) (\\d+.\\d+.\\d{4}+) -(?<amount>[\\.\\d]+[,\\d]*) .*")
                        .assign((t, v) -> {
                            t.setAmount(asAmount(v.get("amount")));
                            t.setCurrencyCode("EUR"); // Sutor always provides the amount in EUR, column "Betrag in EUR"
                        })

                        .section("shares").match("^.* (?<shares>[\\.\\d]+[,\\d]*)$")
                        .assign((t, v) -> t.setShares(asShares(v.get("shares"))))

                        .wrap(t -> new BuySellEntryItem(t)));
    }

    @Override
    public String getLabel()
    {
        return "Sutor Fairriester";
    }

}<commit_msg>Suppress warnings about Strings to externalize in SutorPDFExtractor<commit_after>package name.abuchen.portfolio.datatransfer.pdf;

import name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block;
import name.abuchen.portfolio.datatransfer.pdf.PDFParser.DocumentType;
import name.abuchen.portfolio.datatransfer.pdf.PDFParser.Transaction;
import name.abuchen.portfolio.model.BuySellEntry;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.PortfolioTransaction;
import name.abuchen.portfolio.money.CurrencyUnit;

public class SutorPDFExtractor extends AbstractPDFExtractor
{

    public SutorPDFExtractor(Client client)
    {
        super(client);

        addBankIdentifier("Sutor"); //$NON-NLS-1$
        addBankIdentifier("Sutor Bank"); //$NON-NLS-1$

        addBuyTransaction();
    }

    @Override
    public String getPDFAuthor()
    {
        return "Sutor Bank"; //$NON-NLS-1$
    }

    @SuppressWarnings("nls")
    private void addBuyTransaction()
    {
        DocumentType type = new DocumentType("Sutor fairriester 2.0 | Umsätze");
        this.addDocumentTyp(type);

        Block block = new Block(".* Kauf .*");
        type.addBlock(block);
        block.set(new Transaction<BuySellEntry>()

                        .subject(() -> {
                            BuySellEntry entry = new BuySellEntry();
                            entry.setType(PortfolioTransaction.Type.BUY);
                            return entry;
                        })

                        .section("name").match("^.* Kauf (?<name>[^\\d]*) .*")
                        .assign((t, v) -> t.setSecurity(getOrCreateSecurity(v)))

                        .section("date").match("^(\\d+.\\d+.\\d{4}+) (?<date>\\d+.\\d+.\\d{4}+) .*")
                        .assign((t, v) -> t.setDate(asDate(v.get("date"))))

                        .section("amount")
                        .match("^(\\d+.\\d+.\\d{4}+) (\\d+.\\d+.\\d{4}+) -(?<amount>[\\.\\d]+[,\\d]*) .*")
                        .assign((t, v) -> {
                            t.setAmount(asAmount(v.get("amount")));
                            // Sutor always provides the amount in EUR, column
                            // "Betrag in EUR"
                            t.setCurrencyCode(CurrencyUnit.EUR);
                        })

                        .section("shares").match("^.* (?<shares>[\\.\\d]+[,\\d]*)$")
                        .assign((t, v) -> t.setShares(asShares(v.get("shares"))))

                        .wrap(BuySellEntryItem::new));
    }

    @Override
    public String getLabel()
    {
        return "Sutor Fairriester"; //$NON-NLS-1$
    }

}
{'fraction_non_alphanumeric': 0.16866746698679472, 'fraction_numerical': 0.0038015206082432974, 'mean_word_length': 1.8306908267270667, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3145421', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1535, 'n_words': 226}