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 Permission}.
025     * </p>
026     *
027     * @author    Brian Wing Shun Chan
028     * @see       Permission
029     * @generated
030     */
031    public class PermissionWrapper implements Permission, ModelWrapper<Permission> {
032            public PermissionWrapper(Permission permission) {
033                    _permission = permission;
034            }
035    
036            public Class<?> getModelClass() {
037                    return Permission.class;
038            }
039    
040            public String getModelClassName() {
041                    return Permission.class.getName();
042            }
043    
044            public Map<String, Object> getModelAttributes() {
045                    Map<String, Object> attributes = new HashMap<String, Object>();
046    
047                    attributes.put("permissionId", getPermissionId());
048                    attributes.put("companyId", getCompanyId());
049                    attributes.put("actionId", getActionId());
050                    attributes.put("resourceId", getResourceId());
051    
052                    return attributes;
053            }
054    
055            public void setModelAttributes(Map<String, Object> attributes) {
056                    Long permissionId = (Long)attributes.get("permissionId");
057    
058                    if (permissionId != null) {
059                            setPermissionId(permissionId);
060                    }
061    
062                    Long companyId = (Long)attributes.get("companyId");
063    
064                    if (companyId != null) {
065                            setCompanyId(companyId);
066                    }
067    
068                    String actionId = (String)attributes.get("actionId");
069    
070                    if (actionId != null) {
071                            setActionId(actionId);
072                    }
073    
074                    Long resourceId = (Long)attributes.get("resourceId");
075    
076                    if (resourceId != null) {
077                            setResourceId(resourceId);
078                    }
079            }
080    
081            /**
082            * Returns the primary key of this permission.
083            *
084            * @return the primary key of this permission
085            */
086            public long getPrimaryKey() {
087                    return _permission.getPrimaryKey();
088            }
089    
090            /**
091            * Sets the primary key of this permission.
092            *
093            * @param primaryKey the primary key of this permission
094            */
095            public void setPrimaryKey(long primaryKey) {
096                    _permission.setPrimaryKey(primaryKey);
097            }
098    
099            /**
100            * Returns the permission ID of this permission.
101            *
102            * @return the permission ID of this permission
103            */
104            public long getPermissionId() {
105                    return _permission.getPermissionId();
106            }
107    
108            /**
109            * Sets the permission ID of this permission.
110            *
111            * @param permissionId the permission ID of this permission
112            */
113            public void setPermissionId(long permissionId) {
114                    _permission.setPermissionId(permissionId);
115            }
116    
117            /**
118            * Returns the company ID of this permission.
119            *
120            * @return the company ID of this permission
121            */
122            public long getCompanyId() {
123                    return _permission.getCompanyId();
124            }
125    
126            /**
127            * Sets the company ID of this permission.
128            *
129            * @param companyId the company ID of this permission
130            */
131            public void setCompanyId(long companyId) {
132                    _permission.setCompanyId(companyId);
133            }
134    
135            /**
136            * Returns the action ID of this permission.
137            *
138            * @return the action ID of this permission
139            */
140            public java.lang.String getActionId() {
141                    return _permission.getActionId();
142            }
143    
144            /**
145            * Sets the action ID of this permission.
146            *
147            * @param actionId the action ID of this permission
148            */
149            public void setActionId(java.lang.String actionId) {
150                    _permission.setActionId(actionId);
151            }
152    
153            /**
154            * Returns the resource ID of this permission.
155            *
156            * @return the resource ID of this permission
157            */
158            public long getResourceId() {
159                    return _permission.getResourceId();
160            }
161    
162            /**
163            * Sets the resource ID of this permission.
164            *
165            * @param resourceId the resource ID of this permission
166            */
167            public void setResourceId(long resourceId) {
168                    _permission.setResourceId(resourceId);
169            }
170    
171            public boolean isNew() {
172                    return _permission.isNew();
173            }
174    
175            public void setNew(boolean n) {
176                    _permission.setNew(n);
177            }
178    
179            public boolean isCachedModel() {
180                    return _permission.isCachedModel();
181            }
182    
183            public void setCachedModel(boolean cachedModel) {
184                    _permission.setCachedModel(cachedModel);
185            }
186    
187            public boolean isEscapedModel() {
188                    return _permission.isEscapedModel();
189            }
190    
191            public java.io.Serializable getPrimaryKeyObj() {
192                    return _permission.getPrimaryKeyObj();
193            }
194    
195            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
196                    _permission.setPrimaryKeyObj(primaryKeyObj);
197            }
198    
199            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
200                    return _permission.getExpandoBridge();
201            }
202    
203            public void setExpandoBridgeAttributes(
204                    com.liferay.portal.service.ServiceContext serviceContext) {
205                    _permission.setExpandoBridgeAttributes(serviceContext);
206            }
207    
208            @Override
209            public java.lang.Object clone() {
210                    return new PermissionWrapper((Permission)_permission.clone());
211            }
212    
213            public int compareTo(com.liferay.portal.model.Permission permission) {
214                    return _permission.compareTo(permission);
215            }
216    
217            @Override
218            public int hashCode() {
219                    return _permission.hashCode();
220            }
221    
222            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.Permission> toCacheModel() {
223                    return _permission.toCacheModel();
224            }
225    
226            public com.liferay.portal.model.Permission toEscapedModel() {
227                    return new PermissionWrapper(_permission.toEscapedModel());
228            }
229    
230            public com.liferay.portal.model.Permission toUnescapedModel() {
231                    return new PermissionWrapper(_permission.toUnescapedModel());
232            }
233    
234            @Override
235            public java.lang.String toString() {
236                    return _permission.toString();
237            }
238    
239            public java.lang.String toXmlString() {
240                    return _permission.toXmlString();
241            }
242    
243            public void persist()
244                    throws com.liferay.portal.kernel.exception.SystemException {
245                    _permission.persist();
246            }
247    
248            public java.lang.String getName() {
249                    return _permission.getName();
250            }
251    
252            public java.lang.String getPrimKey() {
253                    return _permission.getPrimKey();
254            }
255    
256            public int getScope() {
257                    return _permission.getScope();
258            }
259    
260            public void setName(java.lang.String name) {
261                    _permission.setName(name);
262            }
263    
264            public void setPrimKey(java.lang.String primKey) {
265                    _permission.setPrimKey(primKey);
266            }
267    
268            public void setScope(int scope) {
269                    _permission.setScope(scope);
270            }
271    
272            @Override
273            public boolean equals(Object obj) {
274                    if (this == obj) {
275                            return true;
276                    }
277    
278                    if (!(obj instanceof PermissionWrapper)) {
279                            return false;
280                    }
281    
282                    PermissionWrapper permissionWrapper = (PermissionWrapper)obj;
283    
284                    if (Validator.equals(_permission, permissionWrapper._permission)) {
285                            return true;
286                    }
287    
288                    return false;
289            }
290    
291            /**
292             * @deprecated Renamed to {@link #getWrappedModel}
293             */
294            public Permission getWrappedPermission() {
295                    return _permission;
296            }
297    
298            public Permission getWrappedModel() {
299                    return _permission;
300            }
301    
302            public void resetOriginalValues() {
303                    _permission.resetOriginalValues();
304            }
305    
306            private Permission _permission;
307    }