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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.Validator;
020    
021    import java.util.HashMap;
022    import java.util.Map;
023    
024    /**
025     * <p>
026     * This class is a wrapper for {@link ResourcePermission}.
027     * </p>
028     *
029     * @author Brian Wing Shun Chan
030     * @see ResourcePermission
031     * @generated
032     */
033    @ProviderType
034    public class ResourcePermissionWrapper implements ResourcePermission,
035            ModelWrapper<ResourcePermission> {
036            public ResourcePermissionWrapper(ResourcePermission resourcePermission) {
037                    _resourcePermission = resourcePermission;
038            }
039    
040            @Override
041            public Class<?> getModelClass() {
042                    return ResourcePermission.class;
043            }
044    
045            @Override
046            public String getModelClassName() {
047                    return ResourcePermission.class.getName();
048            }
049    
050            @Override
051            public Map<String, Object> getModelAttributes() {
052                    Map<String, Object> attributes = new HashMap<String, Object>();
053    
054                    attributes.put("resourcePermissionId", getResourcePermissionId());
055                    attributes.put("companyId", getCompanyId());
056                    attributes.put("name", getName());
057                    attributes.put("scope", getScope());
058                    attributes.put("primKey", getPrimKey());
059                    attributes.put("roleId", getRoleId());
060                    attributes.put("ownerId", getOwnerId());
061                    attributes.put("actionIds", getActionIds());
062    
063                    return attributes;
064            }
065    
066            @Override
067            public void setModelAttributes(Map<String, Object> attributes) {
068                    Long resourcePermissionId = (Long)attributes.get("resourcePermissionId");
069    
070                    if (resourcePermissionId != null) {
071                            setResourcePermissionId(resourcePermissionId);
072                    }
073    
074                    Long companyId = (Long)attributes.get("companyId");
075    
076                    if (companyId != null) {
077                            setCompanyId(companyId);
078                    }
079    
080                    String name = (String)attributes.get("name");
081    
082                    if (name != null) {
083                            setName(name);
084                    }
085    
086                    Integer scope = (Integer)attributes.get("scope");
087    
088                    if (scope != null) {
089                            setScope(scope);
090                    }
091    
092                    String primKey = (String)attributes.get("primKey");
093    
094                    if (primKey != null) {
095                            setPrimKey(primKey);
096                    }
097    
098                    Long roleId = (Long)attributes.get("roleId");
099    
100                    if (roleId != null) {
101                            setRoleId(roleId);
102                    }
103    
104                    Long ownerId = (Long)attributes.get("ownerId");
105    
106                    if (ownerId != null) {
107                            setOwnerId(ownerId);
108                    }
109    
110                    Long actionIds = (Long)attributes.get("actionIds");
111    
112                    if (actionIds != null) {
113                            setActionIds(actionIds);
114                    }
115            }
116    
117            /**
118            * Returns the primary key of this resource permission.
119            *
120            * @return the primary key of this resource permission
121            */
122            @Override
123            public long getPrimaryKey() {
124                    return _resourcePermission.getPrimaryKey();
125            }
126    
127            /**
128            * Sets the primary key of this resource permission.
129            *
130            * @param primaryKey the primary key of this resource permission
131            */
132            @Override
133            public void setPrimaryKey(long primaryKey) {
134                    _resourcePermission.setPrimaryKey(primaryKey);
135            }
136    
137            /**
138            * Returns the resource permission ID of this resource permission.
139            *
140            * @return the resource permission ID of this resource permission
141            */
142            @Override
143            public long getResourcePermissionId() {
144                    return _resourcePermission.getResourcePermissionId();
145            }
146    
147            /**
148            * Sets the resource permission ID of this resource permission.
149            *
150            * @param resourcePermissionId the resource permission ID of this resource permission
151            */
152            @Override
153            public void setResourcePermissionId(long resourcePermissionId) {
154                    _resourcePermission.setResourcePermissionId(resourcePermissionId);
155            }
156    
157            /**
158            * Returns the company ID of this resource permission.
159            *
160            * @return the company ID of this resource permission
161            */
162            @Override
163            public long getCompanyId() {
164                    return _resourcePermission.getCompanyId();
165            }
166    
167            /**
168            * Sets the company ID of this resource permission.
169            *
170            * @param companyId the company ID of this resource permission
171            */
172            @Override
173            public void setCompanyId(long companyId) {
174                    _resourcePermission.setCompanyId(companyId);
175            }
176    
177            /**
178            * Returns the name of this resource permission.
179            *
180            * @return the name of this resource permission
181            */
182            @Override
183            public java.lang.String getName() {
184                    return _resourcePermission.getName();
185            }
186    
187            /**
188            * Sets the name of this resource permission.
189            *
190            * @param name the name of this resource permission
191            */
192            @Override
193            public void setName(java.lang.String name) {
194                    _resourcePermission.setName(name);
195            }
196    
197            /**
198            * Returns the scope of this resource permission.
199            *
200            * @return the scope of this resource permission
201            */
202            @Override
203            public int getScope() {
204                    return _resourcePermission.getScope();
205            }
206    
207            /**
208            * Sets the scope of this resource permission.
209            *
210            * @param scope the scope of this resource permission
211            */
212            @Override
213            public void setScope(int scope) {
214                    _resourcePermission.setScope(scope);
215            }
216    
217            /**
218            * Returns the prim key of this resource permission.
219            *
220            * @return the prim key of this resource permission
221            */
222            @Override
223            public java.lang.String getPrimKey() {
224                    return _resourcePermission.getPrimKey();
225            }
226    
227            /**
228            * Sets the prim key of this resource permission.
229            *
230            * @param primKey the prim key of this resource permission
231            */
232            @Override
233            public void setPrimKey(java.lang.String primKey) {
234                    _resourcePermission.setPrimKey(primKey);
235            }
236    
237            /**
238            * Returns the role ID of this resource permission.
239            *
240            * @return the role ID of this resource permission
241            */
242            @Override
243            public long getRoleId() {
244                    return _resourcePermission.getRoleId();
245            }
246    
247            /**
248            * Sets the role ID of this resource permission.
249            *
250            * @param roleId the role ID of this resource permission
251            */
252            @Override
253            public void setRoleId(long roleId) {
254                    _resourcePermission.setRoleId(roleId);
255            }
256    
257            /**
258            * Returns the owner ID of this resource permission.
259            *
260            * @return the owner ID of this resource permission
261            */
262            @Override
263            public long getOwnerId() {
264                    return _resourcePermission.getOwnerId();
265            }
266    
267            /**
268            * Sets the owner ID of this resource permission.
269            *
270            * @param ownerId the owner ID of this resource permission
271            */
272            @Override
273            public void setOwnerId(long ownerId) {
274                    _resourcePermission.setOwnerId(ownerId);
275            }
276    
277            /**
278            * Returns the action IDs of this resource permission.
279            *
280            * @return the action IDs of this resource permission
281            */
282            @Override
283            public long getActionIds() {
284                    return _resourcePermission.getActionIds();
285            }
286    
287            /**
288            * Sets the action IDs of this resource permission.
289            *
290            * @param actionIds the action IDs of this resource permission
291            */
292            @Override
293            public void setActionIds(long actionIds) {
294                    _resourcePermission.setActionIds(actionIds);
295            }
296    
297            @Override
298            public boolean isNew() {
299                    return _resourcePermission.isNew();
300            }
301    
302            @Override
303            public void setNew(boolean n) {
304                    _resourcePermission.setNew(n);
305            }
306    
307            @Override
308            public boolean isCachedModel() {
309                    return _resourcePermission.isCachedModel();
310            }
311    
312            @Override
313            public void setCachedModel(boolean cachedModel) {
314                    _resourcePermission.setCachedModel(cachedModel);
315            }
316    
317            @Override
318            public boolean isEscapedModel() {
319                    return _resourcePermission.isEscapedModel();
320            }
321    
322            @Override
323            public java.io.Serializable getPrimaryKeyObj() {
324                    return _resourcePermission.getPrimaryKeyObj();
325            }
326    
327            @Override
328            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
329                    _resourcePermission.setPrimaryKeyObj(primaryKeyObj);
330            }
331    
332            @Override
333            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
334                    return _resourcePermission.getExpandoBridge();
335            }
336    
337            @Override
338            public void setExpandoBridgeAttributes(
339                    com.liferay.portal.model.BaseModel<?> baseModel) {
340                    _resourcePermission.setExpandoBridgeAttributes(baseModel);
341            }
342    
343            @Override
344            public void setExpandoBridgeAttributes(
345                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
346                    _resourcePermission.setExpandoBridgeAttributes(expandoBridge);
347            }
348    
349            @Override
350            public void setExpandoBridgeAttributes(
351                    com.liferay.portal.service.ServiceContext serviceContext) {
352                    _resourcePermission.setExpandoBridgeAttributes(serviceContext);
353            }
354    
355            @Override
356            public java.lang.Object clone() {
357                    return new ResourcePermissionWrapper((ResourcePermission)_resourcePermission.clone());
358            }
359    
360            @Override
361            public int compareTo(
362                    com.liferay.portal.model.ResourcePermission resourcePermission) {
363                    return _resourcePermission.compareTo(resourcePermission);
364            }
365    
366            @Override
367            public int hashCode() {
368                    return _resourcePermission.hashCode();
369            }
370    
371            @Override
372            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.ResourcePermission> toCacheModel() {
373                    return _resourcePermission.toCacheModel();
374            }
375    
376            @Override
377            public com.liferay.portal.model.ResourcePermission toEscapedModel() {
378                    return new ResourcePermissionWrapper(_resourcePermission.toEscapedModel());
379            }
380    
381            @Override
382            public com.liferay.portal.model.ResourcePermission toUnescapedModel() {
383                    return new ResourcePermissionWrapper(_resourcePermission.toUnescapedModel());
384            }
385    
386            @Override
387            public java.lang.String toString() {
388                    return _resourcePermission.toString();
389            }
390    
391            @Override
392            public java.lang.String toXmlString() {
393                    return _resourcePermission.toXmlString();
394            }
395    
396            @Override
397            public void persist()
398                    throws com.liferay.portal.kernel.exception.SystemException {
399                    _resourcePermission.persist();
400            }
401    
402            @Override
403            public void addResourceAction(java.lang.String actionId)
404                    throws com.liferay.portal.kernel.exception.PortalException {
405                    _resourcePermission.addResourceAction(actionId);
406            }
407    
408            @Override
409            public boolean hasActionId(java.lang.String actionId) {
410                    return _resourcePermission.hasActionId(actionId);
411            }
412    
413            @Override
414            public void removeResourceAction(java.lang.String actionId)
415                    throws com.liferay.portal.kernel.exception.PortalException {
416                    _resourcePermission.removeResourceAction(actionId);
417            }
418    
419            @Override
420            public boolean equals(Object obj) {
421                    if (this == obj) {
422                            return true;
423                    }
424    
425                    if (!(obj instanceof ResourcePermissionWrapper)) {
426                            return false;
427                    }
428    
429                    ResourcePermissionWrapper resourcePermissionWrapper = (ResourcePermissionWrapper)obj;
430    
431                    if (Validator.equals(_resourcePermission,
432                                            resourcePermissionWrapper._resourcePermission)) {
433                            return true;
434                    }
435    
436                    return false;
437            }
438    
439            /**
440             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
441             */
442            public ResourcePermission getWrappedResourcePermission() {
443                    return _resourcePermission;
444            }
445    
446            @Override
447            public ResourcePermission getWrappedModel() {
448                    return _resourcePermission;
449            }
450    
451            @Override
452            public void resetOriginalValues() {
453                    _resourcePermission.resetOriginalValues();
454            }
455    
456            private ResourcePermission _resourcePermission;
457    }