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