001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.model.Country;
020 import com.liferay.portal.model.ListType;
021 import com.liferay.portal.model.Region;
022 import com.liferay.portal.service.CountryServiceUtil;
023 import com.liferay.portal.service.ListTypeServiceUtil;
024 import com.liferay.portal.service.RegionServiceUtil;
025
026
029 public class AddressImpl extends AddressBaseImpl {
030
031 @Override
032 public Country getCountry() {
033 Country country = null;
034
035 try {
036 country = CountryServiceUtil.getCountry(getCountryId());
037 }
038 catch (Exception e) {
039 country = new CountryImpl();
040
041 if (_log.isWarnEnabled()) {
042 _log.warn(e);
043 }
044 }
045
046 return country;
047 }
048
049 @Override
050 public Region getRegion() {
051 Region region = null;
052
053 try {
054 region = RegionServiceUtil.getRegion(getRegionId());
055 }
056 catch (Exception e) {
057 region = new RegionImpl();
058
059 if (_log.isWarnEnabled()) {
060 _log.warn(e);
061 }
062 }
063
064 return region;
065 }
066
067 @Override
068 public ListType getType() {
069 ListType type = null;
070
071 try {
072 type = ListTypeServiceUtil.getListType(getTypeId());
073 }
074 catch (Exception e) {
075 type = new ListTypeImpl();
076
077 if (_log.isWarnEnabled()) {
078 _log.warn(e);
079 }
080 }
081
082 return type;
083 }
084
085 private static final Log _log = LogFactoryUtil.getLog(AddressImpl.class);
086
087 }