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.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            @Override
076            public java.lang.Object clone() {
077                    return new CounterWrapper((Counter)_counter.clone());
078            }
079    
080            @Override
081            public int compareTo(com.liferay.counter.model.Counter counter) {
082                    return _counter.compareTo(counter);
083            }
084    
085            /**
086            * Returns the current ID of this counter.
087            *
088            * @return the current ID of this counter
089            */
090            @Override
091            public long getCurrentId() {
092                    return _counter.getCurrentId();
093            }
094    
095            @Override
096            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
097                    return _counter.getExpandoBridge();
098            }
099    
100            /**
101            * Returns the name of this counter.
102            *
103            * @return the name of this counter
104            */
105            @Override
106            public java.lang.String getName() {
107                    return _counter.getName();
108            }
109    
110            /**
111            * Returns the primary key of this counter.
112            *
113            * @return the primary key of this counter
114            */
115            @Override
116            public java.lang.String getPrimaryKey() {
117                    return _counter.getPrimaryKey();
118            }
119    
120            @Override
121            public java.io.Serializable getPrimaryKeyObj() {
122                    return _counter.getPrimaryKeyObj();
123            }
124    
125            @Override
126            public int hashCode() {
127                    return _counter.hashCode();
128            }
129    
130            @Override
131            public boolean isCachedModel() {
132                    return _counter.isCachedModel();
133            }
134    
135            @Override
136            public boolean isEscapedModel() {
137                    return _counter.isEscapedModel();
138            }
139    
140            @Override
141            public boolean isNew() {
142                    return _counter.isNew();
143            }
144    
145            @Override
146            public void persist() {
147                    _counter.persist();
148            }
149    
150            @Override
151            public void setCachedModel(boolean cachedModel) {
152                    _counter.setCachedModel(cachedModel);
153            }
154    
155            /**
156            * Sets the current ID of this counter.
157            *
158            * @param currentId the current ID of this counter
159            */
160            @Override
161            public void setCurrentId(long currentId) {
162                    _counter.setCurrentId(currentId);
163            }
164    
165            @Override
166            public void setExpandoBridgeAttributes(
167                    com.liferay.portal.model.BaseModel<?> baseModel) {
168                    _counter.setExpandoBridgeAttributes(baseModel);
169            }
170    
171            @Override
172            public void setExpandoBridgeAttributes(
173                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
174                    _counter.setExpandoBridgeAttributes(expandoBridge);
175            }
176    
177            @Override
178            public void setExpandoBridgeAttributes(
179                    com.liferay.portal.service.ServiceContext serviceContext) {
180                    _counter.setExpandoBridgeAttributes(serviceContext);
181            }
182    
183            /**
184            * Sets the name of this counter.
185            *
186            * @param name the name of this counter
187            */
188            @Override
189            public void setName(java.lang.String name) {
190                    _counter.setName(name);
191            }
192    
193            @Override
194            public void setNew(boolean n) {
195                    _counter.setNew(n);
196            }
197    
198            /**
199            * Sets the primary key of this counter.
200            *
201            * @param primaryKey the primary key of this counter
202            */
203            @Override
204            public void setPrimaryKey(java.lang.String primaryKey) {
205                    _counter.setPrimaryKey(primaryKey);
206            }
207    
208            @Override
209            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
210                    _counter.setPrimaryKeyObj(primaryKeyObj);
211            }
212    
213            @Override
214            public com.liferay.portal.model.CacheModel<com.liferay.counter.model.Counter> toCacheModel() {
215                    return _counter.toCacheModel();
216            }
217    
218            @Override
219            public com.liferay.counter.model.Counter toEscapedModel() {
220                    return new CounterWrapper(_counter.toEscapedModel());
221            }
222    
223            @Override
224            public java.lang.String toString() {
225                    return _counter.toString();
226            }
227    
228            @Override
229            public com.liferay.counter.model.Counter toUnescapedModel() {
230                    return new CounterWrapper(_counter.toUnescapedModel());
231            }
232    
233            @Override
234            public java.lang.String toXmlString() {
235                    return _counter.toXmlString();
236            }
237    
238            @Override
239            public boolean equals(Object obj) {
240                    if (this == obj) {
241                            return true;
242                    }
243    
244                    if (!(obj instanceof CounterWrapper)) {
245                            return false;
246                    }
247    
248                    CounterWrapper counterWrapper = (CounterWrapper)obj;
249    
250                    if (Validator.equals(_counter, counterWrapper._counter)) {
251                            return true;
252                    }
253    
254                    return false;
255            }
256    
257            @Override
258            public Counter getWrappedModel() {
259                    return _counter;
260            }
261    
262            @Override
263            public boolean isEntityCacheEnabled() {
264                    return _counter.isEntityCacheEnabled();
265            }
266    
267            @Override
268            public boolean isFinderCacheEnabled() {
269                    return _counter.isFinderCacheEnabled();
270            }
271    
272            @Override
273            public void resetOriginalValues() {
274                    _counter.resetOriginalValues();
275            }
276    
277            private final Counter _counter;
278    }