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.portlet.softwarecatalog.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    
021    import com.liferay.portlet.softwarecatalog.model.SCLicense;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    /**
029     * The cache model class for representing SCLicense in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see SCLicense
033     * @generated
034     */
035    public class SCLicenseCacheModel implements CacheModel<SCLicense>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(13);
040    
041                    sb.append("{licenseId=");
042                    sb.append(licenseId);
043                    sb.append(", name=");
044                    sb.append(name);
045                    sb.append(", url=");
046                    sb.append(url);
047                    sb.append(", openSource=");
048                    sb.append(openSource);
049                    sb.append(", active=");
050                    sb.append(active);
051                    sb.append(", recommended=");
052                    sb.append(recommended);
053                    sb.append("}");
054    
055                    return sb.toString();
056            }
057    
058            public SCLicense toEntityModel() {
059                    SCLicenseImpl scLicenseImpl = new SCLicenseImpl();
060    
061                    scLicenseImpl.setLicenseId(licenseId);
062    
063                    if (name == null) {
064                            scLicenseImpl.setName(StringPool.BLANK);
065                    }
066                    else {
067                            scLicenseImpl.setName(name);
068                    }
069    
070                    if (url == null) {
071                            scLicenseImpl.setUrl(StringPool.BLANK);
072                    }
073                    else {
074                            scLicenseImpl.setUrl(url);
075                    }
076    
077                    scLicenseImpl.setOpenSource(openSource);
078                    scLicenseImpl.setActive(active);
079                    scLicenseImpl.setRecommended(recommended);
080    
081                    scLicenseImpl.resetOriginalValues();
082    
083                    return scLicenseImpl;
084            }
085    
086            public void readExternal(ObjectInput objectInput) throws IOException {
087                    licenseId = objectInput.readLong();
088                    name = objectInput.readUTF();
089                    url = objectInput.readUTF();
090                    openSource = objectInput.readBoolean();
091                    active = objectInput.readBoolean();
092                    recommended = objectInput.readBoolean();
093            }
094    
095            public void writeExternal(ObjectOutput objectOutput)
096                    throws IOException {
097                    objectOutput.writeLong(licenseId);
098    
099                    if (name == null) {
100                            objectOutput.writeUTF(StringPool.BLANK);
101                    }
102                    else {
103                            objectOutput.writeUTF(name);
104                    }
105    
106                    if (url == null) {
107                            objectOutput.writeUTF(StringPool.BLANK);
108                    }
109                    else {
110                            objectOutput.writeUTF(url);
111                    }
112    
113                    objectOutput.writeBoolean(openSource);
114                    objectOutput.writeBoolean(active);
115                    objectOutput.writeBoolean(recommended);
116            }
117    
118            public long licenseId;
119            public String name;
120            public String url;
121            public boolean openSource;
122            public boolean active;
123            public boolean recommended;
124    }