1
22
23 package com.liferay.portlet.tags.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 TagsSourceModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "TagsSource";
57 public static Object[][] TABLE_COLUMNS = {
58 { "sourceId", new Integer(Types.BIGINT) },
59 { "parentSourceId", new Integer(Types.BIGINT) },
60 { "name", new Integer(Types.VARCHAR) },
61 { "acronym", new Integer(Types.VARCHAR) }
62 };
63 public static String TABLE_SQL_CREATE = "create table TagsSource (sourceId LONG not null primary key,parentSourceId LONG,name VARCHAR(75) null,acronym VARCHAR(75) null)";
64 public static String TABLE_SQL_DROP = "drop table TagsSource";
65 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
66 "xss.allow.com.liferay.portlet.tags.model.TagsSource"),
67 XSS_ALLOW);
68 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
69 "xss.allow.com.liferay.portlet.tags.model.TagsSource.name"),
70 XSS_ALLOW_BY_MODEL);
71 public static boolean XSS_ALLOW_ACRONYM = GetterUtil.getBoolean(PropsUtil.get(
72 "xss.allow.com.liferay.portlet.tags.model.TagsSource.acronym"),
73 XSS_ALLOW_BY_MODEL);
74 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
75 "lock.expiration.time.com.liferay.portlet.tags.model.TagsSourceModel"));
76
77 public TagsSourceModelImpl() {
78 }
79
80 public long getPrimaryKey() {
81 return _sourceId;
82 }
83
84 public void setPrimaryKey(long pk) {
85 setSourceId(pk);
86 }
87
88 public Serializable getPrimaryKeyObj() {
89 return new Long(_sourceId);
90 }
91
92 public long getSourceId() {
93 return _sourceId;
94 }
95
96 public void setSourceId(long sourceId) {
97 if (sourceId != _sourceId) {
98 _sourceId = sourceId;
99 }
100 }
101
102 public long getParentSourceId() {
103 return _parentSourceId;
104 }
105
106 public void setParentSourceId(long parentSourceId) {
107 if (parentSourceId != _parentSourceId) {
108 _parentSourceId = parentSourceId;
109 }
110 }
111
112 public String getName() {
113 return GetterUtil.getString(_name);
114 }
115
116 public void setName(String name) {
117 if (((name == null) && (_name != null)) ||
118 ((name != null) && (_name == null)) ||
119 ((name != null) && (_name != null) && !name.equals(_name))) {
120 if (!XSS_ALLOW_NAME) {
121 name = XSSUtil.strip(name);
122 }
123
124 _name = name;
125 }
126 }
127
128 public String getAcronym() {
129 return GetterUtil.getString(_acronym);
130 }
131
132 public void setAcronym(String acronym) {
133 if (((acronym == null) && (_acronym != null)) ||
134 ((acronym != null) && (_acronym == null)) ||
135 ((acronym != null) && (_acronym != null) &&
136 !acronym.equals(_acronym))) {
137 if (!XSS_ALLOW_ACRONYM) {
138 acronym = XSSUtil.strip(acronym);
139 }
140
141 _acronym = acronym;
142 }
143 }
144
145 public Object clone() {
146 TagsSourceImpl clone = new TagsSourceImpl();
147 clone.setSourceId(getSourceId());
148 clone.setParentSourceId(getParentSourceId());
149 clone.setName(getName());
150 clone.setAcronym(getAcronym());
151
152 return clone;
153 }
154
155 public int compareTo(Object obj) {
156 if (obj == null) {
157 return -1;
158 }
159
160 TagsSourceImpl tagsSource = (TagsSourceImpl)obj;
161 long pk = tagsSource.getPrimaryKey();
162
163 if (getPrimaryKey() < pk) {
164 return -1;
165 }
166 else if (getPrimaryKey() > pk) {
167 return 1;
168 }
169 else {
170 return 0;
171 }
172 }
173
174 public boolean equals(Object obj) {
175 if (obj == null) {
176 return false;
177 }
178
179 TagsSourceImpl tagsSource = null;
180
181 try {
182 tagsSource = (TagsSourceImpl)obj;
183 }
184 catch (ClassCastException cce) {
185 return false;
186 }
187
188 long pk = tagsSource.getPrimaryKey();
189
190 if (getPrimaryKey() == pk) {
191 return true;
192 }
193 else {
194 return false;
195 }
196 }
197
198 public int hashCode() {
199 return (int)getPrimaryKey();
200 }
201
202 private long _sourceId;
203 private long _parentSourceId;
204 private String _name;
205 private String _acronym;
206 }