001    /**
002     * Copyright (c) 2000-2012 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.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.Country;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing Country in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see Country
032     * @generated
033     */
034    public class CountryCacheModel implements CacheModel<Country>, Externalizable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(17);
038    
039                    sb.append("{countryId=");
040                    sb.append(countryId);
041                    sb.append(", name=");
042                    sb.append(name);
043                    sb.append(", a2=");
044                    sb.append(a2);
045                    sb.append(", a3=");
046                    sb.append(a3);
047                    sb.append(", number=");
048                    sb.append(number);
049                    sb.append(", idd=");
050                    sb.append(idd);
051                    sb.append(", zipRequired=");
052                    sb.append(zipRequired);
053                    sb.append(", active=");
054                    sb.append(active);
055                    sb.append("}");
056    
057                    return sb.toString();
058            }
059    
060            public Country toEntityModel() {
061                    CountryImpl countryImpl = new CountryImpl();
062    
063                    countryImpl.setCountryId(countryId);
064    
065                    if (name == null) {
066                            countryImpl.setName(StringPool.BLANK);
067                    }
068                    else {
069                            countryImpl.setName(name);
070                    }
071    
072                    if (a2 == null) {
073                            countryImpl.setA2(StringPool.BLANK);
074                    }
075                    else {
076                            countryImpl.setA2(a2);
077                    }
078    
079                    if (a3 == null) {
080                            countryImpl.setA3(StringPool.BLANK);
081                    }
082                    else {
083                            countryImpl.setA3(a3);
084                    }
085    
086                    if (number == null) {
087                            countryImpl.setNumber(StringPool.BLANK);
088                    }
089                    else {
090                            countryImpl.setNumber(number);
091                    }
092    
093                    if (idd == null) {
094                            countryImpl.setIdd(StringPool.BLANK);
095                    }
096                    else {
097                            countryImpl.setIdd(idd);
098                    }
099    
100                    countryImpl.setZipRequired(zipRequired);
101                    countryImpl.setActive(active);
102    
103                    countryImpl.resetOriginalValues();
104    
105                    return countryImpl;
106            }
107    
108            public void readExternal(ObjectInput objectInput) throws IOException {
109                    countryId = objectInput.readLong();
110                    name = objectInput.readUTF();
111                    a2 = objectInput.readUTF();
112                    a3 = objectInput.readUTF();
113                    number = objectInput.readUTF();
114                    idd = objectInput.readUTF();
115                    zipRequired = objectInput.readBoolean();
116                    active = objectInput.readBoolean();
117            }
118    
119            public void writeExternal(ObjectOutput objectOutput)
120                    throws IOException {
121                    objectOutput.writeLong(countryId);
122    
123                    if (name == null) {
124                            objectOutput.writeUTF(StringPool.BLANK);
125                    }
126                    else {
127                            objectOutput.writeUTF(name);
128                    }
129    
130                    if (a2 == null) {
131                            objectOutput.writeUTF(StringPool.BLANK);
132                    }
133                    else {
134                            objectOutput.writeUTF(a2);
135                    }
136    
137                    if (a3 == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(a3);
142                    }
143    
144                    if (number == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(number);
149                    }
150    
151                    if (idd == null) {
152                            objectOutput.writeUTF(StringPool.BLANK);
153                    }
154                    else {
155                            objectOutput.writeUTF(idd);
156                    }
157    
158                    objectOutput.writeBoolean(zipRequired);
159                    objectOutput.writeBoolean(active);
160            }
161    
162            public long countryId;
163            public String name;
164            public String a2;
165            public String a3;
166            public String number;
167            public String idd;
168            public boolean zipRequired;
169            public boolean active;
170    }