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 PluginSetting}.
032     * </p>
033     *
034     * @author Brian Wing Shun Chan
035     * @see PluginSetting
036     * @generated
037     */
038    @ProviderType
039    public class PluginSettingWrapper implements PluginSetting,
040            ModelWrapper<PluginSetting> {
041            public PluginSettingWrapper(PluginSetting pluginSetting) {
042                    _pluginSetting = pluginSetting;
043            }
044    
045            @Override
046            public Class<?> getModelClass() {
047                    return PluginSetting.class;
048            }
049    
050            @Override
051            public String getModelClassName() {
052                    return PluginSetting.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("pluginSettingId", getPluginSettingId());
061                    attributes.put("companyId", getCompanyId());
062                    attributes.put("pluginId", getPluginId());
063                    attributes.put("pluginType", getPluginType());
064                    attributes.put("roles", getRoles());
065                    attributes.put("active", getActive());
066    
067                    return attributes;
068            }
069    
070            @Override
071            public void setModelAttributes(Map<String, Object> attributes) {
072                    Long mvccVersion = (Long)attributes.get("mvccVersion");
073    
074                    if (mvccVersion != null) {
075                            setMvccVersion(mvccVersion);
076                    }
077    
078                    Long pluginSettingId = (Long)attributes.get("pluginSettingId");
079    
080                    if (pluginSettingId != null) {
081                            setPluginSettingId(pluginSettingId);
082                    }
083    
084                    Long companyId = (Long)attributes.get("companyId");
085    
086                    if (companyId != null) {
087                            setCompanyId(companyId);
088                    }
089    
090                    String pluginId = (String)attributes.get("pluginId");
091    
092                    if (pluginId != null) {
093                            setPluginId(pluginId);
094                    }
095    
096                    String pluginType = (String)attributes.get("pluginType");
097    
098                    if (pluginType != null) {
099                            setPluginType(pluginType);
100                    }
101    
102                    String roles = (String)attributes.get("roles");
103    
104                    if (roles != null) {
105                            setRoles(roles);
106                    }
107    
108                    Boolean active = (Boolean)attributes.get("active");
109    
110                    if (active != null) {
111                            setActive(active);
112                    }
113            }
114    
115            @Override
116            public CacheModel<PluginSetting> toCacheModel() {
117                    return _pluginSetting.toCacheModel();
118            }
119    
120            @Override
121            public PluginSetting toEscapedModel() {
122                    return new PluginSettingWrapper(_pluginSetting.toEscapedModel());
123            }
124    
125            @Override
126            public PluginSetting toUnescapedModel() {
127                    return new PluginSettingWrapper(_pluginSetting.toUnescapedModel());
128            }
129    
130            /**
131            * Returns the active of this plugin setting.
132            *
133            * @return the active of this plugin setting
134            */
135            @Override
136            public boolean getActive() {
137                    return _pluginSetting.getActive();
138            }
139    
140            /**
141            * Returns <code>true</code> if the user has permission to use this plugin
142            *
143            * @param userId the primary key of the user
144            * @return <code>true</code> if the user has permission to use this plugin
145            */
146            @Override
147            public boolean hasPermission(long userId) {
148                    return _pluginSetting.hasPermission(userId);
149            }
150    
151            /**
152            * Returns <code>true</code> if the plugin has a role with the specified
153            * name.
154            *
155            * @param roleName the role name
156            * @return <code>true</code> if the plugin has a role with the specified
157            name
158            */
159            @Override
160            public boolean hasRoleWithName(java.lang.String roleName) {
161                    return _pluginSetting.hasRoleWithName(roleName);
162            }
163    
164            /**
165            * Returns <code>true</code> if this plugin setting is active.
166            *
167            * @return <code>true</code> if this plugin setting is active; <code>false</code> otherwise
168            */
169            @Override
170            public boolean isActive() {
171                    return _pluginSetting.isActive();
172            }
173    
174            @Override
175            public boolean isCachedModel() {
176                    return _pluginSetting.isCachedModel();
177            }
178    
179            @Override
180            public boolean isEscapedModel() {
181                    return _pluginSetting.isEscapedModel();
182            }
183    
184            @Override
185            public boolean isNew() {
186                    return _pluginSetting.isNew();
187            }
188    
189            @Override
190            public ExpandoBridge getExpandoBridge() {
191                    return _pluginSetting.getExpandoBridge();
192            }
193    
194            @Override
195            public int compareTo(PluginSetting pluginSetting) {
196                    return _pluginSetting.compareTo(pluginSetting);
197            }
198    
199            @Override
200            public int hashCode() {
201                    return _pluginSetting.hashCode();
202            }
203    
204            @Override
205            public Serializable getPrimaryKeyObj() {
206                    return _pluginSetting.getPrimaryKeyObj();
207            }
208    
209            @Override
210            public java.lang.Object clone() {
211                    return new PluginSettingWrapper((PluginSetting)_pluginSetting.clone());
212            }
213    
214            /**
215            * Returns the plugin ID of this plugin setting.
216            *
217            * @return the plugin ID of this plugin setting
218            */
219            @Override
220            public java.lang.String getPluginId() {
221                    return _pluginSetting.getPluginId();
222            }
223    
224            /**
225            * Returns the plugin type of this plugin setting.
226            *
227            * @return the plugin type of this plugin setting
228            */
229            @Override
230            public java.lang.String getPluginType() {
231                    return _pluginSetting.getPluginType();
232            }
233    
234            /**
235            * Returns the roles of this plugin setting.
236            *
237            * @return the roles of this plugin setting
238            */
239            @Override
240            public java.lang.String getRoles() {
241                    return _pluginSetting.getRoles();
242            }
243    
244            @Override
245            public java.lang.String toString() {
246                    return _pluginSetting.toString();
247            }
248    
249            @Override
250            public java.lang.String toXmlString() {
251                    return _pluginSetting.toXmlString();
252            }
253    
254            /**
255            * Returns an array of required roles of the plugin.
256            *
257            * @return an array of required roles of the plugin
258            */
259            @Override
260            public java.lang.String[] getRolesArray() {
261                    return _pluginSetting.getRolesArray();
262            }
263    
264            /**
265            * Returns the company ID of this plugin setting.
266            *
267            * @return the company ID of this plugin setting
268            */
269            @Override
270            public long getCompanyId() {
271                    return _pluginSetting.getCompanyId();
272            }
273    
274            /**
275            * Returns the mvcc version of this plugin setting.
276            *
277            * @return the mvcc version of this plugin setting
278            */
279            @Override
280            public long getMvccVersion() {
281                    return _pluginSetting.getMvccVersion();
282            }
283    
284            /**
285            * Returns the plugin setting ID of this plugin setting.
286            *
287            * @return the plugin setting ID of this plugin setting
288            */
289            @Override
290            public long getPluginSettingId() {
291                    return _pluginSetting.getPluginSettingId();
292            }
293    
294            /**
295            * Returns the primary key of this plugin setting.
296            *
297            * @return the primary key of this plugin setting
298            */
299            @Override
300            public long getPrimaryKey() {
301                    return _pluginSetting.getPrimaryKey();
302            }
303    
304            /**
305            * Adds a role to the list of roles.
306            */
307            @Override
308            public void addRole(java.lang.String role) {
309                    _pluginSetting.addRole(role);
310            }
311    
312            @Override
313            public void persist() {
314                    _pluginSetting.persist();
315            }
316    
317            /**
318            * Sets whether this plugin setting is active.
319            *
320            * @param active the active of this plugin setting
321            */
322            @Override
323            public void setActive(boolean active) {
324                    _pluginSetting.setActive(active);
325            }
326    
327            @Override
328            public void setCachedModel(boolean cachedModel) {
329                    _pluginSetting.setCachedModel(cachedModel);
330            }
331    
332            /**
333            * Sets the company ID of this plugin setting.
334            *
335            * @param companyId the company ID of this plugin setting
336            */
337            @Override
338            public void setCompanyId(long companyId) {
339                    _pluginSetting.setCompanyId(companyId);
340            }
341    
342            @Override
343            public void setExpandoBridgeAttributes(BaseModel<?> baseModel) {
344                    _pluginSetting.setExpandoBridgeAttributes(baseModel);
345            }
346    
347            @Override
348            public void setExpandoBridgeAttributes(ExpandoBridge expandoBridge) {
349                    _pluginSetting.setExpandoBridgeAttributes(expandoBridge);
350            }
351    
352            @Override
353            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
354                    _pluginSetting.setExpandoBridgeAttributes(serviceContext);
355            }
356    
357            /**
358            * Sets the mvcc version of this plugin setting.
359            *
360            * @param mvccVersion the mvcc version of this plugin setting
361            */
362            @Override
363            public void setMvccVersion(long mvccVersion) {
364                    _pluginSetting.setMvccVersion(mvccVersion);
365            }
366    
367            @Override
368            public void setNew(boolean n) {
369                    _pluginSetting.setNew(n);
370            }
371    
372            /**
373            * Sets the plugin ID of this plugin setting.
374            *
375            * @param pluginId the plugin ID of this plugin setting
376            */
377            @Override
378            public void setPluginId(java.lang.String pluginId) {
379                    _pluginSetting.setPluginId(pluginId);
380            }
381    
382            /**
383            * Sets the plugin setting ID of this plugin setting.
384            *
385            * @param pluginSettingId the plugin setting ID of this plugin setting
386            */
387            @Override
388            public void setPluginSettingId(long pluginSettingId) {
389                    _pluginSetting.setPluginSettingId(pluginSettingId);
390            }
391    
392            /**
393            * Sets the plugin type of this plugin setting.
394            *
395            * @param pluginType the plugin type of this plugin setting
396            */
397            @Override
398            public void setPluginType(java.lang.String pluginType) {
399                    _pluginSetting.setPluginType(pluginType);
400            }
401    
402            /**
403            * Sets the primary key of this plugin setting.
404            *
405            * @param primaryKey the primary key of this plugin setting
406            */
407            @Override
408            public void setPrimaryKey(long primaryKey) {
409                    _pluginSetting.setPrimaryKey(primaryKey);
410            }
411    
412            @Override
413            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
414                    _pluginSetting.setPrimaryKeyObj(primaryKeyObj);
415            }
416    
417            /**
418            * Sets the roles of this plugin setting.
419            *
420            * @param roles the roles of this plugin setting
421            */
422            @Override
423            public void setRoles(java.lang.String roles) {
424                    _pluginSetting.setRoles(roles);
425            }
426    
427            /**
428            * Sets an array of required roles of the plugin.
429            */
430            @Override
431            public void setRolesArray(java.lang.String[] rolesArray) {
432                    _pluginSetting.setRolesArray(rolesArray);
433            }
434    
435            @Override
436            public boolean equals(Object obj) {
437                    if (this == obj) {
438                            return true;
439                    }
440    
441                    if (!(obj instanceof PluginSettingWrapper)) {
442                            return false;
443                    }
444    
445                    PluginSettingWrapper pluginSettingWrapper = (PluginSettingWrapper)obj;
446    
447                    if (Objects.equals(_pluginSetting, pluginSettingWrapper._pluginSetting)) {
448                            return true;
449                    }
450    
451                    return false;
452            }
453    
454            @Override
455            public PluginSetting getWrappedModel() {
456                    return _pluginSetting;
457            }
458    
459            @Override
460            public boolean isEntityCacheEnabled() {
461                    return _pluginSetting.isEntityCacheEnabled();
462            }
463    
464            @Override
465            public boolean isFinderCacheEnabled() {
466                    return _pluginSetting.isFinderCacheEnabled();
467            }
468    
469            @Override
470            public void resetOriginalValues() {
471                    _pluginSetting.resetOriginalValues();
472            }
473    
474            private final PluginSetting _pluginSetting;
475    }