List of usage examples for com.liferay.portal.kernel.util StringUtil stripBetween
public static String stripBetween(String s, String begin, String end)
s up to but not including the string begin concatenated with the substring of s after but not including the string end. From source file:com.liferay.portlet.asset.util.AssetUtil.java
License:Open Source License
public static String substituteCategoryPropertyVariables(long groupId, long categoryId, String s) throws PortalException, SystemException { String result = s;//from w w w .j av a 2 s. c o m AssetCategory category = null; if (categoryId > 0) { try { category = AssetCategoryLocalServiceUtil.getCategory(categoryId); } catch (NoSuchCategoryException nsce) { } } if (category != null) { List<AssetCategoryProperty> categoryProperties = AssetCategoryPropertyLocalServiceUtil .getCategoryProperties(categoryId); for (AssetCategoryProperty categoryProperty : categoryProperties) { result = StringUtil.replace(result, "[$" + categoryProperty.getKey() + "$]", categoryProperty.getValue()); } } return StringUtil.stripBetween(result, "[$", "$]"); }
From source file:com.liferay.portlet.asset.util.AssetUtil.java
License:Open Source License
public static String substituteTagPropertyVariables(long groupId, String tagName, String s) throws PortalException, SystemException { String result = s;// w w w .j a v a 2 s .co m AssetTag tag = null; if (tagName != null) { try { tag = AssetTagLocalServiceUtil.getTag(groupId, tagName); } catch (NoSuchTagException nste) { } } if (tag != null) { List<AssetTagProperty> tagProperties = AssetTagPropertyLocalServiceUtil .getTagProperties(tag.getTagId()); for (AssetTagProperty tagProperty : tagProperties) { result = StringUtil.replace(result, "[$" + tagProperty.getKey() + "$]", tagProperty.getValue()); } } return StringUtil.stripBetween(result, "[$", "$]"); }