001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model;
016    
017    import com.liferay.portal.kernel.util.Validator;
018    
019    import java.util.HashMap;
020    import java.util.Map;
021    
022    /**
023     * <p>
024     * This class is a wrapper for {@link Resource}.
025     * </p>
026     *
027     * @author    Brian Wing Shun Chan
028     * @see       Resource
029     * @generated
030     */
031    public class ResourceWrapper implements Resource, ModelWrapper<Resource> {
032            public ResourceWrapper(Resource resource) {
033                    _resource = resource;
034            }
035    
036            public Class<?> getModelClass() {
037                    return Resource.class;
038            }
039    
040            public String getModelClassName() {
041                    return Resource.class.getName();
042            }
043    
044            public Map<String, Object> getModelAttributes() {
045                    Map<String, Object> attributes = new HashMap<String, Object>();
046    
047                    attributes.put("resourceId", getResourceId());
048                    attributes.put("codeId", getCodeId());
049                    attributes.put("primKey", getPrimKey());
050    
051                    return attributes;
052            }
053    
054            public void setModelAttributes(Map<String, Object> attributes) {
055                    Long resourceId = (Long)attributes.get("resourceId");
056    
057                    if (resourceId != null) {
058                            setResourceId(resourceId);
059                    }
060    
061                    Long codeId = (Long)attributes.get("codeId");
062    
063                    if (codeId != null) {
064                            setCodeId(codeId);
065                    }
066    
067                    String primKey = (String)attributes.get("primKey");
068    
069                    if (primKey != null) {
070                            setPrimKey(primKey);
071                    }
072            }
073    
074            /**
075            * Returns the primary key of this resource.
076            *
077            * @return the primary key of this resource
078            */
079            public long getPrimaryKey() {
080                    return _resource.getPrimaryKey();
081            }
082    
083            /**
084            * Sets the primary key of this resource.
085            *
086            * @param primaryKey the primary key of this resource
087            */
088            public void setPrimaryKey(long primaryKey) {
089                    _resource.setPrimaryKey(primaryKey);
090            }
091    
092            /**
093            * Returns the resource ID of this resource.
094            *
095            * @return the resource ID of this resource
096            */
097            public long getResourceId() {
098                    return _resource.getResourceId();
099            }
100    
101            /**
102            * Sets the resource ID of this resource.
103            *
104            * @param resourceId the resource ID of this resource
105            */
106            public void setResourceId(long resourceId) {
107                    _resource.setResourceId(resourceId);
108            }
109    
110            /**
111            * Returns the code ID of this resource.
112            *
113            * @return the code ID of this resource
114            */
115            public long getCodeId() {
116                    return _resource.getCodeId();
117            }
118    
119            /**
120            * Sets the code ID of this resource.
121            *
122            * @param codeId the code ID of this resource
123            */
124            public void setCodeId(long codeId) {
125                    _resource.setCodeId(codeId);
126            }
127    
128            /**
129            * Returns the prim key of this resource.
130            *
131            * @return the prim key of this resource
132            */
133            public java.lang.String getPrimKey() {
134                    return _resource.getPrimKey();
135            }
136    
137            /**
138            * Sets the prim key of this resource.
139            *
140            * @param primKey the prim key of this resource
141            */
142            public void setPrimKey(java.lang.String primKey) {
143                    _resource.setPrimKey(primKey);
144            }
145    
146            public boolean isNew() {
147                    return _resource.isNew();
148            }
149    
150            public void setNew(boolean n) {
151                    _resource.setNew(n);
152            }
153    
154            public boolean isCachedModel() {
155                    return _resource.isCachedModel();
156            }
157    
158            public void setCachedModel(boolean cachedModel) {
159                    _resource.setCachedModel(cachedModel);
160            }
161    
162            public boolean isEscapedModel() {
163                    return _resource.isEscapedModel();
164            }
165    
166            public java.io.Serializable getPrimaryKeyObj() {
167                    return _resource.getPrimaryKeyObj();
168            }
169    
170            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
171                    _resource.setPrimaryKeyObj(primaryKeyObj);
172            }
173    
174            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
175                    return _resource.getExpandoBridge();
176            }
177    
178            public void setExpandoBridgeAttributes(
179                    com.liferay.portal.service.ServiceContext serviceContext) {
180                    _resource.setExpandoBridgeAttributes(serviceContext);
181            }
182    
183            @Override
184            public java.lang.Object clone() {
185                    return new ResourceWrapper((Resource)_resource.clone());
186            }
187    
188            public int compareTo(com.liferay.portal.model.Resource resource) {
189                    return _resource.compareTo(resource);
190            }
191    
192            @Override
193            public int hashCode() {
194                    return _resource.hashCode();
195            }
196    
197            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.Resource> toCacheModel() {
198                    return _resource.toCacheModel();
199            }
200    
201            public com.liferay.portal.model.Resource toEscapedModel() {
202                    return new ResourceWrapper(_resource.toEscapedModel());
203            }
204    
205            public com.liferay.portal.model.Resource toUnescapedModel() {
206                    return new ResourceWrapper(_resource.toUnescapedModel());
207            }
208    
209            @Override
210            public java.lang.String toString() {
211                    return _resource.toString();
212            }
213    
214            public java.lang.String toXmlString() {
215                    return _resource.toXmlString();
216            }
217    
218            public void persist()
219                    throws com.liferay.portal.kernel.exception.SystemException {
220                    _resource.persist();
221            }
222    
223            public long getCompanyId()
224                    throws com.liferay.portal.kernel.exception.PortalException,
225                            com.liferay.portal.kernel.exception.SystemException {
226                    return _resource.getCompanyId();
227            }
228    
229            public java.lang.String getName()
230                    throws com.liferay.portal.kernel.exception.PortalException,
231                            com.liferay.portal.kernel.exception.SystemException {
232                    return _resource.getName();
233            }
234    
235            public int getScope()
236                    throws com.liferay.portal.kernel.exception.PortalException,
237                            com.liferay.portal.kernel.exception.SystemException {
238                    return _resource.getScope();
239            }
240    
241            public void setCompanyId(long companyId) {
242                    _resource.setCompanyId(companyId);
243            }
244    
245            public void setName(java.lang.String name) {
246                    _resource.setName(name);
247            }
248    
249            public void setScope(int scope) {
250                    _resource.setScope(scope);
251            }
252    
253            @Override
254            public boolean equals(Object obj) {
255                    if (this == obj) {
256                            return true;
257                    }
258    
259                    if (!(obj instanceof ResourceWrapper)) {
260                            return false;
261                    }
262    
263                    ResourceWrapper resourceWrapper = (ResourceWrapper)obj;
264    
265                    if (Validator.equals(_resource, resourceWrapper._resource)) {
266                            return true;
267                    }
268    
269                    return false;
270            }
271    
272            /**
273             * @deprecated Renamed to {@link #getWrappedModel}
274             */
275            public Resource getWrappedResource() {
276                    return _resource;
277            }
278    
279            public Resource getWrappedModel() {
280                    return _resource;
281            }
282    
283            public void resetOriginalValues() {
284                    _resource.resetOriginalValues();
285            }
286    
287            private Resource _resource;
288    }