001
014
015 package com.liferay.portlet.social.model.impl;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portal.kernel.json.JSONException;
019 import com.liferay.portal.kernel.json.JSONFactoryUtil;
020 import com.liferay.portal.kernel.json.JSONObject;
021 import com.liferay.portal.kernel.util.Validator;
022 import com.liferay.portlet.asset.model.AssetEntry;
023 import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
024
025
029 public class SocialActivityImpl extends SocialActivityBaseImpl {
030
031 public AssetEntry getAssetEntry() throws SystemException {
032 if ((_assetEntry == null) && Validator.isNotNull(getClassName()) &&
033 (getClassPK() > 0)) {
034
035 _assetEntry = AssetEntryLocalServiceUtil.fetchEntry(
036 getClassName(), getClassPK());
037 }
038
039 return _assetEntry;
040 }
041
042 public String getExtraDataValue(String key) throws JSONException {
043 if (_extraDataJSONObject == null) {
044 _extraDataJSONObject = JSONFactoryUtil.createJSONObject(
045 getExtraData());
046 }
047
048 return _extraDataJSONObject.getString(key);
049 }
050
051 public boolean isClassName(String className) {
052 if (className == null) {
053 return false;
054 }
055
056 return className.equals(getClassName());
057 }
058
059 public void setAssetEntry(AssetEntry assetEntry) {
060 _assetEntry = assetEntry;
061 }
062
063 @Override
064 public void setExtraData(String extraData) {
065 _extraDataJSONObject = null;
066
067 super.setExtraData(extraData);
068 }
069
070 private AssetEntry _assetEntry;
071 private JSONObject _extraDataJSONObject;
072
073 }