001
014
015 package com.liferay.portal.model;
016
017
020 public class PortletConstants {
021
022
025 public static final String DEFAULT_PREFERENCES = "<portlet-preferences />";
026
027
030 public static final String FACEBOOK_INTEGRATION_FBML = "fbml";
031
032
035 public static final String FACEBOOK_INTEGRATION_IFRAME = "iframe";
036
037
040 public static final String INSTANCE_SEPARATOR = "_INSTANCE_";
041
042
045 public static final String LAYOUT_SEPARATOR = "_LAYOUT_";
046
047
050 public static final String USER_PRINCIPAL_STRATEGY_SCREEN_NAME =
051 "screenName";
052
053
056 public static final String USER_PRINCIPAL_STRATEGY_USER_ID = "userId";
057
058
061 public static final String WAR_SEPARATOR = "_WAR_";
062
063
068 public static String getInstanceId(String portletId) {
069 int pos = portletId.indexOf(INSTANCE_SEPARATOR);
070
071 if (pos == -1) {
072 return null;
073 }
074 else {
075 return portletId.substring(pos + INSTANCE_SEPARATOR.length());
076 }
077 }
078
079
084 public static String getRootPortletId(String portletId) {
085 int pos = portletId.indexOf(INSTANCE_SEPARATOR);
086
087 if (pos == -1) {
088 return portletId;
089 }
090 else {
091 return portletId.substring(0, pos);
092 }
093 }
094
095 public static boolean hasInstanceId(String portletId) {
096 return portletId.contains(INSTANCE_SEPARATOR);
097 }
098
099 }