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