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 ResourceModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "Resource_";
57 public static Object[][] TABLE_COLUMNS = {
58 { "resourceId", new Integer(Types.BIGINT) },
59 { "codeId", new Integer(Types.BIGINT) },
60 { "primKey", new Integer(Types.VARCHAR) }
61 };
62 public static String TABLE_SQL_CREATE = "create table Resource_ (resourceId LONG not null primary key,codeId LONG,primKey VARCHAR(300) null)";
63 public static String TABLE_SQL_DROP = "drop table Resource_";
64 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
65 "xss.allow.com.liferay.portal.model.Resource"), XSS_ALLOW);
66 public static boolean XSS_ALLOW_PRIMKEY = GetterUtil.getBoolean(PropsUtil.get(
67 "xss.allow.com.liferay.portal.model.Resource.primKey"),
68 XSS_ALLOW_BY_MODEL);
69 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
70 "lock.expiration.time.com.liferay.portal.model.ResourceModel"));
71
72 public ResourceModelImpl() {
73 }
74
75 public long getPrimaryKey() {
76 return _resourceId;
77 }
78
79 public void setPrimaryKey(long pk) {
80 setResourceId(pk);
81 }
82
83 public Serializable getPrimaryKeyObj() {
84 return new Long(_resourceId);
85 }
86
87 public long getResourceId() {
88 return _resourceId;
89 }
90
91 public void setResourceId(long resourceId) {
92 if (resourceId != _resourceId) {
93 _resourceId = resourceId;
94 }
95 }
96
97 public long getCodeId() {
98 return _codeId;
99 }
100
101 public void setCodeId(long codeId) {
102 if (codeId != _codeId) {
103 _codeId = codeId;
104 }
105 }
106
107 public String getPrimKey() {
108 return GetterUtil.getString(_primKey);
109 }
110
111 public void setPrimKey(String primKey) {
112 if (((primKey == null) && (_primKey != null)) ||
113 ((primKey != null) && (_primKey == null)) ||
114 ((primKey != null) && (_primKey != null) &&
115 !primKey.equals(_primKey))) {
116 if (!XSS_ALLOW_PRIMKEY) {
117 primKey = XSSUtil.strip(primKey);
118 }
119
120 _primKey = primKey;
121 }
122 }
123
124 public Object clone() {
125 ResourceImpl clone = new ResourceImpl();
126 clone.setResourceId(getResourceId());
127 clone.setCodeId(getCodeId());
128 clone.setPrimKey(getPrimKey());
129
130 return clone;
131 }
132
133 public int compareTo(Object obj) {
134 if (obj == null) {
135 return -1;
136 }
137
138 ResourceImpl resource = (ResourceImpl)obj;
139 long pk = resource.getPrimaryKey();
140
141 if (getPrimaryKey() < pk) {
142 return -1;
143 }
144 else if (getPrimaryKey() > pk) {
145 return 1;
146 }
147 else {
148 return 0;
149 }
150 }
151
152 public boolean equals(Object obj) {
153 if (obj == null) {
154 return false;
155 }
156
157 ResourceImpl resource = null;
158
159 try {
160 resource = (ResourceImpl)obj;
161 }
162 catch (ClassCastException cce) {
163 return false;
164 }
165
166 long pk = resource.getPrimaryKey();
167
168 if (getPrimaryKey() == pk) {
169 return true;
170 }
171 else {
172 return false;
173 }
174 }
175
176 public int hashCode() {
177 return (int)getPrimaryKey();
178 }
179
180 private long _resourceId;
181 private long _codeId;
182 private String _primKey;
183 }