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 ListTypeModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "ListType";
57 public static Object[][] TABLE_COLUMNS = {
58 { "listTypeId", new Integer(Types.INTEGER) },
59 { "name", new Integer(Types.VARCHAR) },
60 { "type_", new Integer(Types.VARCHAR) }
61 };
62 public static String TABLE_SQL_CREATE = "create table ListType (listTypeId INTEGER not null primary key,name VARCHAR(75) null,type_ VARCHAR(75) null)";
63 public static String TABLE_SQL_DROP = "drop table ListType";
64 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
65 "xss.allow.com.liferay.portal.model.ListType"), XSS_ALLOW);
66 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
67 "xss.allow.com.liferay.portal.model.ListType.name"),
68 XSS_ALLOW_BY_MODEL);
69 public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
70 "xss.allow.com.liferay.portal.model.ListType.type"),
71 XSS_ALLOW_BY_MODEL);
72 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
73 "lock.expiration.time.com.liferay.portal.model.ListTypeModel"));
74
75 public ListTypeModelImpl() {
76 }
77
78 public int getPrimaryKey() {
79 return _listTypeId;
80 }
81
82 public void setPrimaryKey(int pk) {
83 setListTypeId(pk);
84 }
85
86 public Serializable getPrimaryKeyObj() {
87 return new Integer(_listTypeId);
88 }
89
90 public int getListTypeId() {
91 return _listTypeId;
92 }
93
94 public void setListTypeId(int listTypeId) {
95 if (listTypeId != _listTypeId) {
96 _listTypeId = listTypeId;
97 }
98 }
99
100 public String getName() {
101 return GetterUtil.getString(_name);
102 }
103
104 public void setName(String name) {
105 if (((name == null) && (_name != null)) ||
106 ((name != null) && (_name == null)) ||
107 ((name != null) && (_name != null) && !name.equals(_name))) {
108 if (!XSS_ALLOW_NAME) {
109 name = XSSUtil.strip(name);
110 }
111
112 _name = name;
113 }
114 }
115
116 public String getType() {
117 return GetterUtil.getString(_type);
118 }
119
120 public void setType(String type) {
121 if (((type == null) && (_type != null)) ||
122 ((type != null) && (_type == null)) ||
123 ((type != null) && (_type != null) && !type.equals(_type))) {
124 if (!XSS_ALLOW_TYPE) {
125 type = XSSUtil.strip(type);
126 }
127
128 _type = type;
129 }
130 }
131
132 public Object clone() {
133 ListTypeImpl clone = new ListTypeImpl();
134 clone.setListTypeId(getListTypeId());
135 clone.setName(getName());
136 clone.setType(getType());
137
138 return clone;
139 }
140
141 public int compareTo(Object obj) {
142 if (obj == null) {
143 return -1;
144 }
145
146 ListTypeImpl listType = (ListTypeImpl)obj;
147 int value = 0;
148 value = getName().toLowerCase().compareTo(listType.getName()
149 .toLowerCase());
150
151 if (value != 0) {
152 return value;
153 }
154
155 return 0;
156 }
157
158 public boolean equals(Object obj) {
159 if (obj == null) {
160 return false;
161 }
162
163 ListTypeImpl listType = null;
164
165 try {
166 listType = (ListTypeImpl)obj;
167 }
168 catch (ClassCastException cce) {
169 return false;
170 }
171
172 int pk = listType.getPrimaryKey();
173
174 if (getPrimaryKey() == pk) {
175 return true;
176 }
177 else {
178 return false;
179 }
180 }
181
182 public int hashCode() {
183 return (int)getPrimaryKey();
184 }
185
186 private int _listTypeId;
187 private String _name;
188 private String _type;
189 }