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