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.StringUtil;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     * @author Jorge Ferrer
023     */
024    public class UserIdException extends PortalException {
025    
026            /**
027             * @deprecated As of 7.0.0, replaced by the inner classes
028             */
029            @Deprecated
030            public UserIdException() {
031            }
032    
033            /**
034             * @deprecated As of 7.0.0, replaced by the inner classes
035             */
036            @Deprecated
037            public UserIdException(String msg) {
038                    super(msg);
039            }
040    
041            /**
042             * @deprecated As of 7.0.0, replaced by the inner classes
043             */
044            @Deprecated
045            public UserIdException(String msg, Throwable cause) {
046                    super(msg, cause);
047            }
048    
049            /**
050             * @deprecated As of 7.0.0, replaced by the inner classes
051             */
052            @Deprecated
053            public UserIdException(Throwable cause) {
054                    super(cause);
055            }
056    
057            public static class MustNotBeNull extends UserIdException {
058    
059                    public MustNotBeNull() {
060                            super("User ID must not be null");
061                    }
062    
063            }
064    
065            public static class MustNotBeReserved extends UserIdException {
066    
067                    public MustNotBeReserved(long userId, String[] reservedUserIds) {
068                            super(
069                                    String.format(
070                                            "User ID %s must not be a reserved one such as: %s", userId,
071                                            StringUtil.merge(reservedUserIds)));
072    
073                            this.userId = userId;
074                            this.reservedUserIds = reservedUserIds;
075                    }
076    
077                    public final String[] reservedUserIds;
078                    public final long userId;
079    
080            }
081    
082    }