001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.HashUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023 import com.liferay.portal.model.MVCCModel;
024 import com.liferay.portal.model.ResourceAction;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031
038 @ProviderType
039 public class ResourceActionCacheModel implements CacheModel<ResourceAction>,
040 Externalizable, MVCCModel {
041 @Override
042 public boolean equals(Object obj) {
043 if (this == obj) {
044 return true;
045 }
046
047 if (!(obj instanceof ResourceActionCacheModel)) {
048 return false;
049 }
050
051 ResourceActionCacheModel resourceActionCacheModel = (ResourceActionCacheModel)obj;
052
053 if ((resourceActionId == resourceActionCacheModel.resourceActionId) &&
054 (mvccVersion == resourceActionCacheModel.mvccVersion)) {
055 return true;
056 }
057
058 return false;
059 }
060
061 @Override
062 public int hashCode() {
063 int hashCode = HashUtil.hash(0, resourceActionId);
064
065 return HashUtil.hash(hashCode, mvccVersion);
066 }
067
068 @Override
069 public long getMvccVersion() {
070 return mvccVersion;
071 }
072
073 @Override
074 public void setMvccVersion(long mvccVersion) {
075 this.mvccVersion = mvccVersion;
076 }
077
078 @Override
079 public String toString() {
080 StringBundler sb = new StringBundler(11);
081
082 sb.append("{mvccVersion=");
083 sb.append(mvccVersion);
084 sb.append(", resourceActionId=");
085 sb.append(resourceActionId);
086 sb.append(", name=");
087 sb.append(name);
088 sb.append(", actionId=");
089 sb.append(actionId);
090 sb.append(", bitwiseValue=");
091 sb.append(bitwiseValue);
092 sb.append("}");
093
094 return sb.toString();
095 }
096
097 @Override
098 public ResourceAction toEntityModel() {
099 ResourceActionImpl resourceActionImpl = new ResourceActionImpl();
100
101 resourceActionImpl.setMvccVersion(mvccVersion);
102 resourceActionImpl.setResourceActionId(resourceActionId);
103
104 if (name == null) {
105 resourceActionImpl.setName(StringPool.BLANK);
106 }
107 else {
108 resourceActionImpl.setName(name);
109 }
110
111 if (actionId == null) {
112 resourceActionImpl.setActionId(StringPool.BLANK);
113 }
114 else {
115 resourceActionImpl.setActionId(actionId);
116 }
117
118 resourceActionImpl.setBitwiseValue(bitwiseValue);
119
120 resourceActionImpl.resetOriginalValues();
121
122 return resourceActionImpl;
123 }
124
125 @Override
126 public void readExternal(ObjectInput objectInput) throws IOException {
127 mvccVersion = objectInput.readLong();
128 resourceActionId = objectInput.readLong();
129 name = objectInput.readUTF();
130 actionId = objectInput.readUTF();
131 bitwiseValue = objectInput.readLong();
132 }
133
134 @Override
135 public void writeExternal(ObjectOutput objectOutput)
136 throws IOException {
137 objectOutput.writeLong(mvccVersion);
138 objectOutput.writeLong(resourceActionId);
139
140 if (name == null) {
141 objectOutput.writeUTF(StringPool.BLANK);
142 }
143 else {
144 objectOutput.writeUTF(name);
145 }
146
147 if (actionId == null) {
148 objectOutput.writeUTF(StringPool.BLANK);
149 }
150 else {
151 objectOutput.writeUTF(actionId);
152 }
153
154 objectOutput.writeLong(bitwiseValue);
155 }
156
157 public long mvccVersion;
158 public long resourceActionId;
159 public String name;
160 public String actionId;
161 public long bitwiseValue;
162 }