1
22
23 package com.liferay.portlet.wiki.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.wiki.model.WikiPageResource;
32 import com.liferay.portlet.wiki.model.WikiPageResourceSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.List;
42
43
63 public class WikiPageResourceModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "WikiPageResource";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "resourcePrimKey", new Integer(Types.BIGINT) },
67
68
69 { "nodeId", new Integer(Types.BIGINT) },
70
71
72 { "title", new Integer(Types.VARCHAR) }
73 };
74 public static final String TABLE_SQL_CREATE = "create table WikiPageResource (resourcePrimKey LONG not null primary key,nodeId LONG,title VARCHAR(75) null)";
75 public static final String TABLE_SQL_DROP = "drop table WikiPageResource";
76 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
77 "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
78 true);
79
80 public static WikiPageResource toModel(WikiPageResourceSoap soapModel) {
81 WikiPageResource model = new WikiPageResourceImpl();
82
83 model.setResourcePrimKey(soapModel.getResourcePrimKey());
84 model.setNodeId(soapModel.getNodeId());
85 model.setTitle(soapModel.getTitle());
86
87 return model;
88 }
89
90 public static List<WikiPageResource> toModels(
91 WikiPageResourceSoap[] soapModels) {
92 List<WikiPageResource> models = new ArrayList<WikiPageResource>(soapModels.length);
93
94 for (WikiPageResourceSoap soapModel : soapModels) {
95 models.add(toModel(soapModel));
96 }
97
98 return models;
99 }
100
101 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
102 "lock.expiration.time.com.liferay.portlet.wiki.model.WikiPageResource"));
103
104 public WikiPageResourceModelImpl() {
105 }
106
107 public long getPrimaryKey() {
108 return _resourcePrimKey;
109 }
110
111 public void setPrimaryKey(long pk) {
112 setResourcePrimKey(pk);
113 }
114
115 public Serializable getPrimaryKeyObj() {
116 return new Long(_resourcePrimKey);
117 }
118
119 public long getResourcePrimKey() {
120 return _resourcePrimKey;
121 }
122
123 public void setResourcePrimKey(long resourcePrimKey) {
124 if (resourcePrimKey != _resourcePrimKey) {
125 _resourcePrimKey = resourcePrimKey;
126 }
127 }
128
129 public long getNodeId() {
130 return _nodeId;
131 }
132
133 public void setNodeId(long nodeId) {
134 if (nodeId != _nodeId) {
135 _nodeId = nodeId;
136 }
137 }
138
139 public String getTitle() {
140 return GetterUtil.getString(_title);
141 }
142
143 public void setTitle(String title) {
144 if (((title == null) && (_title != null)) ||
145 ((title != null) && (_title == null)) ||
146 ((title != null) && (_title != null) && !title.equals(_title))) {
147 _title = title;
148 }
149 }
150
151 public WikiPageResource toEscapedModel() {
152 if (isEscapedModel()) {
153 return (WikiPageResource)this;
154 }
155 else {
156 WikiPageResource model = new WikiPageResourceImpl();
157
158 model.setEscapedModel(true);
159
160 model.setResourcePrimKey(getResourcePrimKey());
161 model.setNodeId(getNodeId());
162 model.setTitle(HtmlUtil.escape(getTitle()));
163
164 model = (WikiPageResource)Proxy.newProxyInstance(WikiPageResource.class.getClassLoader(),
165 new Class[] { WikiPageResource.class },
166 new ReadOnlyBeanHandler(model));
167
168 return model;
169 }
170 }
171
172 public Object clone() {
173 WikiPageResourceImpl clone = new WikiPageResourceImpl();
174
175 clone.setResourcePrimKey(getResourcePrimKey());
176 clone.setNodeId(getNodeId());
177 clone.setTitle(getTitle());
178
179 return clone;
180 }
181
182 public int compareTo(Object obj) {
183 if (obj == null) {
184 return -1;
185 }
186
187 WikiPageResourceImpl wikiPageResource = (WikiPageResourceImpl)obj;
188
189 long pk = wikiPageResource.getPrimaryKey();
190
191 if (getPrimaryKey() < pk) {
192 return -1;
193 }
194 else if (getPrimaryKey() > pk) {
195 return 1;
196 }
197 else {
198 return 0;
199 }
200 }
201
202 public boolean equals(Object obj) {
203 if (obj == null) {
204 return false;
205 }
206
207 WikiPageResourceImpl wikiPageResource = null;
208
209 try {
210 wikiPageResource = (WikiPageResourceImpl)obj;
211 }
212 catch (ClassCastException cce) {
213 return false;
214 }
215
216 long pk = wikiPageResource.getPrimaryKey();
217
218 if (getPrimaryKey() == pk) {
219 return true;
220 }
221 else {
222 return false;
223 }
224 }
225
226 public int hashCode() {
227 return (int)getPrimaryKey();
228 }
229
230 private long _resourcePrimKey;
231 private long _nodeId;
232 private String _title;
233 }