/*
 * 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.server.requestprocessor.exception;

import hu.astrid.debgen.exception.DebGenException;
import hu.astrid.debgen.localization.service.LocalizationService;

/**
 * Exception to show unknown page requests
 * @author inagy
 */
public class InvalidPageNameFormatException extends DebGenException {
    /**
     * The name of the requested page
     */
    private String pageName;

    /**
     * Constructor to set pageName too
     * @param pageName
     */
    public InvalidPageNameFormatException(String pageName) {
        this.type = DebGenException.MIDDLE_TYPE;
        this.pageName = pageName;
    }

    @Override
    public String getMessage() {
        return getLeftMessage() + getMiddle() + getRightMessage();
    }

    public String getMiddle() {
        return pageName;
    }

    public String getRightMessage() {
        return "]. Kérem ellenőrizze a kért oldalt!";         //i18
    }

    public String getLeftMessage() {
        return "A kért oldal neve ismeretlen: [";    //i18
    }

    @Override
    public String getLocalizedMessage() {
        LocalizationService localizationService = new LocalizationService();
        return localizationService.getMessage("A kért oldal neve ismeretlen: [") + pageName + localizationService.getMessage("]. Kérem ellenőrizze a kért oldalt!");
    }

}
