001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.exception;
016    
017    import com.liferay.portal.kernel.security.auth.FullNameValidator;
018    import com.liferay.portal.kernel.util.ClassUtil;
019    
020    /**
021     * @author Drew Brokke
022     */
023    public class ContactNameException extends PortalException {
024    
025            public static class MustHaveFirstName extends ContactNameException {
026    
027                    public MustHaveFirstName() {
028                            super("Contacts must have a first name");
029                    }
030    
031            }
032    
033            public static class MustHaveLastName extends ContactNameException {
034    
035                    public MustHaveLastName() {
036                            super("Contacts must have a last name");
037                    }
038    
039            }
040    
041            public static class MustHaveMiddleName extends ContactNameException {
042    
043                    public MustHaveMiddleName() {
044                            super("Contacts must have a middle name");
045                    }
046    
047            }
048    
049            public static class MustHaveValidFullName extends ContactNameException {
050    
051                    public MustHaveValidFullName(FullNameValidator fullNameValidator) {
052                            super(
053                                    String.format(
054                                            "Contact full name must validate with %s",
055                                            ClassUtil.getClassName(fullNameValidator)));
056    
057                            this.fullNameValidator = fullNameValidator;
058                    }
059    
060                    public final FullNameValidator fullNameValidator;
061    
062            }
063    
064            private ContactNameException(String msg) {
065                    super(msg);
066            }
067    
068    }