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.ServiceComponent;
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 ServiceComponent in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ServiceComponent
032     * @generated
033     */
034    public class ServiceComponentCacheModel implements CacheModel<ServiceComponent>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(11);
039    
040                    sb.append("{serviceComponentId=");
041                    sb.append(serviceComponentId);
042                    sb.append(", buildNamespace=");
043                    sb.append(buildNamespace);
044                    sb.append(", buildNumber=");
045                    sb.append(buildNumber);
046                    sb.append(", buildDate=");
047                    sb.append(buildDate);
048                    sb.append(", data=");
049                    sb.append(data);
050                    sb.append("}");
051    
052                    return sb.toString();
053            }
054    
055            public ServiceComponent toEntityModel() {
056                    ServiceComponentImpl serviceComponentImpl = new ServiceComponentImpl();
057    
058                    serviceComponentImpl.setServiceComponentId(serviceComponentId);
059    
060                    if (buildNamespace == null) {
061                            serviceComponentImpl.setBuildNamespace(StringPool.BLANK);
062                    }
063                    else {
064                            serviceComponentImpl.setBuildNamespace(buildNamespace);
065                    }
066    
067                    serviceComponentImpl.setBuildNumber(buildNumber);
068                    serviceComponentImpl.setBuildDate(buildDate);
069    
070                    if (data == null) {
071                            serviceComponentImpl.setData(StringPool.BLANK);
072                    }
073                    else {
074                            serviceComponentImpl.setData(data);
075                    }
076    
077                    serviceComponentImpl.resetOriginalValues();
078    
079                    return serviceComponentImpl;
080            }
081    
082            public void readExternal(ObjectInput objectInput) throws IOException {
083                    serviceComponentId = objectInput.readLong();
084                    buildNamespace = objectInput.readUTF();
085                    buildNumber = objectInput.readLong();
086                    buildDate = objectInput.readLong();
087                    data = objectInput.readUTF();
088            }
089    
090            public void writeExternal(ObjectOutput objectOutput)
091                    throws IOException {
092                    objectOutput.writeLong(serviceComponentId);
093    
094                    if (buildNamespace == null) {
095                            objectOutput.writeUTF(StringPool.BLANK);
096                    }
097                    else {
098                            objectOutput.writeUTF(buildNamespace);
099                    }
100    
101                    objectOutput.writeLong(buildNumber);
102                    objectOutput.writeLong(buildDate);
103    
104                    if (data == null) {
105                            objectOutput.writeUTF(StringPool.BLANK);
106                    }
107                    else {
108                            objectOutput.writeUTF(data);
109                    }
110            }
111    
112            public long serviceComponentId;
113            public String buildNamespace;
114            public long buildNumber;
115            public long buildDate;
116            public String data;
117    }