/*
 * This file is part of DebGen Biobank Software developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 * Copyright ASTRID Research Inc., Hungary, 2009-2011.
 *
 * ASTRID Research
 * Headquaters: Csapo 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 Software project.
 * URLS:
 * Developers: Istvan Zoltan Nagy (istvan.nagy@astrid.hu)
 */
package hu.astrid.debgen.exception;

import hu.astrid.debgen.localization.service.LocalizationService;
import java.util.Arrays;
import java.util.List;

/**
 * Exception to show an invalid forms errors
 * @author inagy
 */
public class ValidationFailedException extends DebGenException {

    /**
     * The list of invalid properties
     */
    private List<String> properties;

    /**
     * Constructor, which sets the list of invalid properties too
     * @param properties The list of invalid properties
     */
    public ValidationFailedException(List<String> properties) {
        this.properties = properties;
        this.type = DebGenException.LIST_TYPE;
    }

    /**
     * Constructor, which sets the list of invalid properties too
     * @param properties The list of invalid properties
     */
    public ValidationFailedException(String... properties) {
        this.properties = Arrays.asList(properties);
        this.type = DebGenException.LIST_TYPE;
    }

    /**
     * Returns the list of invalid properties
     * @return The list of invalid properties
     */
    public List<String> getProperties() {
        return properties;
    }

    @Override
    public String getMessage() {
        StringBuilder sb = new StringBuilder();
        sb.append(this.getMessageText());
        for (String s : properties) {
            sb.append(s + ", ");
        }
        return sb.toString();
    }

    public String getMessageText() {
        return "FORMFILL";
    }
}
