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