001    package org.trails.validation;
002    
003    import java.text.MessageFormat;
004    
005    import org.trails.descriptor.IPropertyDescriptor;
006    import org.trails.persistence.PersistenceException;
007    
008    public class ValidationException extends PersistenceException
009    {
010    
011            public static final String DEFAULT_MESSAGE = "{0} must be unique.";
012            private String message;
013    
014            public ValidationException(IPropertyDescriptor descriptor)
015            {
016                    this(descriptor, DEFAULT_MESSAGE);
017            }
018    
019            public ValidationException(IPropertyDescriptor descriptor, String message)
020            {
021                    this(MessageFormat.format(message, descriptor.getDisplayName()));
022            }
023    
024            public ValidationException()
025            {
026                    super();
027                    // TODO Auto-generated constructor stub
028            }
029    
030            public ValidationException(String message)
031            {
032                    super(message);
033                    // TODO Auto-generated constructor stub
034            }
035    
036            public ValidationException(String message, Throwable cause)
037            {
038                    super(message, cause);
039                    // TODO Auto-generated constructor stub
040            }
041    
042            public ValidationException(Throwable cause)
043            {
044                    super(cause);
045                    // TODO Auto-generated constructor stub
046            }
047    
048    }