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