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.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.model.Resource;
20  import com.liferay.portal.model.ResourceCode;
21  import com.liferay.portal.service.ResourceCodeLocalServiceUtil;
22  
23  /**
24   * <a href="ResourceImpl.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   */
28  public class ResourceImpl extends ResourceModelImpl implements Resource {
29  
30      public ResourceImpl() {
31      }
32  
33      public long getCompanyId() throws PortalException, SystemException {
34          if (_companyId != 0) {
35              return _companyId;
36          }
37          else {
38              ResourceCode resourceCode =
39                  ResourceCodeLocalServiceUtil.getResourceCode(getCodeId());
40  
41              return resourceCode.getCompanyId();
42          }
43      }
44  
45      public String getName() throws PortalException, SystemException {
46          if (_name != null) {
47              return _name;
48          }
49          else {
50              ResourceCode resourceCode =
51                  ResourceCodeLocalServiceUtil.getResourceCode(getCodeId());
52  
53              return resourceCode.getName();
54          }
55      }
56  
57      public int getScope() throws PortalException, SystemException {
58          if (_scope != 0) {
59              return _scope;
60          }
61          else {
62              ResourceCode resourceCode =
63                  ResourceCodeLocalServiceUtil.getResourceCode(getCodeId());
64  
65              return resourceCode.getScope();
66          }
67      }
68  
69      public void setCompanyId(long companyId) {
70          _companyId = companyId;
71      }
72  
73      public void setName(String name) {
74          _name = name;
75      }
76  
77      public void setScope(int scope) {
78          _scope = scope;
79      }
80  
81      private long _companyId;
82      private String _name;
83      private int _scope;
84  
85  }