001 package com.sptci.prevayler;
002
003 /**
004 * An exception used to indicate that a prevalent object cannot be deleted
005 * from the system since other prevalent objects hold references to it.
006 *
007 * <p>© Copyright 2008 <a href='http://sptci.com/' target='_top'>Sans Pareil
008 * Technologies, Inc.</a></p>
009 * @author Rakesh Vidyadharan 2008-05-28
010 * @version $Id: DeleteException.java 4345 2008-06-30 21:22:03Z rakesh $
011 */
012 public class DeleteException extends ConstraintException
013 {
014 private static final long serialVersionUID = 1l;
015
016 /** The pattern for the message to display for the exception. */
017 private static final String PATTERN = "Cannot delete object of type: " +
018 "$TYPE$ with objectId: " +
019 "$OBJECTID$ due to references from other objects.";
020
021 /**
022 * Create a new instance of the exception for attempting to delete the
023 * specified prevalent object.
024 *
025 * @param object The prevalent object that was to be deleted.
026 */
027 public DeleteException( final PrevalentObject object )
028 {
029 super( PATTERN.replace( "$TYPE$", object.getClass().getName() ).
030 replace( "$OBJECTID$", object.getObjectId().toString() ) );
031 }
032 }