1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.model.Address;
20  import com.liferay.portal.model.Country;
21  import com.liferay.portal.model.ListType;
22  import com.liferay.portal.model.Region;
23  import com.liferay.portal.service.CountryServiceUtil;
24  import com.liferay.portal.service.ListTypeServiceUtil;
25  import com.liferay.portal.service.RegionServiceUtil;
26  
27  /**
28   * <a href="AddressImpl.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public class AddressImpl extends AddressModelImpl implements Address {
33  
34      public AddressImpl() {
35      }
36  
37      public Region getRegion() {
38          Region region = null;
39  
40          try {
41              region = RegionServiceUtil.getRegion(getRegionId());
42          }
43          catch (Exception e) {
44              region = new RegionImpl();
45  
46              _log.warn(e);
47          }
48  
49          return region;
50      }
51  
52      public Country getCountry() {
53          Country country = null;
54  
55          try {
56              country = CountryServiceUtil.getCountry(getCountryId());
57          }
58          catch (Exception e) {
59              country = new CountryImpl();
60  
61              _log.warn(e);
62          }
63  
64          return country;
65      }
66  
67      public ListType getType() {
68          ListType type = null;
69  
70          try {
71              type = ListTypeServiceUtil.getListType(getTypeId());
72          }
73          catch (Exception e) {
74              type = new ListTypeImpl();
75  
76              _log.warn(e);
77          }
78  
79          return type;
80      }
81  
82      private static Log _log = LogFactoryUtil.getLog(AddressImpl.class);
83  
84  }