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.servlet.ImageServletTokenUtil;
018    import com.liferay.portal.kernel.util.PropsKeys;
019    import com.liferay.portal.kernel.util.PropsUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    
022    /**
023     * @author Amos Fong
024     */
025    public class UserConstants {
026    
027            public static final String USERS_EMAIL_ADDRESS_AUTO_SUFFIX = PropsUtil.get(
028                    PropsKeys.USERS_EMAIL_ADDRESS_AUTO_SUFFIX);
029    
030            public static String getPortraitURL(
031                    String imagePath, boolean male, long portraitId) {
032    
033                    StringBundler sb = new StringBundler(7);
034    
035                    sb.append(imagePath);
036                    sb.append("/user_");
037    
038                    if (male) {
039                            sb.append("male");
040                    }
041                    else {
042                            sb.append("female");
043                    }
044    
045                    sb.append("_portrait?img_id=");
046                    sb.append(portraitId);
047                    sb.append("&t=");
048                    sb.append(ImageServletTokenUtil.getToken(portraitId));
049    
050                    return sb.toString();
051            }
052    
053    }