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.portlet.polls.model;
016    
017    import com.liferay.portal.kernel.util.Validator;
018    import com.liferay.portal.model.ModelWrapper;
019    
020    import java.util.HashMap;
021    import java.util.Map;
022    
023    /**
024     * <p>
025     * This class is a wrapper for {@link PollsChoice}.
026     * </p>
027     *
028     * @author    Brian Wing Shun Chan
029     * @see       PollsChoice
030     * @generated
031     */
032    public class PollsChoiceWrapper implements PollsChoice,
033            ModelWrapper<PollsChoice> {
034            public PollsChoiceWrapper(PollsChoice pollsChoice) {
035                    _pollsChoice = pollsChoice;
036            }
037    
038            public Class<?> getModelClass() {
039                    return PollsChoice.class;
040            }
041    
042            public String getModelClassName() {
043                    return PollsChoice.class.getName();
044            }
045    
046            public Map<String, Object> getModelAttributes() {
047                    Map<String, Object> attributes = new HashMap<String, Object>();
048    
049                    attributes.put("uuid", getUuid());
050                    attributes.put("choiceId", getChoiceId());
051                    attributes.put("questionId", getQuestionId());
052                    attributes.put("name", getName());
053                    attributes.put("description", getDescription());
054    
055                    return attributes;
056            }
057    
058            public void setModelAttributes(Map<String, Object> attributes) {
059                    String uuid = (String)attributes.get("uuid");
060    
061                    if (uuid != null) {
062                            setUuid(uuid);
063                    }
064    
065                    Long choiceId = (Long)attributes.get("choiceId");
066    
067                    if (choiceId != null) {
068                            setChoiceId(choiceId);
069                    }
070    
071                    Long questionId = (Long)attributes.get("questionId");
072    
073                    if (questionId != null) {
074                            setQuestionId(questionId);
075                    }
076    
077                    String name = (String)attributes.get("name");
078    
079                    if (name != null) {
080                            setName(name);
081                    }
082    
083                    String description = (String)attributes.get("description");
084    
085                    if (description != null) {
086                            setDescription(description);
087                    }
088            }
089    
090            /**
091            * Returns the primary key of this polls choice.
092            *
093            * @return the primary key of this polls choice
094            */
095            public long getPrimaryKey() {
096                    return _pollsChoice.getPrimaryKey();
097            }
098    
099            /**
100            * Sets the primary key of this polls choice.
101            *
102            * @param primaryKey the primary key of this polls choice
103            */
104            public void setPrimaryKey(long primaryKey) {
105                    _pollsChoice.setPrimaryKey(primaryKey);
106            }
107    
108            /**
109            * Returns the uuid of this polls choice.
110            *
111            * @return the uuid of this polls choice
112            */
113            public java.lang.String getUuid() {
114                    return _pollsChoice.getUuid();
115            }
116    
117            /**
118            * Sets the uuid of this polls choice.
119            *
120            * @param uuid the uuid of this polls choice
121            */
122            public void setUuid(java.lang.String uuid) {
123                    _pollsChoice.setUuid(uuid);
124            }
125    
126            /**
127            * Returns the choice ID of this polls choice.
128            *
129            * @return the choice ID of this polls choice
130            */
131            public long getChoiceId() {
132                    return _pollsChoice.getChoiceId();
133            }
134    
135            /**
136            * Sets the choice ID of this polls choice.
137            *
138            * @param choiceId the choice ID of this polls choice
139            */
140            public void setChoiceId(long choiceId) {
141                    _pollsChoice.setChoiceId(choiceId);
142            }
143    
144            /**
145            * Returns the question ID of this polls choice.
146            *
147            * @return the question ID of this polls choice
148            */
149            public long getQuestionId() {
150                    return _pollsChoice.getQuestionId();
151            }
152    
153            /**
154            * Sets the question ID of this polls choice.
155            *
156            * @param questionId the question ID of this polls choice
157            */
158            public void setQuestionId(long questionId) {
159                    _pollsChoice.setQuestionId(questionId);
160            }
161    
162            /**
163            * Returns the name of this polls choice.
164            *
165            * @return the name of this polls choice
166            */
167            public java.lang.String getName() {
168                    return _pollsChoice.getName();
169            }
170    
171            /**
172            * Sets the name of this polls choice.
173            *
174            * @param name the name of this polls choice
175            */
176            public void setName(java.lang.String name) {
177                    _pollsChoice.setName(name);
178            }
179    
180            /**
181            * Returns the description of this polls choice.
182            *
183            * @return the description of this polls choice
184            */
185            public java.lang.String getDescription() {
186                    return _pollsChoice.getDescription();
187            }
188    
189            /**
190            * Returns the localized description of this polls choice in the language. Uses the default language if no localization exists for the requested language.
191            *
192            * @param locale the locale of the language
193            * @return the localized description of this polls choice
194            */
195            public java.lang.String getDescription(java.util.Locale locale) {
196                    return _pollsChoice.getDescription(locale);
197            }
198    
199            /**
200            * Returns the localized description of this polls choice in the language, optionally using the default language if no localization exists for the requested language.
201            *
202            * @param locale the local of the language
203            * @param useDefault whether to use the default language if no localization exists for the requested language
204            * @return the localized description of this polls choice. If <code>useDefault</code> is <code>false</code> and no localization exists for the requested language, an empty string will be returned.
205            */
206            public java.lang.String getDescription(java.util.Locale locale,
207                    boolean useDefault) {
208                    return _pollsChoice.getDescription(locale, useDefault);
209            }
210    
211            /**
212            * Returns the localized description of this polls choice in the language. Uses the default language if no localization exists for the requested language.
213            *
214            * @param languageId the ID of the language
215            * @return the localized description of this polls choice
216            */
217            public java.lang.String getDescription(java.lang.String languageId) {
218                    return _pollsChoice.getDescription(languageId);
219            }
220    
221            /**
222            * Returns the localized description of this polls choice in the language, optionally using the default language if no localization exists for the requested language.
223            *
224            * @param languageId the ID of the language
225            * @param useDefault whether to use the default language if no localization exists for the requested language
226            * @return the localized description of this polls choice
227            */
228            public java.lang.String getDescription(java.lang.String languageId,
229                    boolean useDefault) {
230                    return _pollsChoice.getDescription(languageId, useDefault);
231            }
232    
233            public java.lang.String getDescriptionCurrentLanguageId() {
234                    return _pollsChoice.getDescriptionCurrentLanguageId();
235            }
236    
237            public java.lang.String getDescriptionCurrentValue() {
238                    return _pollsChoice.getDescriptionCurrentValue();
239            }
240    
241            /**
242            * Returns a map of the locales and localized descriptions of this polls choice.
243            *
244            * @return the locales and localized descriptions of this polls choice
245            */
246            public java.util.Map<java.util.Locale, java.lang.String> getDescriptionMap() {
247                    return _pollsChoice.getDescriptionMap();
248            }
249    
250            /**
251            * Sets the description of this polls choice.
252            *
253            * @param description the description of this polls choice
254            */
255            public void setDescription(java.lang.String description) {
256                    _pollsChoice.setDescription(description);
257            }
258    
259            /**
260            * Sets the localized description of this polls choice in the language.
261            *
262            * @param description the localized description of this polls choice
263            * @param locale the locale of the language
264            */
265            public void setDescription(java.lang.String description,
266                    java.util.Locale locale) {
267                    _pollsChoice.setDescription(description, locale);
268            }
269    
270            /**
271            * Sets the localized description of this polls choice in the language, and sets the default locale.
272            *
273            * @param description the localized description of this polls choice
274            * @param locale the locale of the language
275            * @param defaultLocale the default locale
276            */
277            public void setDescription(java.lang.String description,
278                    java.util.Locale locale, java.util.Locale defaultLocale) {
279                    _pollsChoice.setDescription(description, locale, defaultLocale);
280            }
281    
282            public void setDescriptionCurrentLanguageId(java.lang.String languageId) {
283                    _pollsChoice.setDescriptionCurrentLanguageId(languageId);
284            }
285    
286            /**
287            * Sets the localized descriptions of this polls choice from the map of locales and localized descriptions.
288            *
289            * @param descriptionMap the locales and localized descriptions of this polls choice
290            */
291            public void setDescriptionMap(
292                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap) {
293                    _pollsChoice.setDescriptionMap(descriptionMap);
294            }
295    
296            /**
297            * Sets the localized descriptions of this polls choice from the map of locales and localized descriptions, and sets the default locale.
298            *
299            * @param descriptionMap the locales and localized descriptions of this polls choice
300            * @param defaultLocale the default locale
301            */
302            public void setDescriptionMap(
303                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
304                    java.util.Locale defaultLocale) {
305                    _pollsChoice.setDescriptionMap(descriptionMap, defaultLocale);
306            }
307    
308            public boolean isNew() {
309                    return _pollsChoice.isNew();
310            }
311    
312            public void setNew(boolean n) {
313                    _pollsChoice.setNew(n);
314            }
315    
316            public boolean isCachedModel() {
317                    return _pollsChoice.isCachedModel();
318            }
319    
320            public void setCachedModel(boolean cachedModel) {
321                    _pollsChoice.setCachedModel(cachedModel);
322            }
323    
324            public boolean isEscapedModel() {
325                    return _pollsChoice.isEscapedModel();
326            }
327    
328            public java.io.Serializable getPrimaryKeyObj() {
329                    return _pollsChoice.getPrimaryKeyObj();
330            }
331    
332            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
333                    _pollsChoice.setPrimaryKeyObj(primaryKeyObj);
334            }
335    
336            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
337                    return _pollsChoice.getExpandoBridge();
338            }
339    
340            public void setExpandoBridgeAttributes(
341                    com.liferay.portal.service.ServiceContext serviceContext) {
342                    _pollsChoice.setExpandoBridgeAttributes(serviceContext);
343            }
344    
345            public void prepareLocalizedFieldsForImport(
346                    java.util.Locale defaultImportLocale)
347                    throws com.liferay.portal.LocaleException {
348                    _pollsChoice.prepareLocalizedFieldsForImport(defaultImportLocale);
349            }
350    
351            @Override
352            public java.lang.Object clone() {
353                    return new PollsChoiceWrapper((PollsChoice)_pollsChoice.clone());
354            }
355    
356            public int compareTo(
357                    com.liferay.portlet.polls.model.PollsChoice pollsChoice) {
358                    return _pollsChoice.compareTo(pollsChoice);
359            }
360    
361            @Override
362            public int hashCode() {
363                    return _pollsChoice.hashCode();
364            }
365    
366            public com.liferay.portal.model.CacheModel<com.liferay.portlet.polls.model.PollsChoice> toCacheModel() {
367                    return _pollsChoice.toCacheModel();
368            }
369    
370            public com.liferay.portlet.polls.model.PollsChoice toEscapedModel() {
371                    return new PollsChoiceWrapper(_pollsChoice.toEscapedModel());
372            }
373    
374            public com.liferay.portlet.polls.model.PollsChoice toUnescapedModel() {
375                    return new PollsChoiceWrapper(_pollsChoice.toUnescapedModel());
376            }
377    
378            @Override
379            public java.lang.String toString() {
380                    return _pollsChoice.toString();
381            }
382    
383            public java.lang.String toXmlString() {
384                    return _pollsChoice.toXmlString();
385            }
386    
387            public void persist()
388                    throws com.liferay.portal.kernel.exception.SystemException {
389                    _pollsChoice.persist();
390            }
391    
392            public int getVotesCount()
393                    throws com.liferay.portal.kernel.exception.SystemException {
394                    return _pollsChoice.getVotesCount();
395            }
396    
397            @Override
398            public boolean equals(Object obj) {
399                    if (this == obj) {
400                            return true;
401                    }
402    
403                    if (!(obj instanceof PollsChoiceWrapper)) {
404                            return false;
405                    }
406    
407                    PollsChoiceWrapper pollsChoiceWrapper = (PollsChoiceWrapper)obj;
408    
409                    if (Validator.equals(_pollsChoice, pollsChoiceWrapper._pollsChoice)) {
410                            return true;
411                    }
412    
413                    return false;
414            }
415    
416            /**
417             * @deprecated Renamed to {@link #getWrappedModel}
418             */
419            public PollsChoice getWrappedPollsChoice() {
420                    return _pollsChoice;
421            }
422    
423            public PollsChoice getWrappedModel() {
424                    return _pollsChoice;
425            }
426    
427            public void resetOriginalValues() {
428                    _pollsChoice.resetOriginalValues();
429            }
430    
431            private PollsChoice _pollsChoice;
432    }