1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.Portlet;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.util.Html;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38
58 public class PortletModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "Portlet";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "id_", new Integer(Types.BIGINT) },
62
63
64 { "companyId", new Integer(Types.BIGINT) },
65
66
67 { "portletId", new Integer(Types.VARCHAR) },
68
69
70 { "roles", new Integer(Types.VARCHAR) },
71
72
73 { "active_", new Integer(Types.BOOLEAN) }
74 };
75 public static final String TABLE_SQL_CREATE = "create table Portlet (id_ LONG not null primary key,companyId LONG,portletId VARCHAR(200) null,roles STRING null,active_ BOOLEAN)";
76 public static final String TABLE_SQL_DROP = "drop table Portlet";
77 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
78 "value.object.finder.cache.enabled.com.liferay.portal.model.Portlet"),
79 true);
80 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
81 "lock.expiration.time.com.liferay.portal.model.Portlet"));
82
83 public PortletModelImpl() {
84 }
85
86 public long getPrimaryKey() {
87 return _id;
88 }
89
90 public void setPrimaryKey(long pk) {
91 setId(pk);
92 }
93
94 public Serializable getPrimaryKeyObj() {
95 return new Long(_id);
96 }
97
98 public long getId() {
99 return _id;
100 }
101
102 public void setId(long id) {
103 if (id != _id) {
104 _id = id;
105 }
106 }
107
108 public long getCompanyId() {
109 return _companyId;
110 }
111
112 public void setCompanyId(long companyId) {
113 if (companyId != _companyId) {
114 _companyId = companyId;
115 }
116 }
117
118 public String getPortletId() {
119 return GetterUtil.getString(_portletId);
120 }
121
122 public void setPortletId(String portletId) {
123 if (((portletId == null) && (_portletId != null)) ||
124 ((portletId != null) && (_portletId == null)) ||
125 ((portletId != null) && (_portletId != null) &&
126 !portletId.equals(_portletId))) {
127 _portletId = portletId;
128 }
129 }
130
131 public String getRoles() {
132 return GetterUtil.getString(_roles);
133 }
134
135 public void setRoles(String roles) {
136 if (((roles == null) && (_roles != null)) ||
137 ((roles != null) && (_roles == null)) ||
138 ((roles != null) && (_roles != null) && !roles.equals(_roles))) {
139 _roles = roles;
140 }
141 }
142
143 public boolean getActive() {
144 return _active;
145 }
146
147 public boolean isActive() {
148 return _active;
149 }
150
151 public void setActive(boolean active) {
152 if (active != _active) {
153 _active = active;
154 }
155 }
156
157 public Portlet toEscapedModel() {
158 if (isEscapedModel()) {
159 return (Portlet)this;
160 }
161 else {
162 Portlet model = new PortletImpl();
163
164 model.setEscapedModel(true);
165
166 model.setId(getId());
167 model.setCompanyId(getCompanyId());
168 model.setPortletId(Html.escape(getPortletId()));
169 model.setRoles(Html.escape(getRoles()));
170 model.setActive(getActive());
171
172 model = (Portlet)Proxy.newProxyInstance(Portlet.class.getClassLoader(),
173 new Class[] { Portlet.class },
174 new ReadOnlyBeanHandler(model));
175
176 return model;
177 }
178 }
179
180 public Object clone() {
181 PortletImpl clone = new PortletImpl();
182
183 clone.setId(getId());
184 clone.setCompanyId(getCompanyId());
185 clone.setPortletId(getPortletId());
186 clone.setRoles(getRoles());
187 clone.setActive(getActive());
188
189 return clone;
190 }
191
192 public int compareTo(Object obj) {
193 if (obj == null) {
194 return -1;
195 }
196
197 PortletImpl portlet = (PortletImpl)obj;
198
199 long pk = portlet.getPrimaryKey();
200
201 if (getPrimaryKey() < pk) {
202 return -1;
203 }
204 else if (getPrimaryKey() > pk) {
205 return 1;
206 }
207 else {
208 return 0;
209 }
210 }
211
212 public boolean equals(Object obj) {
213 if (obj == null) {
214 return false;
215 }
216
217 PortletImpl portlet = null;
218
219 try {
220 portlet = (PortletImpl)obj;
221 }
222 catch (ClassCastException cce) {
223 return false;
224 }
225
226 long pk = portlet.getPrimaryKey();
227
228 if (getPrimaryKey() == pk) {
229 return true;
230 }
231 else {
232 return false;
233 }
234 }
235
236 public int hashCode() {
237 return (int)getPrimaryKey();
238 }
239
240 private long _id;
241 private long _companyId;
242 private String _portletId;
243 private String _roles;
244 private boolean _active;
245 }