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.model.ClassName;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.util.Html;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38
58 public class ClassNameModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "ClassName_";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "classNameId", new Integer(Types.BIGINT) },
62
63
64 { "value", new Integer(Types.VARCHAR) }
65 };
66 public static final String TABLE_SQL_CREATE = "create table ClassName_ (classNameId LONG not null primary key,value VARCHAR(200) null)";
67 public static final String TABLE_SQL_DROP = "drop table ClassName_";
68 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
69 "value.object.finder.cache.enabled.com.liferay.portal.model.ClassName"),
70 true);
71 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
72 "lock.expiration.time.com.liferay.portal.model.ClassName"));
73
74 public ClassNameModelImpl() {
75 }
76
77 public long getPrimaryKey() {
78 return _classNameId;
79 }
80
81 public void setPrimaryKey(long pk) {
82 setClassNameId(pk);
83 }
84
85 public Serializable getPrimaryKeyObj() {
86 return new Long(_classNameId);
87 }
88
89 public long getClassNameId() {
90 return _classNameId;
91 }
92
93 public void setClassNameId(long classNameId) {
94 if (classNameId != _classNameId) {
95 _classNameId = classNameId;
96 }
97 }
98
99 public String getValue() {
100 return GetterUtil.getString(_value);
101 }
102
103 public void setValue(String value) {
104 if (((value == null) && (_value != null)) ||
105 ((value != null) && (_value == null)) ||
106 ((value != null) && (_value != null) && !value.equals(_value))) {
107 _value = value;
108 }
109 }
110
111 public ClassName toEscapedModel() {
112 if (isEscapedModel()) {
113 return (ClassName)this;
114 }
115 else {
116 ClassName model = new ClassNameImpl();
117
118 model.setEscapedModel(true);
119
120 model.setClassNameId(getClassNameId());
121 model.setValue(Html.escape(getValue()));
122
123 model = (ClassName)Proxy.newProxyInstance(ClassName.class.getClassLoader(),
124 new Class[] { ClassName.class },
125 new ReadOnlyBeanHandler(model));
126
127 return model;
128 }
129 }
130
131 public Object clone() {
132 ClassNameImpl clone = new ClassNameImpl();
133
134 clone.setClassNameId(getClassNameId());
135 clone.setValue(getValue());
136
137 return clone;
138 }
139
140 public int compareTo(Object obj) {
141 if (obj == null) {
142 return -1;
143 }
144
145 ClassNameImpl className = (ClassNameImpl)obj;
146
147 long pk = className.getPrimaryKey();
148
149 if (getPrimaryKey() < pk) {
150 return -1;
151 }
152 else if (getPrimaryKey() > pk) {
153 return 1;
154 }
155 else {
156 return 0;
157 }
158 }
159
160 public boolean equals(Object obj) {
161 if (obj == null) {
162 return false;
163 }
164
165 ClassNameImpl className = null;
166
167 try {
168 className = (ClassNameImpl)obj;
169 }
170 catch (ClassCastException cce) {
171 return false;
172 }
173
174 long pk = className.getPrimaryKey();
175
176 if (getPrimaryKey() == pk) {
177 return true;
178 }
179 else {
180 return false;
181 }
182 }
183
184 public int hashCode() {
185 return (int)getPrimaryKey();
186 }
187
188 private long _classNameId;
189 private String _value;
190 }