1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35
55 public class OrganizationModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "Organization_";
57 public static Object[][] TABLE_COLUMNS = {
58 { "organizationId", new Integer(Types.BIGINT) },
59 { "companyId", new Integer(Types.BIGINT) },
60 { "parentOrganizationId", new Integer(Types.BIGINT) },
61 { "name", new Integer(Types.VARCHAR) },
62 { "location", new Integer(Types.BOOLEAN) },
63 { "recursable", new Integer(Types.BOOLEAN) },
64 { "regionId", new Integer(Types.BIGINT) },
65 { "countryId", new Integer(Types.BIGINT) },
66 { "statusId", new Integer(Types.INTEGER) },
67 { "comments", new Integer(Types.VARCHAR) }
68 };
69 public static String TABLE_SQL_CREATE = "create table Organization_ (organizationId LONG not null primary key,companyId LONG,parentOrganizationId LONG,name VARCHAR(100) null,location BOOLEAN,recursable BOOLEAN,regionId LONG,countryId LONG,statusId INTEGER,comments STRING null)";
70 public static String TABLE_SQL_DROP = "drop table Organization_";
71 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
72 "xss.allow.com.liferay.portal.model.Organization"), XSS_ALLOW);
73 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
74 "xss.allow.com.liferay.portal.model.Organization.name"),
75 XSS_ALLOW_BY_MODEL);
76 public static boolean XSS_ALLOW_COMMENTS = GetterUtil.getBoolean(PropsUtil.get(
77 "xss.allow.com.liferay.portal.model.Organization.comments"),
78 XSS_ALLOW_BY_MODEL);
79 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
80 "lock.expiration.time.com.liferay.portal.model.OrganizationModel"));
81
82 public OrganizationModelImpl() {
83 }
84
85 public long getPrimaryKey() {
86 return _organizationId;
87 }
88
89 public void setPrimaryKey(long pk) {
90 setOrganizationId(pk);
91 }
92
93 public Serializable getPrimaryKeyObj() {
94 return new Long(_organizationId);
95 }
96
97 public long getOrganizationId() {
98 return _organizationId;
99 }
100
101 public void setOrganizationId(long organizationId) {
102 if (organizationId != _organizationId) {
103 _organizationId = organizationId;
104 }
105 }
106
107 public long getCompanyId() {
108 return _companyId;
109 }
110
111 public void setCompanyId(long companyId) {
112 if (companyId != _companyId) {
113 _companyId = companyId;
114 }
115 }
116
117 public long getParentOrganizationId() {
118 return _parentOrganizationId;
119 }
120
121 public void setParentOrganizationId(long parentOrganizationId) {
122 if (parentOrganizationId != _parentOrganizationId) {
123 _parentOrganizationId = parentOrganizationId;
124 }
125 }
126
127 public String getName() {
128 return GetterUtil.getString(_name);
129 }
130
131 public void setName(String name) {
132 if (((name == null) && (_name != null)) ||
133 ((name != null) && (_name == null)) ||
134 ((name != null) && (_name != null) && !name.equals(_name))) {
135 if (!XSS_ALLOW_NAME) {
136 name = XSSUtil.strip(name);
137 }
138
139 _name = name;
140 }
141 }
142
143 public boolean getLocation() {
144 return _location;
145 }
146
147 public boolean isLocation() {
148 return _location;
149 }
150
151 public void setLocation(boolean location) {
152 if (location != _location) {
153 _location = location;
154 }
155 }
156
157 public boolean getRecursable() {
158 return _recursable;
159 }
160
161 public boolean isRecursable() {
162 return _recursable;
163 }
164
165 public void setRecursable(boolean recursable) {
166 if (recursable != _recursable) {
167 _recursable = recursable;
168 }
169 }
170
171 public long getRegionId() {
172 return _regionId;
173 }
174
175 public void setRegionId(long regionId) {
176 if (regionId != _regionId) {
177 _regionId = regionId;
178 }
179 }
180
181 public long getCountryId() {
182 return _countryId;
183 }
184
185 public void setCountryId(long countryId) {
186 if (countryId != _countryId) {
187 _countryId = countryId;
188 }
189 }
190
191 public int getStatusId() {
192 return _statusId;
193 }
194
195 public void setStatusId(int statusId) {
196 if (statusId != _statusId) {
197 _statusId = statusId;
198 }
199 }
200
201 public String getComments() {
202 return GetterUtil.getString(_comments);
203 }
204
205 public void setComments(String comments) {
206 if (((comments == null) && (_comments != null)) ||
207 ((comments != null) && (_comments == null)) ||
208 ((comments != null) && (_comments != null) &&
209 !comments.equals(_comments))) {
210 if (!XSS_ALLOW_COMMENTS) {
211 comments = XSSUtil.strip(comments);
212 }
213
214 _comments = comments;
215 }
216 }
217
218 public Object clone() {
219 OrganizationImpl clone = new OrganizationImpl();
220 clone.setOrganizationId(getOrganizationId());
221 clone.setCompanyId(getCompanyId());
222 clone.setParentOrganizationId(getParentOrganizationId());
223 clone.setName(getName());
224 clone.setLocation(getLocation());
225 clone.setRecursable(getRecursable());
226 clone.setRegionId(getRegionId());
227 clone.setCountryId(getCountryId());
228 clone.setStatusId(getStatusId());
229 clone.setComments(getComments());
230
231 return clone;
232 }
233
234 public int compareTo(Object obj) {
235 if (obj == null) {
236 return -1;
237 }
238
239 OrganizationImpl organization = (OrganizationImpl)obj;
240 int value = 0;
241 value = getName().compareTo(organization.getName());
242
243 if (value != 0) {
244 return value;
245 }
246
247 return 0;
248 }
249
250 public boolean equals(Object obj) {
251 if (obj == null) {
252 return false;
253 }
254
255 OrganizationImpl organization = null;
256
257 try {
258 organization = (OrganizationImpl)obj;
259 }
260 catch (ClassCastException cce) {
261 return false;
262 }
263
264 long pk = organization.getPrimaryKey();
265
266 if (getPrimaryKey() == pk) {
267 return true;
268 }
269 else {
270 return false;
271 }
272 }
273
274 public int hashCode() {
275 return (int)getPrimaryKey();
276 }
277
278 private long _organizationId;
279 private long _companyId;
280 private long _parentOrganizationId;
281 private String _name;
282 private boolean _location;
283 private boolean _recursable;
284 private long _regionId;
285 private long _countryId;
286 private int _statusId;
287 private String _comments;
288 }