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