<commit_before>package com.ilscipio.scipio.accounting.external.datev;

import java.lang.reflect.Constructor;
import java.util.Iterator;
import java.util.Map;

import org.ofbiz.entity.Delegator;

import com.ilscipio.scipio.accounting.external.OperationStats;
import com.ilscipio.scipio.accounting.external.OperationStats.NotificationLevel;
import com.ilscipio.scipio.accounting.external.OperationStats.NotificationScope;
import com.ilscipio.scipio.accounting.external.OperationStats.Stat;
import com.ilscipio.scipio.accounting.external.datev.category.AbstractDatevDataCategory;

public class DatevHelper {
    private static final String module = DatevHelper.class.getName();

    private final String orgPartyId;
    private final OperationStats stats;
    private final AbstractDatevDataCategory dataCategory;

    public DatevHelper(Delegator delegator, String orgPartyId, Class<? extends AbstractDatevDataCategory> dataCategoryClass) throws DatevException {
        this.orgPartyId = orgPartyId;
        try {
            Constructor<? extends AbstractDatevDataCategory> datevDataCategoryConstructor = dataCategoryClass.getConstructor(Delegator.class, DatevHelper.class);
            this.dataCategory = datevDataCategoryConstructor.newInstance(delegator, this);
            this.stats = dataCategory.getOperationStatsClass().newInstance();
        } catch (Exception e) {
            throw new DatevException("Internal error. Cannot initialize DATEV helper.");
        }

    }

    public void processRecord(Map<String, String> recordMap) throws DatevException {
        dataCategory.processRecord(recordMap);
    }

    public String[] getFieldNames() throws DatevException {
        return dataCategory.getFieldNames();
    }

    public boolean validateField(Object o, String value) throws DatevException {
        if (o instanceof String)
            return dataCategory.validateField(String.valueOf(o), value);
        else if (o instanceof Integer)
            return dataCategory.validateField((Integer) o, value);
        return false;
    }

    public String getOrgPartyId() {
        return orgPartyId;
    }

    public boolean isMetaHeader(Iterator<String> metaHeader) throws DatevException {
        return dataCategory.isMetaHeader(metaHeader);<commit_msg>Refs #1575:  * Added a record index arg to the processRecord method<commit_after>package com.ilscipio.scipio.accounting.external.datev;

import java.lang.reflect.Constructor;
import java.util.Iterator;
import java.util.Map;

import org.ofbiz.entity.Delegator;

import com.ilscipio.scipio.accounting.external.OperationStats;
import com.ilscipio.scipio.accounting.external.OperationStats.NotificationLevel;
import com.ilscipio.scipio.accounting.external.OperationStats.NotificationScope;
import com.ilscipio.scipio.accounting.external.OperationStats.Stat;
import com.ilscipio.scipio.accounting.external.datev.category.AbstractDatevDataCategory;

public class DatevHelper {
    private static final String module = DatevHelper.class.getName();

    private final String orgPartyId;
    private final OperationStats stats;
    private final AbstractDatevDataCategory dataCategory;

    public DatevHelper(Delegator delegator, String orgPartyId, Class<? extends AbstractDatevDataCategory> dataCategoryClass) throws DatevException {
        this.orgPartyId = orgPartyId;
        try {
            Constructor<? extends AbstractDatevDataCategory> datevDataCategoryConstructor = dataCategoryClass.getConstructor(Delegator.class, DatevHelper.class);
            this.dataCategory = datevDataCategoryConstructor.newInstance(delegator, this);
            this.stats = dataCategory.getOperationStatsClass().newInstance();
        } catch (Exception e) {
            throw new DatevException("Internal error. Cannot initialize DATEV helper.");
        }

    }

    public void processRecord(int index, Map<String, String> recordMap) throws DatevException {
        dataCategory.processRecord(index, recordMap);
    }

    public String[] getFieldNames() throws DatevException {
        return dataCategory.getFieldNames();
    }

    public boolean validateField(Object o, String value) throws DatevException {
        if (o instanceof String)
            return dataCategory.validateField(String.valueOf(o), value);
        else if (o instanceof Integer)
            return dataCategory.validateField((Integer) o, value);
        return false;
    }

    public String getOrgPartyId() {
        return orgPartyId;
    }

    public boolean isMetaHeader(Iterator<String> metaHeader) throws DatevException {
        return dataCategory.isMetaHeader(metaHeader);
{'fraction_non_alphanumeric': 0.07893598615916955, 'fraction_numerical': 0.0008650519031141869, 'mean_word_length': 4.082417582417582, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6992011', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1208, 'n_words': 276}