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 @Override
038 public abstract Object clone();
039
040 public ExpandoBridge getExpandoBridge() {
041 throw new UnsupportedOperationException();
042 }
043
044 public boolean isCachedModel() {
045 return _cachedModel;
046 }
047
048 public boolean isEscapedModel() {
049 return _ESCAPED_MODEL;
050 }
051
052 public boolean isNew() {
053 return _new;
054 }
055
056 public void resetOriginalValues() {
057 }
058
059 public void setCachedModel(boolean cachedModel) {
060 _cachedModel = cachedModel;
061 }
062
063 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
064 throw new UnsupportedOperationException();
065 }
066
067 public void setNew(boolean n) {
068 _new = n;
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 _cachedModel;
100 private boolean _new;
101
102 }