1
19
20 package com.liferay.portlet.wiki.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.impl.BaseModelImpl;
26
27 import com.liferay.portlet.wiki.model.WikiPageResource;
28 import com.liferay.portlet.wiki.model.WikiPageResourceSoap;
29
30 import java.io.Serializable;
31
32 import java.lang.reflect.Proxy;
33
34 import java.sql.Types;
35
36 import java.util.ArrayList;
37 import java.util.List;
38
39
59 public class WikiPageResourceModelImpl extends BaseModelImpl {
60 public static final String TABLE_NAME = "WikiPageResource";
61 public static final Object[][] TABLE_COLUMNS = {
62 { "resourcePrimKey", new Integer(Types.BIGINT) },
63
64
65 { "nodeId", new Integer(Types.BIGINT) },
66
67
68 { "title", new Integer(Types.VARCHAR) }
69 };
70 public static final String TABLE_SQL_CREATE = "create table WikiPageResource (resourcePrimKey LONG not null primary key,nodeId LONG,title VARCHAR(75) null)";
71 public static final String TABLE_SQL_DROP = "drop table WikiPageResource";
72 public static final String DATA_SOURCE = "liferayDataSource";
73 public static final String SESSION_FACTORY = "liferaySessionFactory";
74 public static final String TX_MANAGER = "liferayTransactionManager";
75 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
76 "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
77 true);
78
79 public static WikiPageResource toModel(WikiPageResourceSoap soapModel) {
80 WikiPageResource model = new WikiPageResourceImpl();
81
82 model.setResourcePrimKey(soapModel.getResourcePrimKey());
83 model.setNodeId(soapModel.getNodeId());
84 model.setTitle(soapModel.getTitle());
85
86 return model;
87 }
88
89 public static List<WikiPageResource> toModels(
90 WikiPageResourceSoap[] soapModels) {
91 List<WikiPageResource> models = new ArrayList<WikiPageResource>(soapModels.length);
92
93 for (WikiPageResourceSoap soapModel : soapModels) {
94 models.add(toModel(soapModel));
95 }
96
97 return models;
98 }
99
100 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
101 "lock.expiration.time.com.liferay.portlet.wiki.model.WikiPageResource"));
102
103 public WikiPageResourceModelImpl() {
104 }
105
106 public long getPrimaryKey() {
107 return _resourcePrimKey;
108 }
109
110 public void setPrimaryKey(long pk) {
111 setResourcePrimKey(pk);
112 }
113
114 public Serializable getPrimaryKeyObj() {
115 return new Long(_resourcePrimKey);
116 }
117
118 public long getResourcePrimKey() {
119 return _resourcePrimKey;
120 }
121
122 public void setResourcePrimKey(long resourcePrimKey) {
123 if (resourcePrimKey != _resourcePrimKey) {
124 _resourcePrimKey = resourcePrimKey;
125 }
126 }
127
128 public long getNodeId() {
129 return _nodeId;
130 }
131
132 public void setNodeId(long nodeId) {
133 if (nodeId != _nodeId) {
134 _nodeId = nodeId;
135 }
136 }
137
138 public String getTitle() {
139 return GetterUtil.getString(_title);
140 }
141
142 public void setTitle(String title) {
143 if (((title == null) && (_title != null)) ||
144 ((title != null) && (_title == null)) ||
145 ((title != null) && (_title != null) && !title.equals(_title))) {
146 _title = title;
147 }
148 }
149
150 public WikiPageResource toEscapedModel() {
151 if (isEscapedModel()) {
152 return (WikiPageResource)this;
153 }
154 else {
155 WikiPageResource model = new WikiPageResourceImpl();
156
157 model.setNew(isNew());
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 }