001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.ResourceCode;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="ResourceCodeModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>ResourceCode</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.ResourceCode
052: * @see com.liferay.portal.service.model.ResourceCodeModel
053: * @see com.liferay.portal.service.model.impl.ResourceCodeImpl
054: *
055: */
056: public class ResourceCodeModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "ResourceCode";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "codeId", new Integer(Types.BIGINT) },
060:
061: { "companyId", new Integer(Types.BIGINT) },
062:
063: { "name", new Integer(Types.VARCHAR) },
064:
065: { "scope", new Integer(Types.INTEGER) } };
066: public static final String TABLE_SQL_CREATE = "create table ResourceCode (codeId LONG not null primary key,companyId LONG,name VARCHAR(300) null,scope INTEGER)";
067: public static final String TABLE_SQL_DROP = "drop table ResourceCode";
068: public static final boolean CACHE_ENABLED = GetterUtil
069: .getBoolean(
070: PropsUtil
071: .get("value.object.finder.cache.enabled.com.liferay.portal.model.ResourceCode"),
072: true);
073: public static final long LOCK_EXPIRATION_TIME = GetterUtil
074: .getLong(PropsUtil
075: .get("lock.expiration.time.com.liferay.portal.model.ResourceCode"));
076:
077: public ResourceCodeModelImpl() {
078: }
079:
080: public long getPrimaryKey() {
081: return _codeId;
082: }
083:
084: public void setPrimaryKey(long pk) {
085: setCodeId(pk);
086: }
087:
088: public Serializable getPrimaryKeyObj() {
089: return new Long(_codeId);
090: }
091:
092: public long getCodeId() {
093: return _codeId;
094: }
095:
096: public void setCodeId(long codeId) {
097: if (codeId != _codeId) {
098: _codeId = codeId;
099: }
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 String getName() {
113: return GetterUtil.getString(_name);
114: }
115:
116: public void setName(String name) {
117: if (((name == null) && (_name != null))
118: || ((name != null) && (_name == null))
119: || ((name != null) && (_name != null) && !name
120: .equals(_name))) {
121: _name = name;
122: }
123: }
124:
125: public int getScope() {
126: return _scope;
127: }
128:
129: public void setScope(int scope) {
130: if (scope != _scope) {
131: _scope = scope;
132: }
133: }
134:
135: public ResourceCode toEscapedModel() {
136: if (isEscapedModel()) {
137: return (ResourceCode) this ;
138: } else {
139: ResourceCode model = new ResourceCodeImpl();
140:
141: model.setEscapedModel(true);
142:
143: model.setCodeId(getCodeId());
144: model.setCompanyId(getCompanyId());
145: model.setName(Html.escape(getName()));
146: model.setScope(getScope());
147:
148: model = (ResourceCode) Proxy.newProxyInstance(
149: ResourceCode.class.getClassLoader(),
150: new Class[] { ResourceCode.class },
151: new ReadOnlyBeanHandler(model));
152:
153: return model;
154: }
155: }
156:
157: public Object clone() {
158: ResourceCodeImpl clone = new ResourceCodeImpl();
159:
160: clone.setCodeId(getCodeId());
161: clone.setCompanyId(getCompanyId());
162: clone.setName(getName());
163: clone.setScope(getScope());
164:
165: return clone;
166: }
167:
168: public int compareTo(Object obj) {
169: if (obj == null) {
170: return -1;
171: }
172:
173: ResourceCodeImpl resourceCode = (ResourceCodeImpl) obj;
174:
175: long pk = resourceCode.getPrimaryKey();
176:
177: if (getPrimaryKey() < pk) {
178: return -1;
179: } else if (getPrimaryKey() > pk) {
180: return 1;
181: } else {
182: return 0;
183: }
184: }
185:
186: public boolean equals(Object obj) {
187: if (obj == null) {
188: return false;
189: }
190:
191: ResourceCodeImpl resourceCode = null;
192:
193: try {
194: resourceCode = (ResourceCodeImpl) obj;
195: } catch (ClassCastException cce) {
196: return false;
197: }
198:
199: long pk = resourceCode.getPrimaryKey();
200:
201: if (getPrimaryKey() == pk) {
202: return true;
203: } else {
204: return false;
205: }
206: }
207:
208: public int hashCode() {
209: return (int) getPrimaryKey();
210: }
211:
212: private long _codeId;
213: private long _companyId;
214: private String _name;
215: private int _scope;
216: }
|