/*
 * Copyright (C) 2004-2005  exedio GmbH (www.exedio.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.exedio.cope;

/**
 * Signals, that an attempt to write an attribute has been failed,
 * because it cannot be written with a null value.
 *
 * This exception will be thrown by {@link Item#set(ObjectAttribute,Object) Item.set}
 * and item constructors
 * if that attribute is {@link Attribute#isMandatory() mandatory}.
 * <p>
 * This exception is also thrown for empty strings if
 * {@link Model#supportsEmptyStrings()} is false.
 * 
 * @author Ralf Wiebicke
 */
public final class MandatoryViolationException extends ConstraintViolationException
{
	private final Item item;
	private final Attribute notNullAttribute;
	
	/**
	 * Creates a new NotNullViolationException with the neccessary information about the violation.
	 * @param item initializes, what is returned by {@link #getItem()}.
	 * @param notNullAttribute initializes, what is returned by {@link #getMandatoryAttribute()}.
	 */
	public MandatoryViolationException(final Item item, final Attribute notNullAttribute)
	{
		super(null);
		this.item = item;
		this.notNullAttribute = notNullAttribute;
	}
	
	/**
	 * Returns the item that was attempted to be modified.
	 */
	public final Item getItem()
	{
		return item;
	}

	/**
	 * Returns the attribute, that was attempted to be written.
	 */
	public Attribute getMandatoryAttribute()
	{
		return notNullAttribute;
	}

}

@@ -1399,39 +1399,41 @@
 final Attribute 
-notNull
+mandatory
 Attribute;%0A%09%0A%09/*
@@ -1611,23 +1611,25 @@
  @param 
-notNull
+mandatory
 Attribut
@@ -1771,23 +1771,25 @@
 tribute 
-notNull
+mandatory
 Attribut
@@ -1836,23 +1836,25 @@
 %0A%09%09this.
-notNull
+mandatory
 Attribut
@@ -1857,23 +1857,25 @@
 ibute = 
-notNull
+mandatory
 Attribut
@@ -2128,15 +2128,17 @@
 urn 
-notNull
+mandatory
 Attr

rename notNullAttribute to mandatoryAttribute