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.exception;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.util.ClassUtil;
019    import com.liferay.portal.security.auth.FullNameValidator;
020    
021    /**
022     * @author Drew Brokke
023     */
024    public class ContactNameException extends PortalException {
025    
026            public static class MustHaveFirstName extends ContactNameException {
027    
028                    public MustHaveFirstName() {
029                            super("Contacts must have a first name");
030                    }
031    
032            }
033    
034            public static class MustHaveLastName extends ContactNameException {
035    
036                    public MustHaveLastName() {
037                            super("Contacts must have a last name");
038                    }
039    
040            }
041    
042            public static class MustHaveMiddleName extends ContactNameException {
043    
044                    public MustHaveMiddleName() {
045                            super("Contacts must have a middle name");
046                    }
047    
048            }
049    
050            public static class MustHaveValidFullName extends ContactNameException {
051    
052                    public MustHaveValidFullName(FullNameValidator fullNameValidator) {
053                            super(
054                                    String.format(
055                                            "Contact full name must validate with %s",
056                                            ClassUtil.getClassName(fullNameValidator)));
057    
058                            this.fullNameValidator = fullNameValidator;
059                    }
060    
061                    public final FullNameValidator fullNameValidator;
062    
063            }
064    
065            private ContactNameException(String msg) {
066                    super(msg);
067            }
068    
069    }