001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.util.LocaleThreadLocal;
018 import com.liferay.portal.kernel.util.LocaleUtil;
019 import com.liferay.portal.model.BaseModel;
020 import com.liferay.portal.model.CacheModel;
021 import com.liferay.portal.service.ServiceContext;
022 import com.liferay.portlet.expando.model.ExpandoBridge;
023
024 import java.util.Locale;
025
026
032 public abstract class BaseModelImpl<T> implements BaseModel<T> {
033
034 public BaseModelImpl() {
035 }
036
037 public boolean isNew() {
038 return _new;
039 }
040
041 public void setNew(boolean n) {
042 _new = n;
043 }
044
045 public boolean isCachedModel() {
046 return _cachedModel;
047 }
048
049 public void setCachedModel(boolean cachedModel) {
050 _cachedModel = cachedModel;
051 }
052
053 public boolean isEscapedModel() {
054 return _ESCAPED_MODEL;
055 }
056
057 public ExpandoBridge getExpandoBridge() {
058 throw new UnsupportedOperationException();
059 }
060
061 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
062 throw new UnsupportedOperationException();
063 }
064
065 @Override
066 public abstract Object clone();
067
068 public void resetOriginalValues() {
069 }
070
071 public CacheModel<T> toCacheModel() {
072 throw new UnsupportedOperationException();
073 }
074
075 public T toEscapedModel() {
076 throw new UnsupportedOperationException();
077 }
078
079 protected Locale getLocale(String languageId) {
080 Locale locale = null;
081
082 if (languageId != null) {
083 locale = LocaleUtil.fromLanguageId(languageId);
084 }
085
086 if (locale == null) {
087 locale = LocaleThreadLocal.getThemeDisplayLocale();
088 }
089
090 if (locale == null) {
091 locale = LocaleUtil.getDefault();
092 }
093
094 return locale;
095 }
096
097 private static final boolean _ESCAPED_MODEL = false;
098
099 private boolean _new;
100 private boolean _cachedModel;
101
102 }