001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.model;
016    
017    import com.liferay.portal.kernel.util.PropsKeys;
018    import com.liferay.portal.kernel.util.PropsUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.webserver.WebServerServletTokenUtil;
021    
022    /**
023     * @author Amos Fong
024     */
025    public class UserConstants {
026    
027            public static final int FULL_NAME_MAX_LENGTH = 75;
028    
029            public static final String LIST_VIEW_FLAT_ORGANIZATIONS =
030                    "flat-organizations";
031    
032            public static final String LIST_VIEW_FLAT_USER_GROUPS = "flat-user-groups";
033    
034            public static final String LIST_VIEW_FLAT_USERS = "flat-users";
035    
036            public static final String LIST_VIEW_TREE = "tree";
037    
038            public static final String USERS_EMAIL_ADDRESS_AUTO_SUFFIX = PropsUtil.get(
039                    PropsKeys.USERS_EMAIL_ADDRESS_AUTO_SUFFIX);
040    
041            public static String getPortraitURL(
042                    String imagePath, boolean male, long portraitId) {
043    
044                    StringBundler sb = new StringBundler(7);
045    
046                    sb.append(imagePath);
047                    sb.append("/user_");
048    
049                    if (male) {
050                            sb.append("male");
051                    }
052                    else {
053                            sb.append("female");
054                    }
055    
056                    sb.append("_portrait?img_id=");
057                    sb.append(portraitId);
058                    sb.append("&t=");
059                    sb.append(WebServerServletTokenUtil.getToken(portraitId));
060    
061                    return sb.toString();
062            }
063    
064    }