PortletConstants.java |
1 /** 2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved. 3 * 4 * The contents of this file are subject to the terms of the Liferay Enterprise 5 * Subscription License ("License"). You may not use this file except in 6 * compliance with the License. You can obtain a copy of the License by 7 * contacting Liferay, Inc. See the License for the specific language governing 8 * permissions and limitations under the License, including but not limited to 9 * distribution rights of the Software. 10 * 11 * 12 * 13 */ 14 15 package com.liferay.portal.model; 16 17 /** 18 * <a href="PortletConstants.java.html"><b><i>View Source</i></b></a> 19 * 20 * @author Brian Wing Shun Chan 21 */ 22 public class PortletConstants { 23 24 /** 25 * War file separator. 26 */ 27 public static final String WAR_SEPARATOR = "_WAR_"; 28 29 /** 30 * Instance separator. 31 */ 32 public static final String INSTANCE_SEPARATOR = "_INSTANCE_"; 33 34 /** 35 * Layout separator. 36 */ 37 public static final String LAYOUT_SEPARATOR = "_LAYOUT_"; 38 39 /** 40 * Default preferences. 41 */ 42 public static final String DEFAULT_PREFERENCES = "<portlet-preferences />"; 43 44 /** 45 * User principal strategy for screen name. 46 */ 47 public static final String USER_PRINCIPAL_STRATEGY_SCREEN_NAME = 48 "screenName"; 49 50 /** 51 * User principal strategy for screen name. 52 */ 53 public static final String USER_PRINCIPAL_STRATEGY_USER_ID = "userId"; 54 55 /** 56 * Facebook integration method for FBML. 57 */ 58 public static final String FACEBOOK_INTEGRATION_FBML = "fbml"; 59 60 /** 61 * Facebook integration method for IFrame. 62 */ 63 public static final String FACEBOOK_INTEGRATION_IFRAME = "iframe"; 64 65 /** 66 * Gets the root portlet id of the portlet. 67 * 68 * @return the root portlet id of the portlet 69 */ 70 public static String getRootPortletId(String portletId) { 71 int pos = portletId.indexOf(INSTANCE_SEPARATOR); 72 73 if (pos == -1) { 74 return portletId; 75 } 76 else { 77 return portletId.substring(0, pos); 78 } 79 } 80 81 /** 82 * Gets the instance id of the portlet. 83 * 84 * @return the instance id of the portlet 85 */ 86 public static String getInstanceId(String portletId) { 87 int pos = portletId.indexOf(INSTANCE_SEPARATOR); 88 89 if (pos == -1) { 90 return null; 91 } 92 else { 93 return portletId.substring( 94 pos + INSTANCE_SEPARATOR.length(), portletId.length()); 95 } 96 } 97 98 }