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 Region}.
027     * </p>
028     *
029     * @author Brian Wing Shun Chan
030     * @see Region
031     * @generated
032     */
033    @ProviderType
034    public class RegionWrapper implements Region, ModelWrapper<Region> {
035            public RegionWrapper(Region region) {
036                    _region = region;
037            }
038    
039            @Override
040            public Class<?> getModelClass() {
041                    return Region.class;
042            }
043    
044            @Override
045            public String getModelClassName() {
046                    return Region.class.getName();
047            }
048    
049            @Override
050            public Map<String, Object> getModelAttributes() {
051                    Map<String, Object> attributes = new HashMap<String, Object>();
052    
053                    attributes.put("regionId", getRegionId());
054                    attributes.put("countryId", getCountryId());
055                    attributes.put("regionCode", getRegionCode());
056                    attributes.put("name", getName());
057                    attributes.put("active", getActive());
058    
059                    return attributes;
060            }
061    
062            @Override
063            public void setModelAttributes(Map<String, Object> attributes) {
064                    Long regionId = (Long)attributes.get("regionId");
065    
066                    if (regionId != null) {
067                            setRegionId(regionId);
068                    }
069    
070                    Long countryId = (Long)attributes.get("countryId");
071    
072                    if (countryId != null) {
073                            setCountryId(countryId);
074                    }
075    
076                    String regionCode = (String)attributes.get("regionCode");
077    
078                    if (regionCode != null) {
079                            setRegionCode(regionCode);
080                    }
081    
082                    String name = (String)attributes.get("name");
083    
084                    if (name != null) {
085                            setName(name);
086                    }
087    
088                    Boolean active = (Boolean)attributes.get("active");
089    
090                    if (active != null) {
091                            setActive(active);
092                    }
093            }
094    
095            /**
096            * Returns the primary key of this region.
097            *
098            * @return the primary key of this region
099            */
100            @Override
101            public long getPrimaryKey() {
102                    return _region.getPrimaryKey();
103            }
104    
105            /**
106            * Sets the primary key of this region.
107            *
108            * @param primaryKey the primary key of this region
109            */
110            @Override
111            public void setPrimaryKey(long primaryKey) {
112                    _region.setPrimaryKey(primaryKey);
113            }
114    
115            /**
116            * Returns the region ID of this region.
117            *
118            * @return the region ID of this region
119            */
120            @Override
121            public long getRegionId() {
122                    return _region.getRegionId();
123            }
124    
125            /**
126            * Sets the region ID of this region.
127            *
128            * @param regionId the region ID of this region
129            */
130            @Override
131            public void setRegionId(long regionId) {
132                    _region.setRegionId(regionId);
133            }
134    
135            /**
136            * Returns the country ID of this region.
137            *
138            * @return the country ID of this region
139            */
140            @Override
141            public long getCountryId() {
142                    return _region.getCountryId();
143            }
144    
145            /**
146            * Sets the country ID of this region.
147            *
148            * @param countryId the country ID of this region
149            */
150            @Override
151            public void setCountryId(long countryId) {
152                    _region.setCountryId(countryId);
153            }
154    
155            /**
156            * Returns the region code of this region.
157            *
158            * @return the region code of this region
159            */
160            @Override
161            public java.lang.String getRegionCode() {
162                    return _region.getRegionCode();
163            }
164    
165            /**
166            * Sets the region code of this region.
167            *
168            * @param regionCode the region code of this region
169            */
170            @Override
171            public void setRegionCode(java.lang.String regionCode) {
172                    _region.setRegionCode(regionCode);
173            }
174    
175            /**
176            * Returns the name of this region.
177            *
178            * @return the name of this region
179            */
180            @Override
181            public java.lang.String getName() {
182                    return _region.getName();
183            }
184    
185            /**
186            * Sets the name of this region.
187            *
188            * @param name the name of this region
189            */
190            @Override
191            public void setName(java.lang.String name) {
192                    _region.setName(name);
193            }
194    
195            /**
196            * Returns the active of this region.
197            *
198            * @return the active of this region
199            */
200            @Override
201            public boolean getActive() {
202                    return _region.getActive();
203            }
204    
205            /**
206            * Returns <code>true</code> if this region is active.
207            *
208            * @return <code>true</code> if this region is active; <code>false</code> otherwise
209            */
210            @Override
211            public boolean isActive() {
212                    return _region.isActive();
213            }
214    
215            /**
216            * Sets whether this region is active.
217            *
218            * @param active the active of this region
219            */
220            @Override
221            public void setActive(boolean active) {
222                    _region.setActive(active);
223            }
224    
225            @Override
226            public boolean isNew() {
227                    return _region.isNew();
228            }
229    
230            @Override
231            public void setNew(boolean n) {
232                    _region.setNew(n);
233            }
234    
235            @Override
236            public boolean isCachedModel() {
237                    return _region.isCachedModel();
238            }
239    
240            @Override
241            public void setCachedModel(boolean cachedModel) {
242                    _region.setCachedModel(cachedModel);
243            }
244    
245            @Override
246            public boolean isEscapedModel() {
247                    return _region.isEscapedModel();
248            }
249    
250            @Override
251            public java.io.Serializable getPrimaryKeyObj() {
252                    return _region.getPrimaryKeyObj();
253            }
254    
255            @Override
256            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
257                    _region.setPrimaryKeyObj(primaryKeyObj);
258            }
259    
260            @Override
261            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
262                    return _region.getExpandoBridge();
263            }
264    
265            @Override
266            public void setExpandoBridgeAttributes(
267                    com.liferay.portal.model.BaseModel<?> baseModel) {
268                    _region.setExpandoBridgeAttributes(baseModel);
269            }
270    
271            @Override
272            public void setExpandoBridgeAttributes(
273                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
274                    _region.setExpandoBridgeAttributes(expandoBridge);
275            }
276    
277            @Override
278            public void setExpandoBridgeAttributes(
279                    com.liferay.portal.service.ServiceContext serviceContext) {
280                    _region.setExpandoBridgeAttributes(serviceContext);
281            }
282    
283            @Override
284            public java.lang.Object clone() {
285                    return new RegionWrapper((Region)_region.clone());
286            }
287    
288            @Override
289            public int compareTo(com.liferay.portal.model.Region region) {
290                    return _region.compareTo(region);
291            }
292    
293            @Override
294            public int hashCode() {
295                    return _region.hashCode();
296            }
297    
298            @Override
299            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.Region> toCacheModel() {
300                    return _region.toCacheModel();
301            }
302    
303            @Override
304            public com.liferay.portal.model.Region toEscapedModel() {
305                    return new RegionWrapper(_region.toEscapedModel());
306            }
307    
308            @Override
309            public com.liferay.portal.model.Region toUnescapedModel() {
310                    return new RegionWrapper(_region.toUnescapedModel());
311            }
312    
313            @Override
314            public java.lang.String toString() {
315                    return _region.toString();
316            }
317    
318            @Override
319            public java.lang.String toXmlString() {
320                    return _region.toXmlString();
321            }
322    
323            @Override
324            public boolean equals(Object obj) {
325                    if (this == obj) {
326                            return true;
327                    }
328    
329                    if (!(obj instanceof RegionWrapper)) {
330                            return false;
331                    }
332    
333                    RegionWrapper regionWrapper = (RegionWrapper)obj;
334    
335                    if (Validator.equals(_region, regionWrapper._region)) {
336                            return true;
337                    }
338    
339                    return false;
340            }
341    
342            /**
343             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
344             */
345            public Region getWrappedRegion() {
346                    return _region;
347            }
348    
349            @Override
350            public Region getWrappedModel() {
351                    return _region;
352            }
353    
354            @Override
355            public void resetOriginalValues() {
356                    _region.resetOriginalValues();
357            }
358    
359            private Region _region;
360    }