001/*
002 *  Copyright 2010 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.plugins.repository;
017
018/**
019 * Exception thrown when an attempt to created a {@link AmetysObject} failed because
020 * this {@link AmetysObject} already exist.
021 */
022public class AmetysObjectExistsException extends AmetysRepositoryException
023{
024    private AmetysObject _ao;
025    /**
026     * Constructs a new unknown data exception with the specified
027     * detail message.
028     * @param message The detail message. 
029     */
030    public AmetysObjectExistsException(String message)
031    {
032        super(message);
033    }
034    
035    /**
036     * Constructs a new unknown data exception with the specified
037     * detail message.
038     * @param message The detail message. 
039     * @param ao The Ametys object
040     */
041    public AmetysObjectExistsException(String message, AmetysObject ao)
042    {
043        super(message);
044        _ao = ao;
045    }
046    
047    /**
048     * Constructs a new unknown data exception with the specified
049     * detail message and cause.
050     * @param message The detail message.
051     * @param cause The cause.
052     */
053    public AmetysObjectExistsException(String message, Throwable cause)
054    {
055        super(message, cause);
056    }
057    
058    /**
059     * Constructs a new unknown data exception with the specified
060     * cause.
061     * @param cause The cause.
062     */
063    public AmetysObjectExistsException(Throwable cause)
064    {
065        super(cause);
066    }
067    
068    /**
069     * Get the Ametys object responsible for this exception
070     * @return The Ametys object
071     */
072    public AmetysObject getAmetysObject()
073    {
074        return _ao;
075    }
076}