001    /**
002     * Copyright (c) 2000-2013 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.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    }