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