/*
 * This file (TestLabelPrinter.java) is part of DebGen-LabelPrintLib  developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 *  Copyright ASTRID Research, Hungary, 2010.
 *
 *  ASTRID Research
 *  Headquaters: Csapó utca 42. Debrecen H-4029 HUNGARY
 *  Phone: +36-52-533-173        Fax: +36-52-533-174
 *  Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DEBGEN-Biobank-Project.
 * File last modified at 2010.01.08 14:21
 */
package hu.astrid.debgen.labelprint.test.control;

import hu.astrid.debgen.labelprint.domain.Label;
import hu.astrid.debgen.labelprint.exception.LabelPrintException;
import hu.astrid.debgen.labelprint.printer.AbstractLabelPrinter;

import java.util.List;
import java.util.ArrayList;

/**
 * @author inagy
 */
public class TestLabelPrinter extends AbstractLabelPrinter {

    /**
     * List of results.
     */
    private List<String> result = new ArrayList<String>();

    /**
     * Default constructor.
     */
    public TestLabelPrinter() throws LabelPrintException {
    }

    /**
     * Return result list.
     */
    public List<String> getResult() {
        return result;
    }

    /**
     * Implements AbstractLabelPrinter printLabel(List<Label> labels).
     * @param labels The list of labels to print
     */
    @Override
    public void printLabel(List<Label> labels) throws LabelPrintException {
        try {
            for (Label l : labels) {
                for (int i = 0; i < l.getCopies(); i++) {
                    result.add(l.processTemplate());
                }
            }
        } catch (Exception e) {
            throw new LabelPrintException(e);
        }
    }
}
