1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.ClassName;
29 import com.liferay.portal.model.ClassNameSoap;
30 import com.liferay.portal.util.PortalUtil;
31 import com.liferay.portal.util.PropsUtil;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.List;
41
42
62 public class ClassNameModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "ClassName_";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "classNameId", new Integer(Types.BIGINT) },
66
67
68 { "value", new Integer(Types.VARCHAR) }
69 };
70 public static final String TABLE_SQL_CREATE = "create table ClassName_ (classNameId LONG not null primary key,value VARCHAR(200) null)";
71 public static final String TABLE_SQL_DROP = "drop table ClassName_";
72 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
73 "value.object.finder.cache.enabled.com.liferay.portal.model.ClassName"),
74 true);
75
76 public static ClassName toModel(ClassNameSoap soapModel) {
77 ClassName model = new ClassNameImpl();
78
79 model.setClassNameId(soapModel.getClassNameId());
80 model.setValue(soapModel.getValue());
81
82 return model;
83 }
84
85 public static List<ClassName> toModels(ClassNameSoap[] soapModels) {
86 List<ClassName> models = new ArrayList<ClassName>(soapModels.length);
87
88 for (ClassNameSoap soapModel : soapModels) {
89 models.add(toModel(soapModel));
90 }
91
92 return models;
93 }
94
95 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
96 "lock.expiration.time.com.liferay.portal.model.ClassName"));
97
98 public ClassNameModelImpl() {
99 }
100
101 public long getPrimaryKey() {
102 return _classNameId;
103 }
104
105 public void setPrimaryKey(long pk) {
106 setClassNameId(pk);
107 }
108
109 public Serializable getPrimaryKeyObj() {
110 return new Long(_classNameId);
111 }
112
113 public String getClassName() {
114 return PortalUtil.getClassName(getClassNameId());
115 }
116
117 public long getClassNameId() {
118 return _classNameId;
119 }
120
121 public void setClassNameId(long classNameId) {
122 if (classNameId != _classNameId) {
123 _classNameId = classNameId;
124 }
125 }
126
127 public String getValue() {
128 return GetterUtil.getString(_value);
129 }
130
131 public void setValue(String value) {
132 if (((value == null) && (_value != null)) ||
133 ((value != null) && (_value == null)) ||
134 ((value != null) && (_value != null) && !value.equals(_value))) {
135 _value = value;
136 }
137 }
138
139 public ClassName toEscapedModel() {
140 if (isEscapedModel()) {
141 return (ClassName)this;
142 }
143 else {
144 ClassName model = new ClassNameImpl();
145
146 model.setEscapedModel(true);
147
148 model.setClassNameId(getClassNameId());
149 model.setValue(HtmlUtil.escape(getValue()));
150
151 model = (ClassName)Proxy.newProxyInstance(ClassName.class.getClassLoader(),
152 new Class[] { ClassName.class },
153 new ReadOnlyBeanHandler(model));
154
155 return model;
156 }
157 }
158
159 public Object clone() {
160 ClassNameImpl clone = new ClassNameImpl();
161
162 clone.setClassNameId(getClassNameId());
163 clone.setValue(getValue());
164
165 return clone;
166 }
167
168 public int compareTo(Object obj) {
169 if (obj == null) {
170 return -1;
171 }
172
173 ClassNameImpl className = (ClassNameImpl)obj;
174
175 long pk = className.getPrimaryKey();
176
177 if (getPrimaryKey() < pk) {
178 return -1;
179 }
180 else if (getPrimaryKey() > pk) {
181 return 1;
182 }
183 else {
184 return 0;
185 }
186 }
187
188 public boolean equals(Object obj) {
189 if (obj == null) {
190 return false;
191 }
192
193 ClassNameImpl className = null;
194
195 try {
196 className = (ClassNameImpl)obj;
197 }
198 catch (ClassCastException cce) {
199 return false;
200 }
201
202 long pk = className.getPrimaryKey();
203
204 if (getPrimaryKey() == pk) {
205 return true;
206 }
207 else {
208 return false;
209 }
210 }
211
212 public int hashCode() {
213 return (int)getPrimaryKey();
214 }
215
216 private long _classNameId;
217 private String _value;
218 }