001
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.ClassName;
023 import com.liferay.portal.model.MVCCModel;
024
025 import java.io.Externalizable;
026 import java.io.IOException;
027 import java.io.ObjectInput;
028 import java.io.ObjectOutput;
029
030
037 @ProviderType
038 public class ClassNameCacheModel implements CacheModel<ClassName>,
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(7);
053
054 sb.append("{mvccVersion=");
055 sb.append(mvccVersion);
056 sb.append(", classNameId=");
057 sb.append(classNameId);
058 sb.append(", value=");
059 sb.append(value);
060 sb.append("}");
061
062 return sb.toString();
063 }
064
065 @Override
066 public ClassName toEntityModel() {
067 ClassNameImpl classNameImpl = new ClassNameImpl();
068
069 classNameImpl.setMvccVersion(mvccVersion);
070 classNameImpl.setClassNameId(classNameId);
071
072 if (value == null) {
073 classNameImpl.setValue(StringPool.BLANK);
074 }
075 else {
076 classNameImpl.setValue(value);
077 }
078
079 classNameImpl.resetOriginalValues();
080
081 return classNameImpl;
082 }
083
084 @Override
085 public void readExternal(ObjectInput objectInput) throws IOException {
086 mvccVersion = objectInput.readLong();
087 classNameId = objectInput.readLong();
088 value = objectInput.readUTF();
089 }
090
091 @Override
092 public void writeExternal(ObjectOutput objectOutput)
093 throws IOException {
094 objectOutput.writeLong(mvccVersion);
095 objectOutput.writeLong(classNameId);
096
097 if (value == null) {
098 objectOutput.writeUTF(StringPool.BLANK);
099 }
100 else {
101 objectOutput.writeUTF(value);
102 }
103 }
104
105 public long mvccVersion;
106 public long classNameId;
107 public String value;
108 }