001
014
015 package com.liferay.taglib.ui;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portlet.asset.model.AssetEntry;
020 import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
021 import com.liferay.taglib.util.IncludeTag;
022
023 import javax.servlet.http.HttpServletRequest;
024
025
029 public class AssetLinksTag extends IncludeTag {
030
031 public long getAssetEntryId() {
032 return _assetEntryId;
033 }
034
035 public String getClassName() {
036 return _className;
037 }
038
039 public long getClassPK() {
040 return _classPK;
041 }
042
043 @Override
044 protected String getPage() {
045 return _PAGE;
046 }
047
048 @Override
049 protected void setAttributes(HttpServletRequest request) {
050 if ((_assetEntryId <= 0) && (_classPK > 0)) {
051 try {
052 AssetEntry assetEntry = AssetEntryLocalServiceUtil.fetchEntry(
053 _className, _classPK);
054
055 if (assetEntry != null) {
056 _assetEntryId = assetEntry.getEntryId();
057 }
058 }
059 catch (SystemException se) {
060 }
061 }
062
063 request.setAttribute(
064 "liferay-ui:asset-links:assetEntryId",
065 String.valueOf(_assetEntryId));
066 }
067
068 public void setAssetEntryId(long assetEntryId) {
069 _assetEntryId = assetEntryId;
070 }
071
072 public void setClassName(String className) {
073 _className = className;
074 }
075
076 public void setClassPK(long classPK) {
077 _classPK = classPK;
078 }
079
080 @Override
081 protected void cleanUp() {
082 _assetEntryId = 0;
083 _className = StringPool.BLANK;
084 _classPK = 0;
085 }
086
087 private static final String _PAGE =
088 "/html/taglib/ui/asset_links/page.jsp";
089
090 private long _assetEntryId;
091 private String _className = StringPool.BLANK;
092 private long _classPK;
093
094 }