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.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            @Override
056            public ServiceComponent toEntityModel() {
057                    ServiceComponentImpl serviceComponentImpl = new ServiceComponentImpl();
058    
059                    serviceComponentImpl.setServiceComponentId(serviceComponentId);
060    
061                    if (buildNamespace == null) {
062                            serviceComponentImpl.setBuildNamespace(StringPool.BLANK);
063                    }
064                    else {
065                            serviceComponentImpl.setBuildNamespace(buildNamespace);
066                    }
067    
068                    serviceComponentImpl.setBuildNumber(buildNumber);
069                    serviceComponentImpl.setBuildDate(buildDate);
070    
071                    if (data == null) {
072                            serviceComponentImpl.setData(StringPool.BLANK);
073                    }
074                    else {
075                            serviceComponentImpl.setData(data);
076                    }
077    
078                    serviceComponentImpl.resetOriginalValues();
079    
080                    return serviceComponentImpl;
081            }
082    
083            @Override
084            public void readExternal(ObjectInput objectInput) throws IOException {
085                    serviceComponentId = objectInput.readLong();
086                    buildNamespace = objectInput.readUTF();
087                    buildNumber = objectInput.readLong();
088                    buildDate = objectInput.readLong();
089                    data = objectInput.readUTF();
090            }
091    
092            @Override
093            public void writeExternal(ObjectOutput objectOutput)
094                    throws IOException {
095                    objectOutput.writeLong(serviceComponentId);
096    
097                    if (buildNamespace == null) {
098                            objectOutput.writeUTF(StringPool.BLANK);
099                    }
100                    else {
101                            objectOutput.writeUTF(buildNamespace);
102                    }
103    
104                    objectOutput.writeLong(buildNumber);
105                    objectOutput.writeLong(buildDate);
106    
107                    if (data == null) {
108                            objectOutput.writeUTF(StringPool.BLANK);
109                    }
110                    else {
111                            objectOutput.writeUTF(data);
112                    }
113            }
114    
115            public long serviceComponentId;
116            public String buildNamespace;
117            public long buildNumber;
118            public long buildDate;
119            public String data;
120    }