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