001/*
002 *  Copyright 2015 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.cms.search.query;
017
018import org.ametys.runtime.i18n.I18nizableText;
019
020/**
021 * Thrown when the query syntax is invalid.
022 */
023public class QuerySyntaxException extends Exception
024{
025    
026    /** An internationalized detail message. */
027    protected I18nizableText _i18nMessage;
028    
029    /**
030     * Constructs a new exception with the specified detail message.
031     * @param message the detail message.
032     */
033    public QuerySyntaxException(String message)
034    {
035        this(message, (I18nizableText) null);
036    }
037    
038    /**
039     * Constructs a new exception with the specified detail message and cause.
040     * @param message the detail message.
041     * @param cause the cause.
042     */
043    public QuerySyntaxException(String message, Throwable cause)
044    {
045        this(message, cause, null);
046    }
047    
048    /**
049     * Constructs a new exception with the specified cause.
050     * @param cause the specified cause.
051     */
052    public QuerySyntaxException(Throwable cause)
053    {
054        this(cause, null);
055    }
056    
057    /**
058     * Constructs a new exception with the specified detail message.
059     * @param message the detail message.
060     * @param i18nMessage the internationalized detail message.
061     */
062    public QuerySyntaxException(String message, I18nizableText i18nMessage)
063    {
064        super(message);
065        _i18nMessage = i18nMessage;
066    }
067    
068    /**
069     * Constructs a new exception with the specified detail message and cause.
070     * @param message the detail message.
071     * @param cause the cause.
072     * @param i18nMessage the internationalized detail message.
073     */
074    public QuerySyntaxException(String message, Throwable cause, I18nizableText i18nMessage)
075    {
076        super(message, cause);
077        _i18nMessage = i18nMessage;
078    }
079    
080    /**
081     * Constructs a new exception with the specified cause.
082     * @param cause the specified cause.
083     * @param i18nMessage the internationalized detail message.
084     */
085    public QuerySyntaxException(Throwable cause, I18nizableText i18nMessage)
086    {
087        super(cause);
088        _i18nMessage = i18nMessage;
089    }
090    
091    /**
092     * Get the internationalized detail message.
093     * @return the internationalized detail message.
094     */
095    public I18nizableText getI18nMessage()
096    {
097        return _i18nMessage;
098    }
099    
100}