001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.ServiceComponent;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing ServiceComponent in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ServiceComponent
035     * @generated
036     */
037    @ProviderType
038    public class ServiceComponentCacheModel implements CacheModel<ServiceComponent>,
039            Externalizable, MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(13);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", serviceComponentId=");
057                    sb.append(serviceComponentId);
058                    sb.append(", buildNamespace=");
059                    sb.append(buildNamespace);
060                    sb.append(", buildNumber=");
061                    sb.append(buildNumber);
062                    sb.append(", buildDate=");
063                    sb.append(buildDate);
064                    sb.append(", data=");
065                    sb.append(data);
066                    sb.append("}");
067    
068                    return sb.toString();
069            }
070    
071            @Override
072            public ServiceComponent toEntityModel() {
073                    ServiceComponentImpl serviceComponentImpl = new ServiceComponentImpl();
074    
075                    serviceComponentImpl.setMvccVersion(mvccVersion);
076                    serviceComponentImpl.setServiceComponentId(serviceComponentId);
077    
078                    if (buildNamespace == null) {
079                            serviceComponentImpl.setBuildNamespace(StringPool.BLANK);
080                    }
081                    else {
082                            serviceComponentImpl.setBuildNamespace(buildNamespace);
083                    }
084    
085                    serviceComponentImpl.setBuildNumber(buildNumber);
086                    serviceComponentImpl.setBuildDate(buildDate);
087    
088                    if (data == null) {
089                            serviceComponentImpl.setData(StringPool.BLANK);
090                    }
091                    else {
092                            serviceComponentImpl.setData(data);
093                    }
094    
095                    serviceComponentImpl.resetOriginalValues();
096    
097                    return serviceComponentImpl;
098            }
099    
100            @Override
101            public void readExternal(ObjectInput objectInput) throws IOException {
102                    mvccVersion = objectInput.readLong();
103                    serviceComponentId = objectInput.readLong();
104                    buildNamespace = objectInput.readUTF();
105                    buildNumber = objectInput.readLong();
106                    buildDate = objectInput.readLong();
107                    data = objectInput.readUTF();
108            }
109    
110            @Override
111            public void writeExternal(ObjectOutput objectOutput)
112                    throws IOException {
113                    objectOutput.writeLong(mvccVersion);
114                    objectOutput.writeLong(serviceComponentId);
115    
116                    if (buildNamespace == null) {
117                            objectOutput.writeUTF(StringPool.BLANK);
118                    }
119                    else {
120                            objectOutput.writeUTF(buildNamespace);
121                    }
122    
123                    objectOutput.writeLong(buildNumber);
124                    objectOutput.writeLong(buildDate);
125    
126                    if (data == null) {
127                            objectOutput.writeUTF(StringPool.BLANK);
128                    }
129                    else {
130                            objectOutput.writeUTF(data);
131                    }
132            }
133    
134            public long mvccVersion;
135            public long serviceComponentId;
136            public String buildNamespace;
137            public long buildNumber;
138            public long buildDate;
139            public String data;
140    }